All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: x86: Pass host's CPUID.16H through to KVM_GET_SUPPORTED_CPUID
@ 2022-09-23 22:33 Jim Mattson
  2022-09-26 20:50 ` Sean Christopherson
  0 siblings, 1 reply; 3+ messages in thread
From: Jim Mattson @ 2022-09-23 22:33 UTC (permalink / raw)
  To: kvm, pbonzini, seanjc; +Cc: Jim Mattson

In the default configuration, the guest TSC frequency is the same as
the host TSC frequency. Similarly, the maximum frequency of the
virtual CPU is the same as the maximum frequency of the physical
CPU. Also, the bus (reference) frequency of the virtual CPU matches
that of the physical CPU.

Pass this information directly from host CPUID.16H to guest CPUID.16H
in KVM_GET_SUPPORTED_CPUID.

Signed-off-by: Jim Mattson <jmattson@google.com>
---
 arch/x86/kvm/cpuid.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
index 675eb9ae3948..1527f467d4f8 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -1043,6 +1043,9 @@ static inline int __do_cpuid_func(struct kvm_cpuid_array *array, u32 function)
 				goto out;
 		}
 		break;
+	/* Processor Frequency Information */
+	case 0x16:
+		break;
 	/* Intel AMX TILE */
 	case 0x1d:
 		if (!kvm_cpu_cap_has(X86_FEATURE_AMX_TILE)) {
-- 
2.37.3.998.g577e59143f-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] KVM: x86: Pass host's CPUID.16H through to KVM_GET_SUPPORTED_CPUID
  2022-09-23 22:33 [PATCH] KVM: x86: Pass host's CPUID.16H through to KVM_GET_SUPPORTED_CPUID Jim Mattson
@ 2022-09-26 20:50 ` Sean Christopherson
  2022-09-26 21:13   ` Jim Mattson
  0 siblings, 1 reply; 3+ messages in thread
From: Sean Christopherson @ 2022-09-26 20:50 UTC (permalink / raw)
  To: Jim Mattson; +Cc: kvm, pbonzini

On Fri, Sep 23, 2022, Jim Mattson wrote:
> In the default configuration, the guest TSC frequency is the same as
> the host TSC frequency. Similarly, the maximum frequency of the
> virtual CPU is the same as the maximum frequency of the physical
> CPU.

Under the hood, yes, but after the VM is migrated, isn't it possible that the
host frequencies are completely disjoint from the frequencies that are enumerated
to the guest?

> Also, the bus (reference) frequency of the virtual CPU matches
> that of the physical CPU.
> 
> Pass this information directly from host CPUID.16H to guest CPUID.16H
> in KVM_GET_SUPPORTED_CPUID.

What about "solving" this via documentation, same as CPUID.15H?  If the API were
KVM_GET_DEFAULT_CPUID, then enumerating host properties makes sense, but from a
very pedantic point of view, the "supported" frequencies are just about anything.

Somewhat of a moot point, as the leaf comes with "informational only" disclaimer.

  The returned information should not be used for any other purpose as the returned
  information does not accurately correlate to information / counters returned by
  other processor interfaces.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] KVM: x86: Pass host's CPUID.16H through to KVM_GET_SUPPORTED_CPUID
  2022-09-26 20:50 ` Sean Christopherson
@ 2022-09-26 21:13   ` Jim Mattson
  0 siblings, 0 replies; 3+ messages in thread
From: Jim Mattson @ 2022-09-26 21:13 UTC (permalink / raw)
  To: Sean Christopherson; +Cc: kvm, pbonzini

On Mon, Sep 26, 2022 at 1:50 PM Sean Christopherson <seanjc@google.com> wrote:
>
> On Fri, Sep 23, 2022, Jim Mattson wrote:
> > In the default configuration, the guest TSC frequency is the same as
> > the host TSC frequency. Similarly, the maximum frequency of the
> > virtual CPU is the same as the maximum frequency of the physical
> > CPU.
>
> Under the hood, yes, but after the VM is migrated, isn't it possible that the
> host frequencies are completely disjoint from the frequencies that are enumerated
> to the guest?
>
> > Also, the bus (reference) frequency of the virtual CPU matches
> > that of the physical CPU.
> >
> > Pass this information directly from host CPUID.16H to guest CPUID.16H
> > in KVM_GET_SUPPORTED_CPUID.
>
> What about "solving" this via documentation, same as CPUID.15H?  If the API were
> KVM_GET_DEFAULT_CPUID, then enumerating host properties makes sense, but from a
> very pedantic point of view, the "supported" frequencies are just about anything.

Fair enough. Userspace will just have to figure out how to populate
this leaf on its own (or leave it blank).

> Somewhat of a moot point, as the leaf comes with "informational only" disclaimer.
>
>   The returned information should not be used for any other purpose as the returned
>   information does not accurately correlate to information / counters returned by
>   other processor interfaces.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-09-26 21:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-23 22:33 [PATCH] KVM: x86: Pass host's CPUID.16H through to KVM_GET_SUPPORTED_CPUID Jim Mattson
2022-09-26 20:50 ` Sean Christopherson
2022-09-26 21:13   ` Jim Mattson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.