[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v13 04/14] xen/percpu: defer freeing per-CPU areas after resume failures


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Mykola Kvach <mykola_kvach@xxxxxxxx>
  • Date: Tue, 27 Oct 2026 23:05:53 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=MtpFdnNv8BeIMFzC1ZCCM4xby+yu82MO+Np34s0G850=; b=mZyMP9fjEBVIP3/iNwdxiDtSqCXInccE3wsh9e/Y3He29OTVdniA9ZlrN5BBLEvhvqIfu8fsXiTJfkEdEZKLCF0LYnX/QuuJ/9OHupvSdGi7Mnn6lrxI+XKbCJ9tmH3JROfu0p+XCThGuAQQbygW/IWsRe26MsqK2A81amJpylxKPYf8I2Vj2tiHgjaOr5NFgsf5lMDqLM2DdPfQErgZIEOxeKANBZhNgnXuuxzpv7okFkZIOd5LY9PGaAgyfniuMmoCJnru4g5cmg86G1ZQ7d5hXTd3N4LKQ+H0dmnfH/88+iA5hCZLRq33KjnUvEyjdISCEYJR5oC+rCZY6NVERw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=weHTYAXxufKCmA58N24JSroAzi+8kapvuf0GGjtv665+3t/HB+2xy/jChVNSle6ZgxpUP8Nkgcf15XQ4+S+Eok97bsQkhFYhklclnUUWzHT+G4WFDZQmrSHCaZRw1N/v2XGtaKeB/ZeXSGx9TKRjBCtSfrS/ekgmc0LNH/b1N5/jWti3P6SaPEf6y2/tLGfOmYixkIDiyKasFmm1U4IYwlepsRC8Vs/WPhZi6R+g6/B3sbkeDhkVS6QmvwqvsQGuC0Sq5AKXWJk0GwBV2l57j1kNPCvWvDRtrmI+X2JRbtG6W+esxZIvAb7OrVmiL4L0nHJDH53n6DmyUgNz2jpN6Q==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=epam.com header.i="@epam.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Authentication-results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Roger Pau Monné <roger@xxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • Delivery-date: Tue, 27 Oct 2026 21:06:26 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

When a CPU fails to come back during system resume, cpu_up() sends
CPU_UP_CANCELED. After trying the other CPUs, enable_nonboot_cpus()
sends CPU_RESUME_FAILED for the same CPU.

On architectures which do not park offline CPUs, both notifications
queue free_percpu_area(). The release metadata, including the rcu_head,
is stored in that CPU's per-CPU area. The first callback may already
have freed the area when the second notification arrives, or the same
rcu_head may be queued twice. The CPU_RESUME_FAILED callbacks also need
the area to clean up timers and CPU-pool state.

Skip the per-CPU release for CPU_UP_CANCELED during resume. Let
CPU_RESUME_FAILED release the area after the other cleanup callbacks.

This prepares the common code for Arm system suspend. x86 parks offline
CPUs and does not take this release path.

Signed-off-by: Mykola Kvach <mykola_kvach@xxxxxxxx>
---
Changes in v13:
- New patch.
---
 xen/common/percpu.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/xen/common/percpu.c b/xen/common/percpu.c
index f180f37253..e957c3c58d 100644
--- a/xen/common/percpu.c
+++ b/xen/common/percpu.c
@@ -82,6 +82,15 @@ static int cf_check cpu_percpu_callback(
         break;
 
     case CPU_UP_CANCELED:
+        /*
+         * On resume, CPU_RESUME_FAILED is sent after all CPUs have been
+         * tried. Keep the area alive for its cleanup callbacks and let
+         * that notification release it.
+         */
+        if ( system_state == SYS_STATE_resume )
+            break;
+        fallthrough;
+
     case CPU_DEAD:
     case CPU_RESUME_FAILED:
         if ( !park_offline_cpus && system_state != SYS_STATE_suspend )
-- 
2.53.0




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.