From: Hao Xiang <hao.xiang@linux.alibaba.com>
To: Chao Gao <chao.gao@intel.com>
Cc: kvm@vger.kernel.org, shannon.zhao@linux.alibaba.com,
pbonzini@redhat.com, seanjc@google.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kvm: x86: emulate MSR_PLATFORM_INFO msr bits
Date: Mon, 21 Aug 2023 19:44:09 +0800 [thread overview]
Message-ID: <33f0e9bb-da79-6f32-f1c3-816eb37daea6@linux.alibaba.com> (raw)
In-Reply-To: <ZOM/8IVsRf3esyQ1@chao-email>
On 2023/8/21 18:44, Chao Gao wrote:
> On Mon, Aug 21, 2023 at 05:11:16PM +0800, Hao Xiang wrote:
>> For reason that,
>>
>> The turbo frequency info depends on specific machine type. And the msr value
>> of MSR_PLATFORM_INFO may be diferent on diffrent generation machine.
>>
>> Get following msr bits (needed by turbostat on intel platform) by rdmsr
>> MSR_PLATFORM_INFO directly in KVM is more reasonable. And set these msr bits
>> as vcpu->arch.msr_platform_info default value.
>> -bit 15:8, Maximum Non-Turbo Ratio (MAX_NON_TURBO_LIM_RATIO)
>> -bit 47:40, Maximum Efficiency Ratio (MAX_EFFICIENCY_RATIO)
>
> I don't get why QEMU cannot do this with the existing interface, e.g.,
> KVM_SET_MSRS.
>
> will the MSR value be migrated during VM migration?
>
> looks we are in a dilemma. on one side, if the value is migrated, the value can
> become inconsisntent with hardware value. On the other side, changing the ratio
> bits at runtime isn't the architectural behavior.
>
> And the MSR is per-socket. In theory, a system can have two sockets with
> different values of the MSR. what if a vCPU is created on a socket and then
> later runs on the other socket?
>
Set these msr bits (needed by turbostat on intel platform) in KVM by
default.
Of cource, QEMU can also set MSR value by need. It does not conflict.
>>
>> On 2023/8/21 15:52, Chao Gao wrote:
>>> On Mon, Aug 21, 2023 at 11:26:32AM +0800, Hao Xiang wrote:
>>>> For intel platform, The BzyMhz field of Turbostat shows zero
>>>> due to the missing of part msr bits of MSR_PLATFORM_INFO.
>>>>
>>>> Acquire necessary msr bits, and expose following msr info to guest,
>>>> to make sure guest can get correct turbo frequency info.
>>>
>>> Userspace VMM (e.g., QEMU) can configure this MSR for guests. Please refer to
>>> tools/testing/selftests/kvm/x86_64/platform_info_test.c.
>>>
>>> The question is why KVM needs this patch given KVM already provides interfaces
>>> for QEMU to configure the MSR.
next prev parent reply other threads:[~2023-08-21 11:44 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-21 3:26 Hao Xiang
2023-08-21 7:52 ` Chao Gao
2023-08-21 9:11 ` Hao Xiang
2023-08-21 10:44 ` Chao Gao
2023-08-21 11:44 ` Hao Xiang [this message]
2023-08-21 16:11 ` Sean Christopherson
2023-08-23 6:24 ` Xiaoyao Li
2023-08-23 14:31 ` Sean Christopherson
2023-08-25 3:27 ` Xiaoyao Li
-- strict thread matches above, loose matches on Subject: below --
2023-08-21 3:22 Hao Xiang
2023-08-22 16:50 ` kernel test robot
2023-08-23 0:26 ` kernel test robot
2023-08-23 3:41 ` Xiaoyao Li
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=33f0e9bb-da79-6f32-f1c3-816eb37daea6@linux.alibaba.com \
--to=hao.xiang@linux.alibaba.com \
--cc=chao.gao@intel.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=shannon.zhao@linux.alibaba.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
all inboxes | Powered by JetHome®