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

Re: [PATCH v2 2/4] x86: Introduce MSR_UNHANDLED


  • To: Jan Beulich <jbeulich@xxxxxxxx>, andrew.cooper3@xxxxxxxxxx
  • From: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
  • Date: Fri, 22 Jan 2021 13:56:15 -0500
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.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=3NFD80d7V8OSamYp2NqMvW7r9mgSNNKXjACE6woBRPk=; b=FuBdhdGIm3mRna5hKvVF/6SQKuML1ybueVp/G9TxCGQJSsbP49FE6+52NlqXhvKclA1rPBokQ344cQx1owpdQgIkDGqHtmpwsLHiP+wPW28rIExDBO8nrpXOPGYYlKYu5kCdhlKksBiAYyQCWO3ArJUBGGaqDpSRiI1A27sTu1o6sf4Q7rsizD+rtBrRvbxF5tSdkTxiClILnztiRkskoyhTTWglS5zAGc0bS5NG+WzBfCgH8ARkKlFncinzvTjSrLUmuFo/OM+J+bkQLt1b15FIhFDgXYnrf4EFBzcxXc2dBiW7Oosf/ejh5XUn8rC0FmbYqRQh2g+zbrFdmq9g8w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y5F+uhfrNCzT39lageLsOZLJJp7kPI2VDjhUda4HQpRTmJEd3/i+z3TERKUrfBnMERwckV8eDZG61TkUrrTX2Bl0q/coQoddT3A3on80XZ9JHc/4e5bi3YAc7xIIF3AAozD8OdFTOEUsjSp8ViSLgU5Zc+oPZIPpaJ1qO4GHkWaQ5qedSSrp+QfyB5XOreyBYPMXe+eqJSfk/0iGwLf7Asrp/VFWDGvtgLOdhcLLqAWi2FkrGTv9L0OdQDE4VBARRBYDrr+velxUpL6xtAvlnmpQCZD9AngH1laq7kObKgs1Ch0KW9MARlQPEExGtZWFpSOU7vUoEbm/lWTGonrh+w==
  • Authentication-results: lists.xenproject.org; dkim=none (message not signed) header.d=none;lists.xenproject.org; dmarc=none action=none header.from=oracle.com;
  • Cc: iwj@xxxxxxxxxxxxxx, wl@xxxxxxx, anthony.perard@xxxxxxxxxx, roger.pau@xxxxxxxxxx, jun.nakajima@xxxxxxxxx, kevin.tian@xxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Fri, 22 Jan 2021 18:58:37 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


On 1/22/21 6:51 AM, Jan Beulich wrote:
> On 20.01.2021 23:49, Boris Ostrovsky wrote:
>> --- a/xen/arch/x86/msr.c
>> +++ b/xen/arch/x86/msr.c
>> @@ -295,7 +295,7 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t 
>> *val)
>>          }
>>  
>>          /* Fallthrough. */
>> -    case 0x40000200 ... 0x400002ff:
>> +    case 0x40000200 ... 0x400002fe:
>>          ret = guest_rdmsr_xen(v, msr, val);
>>          break;
>>  
>> @@ -514,7 +514,7 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t 
>> val)
>>          }
>>  
>>          /* Fallthrough. */
>> -    case 0x40000200 ... 0x400002ff:
>> +    case 0x40000200 ... 0x400002fe:
>>          ret = guest_wrmsr_xen(v, msr, val);
>>          break;
> 
> For both of these, we need some kind of connection to
> MSR_UNHANDLED. Could be a BUILD_BUG_ON() or an explicit
> "case MSR_UNHANDLED:" (preventing someone "correcting" the
> apparent mistake) or yet something else.


I actually meant to add a comment there but forgot.

I'll add an explicit 'case'.


> 
>> --- a/xen/include/xen/lib/x86/msr.h
>> +++ b/xen/include/xen/lib/x86/msr.h
>> @@ -2,8 +2,21 @@
>>  #ifndef XEN_LIB_X86_MSR_H
>>  #define XEN_LIB_X86_MSR_H
>>  
>> +/*
>> + * Behavior on accesses to MSRs that are not handled by emulation:
>> + *  0 = return #GP, warning emitted
>> + *  1 = read as 0, writes are dropped, no warning
>> + *  2 = read as 0, writes are dropped, warning emitted
>> + */
>> +#define MSR_UNHANDLED_NEVER     0
>> +#define MSR_UNHANDLED_SILENT    1
>> +#define MSR_UNHANDLED_VERBOSE   2
>> +
>> +/* MSR that is not explicitly processed by emulation */
>> +#define MSR_UNHANDLED           0x400002ff
> 
> MSR indexes as well as definitions for MSR contents generally
> live in asm-x86/msr-index.h. I think it would be better for
> the above to also go there.
> 


I didn't put it there because I felt that file is for "real" (including 
hypervisor range) MSRs. But I can move it to msr-index.h


-boris



 


Rackspace

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