[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190305152133.GM32477@hirez.programming.kicks-ass.net>
Date: Tue, 5 Mar 2019 16:21:33 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Kairui Song <kasong@...hat.com>
Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
"K. Y. Srinivasan" <kys@...rosoft.com>,
Haiyang Zhang <haiyangz@...rosoft.com>,
Stephen Hemminger <sthemmin@...rosoft.com>,
Sasha Levin <sashal@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
"H. Peter Anvin" <hpa@...or.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Dave Young <dyoung@...hat.com>,
the arch/x86 maintainers <x86@...nel.org>,
devel@...uxdriverproject.org
Subject: Re: [PATCH v2] x86, hyperv: fix kernel panic when kexec on HyperV
On Tue, Mar 05, 2019 at 09:34:13PM +0800, Kairui Song wrote:
> On Tue, Mar 5, 2019 at 8:33 PM Peter Zijlstra <peterz@...radead.org> 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(...);
Powered by blists - more mailing lists