[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 3/4] x86: Allow non-faulting accesses to non-emulated MSRs if policy permits this


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Thu, 18 Feb 2021 16:53:31 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Z20XgBSmtQH9S2Bv/kNA51nmdRbVFUITvV+X3oM96Y4=; b=JqlsBEX13C/44ROoQqlC1Ynlu0vs8ao2KcYeEzP25fU7MorMcYjLKQp/LXTzi/7In1Px53MvwdVq0MHYsDXlU4UOrYqCRh5AM1kGKN4o4L93DQRW1DbwWdLu01lRllEhbIIYGTuo8JZfB42IWJnPXPAKIY2H5Km0g5ke2G9cGsj5DM3Av3c4xnsq9KZkSzvQTFtzY61IZKK9rzkBaKuoU/SPMlmIU1pDf/GE9KWEJ/4aN0v7LpJ9rHa95vhFq9hatyew20gxXAHDz3v/WbaFZ3hak9GvpRtn/ofkmRakB0S1JoVQmQagYne78u7tI5cVKnFSTKqMw5uZDFpLKxdbtQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RmpR7lQ3oEAK3b+F83nevG3fyqFShiq4IKraSRYVVQYbj5Q7lPwYOTJ0GHV5FMLOJLIgVZh0PNmXvEc4cG4Qrzk6aZeo2tB3D9Lim9B6woZrSN4Qs+XnE80PbZzv5hH/s9Qa7yw3UTWWdQfviaGchFyzf0EvnZryt9Gz04fKHEeKJFZolDK+VkDVKOI2VxvcMTTRU2xI+DIf1jjkDzapLujil3Ijb5uwF1XAGKf3wZDmWpsM2KFfh7z2QODq5YJevxlD+ftcPsbqv4EJjtqyUGNhck8miWvE+k783SQaBlktrBRZx0+rDclTVT9llscGEVNFbWZXCyCEFzeU0yITDA==
  • Authentication-results: esa5.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: <xen-devel@xxxxxxxxxxxxxxxxxxxx>, <iwj@xxxxxxxxxxxxxx>, <wl@xxxxxxx>, <anthony.perard@xxxxxxxxxx>, <andrew.cooper3@xxxxxxxxxx>, <jun.nakajima@xxxxxxxxx>, <kevin.tian@xxxxxxxxx>, Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
  • Delivery-date: Thu, 18 Feb 2021 15:53:42 +0000
  • Ironport-sdr: FntlC+WxqKmqkLSwvnmCEbb72x4QGzoLFPCvPmEH1xUuBZsaQihcgJjDxWCxHLr9Z+fGkSuZFw 0vA7ABCcHZalM5rVQLFD05PFUI2zLZ6Ikg9kEEYw+4Ph9A4ldTiVIqtdT/lBCGEfy20j73I8OP hgBzoCTKJ5ALO9tD8JNGsJkcHUiNDXG5HqoNZWGLMN7x92SjpSlcmzfvalP36QJXriyh6/kr6P cn9mFnk9O3Jtu+KVE5iS+DcapqnGthTHrFgxoeWD0Y9aEgtJlNI1k021b/EmTLFydZYJ9O8u2E bcQ=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Thu, Feb 18, 2021 at 12:57:13PM +0100, Jan Beulich wrote:
> On 18.02.2021 12:24, Roger Pau Monné wrote:
> > On Wed, Jan 20, 2021 at 05:49:11PM -0500, Boris Ostrovsky wrote:
> >> --- a/xen/arch/x86/hvm/vmx/vmx.c
> >> +++ b/xen/arch/x86/hvm/vmx/vmx.c
> >> @@ -3017,8 +3017,8 @@ static int vmx_msr_read_intercept(unsigned int msr, 
> >> uint64_t *msr_content)
> >>              break;
> >>          }
> >>  
> >> -        gdprintk(XENLOG_WARNING, "RDMSR 0x%08x unimplemented\n", msr);
> >> -        goto gp_fault;
> >> +        if ( guest_unhandled_msr(curr, msr, msr_content, false, true) )
> >> +            goto gp_fault;
> >>      }
> >>  
> >>  done:
> >> @@ -3319,10 +3319,8 @@ static int vmx_msr_write_intercept(unsigned int 
> >> msr, uint64_t msr_content)
> >>               is_last_branch_msr(msr) )
> >>              break;
> >>  
> >> -        gdprintk(XENLOG_WARNING,
> >> -                 "WRMSR 0x%08x val 0x%016"PRIx64" unimplemented\n",
> >> -                 msr, msr_content);
> >> -        goto gp_fault;
> >> +        if ( guest_unhandled_msr(v, msr, &msr_content, true, true) )
> >> +            goto gp_fault;
> >>      }
> > 
> > I think this could be done in hvm_msr_read_intercept instead of having
> > to call guest_unhandled_msr from each vendor specific handler?
> > 
> > Oh, I see, that's likely done to differentiate between guest MSR
> > accesses and emulator ones? I'm not sure we really need to make a
> > difference between guests MSR accesses and emulator ones, surely in
> > the past they would be treated equally?
> 
> We did discuss this before. Even if they were treated the same in
> the past, that's not correct, and hence we shouldn't suppress the
> distinction going forward. A guest explicitly asking to access an
> MSR (via RDMSR/WRMSR) is entirely different from the emulator
> perhaps just probing an MSR, falling back to some default behavior
> if it's unavailable.

Ack, then placing the calls to guest_unhandled_msr in vendor code
seems like the best option.

Thanks, Roger.



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.