Re: [PATCH] x86/perf: Fix guest_get_msrs static call if there is no PMU

2021-03-09 Thread Dmitry Vyukov
On Tue, Mar 9, 2021 at 6:05 PM Sean Christopherson wrote: > > On Tue, Mar 09, 2021, Peter Zijlstra wrote: > > On Tue, Mar 09, 2021 at 08:46:49AM +0100, Peter Zijlstra wrote: > > > On Mon, Mar 08, 2021 at 12:40:44PM -0800, Sean Christopherson wrote: > > > > On Mon, Mar 08, 2021, Peter Zijlstra wrot

Re: [PATCH] x86/perf: Fix guest_get_msrs static call if there is no PMU

2021-03-09 Thread Sean Christopherson
On Tue, Mar 09, 2021, Peter Zijlstra wrote: > On Tue, Mar 09, 2021 at 08:46:49AM +0100, Peter Zijlstra wrote: > > On Mon, Mar 08, 2021 at 12:40:44PM -0800, Sean Christopherson wrote: > > > On Mon, Mar 08, 2021, Peter Zijlstra wrote: > > > > > > Given the one user in atomic_switch_perf_msrs() that

Re: [PATCH] x86/perf: Fix guest_get_msrs static call if there is no PMU

2021-03-09 Thread Peter Zijlstra
On Tue, Mar 09, 2021 at 08:46:49AM +0100, Peter Zijlstra wrote: > On Mon, Mar 08, 2021 at 12:40:44PM -0800, Sean Christopherson wrote: > > On Mon, Mar 08, 2021, Peter Zijlstra wrote: > > > > Given the one user in atomic_switch_perf_msrs() that should work because > > > it doesn't seem to care abou

Re: [PATCH] x86/perf: Fix guest_get_msrs static call if there is no PMU

2021-03-08 Thread Peter Zijlstra
On Mon, Mar 08, 2021 at 12:40:44PM -0800, Sean Christopherson wrote: > On Mon, Mar 08, 2021, Peter Zijlstra wrote: > > Given the one user in atomic_switch_perf_msrs() that should work because > > it doesn't seem to care about nr_msrs when !msrs. > > Uh, that commit quite cleary says: D0h! I got

Re: [PATCH] x86/perf: Fix guest_get_msrs static call if there is no PMU

2021-03-08 Thread Sean Christopherson
On Mon, Mar 08, 2021, Peter Zijlstra wrote: > On Mon, Mar 08, 2021 at 10:25:59AM +0800, Xu, Like wrote: > > On 2021/3/6 6:33, Sean Christopherson wrote: > > > Handle a NULL x86_pmu.guest_get_msrs at invocation instead of patching > > > in perf_guest_get_msrs_nop() during setup. If there is no PMU,

Re: [PATCH] x86/perf: Fix guest_get_msrs static call if there is no PMU

2021-03-08 Thread Xu, Like
On 2021/3/8 16:53, Peter Zijlstra wrote: Still, it calling atomic_switch_perf_msrs() and intel_pmu_lbr_is_enabled() when there isn't a PMU at all is of course, a complete waste of cycles. This suggestion is reminiscent of a sad regression of optimizing it: https://lore.kernel.org/kvm/202006190

Re: [PATCH] x86/perf: Fix guest_get_msrs static call if there is no PMU

2021-03-08 Thread Peter Zijlstra
On Mon, Mar 08, 2021 at 10:25:59AM +0800, Xu, Like wrote: > On 2021/3/6 6:33, Sean Christopherson wrote: > > Handle a NULL x86_pmu.guest_get_msrs at invocation instead of patching > > in perf_guest_get_msrs_nop() during setup. If there is no PMU, setup > > "If there is no PMU" ... Then you shoul

Re: [PATCH] x86/perf: Fix guest_get_msrs static call if there is no PMU

2021-03-08 Thread Dmitry Vyukov
On Mon, Mar 8, 2021 at 9:35 AM Like Xu wrote: > > On 2021/3/8 15:12, Dmitry Vyukov wrote: > > On Mon, Mar 8, 2021 at 3:26 AM Xu, Like wrote: > >> > >> On 2021/3/6 6:33, Sean Christopherson wrote: > >>> Handle a NULL x86_pmu.guest_get_msrs at invocation instead of patching > >>> in perf_guest_get_

Re: [PATCH] x86/perf: Fix guest_get_msrs static call if there is no PMU

2021-03-08 Thread Like Xu
On 2021/3/8 15:12, Dmitry Vyukov wrote: On Mon, Mar 8, 2021 at 3:26 AM Xu, Like wrote: On 2021/3/6 6:33, Sean Christopherson wrote: Handle a NULL x86_pmu.guest_get_msrs at invocation instead of patching in perf_guest_get_msrs_nop() during setup. If there is no PMU, setup "If there is no PM

Re: [PATCH] x86/perf: Fix guest_get_msrs static call if there is no PMU

2021-03-07 Thread Dmitry Vyukov
On Mon, Mar 8, 2021 at 3:26 AM Xu, Like wrote: > > On 2021/3/6 6:33, Sean Christopherson wrote: > > Handle a NULL x86_pmu.guest_get_msrs at invocation instead of patching > > in perf_guest_get_msrs_nop() during setup. If there is no PMU, setup > > "If there is no PMU" ... > > How to set up this k

Re: [PATCH] x86/perf: Fix guest_get_msrs static call if there is no PMU

2021-03-07 Thread Xu, Like
On 2021/3/6 6:33, Sean Christopherson wrote: Handle a NULL x86_pmu.guest_get_msrs at invocation instead of patching in perf_guest_get_msrs_nop() during setup. If there is no PMU, setup "If there is no PMU" ... How to set up this kind of environment, and what changes are needed in .config or b

[PATCH] x86/perf: Fix guest_get_msrs static call if there is no PMU

2021-03-05 Thread Sean Christopherson
Handle a NULL x86_pmu.guest_get_msrs at invocation instead of patching in perf_guest_get_msrs_nop() during setup. If there is no PMU, setup bails before updating the static calls, leaving x86_pmu.guest_get_msrs NULL and thus a complete nop. Ultimately, this causes VMX abort on VM-Exit due to KVM