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=-5.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham 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 B9BCDC2BA1A for ; Fri, 24 Apr 2020 06:13:11 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 9024920767 for ; Fri, 24 Apr 2020 06:13:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9024920767 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jRraB-0001Jy-CU; Fri, 24 Apr 2020 06:13:03 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jRraA-0001Jt-L6 for xen-devel@lists.xenproject.org; Fri, 24 Apr 2020 06:13:02 +0000 X-Inumbo-ID: a6c9aef4-85f2-11ea-b4f4-bc764e2007e4 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id a6c9aef4-85f2-11ea-b4f4-bc764e2007e4; Fri, 24 Apr 2020 06:13:02 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 656BBADEB; Fri, 24 Apr 2020 06:13:00 +0000 (UTC) Subject: Re: [PATCH 1/3] x86/S3: Use percpu_traps_init() rather than opencoding SYSCALL/SYSENTER restoration To: Andrew Cooper References: <20200420145911.5708-1-andrew.cooper3@citrix.com> <20200420145911.5708-2-andrew.cooper3@citrix.com> <4ff5227c-a9a4-f6cc-2068-ddd41165ebaf@citrix.com> From: Jan Beulich Message-ID: <32681985-49cb-339b-0ba2-9dbe11bbdc63@suse.com> Date: Fri, 24 Apr 2020 08:13:00 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <4ff5227c-a9a4-f6cc-2068-ddd41165ebaf@citrix.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Xen-devel , Wei Liu , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" On 23.04.2020 20:24, Andrew Cooper wrote: > On 21/04/2020 08:24, Jan Beulich wrote: >> On 20.04.2020 16:59, Andrew Cooper wrote: >>> @@ -46,24 +36,13 @@ void restore_rest_processor_state(void) >>> /* Restore full CR4 (inc MCE) now that the IDT is in place. */ >>> write_cr4(mmu_cr4_features); >>> >>> - /* Recover syscall MSRs */ >>> - wrmsrl(MSR_LSTAR, saved_lstar); >>> - wrmsrl(MSR_CSTAR, saved_cstar); >>> - wrmsrl(MSR_STAR, XEN_MSR_STAR); >>> - wrmsrl(MSR_SYSCALL_MASK, XEN_SYSCALL_MASK); >>> + /* (re)initialise SYSCALL/SYSENTER state, amongst other things. */ >>> + percpu_traps_init(); >> Without tweaks to subarch_percpu_traps_init() this assumes that, >> now and going forward, map_domain_page() will work reliably at >> this early point of resume. I'm not opposed, i.e. >> Acked-by: Jan Beulich > > I think this reasonable to expect, and robust going forward. > > We are properly in d[IDLE]v0 context when it comes to pagetables, and > there is nothing interesting between this point and coming fully back > online. > > That said, I could easily move the call to later in the resume path for > even more certainty. > > diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c > index 3ad7dfc9a3..d5a468eddd 100644 > --- a/xen/arch/x86/acpi/power.c > +++ b/xen/arch/x86/acpi/power.c > @@ -297,6 +297,8 @@ static int enter_state(u32 state) >      ci->spec_ctrl_flags |= (default_spec_ctrl_flags & SCF_ist_wrmsr); >      spec_ctrl_exit_idle(ci); >   > +    /* (re)initialise SYSCALL/SYSENTER state, amongst other things. */ > +    percpu_traps_init(); > + >   done: >      spin_debug_enable(); >      local_irq_restore(flags); > > In fact - I prefer this, because it works towards one low priority goal > of deleting {save,restore}_rest_processor_state() which I've still got a > pending series for. > > Would your ack still stand if I tweak the patch in this way? Yes. Jan