Re: [PATCH v2] x86/perf: Use RET0 as default for guest_get_msrs to handle "no PMU" case

2021-03-10 Thread Sean Christopherson
On Wed, Mar 10, 2021, Peter Zijlstra wrote: > On Tue, Mar 09, 2021 at 09:10:19AM -0800, Sean Christopherson wrote: > > > @@ -2024,9 +2021,6 @@ static int __init init_hw_perf_events(void) > > if (!x86_pmu.read) > > x86_pmu.read = _x86_pmu_read; > > > > - if

Re: [PATCH v2] x86/perf: Use RET0 as default for guest_get_msrs to handle "no PMU" case

2021-03-10 Thread Peter Zijlstra
On Tue, Mar 09, 2021 at 09:10:19AM -0800, Sean Christopherson wrote: > @@ -2024,9 +2021,6 @@ static int __init init_hw_perf_events(void) > if (!x86_pmu.read) > x86_pmu.read = _x86_pmu_read; > > - if (!x86_pmu.guest_get_msrs) > - x86_pmu.guest_get_msrs =

Re: [PATCH v2] x86/perf: Use RET0 as default for guest_get_msrs to handle "no PMU" case

2021-03-09 Thread Sean Christopherson
On Tue, Mar 09, 2021, Jim Mattson wrote: > On Tue, Mar 9, 2021 at 9:10 AM Sean Christopherson > wrote: > > diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c > > index 50810d471462..32cf8287d4a7 100644 > > --- a/arch/x86/kvm/vmx/vmx.c > > +++ b/arch/x86/kvm/vmx/vmx.c > > @@ -6580,8

Re: [PATCH v2] x86/perf: Use RET0 as default for guest_get_msrs to handle "no PMU" case

2021-03-09 Thread Jim Mattson
On Tue, Mar 9, 2021 at 9:10 AM Sean Christopherson wrote: > > Initialize x86_pmu.guest_get_msrs to return 0/NULL to handle the "nop" > case. Patching in perf_guest_get_msrs_nop() during setup does not work > if there is no PMU, as setup bails before updating the static calls, > leaving

[PATCH v2] x86/perf: Use RET0 as default for guest_get_msrs to handle "no PMU" case

2021-03-09 Thread Sean Christopherson
Initialize x86_pmu.guest_get_msrs to return 0/NULL to handle the "nop" case. Patching in perf_guest_get_msrs_nop() during setup does not work if there is no PMU, as setup bails before updating the static calls, leaving x86_pmu.guest_get_msrs NULL and thus a complete nop. Ultimately, this causes