Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp4535435ybg; Mon, 8 Jun 2020 10:12:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwd9b4pBLBL2+03vg6yMHvUWLGiDR2M6U3C20pFmsTyA2/zYsfs0C+4fKBqMzKNGJkNtDD3 X-Received: by 2002:a17:906:fa03:: with SMTP id lo3mr22276678ejb.196.1591636365949; Mon, 08 Jun 2020 10:12:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591636365; cv=none; d=google.com; s=arc-20160816; b=rOT5AjK9LT5blqP35tl6CUDIlGsPW9rO1tiSI+LQKrFMBnz7A7BCNvn98OO4nhado0 ZpcWe9BzktTfdPjcSh02UTDMJlj5e72IoexNkkXL7FL1/QkSwluwqkXuilcIgRmuGx6x 6xfUzaDaG/9O1ASX4aw6nG/8TF9TvH14rcCOXr4Z2BOGWgsRKTjK2j28ot9ShCpnDUMi N8J5QDZScuS1XSapBBNlU12zwGgrVE/KIjUrpnBKz30rf+FZCHH1qQtGkdJq9bhCe7+u arBA+J4eciyL4bUYDI6puPH7ebv3jiPCMSgdkiItP1FSmIFpJ/l11aJiHy+3QPwHO9Lt dJ6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:cc:to:from :date:subject:ironport-sdr:dkim-signature; bh=t5Ht9pQ/L15OhRjsj3oBdWbi3godPK4J8lNDSU8Sric=; b=e5q0aZxifEDEF5U+/l60xgntzbbwvZByO6ZrZ7Ns9xya2qiPnyy6ZbIrdDD3GvEBLg ZglRheNzBvHL7PnE619CB70PMCmgzpWXjPIMjkux0T7okTBHi14rx6teijJUfi6qkrhu 2W2pBE/4BT/JxC8W3nADdUaFz03mP6VpRUp1NYJ6sYlFRhm1z8lfyu+0EhaefwO44oHw TiVYNaGIuS65DtyI50iWNg652oNz/RqD+H1jfMNK83XHVnnq2UxpP+04D/l99/w/zTWK HHhvF5twSHcem17ziyIFD8ve0aB0YqDFsm1NwVXkzy3kbAPXvkKGp5+K7gE9t31yvr4F fWmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=h7W5Qzyg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id sa14si8556109ejb.297.2020.06.08.10.12.22; Mon, 08 Jun 2020 10:12:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=h7W5Qzyg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387510AbgFHRK2 (ORCPT + 99 others); Mon, 8 Jun 2020 13:10:28 -0400 Received: from smtp-fw-33001.amazon.com ([207.171.190.10]:62208 "EHLO smtp-fw-33001.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730696AbgFHRK1 (ORCPT ); Mon, 8 Jun 2020 13:10:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1591636226; x=1623172226; h=date:from:to:cc:message-id:references:mime-version: in-reply-to:subject; bh=t5Ht9pQ/L15OhRjsj3oBdWbi3godPK4J8lNDSU8Sric=; b=h7W5QzygyIq9kvN2MXSsz8d2kdwog+IbguIPcpOcwHFxk4ZfUhoy3VYU v38Ybr+IdaQPH88f0HS1mGGClX6F04gM3GQNi6w95YpSflTOWLj2fefu1 BrX8Ww8aTcmVeGu1pg5Ca1tqXgKTILyD1UIVTd2PBcOLCx9/tsUcEp/MY c=; 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) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >