From patchwork Wed Mar 23 01:21:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?SmFrdWIgS8SFZHppb8WCa2E=?= X-Patchwork-Id: 12789457 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0793AC433EF for ; Wed, 23 Mar 2022 05:14:01 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.293711.499112 (Exim 4.92) (envelope-from ) id 1nWtJZ-0002N6-Fn; Wed, 23 Mar 2022 05:13:45 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 293711.499112; Wed, 23 Mar 2022 05:13:45 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nWtJZ-0002MI-Bz; Wed, 23 Mar 2022 05:13:45 +0000 Received: by outflank-mailman (input) for mailman id 293711; Wed, 23 Mar 2022 01:21:31 +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 1nWpgp-0003NE-Fq for xen-devel@lists.xenproject.org; Wed, 23 Mar 2022 01:21:31 +0000 Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 905b9ffe-aa47-11ec-8fbc-03012f2f19d4; Wed, 23 Mar 2022 02:21:30 +0100 (CET) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id F06C45C05A9; Tue, 22 Mar 2022 21:21:27 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Tue, 22 Mar 2022 21:21:27 -0400 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 22 Mar 2022 21:21:26 -0400 (EDT) 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: 905b9ffe-aa47-11ec-8fbc-03012f2f19d4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:from:from:in-reply-to:message-id :mime-version:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=S+iu6Z Ib/LKvE8rf+ENQtEacTbCXCd4zjEwhqBC+6c8=; b=fvzdipVfPdgCQpNPy9gEHa bVW/zrcBD7/4EZD7BLsfWqD8JKr6V/LP9N1FeTKErpQSP4doGIM+/2pjmgo1BUD4 neG2bt6s6meWAkCgVFKT/GpZ6EgEKZ6Nom1Cns7rWsNmZMWNErKK+eJQ7+F1Zp/3 Ary6IRNu/H7fATTh9r/7AQohYoVddLt7bDgLke2tKfncioXE63+f2YN7js2oJofR UQ5K4QneYWUaBcdWeFFVaybcKeDr+X4CuYbIMuXgCRKVeyY11WurNerznRd5eFEj c9OlY2g2j504H6daMezN+uYIXsbPqTdyweZYikSa6jfOyzLqJkUd8JU59wntII4w == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrudegiedgfeduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffogggtgfesthekredtredtjeenucfhrhhomheplfgrkhhusgcu mfmnugiiihholhhkrgcuoehnihgvugiivghjkhhosgesihhnvhhishhisghlvghthhhinh hgshhlrggsrdgtohhmqeenucggtffrrghtthgvrhhnpeefgedvleeiteeigfefvdduheef geefieehvdekheeuteekheeigeetfffgffetgfenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpehnihgvugiivghjkhhosgesihhnvhhishhisghl vghthhhinhhgshhlrggsrdgtohhm X-ME-Proxy: From: =?utf-8?b?SmFrdWIgS8SFZHppb8WCa2E=?= To: Boris Ostrovsky , Juergen Gross , Stefano Stabellini , xen-devel@lists.xenproject.org, "Rafael J. Wysocki" , Len Brown , Pavel Machek , linux-pm@vger.kernel.org Cc: =?utf-8?b?SmFrdWIgS8SFZHppb8WCa2E=?= , marmarek@invisiblethingslab.com Subject: [PATCH] xen: don't hang when resuming PCI device Date: Wed, 23 Mar 2022 02:21:03 +0100 Message-Id: <20220323012103.2537-1-niedzejkob@invisiblethingslab.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 If a xen domain with at least two VCPUs has a PCI device attached which enters the D3hot state during suspend, the kernel may hang while resuming, depending on the core on which an async resume task gets scheduled. The bug occurs because xen's do_suspend calls dpm_resume_start while only the timer of the boot CPU has been resumed (when xen_suspend called syscore_resume), before calling xen_arch_suspend to resume the timers of the other CPUs. This breaks pci_dev_d3_sleep. Thus this patch moves the call to xen_arch_resume before the call to dpm_resume_start, eliminating the hangs and restoring the stack-like structure of the suspend/restore procedure. Signed-off-by: Jakub Kądziołka Reviewed-by: Juergen Gross --- drivers/xen/manage.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c index 374d36de7f5a..3d5a384d65f7 100644 --- a/drivers/xen/manage.c +++ b/drivers/xen/manage.c @@ -141,6 +141,8 @@ static void do_suspend(void) raw_notifier_call_chain(&xen_resume_notifier, 0, NULL); + xen_arch_resume(); + dpm_resume_start(si.cancelled ? PMSG_THAW : PMSG_RESTORE); if (err) { @@ -148,8 +150,6 @@ static void do_suspend(void) si.cancelled = 1; } - xen_arch_resume(); - out_resume: if (!si.cancelled) xs_resume();