Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp3377345imb; Tue, 5 Mar 2019 07:56:12 -0800 (PST) X-Google-Smtp-Source: APXvYqz0+9a69lhTUQRr1CQJ/8la69N21JeecblQ6OLOeWHJZiafR8C/zjSZgCbCLq028Nf+nJsq X-Received: by 2002:a62:138f:: with SMTP id 15mr2447556pft.219.1551801372582; Tue, 05 Mar 2019 07:56:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551801372; cv=none; d=google.com; s=arc-20160816; b=KGaU2uT34JtOw9G5simYfR67uj0AoHkRJFAUQ2SBhpdnHjZhmoahu1BuxR4LAyIw0O kVjHP9YDE+CylwdMeb892cL19y/Pp3jKBWDrFQKmdy07z7eoIPSXi2YDaP4ldPbL2xsG qgVtBYj3zaGHRqafc2W7ffWovST9NaMXLN8woRPlVrDKWGJJqGfJaLMpmUmUYjYhznL2 FuIVpxULqhmJGHRmn15LGXIVC576LJu4K3DKlM24qwLsqA0b1hHNt7Z0+evDv+hVygoc z/X94jpe9Dfb5unfQCgQR4jJ1A/+6vFUUF51uQZkVmXrOMX0g57WRtiypftTkjpnzuRP cPEA== 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:subject:cc :to:from:date:dkim-signature; bh=IW/MFqNmMOpjtrIeswXa7KjxSyC87aDyEneaZ4voho8=; b=dQqXgFMx/ioEg9o7qthvNTKCNczOUIU95ZuOu52Tt/EMv2CK618qFcT53ipaYK2XWS IKpLxVc+0cAceqvukFi2VHqKx8uvjMBm3apBbgU4osGnfdpGOKT+Ftiy0MqXD3tMt2LV Y/KmfcfHOa2MLuG8hxs3duG0gZmgI6DLKemXNH/qykMzy4dX4BgvByPT9M6JO0BMZY0J n4XK9WdDFFbh/APHqfXfE+8wNZ70Rnh97/kODPhCTJlVKA+wnacctFLYb3W61cckrRI4 6BqlB8opQn4/MRK+FC7LR+LFIwhibhLG8sN1/pCWZpx70UpZH6uzScyeiZpwu/emKVYO ldHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=NN9un9tz; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y17si8535594pfb.204.2019.03.05.07.55.57; Tue, 05 Mar 2019 07:56:12 -0800 (PST) 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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=NN9un9tz; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728710AbfCEPVm (ORCPT + 99 others); Tue, 5 Mar 2019 10:21:42 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:57878 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727726AbfCEPVl (ORCPT ); Tue, 5 Mar 2019 10:21:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=IW/MFqNmMOpjtrIeswXa7KjxSyC87aDyEneaZ4voho8=; b=NN9un9tzjNMHwTYjbn9TB4q0v 6dJwDD97doQCkEwCF8WtHXr75+QCGjPViO/zpcjiAr7QI5XpOTir8TyKixznjv5qQWnJs9eaoe3Et Q0+bytXdeWsDy3hYCmLDsYaJjwcQbgJEQL8B9QLJsxhHKmVxUHEVAqiGqmkWxc2qh2SmlylpcWMGs DZV+m0nZ+/TBVILIKRQ0V/YL3N0mGJRA9ZzTlEc61YUhnWU+fRkQF5Dbl/5dg8Yt9ANPvxJaOjv+f utNrS5FhZdsJhPC8O9LSEmkA5X2tRB9eOr5trarY8BvdkIwB5BYc87fZaVIrXSvVyfdTW2NkDV/91 BTdlDTDFA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1h1Bst-0003nJ-KW; Tue, 05 Mar 2019 15:21:35 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 04D1D202C2DAE; Tue, 5 Mar 2019 16:21:34 +0100 (CET) Date: Tue, 5 Mar 2019 16:21:33 +0100 From: Peter Zijlstra To: Kairui Song Cc: Linux Kernel Mailing List , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Sasha Levin , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Vitaly Kuznetsov , Dave Young , the arch/x86 maintainers , devel@linuxdriverproject.org Subject: Re: [PATCH v2] x86, hyperv: fix kernel panic when kexec on HyperV Message-ID: <20190305152133.GM32477@hirez.programming.kicks-ass.net> References: <20190305121703.29769-1-kasong@redhat.com> <20190305123329.GK32477@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 05, 2019 at 09:34:13PM +0800, Kairui Song wrote: > On Tue, Mar 5, 2019 at 8:33 PM Peter Zijlstra wrote: > > > > On Tue, Mar 05, 2019 at 08:17:03PM +0800, Kairui Song wrote: > > > diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c > > > index 7abb09e2eeb8..34aa1e953dfc 100644 > > > --- a/arch/x86/hyperv/hv_init.c > > > +++ b/arch/x86/hyperv/hv_init.c > > > @@ -406,6 +406,12 @@ void hyperv_cleanup(void) > > > /* Reset our OS id */ > > > wrmsrl(HV_X64_MSR_GUEST_OS_ID, 0); > > > > > > + /* Cleanup hypercall page reference before reset the page */ > > > + hv_hypercall_pg = NULL; > > > + > > > + /* Make sure page reference is cleared before wrmsr */ > > > > This comment forgets to tell us who cares about this. And why the wrmsr > > itself isn't serializing enough. > > > > > + wmb(); > > > + > > > /* Reset the hypercall page */ > > > hypercall_msr.as_uint64 = 0; > > > wrmsrl(HV_X64_MSR_HYPERCALL, hypercall_msr.as_uint64); > > > > That looks like a fake MSR; and you're telling me that VMEXIT doesn't > > serialize? > > Thanks for the review, seem I being a bit paranoid on this. Will drop > it and send a v3 if no one has any other complaint. Also; our wrmsr implementation has a "memory" clobber on, which means you don't even need a compiler barrier to force emit that store before the wrmsr. You might want to retain the comment that explains this ordering though. hv_hypercall_pg = NULL; /* * text that explains why hv_hypercall_pg must be set NULL * before the wrmsr */ wrmsrl(...);