From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.4 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA9CFC433E2 for ; Mon, 8 Jun 2020 17:10:30 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 70A8C206C3 for ; Mon, 8 Jun 2020 17:10:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=amazon.com header.i=@amazon.com header.b="NhgdstKI" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 70A8C206C3 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amazon.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 0CB496B0005; Mon, 8 Jun 2020 13:10:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 07C226B0007; Mon, 8 Jun 2020 13:10:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EAE056B0008; Mon, 8 Jun 2020 13:10:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0233.hostedemail.com [216.40.44.233]) by kanga.kvack.org (Postfix) with ESMTP id D31946B0005 for ; Mon, 8 Jun 2020 13:10:29 -0400 (EDT) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 8DA855EA20 for ; Mon, 8 Jun 2020 17:10:29 +0000 (UTC) X-FDA: 76906683378.03.shade69_050cfcb26dbb Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin03.hostedemail.com (Postfix) with ESMTP id 39A92248C1D for ; Mon, 8 Jun 2020 17:10:27 +0000 (UTC) X-HE-Tag: shade69_050cfcb26dbb X-Filterd-Recvd-Size: 7521 Received: from smtp-fw-33001.amazon.com (smtp-fw-33001.amazon.com [207.171.190.10]) by imf28.hostedemail.com (Postfix) with ESMTP for ; Mon, 8 Jun 2020 17:10:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1591636227; x=1623172227; h=date:from:to:cc:message-id:references:mime-version: in-reply-to:subject; bh=t5Ht9pQ/L15OhRjsj3oBdWbi3godPK4J8lNDSU8Sric=; b=NhgdstKIFBHILGXKhwpX0Ez6RrU+EaB2VpVhkDN/FX0/maWd1ncx1LzJ 8QS/xbluKIHuUth/qcQiO6B1lkL14ifLSAnMOkWyiiXRMCI8xMRtzRSyI Ba5vt/UtG504/9wP466frqPdmRxYSJJ3WyNhBVFGmkINTkr1QyUDN2KBf E=; IronPort-SDR: S8JB7UWD4QsekyIBB/T3lttKcrT1Ne/0DCTZfl8uIv+BINZ1G4WVygkiGFpts8j2A2qHCjsFIu YrHU8J2n5sQQ== X-IronPort-AV: E=Sophos;i="5.73,487,1583193600"; d="scan'208";a="49364832" Subject: Re: [PATCH 04/12] x86/xen: add system core suspend and resume callbacks Received: from sea32-co-svc-lb4-vlan2.sea.corp.amazon.com (HELO email-inbound-relay-1e-57e1d233.us-east-1.amazon.com) ([10.47.23.34]) by smtp-border-fw-out-33001.sea14.amazon.com with ESMTP; 08 Jun 2020 17:10:17 +0000 Received: from EX13MTAUWC001.ant.amazon.com (iad55-ws-svc-p15-lb9-vlan3.iad.amazon.com [10.40.159.166]) by email-inbound-relay-1e-57e1d233.us-east-1.amazon.com (Postfix) with ESMTPS id C791814168C; Mon, 8 Jun 2020 17:10:08 +0000 (UTC) Received: from EX13D05UWC001.ant.amazon.com (10.43.162.82) by EX13MTAUWC001.ant.amazon.com (10.43.162.135) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 8 Jun 2020 17:09:48 +0000 Received: from EX13MTAUWC001.ant.amazon.com (10.43.162.135) by EX13D05UWC001.ant.amazon.com (10.43.162.82) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 8 Jun 2020 17:09:48 +0000 Received: from dev-dsk-anchalag-2a-9c2d1d96.us-west-2.amazon.com (172.22.96.68) by mail-relay.amazon.com (10.43.162.232) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 8 Jun 2020 17:09:47 +0000 Received: by dev-dsk-anchalag-2a-9c2d1d96.us-west-2.amazon.com (Postfix, from userid 4335130) id F15BC40832; Mon, 8 Jun 2020 17:09:47 +0000 (UTC) Date: Mon, 8 Jun 2020 17:09:47 +0000 From: Anchal Agarwal To: Boris Ostrovsky CC: "tglx@linutronix.de" , "mingo@redhat.com" , "bp@alien8.de" , "hpa@zytor.com" , "x86@kernel.org" , "jgross@suse.com" , "linux-pm@vger.kernel.org" , "linux-mm@kvack.org" , "Kamata, Munehisa" , "sstabellini@kernel.org" , "konrad.wilk@oracle.com" , "roger.pau@citrix.com" , "axboe@kernel.dk" , "davem@davemloft.net" , "rjw@rjwysocki.net" , "len.brown@intel.com" , "pavel@ucw.cz" , "peterz@infradead.org" , "Valentin, Eduardo" , "Singh, Balbir" , "xen-devel@lists.xenproject.org" , "vkuznets@redhat.com" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Woodhouse, David" , "benh@kernel.crashing.org" Message-ID: <20200608170947.GA4392@dev-dsk-anchalag-2a-9c2d1d96.us-west-2.amazon.com> References: <79cf02631dc00e62ebf90410bfbbdb52fe7024cb.1589926004.git.anchalag@amazon.com> <4b577564-e4c3-0182-2b9e-5f79004f32a1@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Rspamd-Queue-Id: 39A92248C1D X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, Jun 05, 2020 at 05:24:37PM -0400, Boris Ostrovsky wrote: > CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you can confirm the sender and know the content is safe. > > > > On 6/3/20 6:40 PM, Agarwal, Anchal wrote: > > CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you can confirm the sender and know the content is safe. > > > > > > > > On 5/19/20 7:26 PM, Anchal Agarwal wrote: > > > From: Munehisa Kamata > > > > > > Add Xen PVHVM specific system core callbacks for PM suspend and > > > hibernation support. The callbacks suspend and resume Xen > > > primitives,like shared_info, pvclock and grant table. Note that > > > Xen suspend can handle them in a different manner, but system > > > core callbacks are called from the context. > > > > > > I don't think I understand that last sentence. > > > > Looks like it may have cryptic meaning of stating that xen_suspend calls syscore_suspend from xen_suspend > > So, if these syscore ops gets called during xen_suspend do not do anything. Check if the mode is in xen suspend > > and return from there. These syscore_ops are specifically for domU hibernation. > > I must admit, I may have overlooked lack of explanation of some implicit details in the original commit msg. > > > > > So if the callbacks > > > are called from Xen suspend context, return immediately. > > > > > > > > > > + > > > +static int xen_syscore_suspend(void) > > > +{ > > > + struct xen_remove_from_physmap xrfp; > > > + int ret; > > > + > > > + /* Xen suspend does similar stuffs in its own logic */ > > > + if (xen_suspend_mode_is_xen_suspend()) > > > + return 0; > > > With your explanation now making this clearer, is this check really > necessary? From what I see we are in XEN_SUSPEND mode when > lock_system_sleep() lock is taken, meaning that we can't initialize > hibernation. > I see. Sounds plausible. I will fix both the code and commit message for better readability. Thanks for catching this. > > > > + > > > + xrfp.domid = DOMID_SELF; > > > + xrfp.gpfn = __pa(HYPERVISOR_shared_info) >> PAGE_SHIFT; > > > + > > > + ret = HYPERVISOR_memory_op(XENMEM_remove_from_physmap, &xrfp); > > > + if (!ret) > > > + HYPERVISOR_shared_info = &xen_dummy_shared_info; > > > + > > > + return ret; > > > +} > > > + > > > +static void xen_syscore_resume(void) > > > +{ > > > + /* Xen suspend does similar stuffs in its own logic */ > > > + if (xen_suspend_mode_is_xen_suspend()) > > > + return; > > > + > > > + /* No need to setup vcpu_info as it's already moved off */ > > > + xen_hvm_map_shared_info(); > > > + > > > + pvclock_resume(); > > > + > > > + gnttab_resume(); > > > > > > Do you call gnttab_suspend() in pm suspend path? > > No, since it does nothing for HVM guests. The unmap_frames is only applicable for PV guests right? > > > You should call it nevertheless. It will decide whether or not anything > needs to be done. Will fix it in V2. > > > -boris > Thanks, Anchal >