xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: "Tian, Kevin" <kevin.tian@intel.com>,
	Xen-devel <xen-devel@lists.xen.org>
Cc: "Nakajima, Jun" <jun.nakajima@intel.com>,
	Jan Beulich <JBeulich@suse.com>
Subject: Re: [PATCH 3/6] x86/vmx: Introduce and use struct vmx_msr_bitmap
Date: Thu, 27 Jul 2017 09:30:00 +0100	[thread overview]
Message-ID: <1a28d258-e15f-81ad-46ba-ed14e18b06e4@citrix.com> (raw)
In-Reply-To: <AADFC41AFE54684AB9EE6CBC0274A5D190D4C219@SHSMSX101.ccr.corp.intel.com>

On 27/07/2017 07:02, Tian, Kevin wrote:
>> From: Andrew Cooper [mailto:andrew.cooper3@citrix.com]
>> Sent: Wednesday, July 19, 2017 7:58 PM
>>
>> This avoids opencoding the bitmap bases in accessor functions.  Introduce a
>> build_assertions() function to check the structure layout against the manual
>> definiton.  In addition, drop some stale comments and ASSERT() that callers
>> pass an in-range MSR.
>>
>> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> Acked-by: Kevin Tian <kevin.tian@intel.com>, with a small comment:
> [...]
>
>> diff --git a/xen/include/asm-x86/hvm/vmx/vmcs.h b/xen/include/asm-
>> x86/hvm/vmx/vmcs.h
>> index e318dc2..926e792 100644
>> --- a/xen/include/asm-x86/hvm/vmx/vmcs.h
>> +++ b/xen/include/asm-x86/hvm/vmx/vmcs.h
>> @@ -64,6 +64,14 @@ struct vmx_domain {
>>      unsigned int status;
>>  };
>>
>> +/* Layout of the MSR bitmap, as interpreted by hardware. */
>> +struct vmx_msr_bitmap {
>> +    unsigned long read_low  [0x2000 / BITS_PER_LONG];
>> +    unsigned long read_high [0x2000 / BITS_PER_LONG];
>> +    unsigned long write_low [0x2000 / BITS_PER_LONG];
>> +    unsigned long write_high[0x2000 / BITS_PER_LONG];
>> +};
>> +
> what about taking this chance to define 0x2000 into a macro
> for better readability?

What would you suggest to make this more readable?

The current way it is expressed by the manuals is that the bitmaps
covers MSRs 0 -> 0x1fff and 0xc0000000 -> 0xc0001fff which is where the
0x2000 is derived from.

Would this be better?

/* Layout of the MSR bitmap, as interpreted by hardware. */
struct vmx_msr_bitmap {
    /* Covers MSRs 0 -> 0x1fff. */
    unsigned long read_low  [0x2000 / BITS_PER_LONG];
    unsigned long read_high [0x2000 / BITS_PER_LONG];
    /* Covers MSRs 0xc0000000 -> 0xc0001fff. */
    unsigned long write_low [0x2000 / BITS_PER_LONG];
    unsigned long write_high[0x2000 / BITS_PER_LONG];
};

~Andrew

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2017-07-27  8:30 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-19 11:57 [PATCH 0/6] x86/vvmx: Fixes to MSR_BITMAP interception handling Andrew Cooper
2017-07-19 11:57 ` [PATCH 1/6] x86/vmx: Improvements to vmx_{dis, en}able_intercept_for_msr() Andrew Cooper
2017-07-27  5:43   ` Tian, Kevin
2017-07-19 11:57 ` [PATCH 2/6] x86/vpmu: Use vmx_{clear, set}_msr_intercept() rather than opencoding them Andrew Cooper
2017-07-19 12:17   ` Andrew Cooper
2017-07-27  5:46     ` Tian, Kevin
2017-07-19 13:33   ` Boris Ostrovsky
2017-07-19 11:57 ` [PATCH 3/6] x86/vmx: Introduce and use struct vmx_msr_bitmap Andrew Cooper
2017-07-27  6:02   ` Tian, Kevin
2017-07-27  8:30     ` Andrew Cooper [this message]
2017-07-27  9:01       ` Tian, Kevin
2017-07-19 11:57 ` [PATCH 4/6] x86/vvmx: Switch nested MSR intercept handling to " Andrew Cooper
2017-07-27  6:09   ` Tian, Kevin
2017-07-19 11:57 ` [PATCH 5/6] x86/vvmx: Fix handing of the MSR_BITMAP field with VMCS shadowing Andrew Cooper
2017-07-26  8:50   ` Sergey Dyasli
2017-07-27  6:11   ` Tian, Kevin
2017-07-19 11:57 ` [PATCH 6/6] x86/vvmx: Fix auditing of MSR_BITMAP parameter Andrew Cooper
2017-07-27  6:13   ` Tian, Kevin

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=1a28d258-e15f-81ad-46ba-ed14e18b06e4@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=jun.nakajima@intel.com \
    --cc=kevin.tian@intel.com \
    --cc=xen-devel@lists.xen.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).