From: Wei Wang <wei.w.wang@intel.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
virtualization@lists.linux-foundation.org, kvm@vger.kernel.org,
linux-kernel@vger.kernel.org, mst@redhat.com, rkrcmar@redhat.com,
ak@linux.intel.com, mingo@redhat.com
Subject: Re: [PATCH v1 1/4] KVM/vmx: re-write the msr auto switch feature
Date: Mon, 25 Sep 2017 21:02:38 +0800 [thread overview]
Message-ID: <59C8FE6E.7070503@intel.com> (raw)
In-Reply-To: <7f9d54dd-546a-548f-5425-e4151e09fbdc@redhat.com>
On 09/25/2017 07:54 PM, Paolo Bonzini wrote:
> On 25/09/2017 06:44, Wei Wang wrote:
>>
>> +static void update_msr_autoload_count_max(void)
>> +{
>> + u64 vmx_msr;
>> + int n;
>> +
>> + /*
>> + * According to the Intel SDM, if Bits 27:25 of MSR_IA32_VMX_MISC is
>> + * n, then (n + 1) * 512 is the recommended max number of MSRs to be
>> + * included in the VMExit and VMEntry MSR auto switch list.
>> + */
>> + rdmsrl(MSR_IA32_VMX_MISC, vmx_msr);
>> + n = ((vmx_msr & 0xe000000) >> 25) + 1;
>> + msr_autoload_count_max = n * KVM_VMX_DEFAULT_MSR_AUTO_LOAD_COUNT;
>> +}
>> +
>
> Any reasons to do this if it's unlikely that we'll ever update more than
> 512 MSRs?
>
> Paolo
It isn't a must to allocate memory for 512 MSRs, but I think it would be
good to
allocate memory at least for 128 MSRs, because on skylake we have 32
triplets
of MSRs (FROM/TO/INFO), which are 96 in total already.
The disadvantage is that developers would need to manually calculate and
change
the number carefully when they need to add new MSRs for auto switching
in the
future. So, if consuming a little bit more memory isn't a concern, I
think we can
directly allocate memory based on what's recommended by the hardware.
Best,
Wei
next prev parent reply other threads:[~2017-09-25 13:02 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-25 4:44 [PATCH v1 0/4] Enable LBR for the guest Wei Wang
2017-09-25 4:44 ` [PATCH v1 1/4] KVM/vmx: re-write the msr auto switch feature Wei Wang
2017-09-25 11:54 ` Paolo Bonzini
2017-09-25 13:02 ` Wei Wang [this message]
2017-09-25 14:24 ` Paolo Bonzini
2017-09-25 4:44 ` [PATCH v1 2/4] KVM/vmx: auto switch MSR_IA32_DEBUGCTLMSR Wei Wang
2017-09-25 11:57 ` Paolo Bonzini
2017-09-25 4:44 ` [PATCH v1 3/4] perf/x86: add a function to get the lbr stack Wei Wang
2017-09-25 4:44 ` [PATCH v1 4/4] KVM/vmx: enable lbr for the guest Wei Wang
2017-09-25 9:16 ` Paolo Bonzini
2017-09-25 12:57 ` Wei Wang
2017-09-25 14:57 ` Andi Kleen
2017-09-26 8:56 ` Wei Wang
2017-09-26 16:41 ` Andi Kleen
2017-09-27 1:27 ` Wei Wang
2017-09-25 14:59 ` [PATCH v1 0/4] Enable LBR " Andi Kleen
2017-09-26 8:47 ` Wei Wang
2017-09-26 16:51 ` Andi Kleen
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=59C8FE6E.7070503@intel.com \
--to=wei.w.wang@intel.com \
--cc=ak@linux.intel.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=rkrcmar@redhat.com \
--cc=virtualization@lists.linux-foundation.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