linux-hyperv.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu@kernel.org>
To: Praveen Kumar <kumarpraveen@linux.microsoft.com>
Cc: Michael Kelley <mikelley@microsoft.com>,
	Wei Liu <wei.liu@kernel.org>,
	"linux-hyperv@vger.kernel.org" <linux-hyperv@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	KY Srinivasan <kys@microsoft.com>,
	Haiyang Zhang <haiyangz@microsoft.com>,
	Stephen Hemminger <sthemmin@microsoft.com>,
	Dexuan Cui <decui@microsoft.com>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"bp@alien8.de" <bp@alien8.de>, "x86@kernel.org" <x86@kernel.org>,
	"hpa@zytor.com" <hpa@zytor.com>,
	"viremana@linux.microsoft.com" <viremana@linux.microsoft.com>,
	Sunil Muthuswamy <sunilmut@microsoft.com>,
	"nunodasneves@linux.microsoft.com"
	<nunodasneves@linux.microsoft.com>
Subject: Re: [PATCH] hyperv: root partition faults writing to VP ASSIST MSR PAGE
Date: Wed, 21 Jul 2021 10:10:26 +0000	[thread overview]
Message-ID: <20210721101026.3tujagjag5umqejh@liuwe-devbox-debian-v2> (raw)
In-Reply-To: <d8bd9c00-4eb5-187f-e31b-cba2ecec565b@linux.microsoft.com>

On Wed, Jul 21, 2021 at 12:42:52PM +0530, Praveen Kumar wrote:
> On 21-07-2021 09:40, Michael Kelley wrote:
> > From: Wei Liu <wei.liu@kernel.org> Sent: Tuesday, July 20, 2021 9:29 AM
> >>
> >> On Tue, Jul 20, 2021 at 04:20:44PM +0000, Michael Kelley wrote:
> >>> From: Wei Liu <wei.liu@kernel.org> Sent: Tuesday, July 20, 2021 6:35 AM
> >>>>
> >>>> On Tue, Jul 20, 2021 at 06:55:56PM +0530, Praveen Kumar wrote:
> >>>> [...]
> >>>>>>
> >>>>>>> +	if (hv_root_partition &&
> >>>>>>> +	    ms_hyperv.features & HV_MSR_APIC_ACCESS_AVAILABLE) {
> >>>>>>
> >>>>>> Is HV_MSR_APIC_ACCESS_AVAILABLE a root only flag? Shouldn't non-root
> >>>>>> kernel check this too?
> >>>>>
> >>>>> Yes, you are right. Will update this in v2. thanks.
> >>>>
> >>>> Please split adding this check to its own patch.
> >>>>
> >>>> Ideally one patch only does one thing.
> >>>>
> >>>> Wei.
> >>>>
> >>>
> >>> I was just looking around in the Hyper-V TLFS, and I didn't see
> >>> anywhere that the ability to set up a VP Assist page is dependent
> >>> on HV_MSR_APIC_ACCESS_AVAILABLE.  Or did I just miss it?
> >>
> >> The feature bit Praveen used is wrong and should be fixed.
> >>
> >> Per internal discussion this is gated by the AccessIntrCtrlRegs bit.
> >>
> >> Wei.
> >>
> > 
> > The AccessIntrCtrlRegs bit *is* HV_MSR_APIC_ACCESS_AVAILABLE.
> > Both are defined as bit 4 of the Partition Privilege flags.  :-)   I don't
> > know why the names don't line up.   Even so, it's not clear to me that
> > AccessIntrCtrlRegs has any bearing on the VP Assist page.  I see this
> > description of AccessIntrCtrlRegs:
> > 
> 
> Yup, what I understood as well, this is the one required one for Partition Privilege Flags (4th bit), however, cannot comment on the naming convention.
> 
>      5 /* Virtual APIC assist and VP assist page registers available */
>      4 #define HV_MSR_APIC_ACCESS_AVAILABLE            BIT(4)
> 

Urgh, okay. It is my fault for not reading the code closely. Sorry for
the confusion.

> > The partition has access to the synthetic MSRs associated with the
> > APIC (HV_X64_MSR_EOI, HV_X64_MSR_ICR and HV_X64_MSR_TPR).
> > If this flag is cleared, accesses to these MSRs results in a #GP fault if
> > the MSR intercept is not installed.
> > 
> 
> As per what I also understood from the TLFS doc,that we let partition
> access the MSR and do a fault.  However, the point is, does it make
> sense to allocate page for vp assist and perform action which is meant
> to fail when the flag is cleared ?

Like Michael said, there are some other things that are not tied to that
particular bit. We should get more clarity on what gates what.  Perhaps
that privilege bit only controls access to the EOI assist bit and the
other things in the VP assist page are gated by other privilege bits.
This basically means we should setup the page when there is at least one
thing in that page can be used.

This is mostly an orthogonal issue from the one we want to fix. In
the interest of making progress we can drop the new check for now and
just add a root specific path for setting up and tearing down the VP
assist pages.

How does that sound?

Wei.

> 
> > But maybe you have additional info that applies to the root
> > partition that is not in the TLFS.
> > 
> 
> As per what discussed internally and I understood, the root partition
> shares the vp assist page provided by hypervisor and its read only for
> Root kernel.
> 
> > Michael
> > 
> 
> Regards,
> 
> ~Praveen.

  reply	other threads:[~2021-07-21 11:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-19 18:51 [PATCH] hyperv: root partition faults writing to VP ASSIST MSR PAGE Praveen Kumar
2021-07-20 11:20 ` Wei Liu
2021-07-20 13:25   ` Praveen Kumar
2021-07-20 13:35     ` Wei Liu
2021-07-20 16:20       ` Michael Kelley
2021-07-20 16:29         ` Wei Liu
2021-07-21  4:10           ` Michael Kelley
2021-07-21  7:12             ` Praveen Kumar
2021-07-21 10:10               ` Wei Liu [this message]
2021-07-21 11:32                 ` Praveen Kumar
2021-07-21 15:07                   ` Michael Kelley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210721101026.3tujagjag5umqejh@liuwe-devbox-debian-v2 \
    --to=wei.liu@kernel.org \
    --cc=bp@alien8.de \
    --cc=decui@microsoft.com \
    --cc=haiyangz@microsoft.com \
    --cc=hpa@zytor.com \
    --cc=kumarpraveen@linux.microsoft.com \
    --cc=kys@microsoft.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mikelley@microsoft.com \
    --cc=mingo@redhat.com \
    --cc=nunodasneves@linux.microsoft.com \
    --cc=sthemmin@microsoft.com \
    --cc=sunilmut@microsoft.com \
    --cc=tglx@linutronix.de \
    --cc=viremana@linux.microsoft.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).