On 8/13/24 00:48, Rick Edgecombe wrote:
From: Isaku Yamahata<isaku.yamahata@xxxxxxxxx>
Because TDX KVM doesn't support PMU yet (it's future work of TDX KVM
support as another patch series) and pmu_intel.c touches vmx specific
structure in vcpu initialization, as workaround add dummy structure to
struct vcpu_tdx and pmu_intel.c can ignore TDX case.
Signed-off-by: Isaku Yamahata<isaku.yamahata@xxxxxxxxx>
Signed-off-by: Rick Edgecombe<rick.p.edgecombe@xxxxxxxxx>
Would be nicer not to have this dummy member at all if possible.
Could vcpu_to_lbr_desc() return NULL, and then lbr_desc can be checked
in intel_pmu_init() and intel_pmu_refresh()? Then the checks for
is_td_vcpu(vcpu), both inside WARN_ON_ONCE() and outside, can also be
changed to check NULL-ness of vcpu_to_lbr_desc().
Also please add a WARN_ON_ONCE(is_td_vcpu(vcpu)), or
WARN_ON_ONCE(!lbr_desc) given the above suggestion, to return early from
vmx_passthrough_lbr_msrs().
Thanks,
Paolo