From: Paolo Bonzini <pbonzini@redhat.com>
To: Wei Wang <wei.w.wang@intel.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 16:24:53 +0200 [thread overview]
Message-ID: <f1a530e3-5d47-3402-ffd6-10a3c1906a68@redhat.com> (raw)
In-Reply-To: <59C8FE6E.7070503@intel.com>
On 25/09/2017 15:02, Wei Wang wrote:
> 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.
Sure. I was just thinking that it's unnecessary to actually use
VMX_MISC; sticking to one-page allocations is nicer.
Paolo
next prev parent reply other threads:[~2017-09-25 14:25 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
2017-09-25 14:24 ` Paolo Bonzini [this message]
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=f1a530e3-5d47-3402-ffd6-10a3c1906a68@redhat.com \
--to=pbonzini@redhat.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=rkrcmar@redhat.com \
--cc=virtualization@lists.linux-foundation.org \
--cc=wei.w.wang@intel.com \
/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
Powered by JetHome