Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp883511imm; Wed, 13 Jun 2018 09:44:19 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKq6l0ZuxtigPOl+omiWW4lmomNp1C1AemW9l4HTy7hPk9csa3ldq63Yaos5U4uqHGsEBHw X-Received: by 2002:a17:902:d20c:: with SMTP id t12-v6mr6001103ply.63.1528908259089; Wed, 13 Jun 2018 09:44:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528908259; cv=none; d=google.com; s=arc-20160816; b=YE2zcnp7zw0FX3gq91RtbvEcWEzU/h2+H17xt4w6Np3MJI/awSOMNE1nLNvK1cKHu2 xiwkjxmla7ik4skQI+DKlyxws8W+D/9y+xzErOGSGnS1lGcjXduGzvyfay5YozID9IEh ISvFJ7BDfmjO7bhuFXhuw6bk3auHJm27KmYBj8oTW0Cfhv9csQJ8XdUhLsnki59CoJuB IeWeH1XcK2FTtoOyKH4pmBXl8As2LJRclvkL95KHc2NpAdnS7LqjHQ3xzke+JqGU7vTl /EiOtydf2Sa61M2EDYWzjiB9ONph0j2a8K49qCS48+eYBDsVTsghwN9O9isPq1F/cEnY wR8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=NUubvUULaJdwfXmJhgtGmCyh+CBTMg8nhoPwNJ56j/U=; b=OU7KlOPRz0/c+xC+VhRkG+cyyq9IVd+1d0R+8v4a7EV+ZMnZSfSBLK+7mWvUbeR7th HWDdc7nBmvEyxZNmO82n6dDRpTU1VIFxz4cOldpJ+5xuEJRNT+vHxRHBnx7w/XtVlob1 nmL+UxtxjQqXuk9VWS8Monv478X2KF8WrpHDJ0b9Aa+UbaETzaAyrQvmtHSrF8oK7HZ1 en6nmYftWyX6fIg/QaiGBRrpHdZa05BwusBQH9j3g2WzhBBrE+e+7wzkRWOTX++ip+3H XbBUIIjoVKKXqLYzg0Qc/oeMSCnUuXMh8hplbEY4nSNgqm3F31s2LUzeuNSiZ7wcLo4o 2TMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qMtcMB3K; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k24-v6si3057306pff.91.2018.06.13.09.44.05; Wed, 13 Jun 2018 09:44:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qMtcMB3K; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935150AbeFMQmW (ORCPT + 99 others); Wed, 13 Jun 2018 12:42:22 -0400 Received: from mail-ua0-f196.google.com ([209.85.217.196]:34155 "EHLO mail-ua0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934941AbeFMQmS (ORCPT ); Wed, 13 Jun 2018 12:42:18 -0400 Received: by mail-ua0-f196.google.com with SMTP id 74-v6so2173586uav.1; Wed, 13 Jun 2018 09:42:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=NUubvUULaJdwfXmJhgtGmCyh+CBTMg8nhoPwNJ56j/U=; b=qMtcMB3KIzR8FAb2Ixp+F6n3iXnVwg6hc4KkOX9rPE9kV3js3utrvM1eqwXpA18FLu YuXXCCJL5ZCFMC6vf7R0NtUjYj0AnSPDajMhk2MJHaR2c3FhqijAQzo6Q+/9p8odjpXs dmA3C5BY6iiJC5Yok8ouXNQVQt58/zDZ0G05k3KDy2dllwnT63kF3WCY9033J0cQGxF7 Ei943AiampbYAcs1HejjYZfKK+oWEJpE9VsfS8rlMcU9qlXO+zDc7tHDYEppsPyzZIMq 1avnxg1fHD3Pla/Z2sxzPdZ3Gd1ZXrIqZsDlXXkzDmh84IEI7C1tdmse92EqZ+iXjOwc NCrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=NUubvUULaJdwfXmJhgtGmCyh+CBTMg8nhoPwNJ56j/U=; b=qS3A0RWLkelbK+zxzJmwLY6Zn8C9LsainXCLaaMP7F4KKZskIRSYOy9Us8uZeMPSxa sNw/D70VUAQ2MJbbNCvbdm4Qum4gbDEW7yXai4W5EeL30fssbB5kMp/UJArumwtWPWnL i/fcSWDqN51+dfXTUyuZtdmq0/mK7rskmI8LBs8Z+vP5F1ep2nCBUDREp8C0iFxVE7rr xm9UoVZHDHeApYHsjMH58TgH6uR8FIPsNhjsxt+8CtNqvt39WuwYePbx4vA1k92v9mBA vYT1RB+gy++0umcU/0kK8YZ1JD1m3wUf4yidn4c+A+rG/wN0wU2zXEtLxVJDTCbcJ/z2 xaag== X-Gm-Message-State: APt69E3vGsV1SBSye4Myabrz0wBdr7Qrnq6IwKW686R6TVKNFoiGsElx y6ubRshj33HKrkJ5dO9RAYI4+iOwqljiiTp4Xjw= X-Received: by 2002:ab0:4161:: with SMTP id j88-v6mr3829508uad.196.1528908137456; Wed, 13 Jun 2018 09:42:17 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ab0:549e:0:0:0:0:0 with HTTP; Wed, 13 Jun 2018 09:42:16 -0700 (PDT) In-Reply-To: <20180612205619.28156-2-anchalag@amazon.com> References: <20180612205619.28156-1-anchalag@amazon.com> <20180612205619.28156-2-anchalag@amazon.com> From: Balbir Singh Date: Thu, 14 Jun 2018 02:42:16 +1000 Message-ID: Subject: Re: [RFC PATCH 01/12] xen/manage: keep track of the on-going suspend mode To: Anchal Agarwal Cc: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , boris.ostrovsky@oracle.com, konrad.wilk@oracle.com, roger.pau@citrix.com, netdev , jgross@suse.com, xen-devel , "linux-kernel@vger.kernel.org" , kamatam@amazon.com, Frank van der Linden , vallish@amazon.com, guruanb@amazon.com, eduval@amazon.com, "Rafael J. Wysocki" , Pavel Machek , Len Brown , linux-pm@vger.kernel.org, cyberax@amazon.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 13, 2018 at 6:56 AM, Anchal Agarwal wrote: > From: Munehisa Kamata > > To differentiate between Xen suspend, PM suspend and PM hibernation, > keep track of the on-going suspend mode by mainly using a new PM > notifier. Since Xen suspend doesn't have corresponding PM event, its > main logic is modfied to acquire pm_mutex and set the current mode. > Why do we need to differentiate between them? The changelog does not explain how Xen Suspend is different from PM suspend. The difference could be what is injected into the guest vs what the guest decides to do. How do we use the new suspend_mode? > Note that we may see deadlock if PM suspend/hibernation is interrupted > by Xen suspend. PM suspend/hibernation depends on xenwatch thread to > process xenbus state transactions, but the thread will sleep to wait > pm_mutex which is already held by PM suspend/hibernation context in the > scenario. Though, acquirng pm_mutex is still right thing to do, and we > would need to modify Xen shutdown code to avoid the issue. This will be > fixed by a separate patch. > > Signed-off-by: Munehisa Kamata > Signed-off-by: Anchal Agarwal > Reviewed-by: Sebastian Biemueller > Reviewed-by: Munehisa Kamata > Reviewed-by: Eduardo Valentin > --- > drivers/xen/manage.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 58 insertions(+) > > diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c > index 8835065..8f9ea87 100644 > --- a/drivers/xen/manage.c > +++ b/drivers/xen/manage.c > @@ -13,6 +13,7 @@ > #include > #include > #include > +#include > > #include > #include > @@ -39,6 +40,16 @@ enum shutdown_state { > /* Ignore multiple shutdown requests. */ > static enum shutdown_state shutting_down = SHUTDOWN_INVALID; > > +enum suspend_modes { > + NO_SUSPEND = 0, > + XEN_SUSPEND, > + PM_SUSPEND, > + PM_HIBERNATION, > +}; Why do the enums range across namespaces -- between NO, XEN and PM? Can we please be consistent XEN_WATCH_SUSPEND, XEN_PM_SUSPEND. etc? Balbir Singh.