From nobody Wed May 15 19:45:47 2024 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=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1662500986; cv=none; d=zohomail.com; s=zohoarc; b=T3QkcRGpcQIYQBMy6pvOx1OTxPnSap3Pt03Tm5pXUpkQgrilsEdp+d6wfbFzEklqRhDrES7tBb9SlxVWuq5kS1N103UTYZvqJRCPVzFfJHsu3HWjZSPPyudBWt3wR5bhnGAUysh5R7xj0DiIYMLMtvLT5iMhaHaVv0xbM8WvFkk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1662500986; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=8y5B8SeVYhFEQ1i+eFOmTPV0zpAN2fLm9xCblFTGrrY=; b=gXW9JIMLaQ6ptH59kKXPQsl3tiO2qA8Hz+uI/uVAcekS22oYzAFdmv+3yIE07bCjgrvQuUSlvz9f0n3jWrBwJL7Hh3XHa51226Kn11cbTrO9O21R2Wt3NCdNLH39tr9R6wJqhdtiXtrhwOBOOghnQmBhtRkCvhs8mOuoUtcU0sM= 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=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1662500986266762.5242583974032; Tue, 6 Sep 2022 14:49:46 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.400308.642011 (Exim 4.92) (envelope-from ) id 1oVgRl-0005e5-RE; Tue, 06 Sep 2022 21:49:29 +0000 Received: by outflank-mailman (output) from mailman id 400308.642011; Tue, 06 Sep 2022 21:49:29 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oVgRl-0005dr-ND; Tue, 06 Sep 2022 21:49:29 +0000 Received: by outflank-mailman (input) for mailman id 400308; Tue, 06 Sep 2022 21:49:28 +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 1oVgIS-0000Cs-HU for xen-devel@lists.xenproject.org; Tue, 06 Sep 2022 21:39:52 +0000 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 4020852e-2de1-11ed-af93-0125da4c0113; Tue, 06 Sep 2022 14:41:38 +0200 (CEST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 3E83D338B0; Tue, 6 Sep 2022 12:41:38 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id F1E6F13A7A; Tue, 6 Sep 2022 12:41:37 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id wFyTOQFAF2NiSQAAMHmgww (envelope-from ); Tue, 06 Sep 2022 12:41:37 +0000 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: 4020852e-2de1-11ed-af93-0125da4c0113 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1662468098; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8y5B8SeVYhFEQ1i+eFOmTPV0zpAN2fLm9xCblFTGrrY=; b=WFFiWAmKMwR0GYGaGXHvkDhG/1Dz1fNnkG4tbPLcc1xbEwsY0clI9tciugJ147AZL/zfkE KLAniDghG6hgg4kCrLoKZhD/FH+QUoPQ5dHw+HCM3JBg2uOLfC4f0qzB/7OhXHbZipdzvB m8Yp7fnvvHIjhFUSdXgqb+hOOFRnH3Y= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Stefano Stabellini , Wei Liu , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Subject: [PATCH] xen/timer: don't migrate timers away from cpus during suspend Date: Tue, 6 Sep 2022 14:41:35 +0200 Message-Id: <20220906124135.12998-1-jgross@suse.com> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1662500988424100001 During a suspend/resume cycle timers on all cpus but cpu 0 will be migrated to cpu 0, as the other cpus are taken down. This is problematic in case such a timer is related to a specific vcpu, as the vcpus are not migrated to another cpu during suspend (migrating them would break cpupools and core scheduling). In order to avoid the problems just try to keep the timers on their cpus. Only migrate them away in case resume failed. Doing so isn't problematic, as any vcpu on a cpu not coming back to life would be migrated away, too. Signed-off-by: Juergen Gross Tested-by: Marek Marczykowski-G=C3=B3recki --- xen/common/timer.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/xen/common/timer.c b/xen/common/timer.c index 9b5016d5ed..6b5473e5f1 100644 --- a/xen/common/timer.c +++ b/xen/common/timer.c @@ -637,6 +637,13 @@ static void free_percpu_timers(unsigned int cpu) ASSERT(ts->heap =3D=3D dummy_heap); } =20 +static void deinit_timers(unsigned int cpu) +{ + migrate_timers_from_cpu(cpu); + if ( !park_offline_cpus ) + free_percpu_timers(cpu); +} + static int cf_check cpu_callback( struct notifier_block *nfb, unsigned long action, void *hcpu) { @@ -655,13 +662,14 @@ static int cf_check cpu_callback( } break; =20 - case CPU_UP_CANCELED: case CPU_DEAD: - case CPU_RESUME_FAILED: - migrate_timers_from_cpu(cpu); + if ( system_state !=3D SYS_STATE_suspend ) + deinit_timers(cpu); + break; =20 - if ( !park_offline_cpus && system_state !=3D SYS_STATE_suspend ) - free_percpu_timers(cpu); + case CPU_UP_CANCELED: + case CPU_RESUME_FAILED: + deinit_timers(cpu); break; =20 case CPU_REMOVE: --=20 2.35.3