2015-05-19 00:01:01

by Thomas Gleixner

[permalink] [raw]
Subject: [patch 4/6] x86, perf, cqm: Avoid pointless msr write

If the usage counter is non-zero there is no point to update the rmid
in the PQR MSR.

Signed-off-by: Thomas Gleixner <[email protected]>
---
arch/x86/kernel/cpu/perf_event_intel_cqm.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)

Index: linux/arch/x86/kernel/cpu/perf_event_intel_cqm.c
===================================================================
--- linux.orig/arch/x86/kernel/cpu/perf_event_intel_cqm.c
+++ linux/arch/x86/kernel/cpu/perf_event_intel_cqm.c
@@ -974,10 +974,12 @@ static void intel_cqm_event_start(struct

event->hw.cqm_state &= ~PERF_HES_STOPPED;

- if (state->cnt++)
- WARN_ON_ONCE(state->rmid != rmid);
- else
+ if (state->cnt++) {
+ if (!WARN_ON_ONCE(state->rmid != rmid))
+ return;
+ } else {
WARN_ON_ONCE(state->rmid);
+ }

state->rmid = rmid;
/*


2015-05-19 09:18:06

by Matt Fleming

[permalink] [raw]
Subject: Re: [patch 4/6] x86, perf, cqm: Avoid pointless msr write

On Tue, 19 May, at 12:00:55AM, Thomas Gleixner wrote:
> If the usage counter is non-zero there is no point to update the rmid
> in the PQR MSR.
>
> Signed-off-by: Thomas Gleixner <[email protected]>
> ---
> arch/x86/kernel/cpu/perf_event_intel_cqm.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)

Good catch.

Acked-by: Matt Fleming <[email protected]>

--
Matt Fleming, Intel Open Source Technology Center