Re: [PATCH v4 05/38] perf: Add generic exclude_guest support

2025-05-21 Thread Liang, Kan
On 2025-05-21 3:55 p.m., Namhyung Kim wrote: > On Mon, Mar 24, 2025 at 05:30:45PM +, Mingwei Zhang wrote: >> From: Kan Liang >> >> Only KVM knows the exact time when a guest is entering/exiting. Expose >> two interfaces to KVM to switch the ownership of the PMU resources. >> >> All the pinn

Re: [PATCH v4 05/38] perf: Add generic exclude_guest support

2025-05-21 Thread Namhyung Kim
On Mon, Mar 24, 2025 at 05:30:45PM +, Mingwei Zhang wrote: > From: Kan Liang > > Only KVM knows the exact time when a guest is entering/exiting. Expose > two interfaces to KVM to switch the ownership of the PMU resources. > > All the pinned events must be scheduled in first. Extend the > per

Re: [PATCH v4 05/38] perf: Add generic exclude_guest support

2025-05-15 Thread Liang, Kan
On 2025-05-15 3:25 p.m., Sean Christopherson wrote: > On Thu, May 15, 2025, Kan Liang wrote: >> On 2025-05-14 7:19 p.m., Sean Christopherson wrote: This naming is confusing on purpose? Pick either guest/host and stick with it. >>> >>> +1. I also think the inner perf_host_{enter,exit}(

Re: [PATCH v4 05/38] perf: Add generic exclude_guest support

2025-05-15 Thread Sean Christopherson
On Thu, May 15, 2025, Kan Liang wrote: > On 2025-05-14 7:19 p.m., Sean Christopherson wrote: > >> This naming is confusing on purpose? Pick either guest/host and stick > >> with it. > > > > +1. I also think the inner perf_host_{enter,exit}() helpers are superflous. > > These flows > > > > After

Re: [PATCH v4 05/38] perf: Add generic exclude_guest support

2025-05-15 Thread Liang, Kan
On 2025-05-14 7:19 p.m., Sean Christopherson wrote: > On Fri, Apr 25, 2025, Peter Zijlstra wrote: >> On Mon, Mar 24, 2025 at 05:30:45PM +, Mingwei Zhang wrote: >> >>> @@ -6040,6 +6041,71 @@ void perf_put_mediated_pmu(void) >>> } >>> EXPORT_SYMBOL_GPL(perf_put_mediated_pmu); >>> >>> +stat

Re: [PATCH v4 05/38] perf: Add generic exclude_guest support

2025-05-14 Thread Mi, Dapeng
On 5/15/2025 7:19 AM, Sean Christopherson wrote: > On Fri, Apr 25, 2025, Peter Zijlstra wrote: >> On Mon, Mar 24, 2025 at 05:30:45PM +, Mingwei Zhang wrote: >> >>> @@ -6040,6 +6041,71 @@ void perf_put_mediated_pmu(void) >>> } >>> EXPORT_SYMBOL_GPL(perf_put_mediated_pmu); >>> >>> +static i

Re: [PATCH v4 05/38] perf: Add generic exclude_guest support

2025-05-14 Thread Sean Christopherson
On Fri, Apr 25, 2025, Peter Zijlstra wrote: > On Mon, Mar 24, 2025 at 05:30:45PM +, Mingwei Zhang wrote: > > > @@ -6040,6 +6041,71 @@ void perf_put_mediated_pmu(void) > > } > > EXPORT_SYMBOL_GPL(perf_put_mediated_pmu); > > > > +static inline void perf_host_exit(struct perf_cpu_context *cpu

Re: [PATCH v4 05/38] perf: Add generic exclude_guest support

2025-04-25 Thread Peter Zijlstra
On Mon, Mar 24, 2025 at 05:30:45PM +, Mingwei Zhang wrote: > @@ -6040,6 +6041,71 @@ void perf_put_mediated_pmu(void) > } > EXPORT_SYMBOL_GPL(perf_put_mediated_pmu); > > +static inline void perf_host_exit(struct perf_cpu_context *cpuctx) > +{ > + perf_ctx_disable(&cpuctx->ctx, EVENT_GUE

[PATCH v4 05/38] perf: Add generic exclude_guest support

2025-03-24 Thread Mingwei Zhang
From: Kan Liang Only KVM knows the exact time when a guest is entering/exiting. Expose two interfaces to KVM to switch the ownership of the PMU resources. All the pinned events must be scheduled in first. Extend the perf_event_sched_in() helper to support extra flag, e.g., EVENT_GUEST. Signed-o