From nobody Mon Mar 10 03:58:43 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1741165956; cv=none; d=zohomail.com; s=zohoarc; b=Di6I3zxe5e7x2nQDGbvKLocJm3vJLmRdriaWnGNMYaMAw2wxldvmDFdpM4D8ZvxsUtr1yni/Mz1OsyFGAVRtecha+3BQBF7C+kDshl1Lsj2C0ya4JU37Qs7ojIAZb2it2ro4PsfN10DUZwj3HzZSUxzU4GddRaoHZ3Uz+eswoZY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1741165956; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=rsEkc5UwQaeOfpAVVoIStpjI7WoGyW7huU1aUhighTY=; b=EExNwje1YLcw/vWdLRE1F+r9efv+Lhx1jmcH57ooDsDkKaTdEC4AXbjC46uA/XMNTtoCzlqXiZecJXY/xwZdBT+y2SKUf3Z5+DdHwpYLV3anQ438p8BqWp692MQidy/aHt9WC+13NkhCUonYLQ4XDzXcUV9hpG1blKo0n3Twlzw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1741165956223471.06505325484807; Wed, 5 Mar 2025 01:12:36 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.901870.1309837 (Exim 4.92) (envelope-from ) id 1tpknM-0007qw-TR; Wed, 05 Mar 2025 09:12:04 +0000 Received: by outflank-mailman (output) from mailman id 901870.1309837; Wed, 05 Mar 2025 09:12:04 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tpknM-0007qj-OA; Wed, 05 Mar 2025 09:12:04 +0000 Received: by outflank-mailman (input) for mailman id 901870; Wed, 05 Mar 2025 09:12:03 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tpknL-0006ew-CY for xen-devel@lists.xenproject.org; Wed, 05 Mar 2025 09:12:03 +0000 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [2a00:1450:4864:20::12f]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id e629023a-f9a1-11ef-9898-31a8f345e629; Wed, 05 Mar 2025 10:12:01 +0100 (CET) Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-5493b5bc6e8so7720351e87.2 for ; Wed, 05 Mar 2025 01:12:01 -0800 (PST) Received: from EPUAKYIW02F7.. ([95.67.15.120]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5495de028fasm1078264e87.139.2025.03.05.01.11.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Mar 2025 01:12:00 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: e629023a-f9a1-11ef-9898-31a8f345e629 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741165921; x=1741770721; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rsEkc5UwQaeOfpAVVoIStpjI7WoGyW7huU1aUhighTY=; b=mhLCdYPEKIPEa7IUE65yvIB4MlhGGRKCB50I3aS2H5qXTgqDhn0SE7b/FTqOx85+uM R2Kc1G2mgKHKPTWh3NdthK41d3tzqIR+1Gjs/2JPV0Za61Sc/NXSdmPa+Ku0kpTJ8erZ lLwPAkw8sl7z8VJd6TdO/002Hki5dsHkIIeyuLLugjCHnGkzbj8aaIoxEQXEMNSaIiaE /FES9PRKP5R3eoVHPRtPHNLvXJBhoJS7Ivq8KSXeDtUGckyPP7GLEDB78ctPTfFHFbpC c2k2ZfrW+9x0uIva5taQG+dgS7tWTJhUgDhfHtCyhdnv6uPBIt4gBG9GuGAFFqsy1oVT s2IQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741165921; x=1741770721; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rsEkc5UwQaeOfpAVVoIStpjI7WoGyW7huU1aUhighTY=; b=MEqYez3sOQRzZnPW3dIaTIuJwyYHo/UCDcn806qumlff+zdjeuAEwkpbV8G/xiHJpA 2LVlIxWEVaoEN0k6B6WhUCczflBog04Vn/uR1l1FhiBVKtN5ACxMWrYTeqTvDMke5TpJ 4JKI8jhk9CAqumpdxdPj0AIJ9TR/BERgWYbWVzgDt03epRsSpPzoed0vLYaGYrMiD18s BciyvB8/Tw2vCc/fgW16rt9TcHktqCEX6f/98frl15pe945hRhMNeZnWaQW3REUnXGIb lDSJuxueP3vlFy5zcmOE/JLUfForHadxFgjgtYLZie9L3U/yq7+hqarvQZAXkohh4zmY jzpA== X-Gm-Message-State: AOJu0YzzsuM4nAqj2TrjFXGKS56A9hsZSFaLmgTIKpggNWvQ2RmnQ/OB dtMw2I0zpEoFCeNQ9WTjj+WfkLJVg3ib+QSfM3ByGBhQ1FeawfLNzqQnAqWe X-Gm-Gg: ASbGncttQ7WYR4Ez0fqjyy9YyyJc6i+JJJdwiRFiv3YCCYZMvu6q+M5R51tRC1hVaxn Jz7nK/4eEU+FY0HdqfaZ9prmGDVExGsaFwlf6iDmQ9siqeNCrarRYaMlUPhN9L2ApU2va6QZtG9 iZm6YMoqbpq/KDUTinh4oDneKqRVV0Ml3upMUiS7vaBMjrC8XHKHaolq0xzFgx17Dv5JuKLhgDx p+VEUxxYGa1y5htGYEU+4FvyJwxCtxIKX2M/969+k3MuRZ0WWfUyTZS/09X/0ACOEIVFgcbyTEG JWGdkrnJaok1ziNUg5JgIVLQojU7TI3YaoYwcPLlmqEg2NyUgw== X-Google-Smtp-Source: AGHT+IG3M+jnZ7dDUzYucmBB1qdaR5sNzVG4SVPMlLekJ0Z4w6Owt27xZGew4IedbsbYDvHnxaVsNQ== X-Received: by 2002:a05:6512:2308:b0:545:bf4:4bd4 with SMTP id 2adb3069b0e04-5497d332250mr783696e87.7.1741165920491; Wed, 05 Mar 2025 01:12:00 -0800 (PST) From: Mykola Kvach To: xen-devel@lists.xenproject.org Cc: Andrew Cooper , Anthony PERARD , Michal Orzel , Jan Beulich , Julien Grall , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Stefano Stabellini , Mykyta Poturai , Mykola Kvach Subject: [PATCH 05/16] xen/percpu: don't initialize percpu on resume Date: Wed, 5 Mar 2025 11:11:13 +0200 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1741165959605019100 Content-Type: text/plain; charset="utf-8" Invocation of the CPU_UP_PREPARE notification on ARM64 during resume causes a crash: (XEN) [ 315.807606] Error bringing CPU1 up: -16 (XEN) [ 315.811926] Xen BUG at common/cpu.c:258 [...] (XEN) [ 316.142765] Xen call trace: (XEN) [ 316.146048] [<00000a0000202264>] enable_nonboot_cpus+0x128/0x1a= c (PC) (XEN) [ 316.153219] [<00000a000020225c>] enable_nonboot_cpus+0x120/0x1a= c (LR) (XEN) [ 316.160391] [<00000a0000278180>] suspend.c#system_suspend+0x4c/= 0x1a0 (XEN) [ 316.167476] [<00000a0000206b70>] domain.c#continue_hypercall_ta= sklet_handler+0x54/0xd0 (XEN) [ 316.176117] [<00000a0000226538>] tasklet.c#do_tasklet_work+0xb8= /0x100 (XEN) [ 316.183288] [<00000a0000226920>] do_tasklet+0x68/0xb0 (XEN) [ 316.189077] [<00000a000026e120>] domain.c#idle_loop+0x7c/0x194 (XEN) [ 316.195644] [<00000a0000277638>] shutdown.c#halt_this_cpu+0/0x14 (XEN) [ 316.202383] [<0000000000000008>] 0000000000000008 Freeing per-CPU areas and setting __per_cpu_offset to INVALID_PERCPU_AREA only occur when !park_offline_cpus and system_state is not SYS_STATE_suspen= d. On ARM64, park_offline_cpus is always false, so setting __per_cpu_offset to INVALID_PERCPU_AREA depends solely on the system state. If the system is suspended, this area is not freed, and during resume, an e= rror occurs in init_percpu_area, causing a crash because INVALID_PERCPU_AREA is = not set and park_offline_cpus remains 0: if ( __per_cpu_offset[cpu] !=3D INVALID_PERCPU_AREA ) return park_offline_cpus ? 0 : -EBUSY; It appears that the same crash can occur on x86 if park_offline_cpus is set to 0 during Xen suspend. Signed-off-by: Mykyta Poturai Signed-off-by: Mykola Kvach --- These changes were introduced in V2 inside "xen: don't free percpu areas during suspend" patch. --- xen/common/percpu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xen/common/percpu.c b/xen/common/percpu.c index e4e8b7bcab..83dca7edd6 100644 --- a/xen/common/percpu.c +++ b/xen/common/percpu.c @@ -74,7 +74,8 @@ static int cf_check cpu_percpu_callback( switch ( action ) { case CPU_UP_PREPARE: - rc =3D init_percpu_area(cpu); + if ( system_state !=3D SYS_STATE_resume ) + rc =3D init_percpu_area(cpu); break; =20 case CPU_UP_CANCELED: --=20 2.43.0