Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1385544 > unrolled thread

[PATCH V1 0/4] Urgent fixes for Intel CQM/MBM counting

Started byVikas Shivappa <vikas.shivappa@linux.intel.com>
First post2016-04-23 02:30 +0200
Last post2016-04-25 18:30 +0200
Articles 9 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH V1 0/4] Urgent fixes for Intel CQM/MBM counting  Vikas Shivappa <vikas.shivappa@linux.intel.com> - 2016-04-23 02:30 +0200
    [PATCH 2/4] perf/x86/mbm: Store bytes counted for mbm during recycle Vikas Shivappa <vikas.shivappa@linux.intel.com> - 2016-04-23 02:30 +0200
      Re: [PATCH 2/4] perf/x86/mbm: Store bytes counted for mbm during  recycle Peter Zijlstra <peterz@infradead.org> - 2016-04-25 11:20 +0200
        Re: [PATCH 2/4] perf/x86/mbm: Store bytes counted for mbm during  recycle Vikas Shivappa <vikas.shivappa@intel.com> - 2016-04-25 20:10 +0200
          Re: [PATCH 2/4] perf/x86/mbm: Store bytes counted for mbm during  recycle Peter Zijlstra <peterz@infradead.org> - 2016-04-25 22:10 +0200
            Re: [PATCH 2/4] perf/x86/mbm: Store bytes counted for mbm during  recycle Vikas Shivappa <vikas.shivappa@intel.com> - 2016-04-25 23:20 +0200
    [PATCH 1/4] perf/x86/cqm,mbm: Store cqm,mbm count for all events when RMID is recycled Vikas Shivappa <vikas.shivappa@linux.intel.com> - 2016-04-23 02:30 +0200
      Re: [PATCH 1/4] perf/x86/cqm,mbm: Store cqm,mbm count for all events  when RMID is recycled Peter Zijlstra <peterz@infradead.org> - 2016-04-25 11:30 +0200
        Re: [PATCH 1/4] perf/x86/cqm,mbm: Store cqm,mbm count for all events  when RMID is recycled Vikas Shivappa <vikas.shivappa@intel.com> - 2016-04-25 18:30 +0200

#1385544 — [PATCH V1 0/4] Urgent fixes for Intel CQM/MBM counting

FromVikas Shivappa <vikas.shivappa@linux.intel.com>
Date2016-04-23 02:30 +0200
Subject[PATCH V1 0/4] Urgent fixes for Intel CQM/MBM counting
Message-ID<rqTCp-2k1-3@gated-at.bofh.it>
Sending some urgent fixes for the MBM(memory b/w monitoring) which is
upstreamed from 4.6-rc1. Patches apply on 4.6-rc1.

CQM and MBM counters reported some incorrect counts for different
scenarios like interval mode or for multiple perf instances. The
1/4,2/4,3/4 address these issues.

The last patch changes the cqm driver to only support task events as
support for cgroup event was broken - Just reporting a 'not-supported'
error to perf instead of pretending to support and send incorrect counts.

[PATCH 1/4] perf/x86/cqm,mbm: Store cqm,mbm count for all events when
[PATCH 2/4] perf/x86/mbm: Store bytes counted for mbm during recycle
[PATCH 3/4] perf/x86/mbm: Fix mbm counting when RMIDs are reused
[PATCH 4/4] perf/x86/cqm: Support cqm/mbm only for perf events

[toc] | [next] | [standalone]


#1385545 — [PATCH 2/4] perf/x86/mbm: Store bytes counted for mbm during recycle

FromVikas Shivappa <vikas.shivappa@linux.intel.com>
Date2016-04-23 02:30 +0200
Subject[PATCH 2/4] perf/x86/mbm: Store bytes counted for mbm during recycle
Message-ID<rqTCq-2k1-9@gated-at.bofh.it>
In reply to#1385544
For MBM, since we report total bytes for the duration the perf counts,
we need to keep the total bytes counted every time we loose an RMID.
Introduce rc_count(recycle count) per event
keep this history count(all bytes counted before the current RMID).

If we do not keep this count separately then we may end up sending a
count that may be less than the previous count during -I perf stat
option which leads to negative numbers being reported in the perf. This
happens say when we counted a greater amount with RMID1 and then
counted lesser with RMID2, and if user checks counts in interval mode
after RMID1 and then again after RMID2.

Signed-off-by: Vikas Shivappa <vikas.shivappa@linux.intel.com>
---
 arch/x86/events/intel/cqm.c | 40 +++++++++++++++++++++++++++++++++++++---
 include/linux/perf_event.h  |  1 +
 2 files changed, 38 insertions(+), 3 deletions(-)

diff --git a/arch/x86/events/intel/cqm.c b/arch/x86/events/intel/cqm.c
index 8dfba39..e679c39 100644
--- a/arch/x86/events/intel/cqm.c
+++ b/arch/x86/events/intel/cqm.c
@@ -479,6 +479,16 @@ static void cqm_mask_call(struct rmid_read *rr)
 		on_each_cpu_mask(&cqm_cpumask, __intel_cqm_event_count, rr, 1);
 }
 
+static inline void mbm_set_rccount(
+			  struct perf_event *event, struct rmid_read *rr)
+{
+	u64 tmpval;
+
+	tmpval = local64_read(&event->hw.rc_count) + atomic64_read(&rr->value);
+	local64_set(&event->hw.rc_count, tmpval);
+	local64_set(&event->count, tmpval);
+}
+
 /*
  * Exchange the RMID of a group of events.
  */
@@ -493,12 +503,19 @@ static u32 intel_cqm_xchg_rmid(struct perf_event *group, u32 rmid)
 
 	/*
 	 * If our RMID is being deallocated, perform a read now.
+	 * For mbm, we need to store the bytes that were counted till now
+	 * separately.
 	 */
 	if (__rmid_valid(old_rmid) && !__rmid_valid(rmid)) {
 
 		rr = __init_rr(old_rmid, group->attr.config, 0);
 		cqm_mask_call(&rr);
-		local64_set(&group->count, atomic64_read(&rr.value));
+
+		if (is_mbm_event(group->attr.config))
+			mbm_set_rccount(group, &rr);
+		else
+			local64_set(&group->count, atomic64_read(&rr.value));
+
 		list_for_each_entry(event, head, hw.cqm_group_entry) {
 			if (event->hw.is_group_event) {
 
@@ -506,6 +523,9 @@ static u32 intel_cqm_xchg_rmid(struct perf_event *group, u32 rmid)
 				rr = __init_rr(old_rmid, evttype, 0);
 
 				cqm_mask_call(&rr);
+				if (is_mbm_event(event->attr.config))
+					mbm_set_rccount(event, &rr);
+				else
 					local64_set(&event->count,
 						    atomic64_read(&rr.value));
 			}
@@ -1194,6 +1214,7 @@ static u64 intel_cqm_event_count(struct perf_event *event)
 {
 	unsigned long flags;
 	struct rmid_read rr = __init_rr(-1, event->attr.config, 0);
+	u64 tmpval;
 
 	/*
 	 * We only need to worry about task events. System-wide events
@@ -1235,6 +1256,11 @@ static u64 intel_cqm_event_count(struct perf_event *event)
 	 * busying performing the IPI calls. It's therefore necessary to
 	 * check @event's RMID afterwards, and if it has changed,
 	 * discard the result of the read.
+	 *
+	 * For MBM events, we are reading the total bytes and not
+	 * a snapshot. Hence if the RMID was recycled for the duration
+	 * we will be adding the rc_count which keeps the historical count
+	 * of old RMIDs that were used.
 	 */
 	rr.rmid = ACCESS_ONCE(event->hw.cqm_rmid);
 
@@ -1244,8 +1270,16 @@ static u64 intel_cqm_event_count(struct perf_event *event)
 	cqm_mask_call(&rr);
 
 	raw_spin_lock_irqsave(&cache_lock, flags);
-	if (event->hw.cqm_rmid == rr.rmid)
-		local64_set(&event->count, atomic64_read(&rr.value));
+	if (event->hw.cqm_rmid == rr.rmid) {
+		if (is_mbm_event(event->attr.config)) {
+			tmpval = atomic64_read(&rr.value) +
+				local64_read(&event->hw.rc_count);
+
+			local64_set(&event->count, tmpval);
+		} else {
+			local64_set(&event->count, atomic64_read(&rr.value));
+		}
+	}
 	raw_spin_unlock_irqrestore(&cache_lock, flags);
 out:
 	return __perf_event_count(event);
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index f291275..ec7772a 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -122,6 +122,7 @@ struct hw_perf_event {
 			int			cqm_state;
 			u32			cqm_rmid;
 			int			is_group_event;
+			local64_t		rc_count;
 			struct list_head	cqm_events_entry;
 			struct list_head	cqm_groups_entry;
 			struct list_head	cqm_group_entry;
-- 
1.9.1

[toc] | [prev] | [next] | [standalone]


#1386161 — Re: [PATCH 2/4] perf/x86/mbm: Store bytes counted for mbm during recycle

FromPeter Zijlstra <peterz@infradead.org>
Date2016-04-25 11:20 +0200
SubjectRe: [PATCH 2/4] perf/x86/mbm: Store bytes counted for mbm during recycle
Message-ID<rrKQq-3ck-37@gated-at.bofh.it>
In reply to#1385545
On Fri, Apr 22, 2016 at 05:27:19PM -0700, Vikas Shivappa wrote:
> +static inline void mbm_set_rccount(
> +			  struct perf_event *event, struct rmid_read *rr)

That's horrible style, the 'normal' style is something like:

static inline
void mbm_set_rccount(struct perf_event *event, struct rmid_read *rr)
{
}

> @@ -1244,8 +1270,16 @@ static u64 intel_cqm_event_count(struct perf_event *event)
>  	cqm_mask_call(&rr);
>  
>  	raw_spin_lock_irqsave(&cache_lock, flags);
> -	if (event->hw.cqm_rmid == rr.rmid)
> -		local64_set(&event->count, atomic64_read(&rr.value));
> +	if (event->hw.cqm_rmid == rr.rmid) {
> +		if (is_mbm_event(event->attr.config)) {
> +			tmpval = atomic64_read(&rr.value) +
> +				local64_read(&event->hw.rc_count);
> +
> +			local64_set(&event->count, tmpval);
> +		} else {
> +			local64_set(&event->count, atomic64_read(&rr.value));
> +		}
> +	}
>  	raw_spin_unlock_irqrestore(&cache_lock, flags);
>  out:
>  	return __perf_event_count(event);

This is a 'creative' solution; why don't you do the normal thing, which
is:

start:
	prev_count = read_hw_counter();

read:
	do {
		prev = prev_count;
		cur_val = read_hw_counter();
		delta = cur_val - prev;
	} while (local_cmpxchg(&prev_count, prev, cur_val) != prev);
	count += delta;

[toc] | [prev] | [next] | [standalone]


#1386727 — Re: [PATCH 2/4] perf/x86/mbm: Store bytes counted for mbm during recycle

FromVikas Shivappa <vikas.shivappa@intel.com>
Date2016-04-25 20:10 +0200
SubjectRe: [PATCH 2/4] perf/x86/mbm: Store bytes counted for mbm during recycle
Message-ID<rrT7k-1Nh-13@gated-at.bofh.it>
In reply to#1386161

On Mon, 25 Apr 2016, Peter Zijlstra wrote:

> On Fri, Apr 22, 2016 at 05:27:19PM -0700, Vikas Shivappa wrote:
>> +static inline void mbm_set_rccount(
>> +			  struct perf_event *event, struct rmid_read *rr)
>
> That's horrible style, the 'normal' style is something like:
>
> static inline
> void mbm_set_rccount(struct perf_event *event, struct rmid_read *rr)
> {
> }

Will fix.. Thanks for pointing out.

>
>> @@ -1244,8 +1270,16 @@ static u64 intel_cqm_event_count(struct perf_event *event)
>>  	cqm_mask_call(&rr);
>>
>>  	raw_spin_lock_irqsave(&cache_lock, flags);
>> -	if (event->hw.cqm_rmid == rr.rmid)
>> -		local64_set(&event->count, atomic64_read(&rr.value));
>> +	if (event->hw.cqm_rmid == rr.rmid) {
>> +		if (is_mbm_event(event->attr.config)) {
>> +			tmpval = atomic64_read(&rr.value) +
>> +				local64_read(&event->hw.rc_count);
>> +
>> +			local64_set(&event->count, tmpval);
>> +		} else {
>> +			local64_set(&event->count, atomic64_read(&rr.value));
>> +		}
>> +	}
>>  	raw_spin_unlock_irqrestore(&cache_lock, flags);
>>  out:
>>  	return __perf_event_count(event);
>
> This is a 'creative' solution; why don't you do the normal thing, which
> is:
>
> start:
> 	prev_count = read_hw_counter();
>
> read:
> 	do {
> 		prev = prev_count;
> 		cur_val = read_hw_counter();
> 		delta = cur_val - prev;
> 	} while (local_cmpxchg(&prev_count, prev, cur_val) != prev);
> 	count += delta;


I may need to update the comment.

rc_count stores the total bytes for RMIDs that were used for this 
event except for the count of current RMID.
Say an event used RMID(1) .. RMID(k) from init to read and it had 
RMID(k) when read was called, the rc_count stores the values read 
from RMID1 .. RMID(k-1).

For MBM the patch is trying to do:
count
= total_bytes of RMID(1) 
+ ... +total_bytes of RMID(k-1) + total_bytes of RMID(k))
= rc_count + total_bytes of RMID(k).

1. event1 init. rc_count = 0. event1 gets RMID1.
2. event1 loses RMID1 due to recycling. Current total_bytes for RMID1 is 50MB.
3. rc_count += 50MB.
4. event1 gets RMID2. total_bytes for RMID2 is set to zero.. basically do the 
prev_count = read_hw_counter()..
5. event1 loses RMID2 due to recycling. Current total_bytes for RMID2 30MB.
6. rc_count += 30MB.
7. event1 gets RMID3..
8. event1 read is called. total_bytes is 10MB (read from RMID3)..
9. count = rc_count(80MB) + 10MB (read from RMID3..)

Thanks,
Vikas

>
>
>

[toc] | [prev] | [next] | [standalone]


#1386813 — Re: [PATCH 2/4] perf/x86/mbm: Store bytes counted for mbm during recycle

FromPeter Zijlstra <peterz@infradead.org>
Date2016-04-25 22:10 +0200
SubjectRe: [PATCH 2/4] perf/x86/mbm: Store bytes counted for mbm during recycle
Message-ID<rrUZs-3iQ-23@gated-at.bofh.it>
In reply to#1386727
On Mon, Apr 25, 2016 at 11:04:38AM -0700, Vikas Shivappa wrote:
> >This is a 'creative' solution; why don't you do the normal thing, which
> >is:
> >
> >start:
> >	prev_count = read_hw_counter();
> >
> >read:
> >	do {
> >		prev = prev_count;
> >		cur_val = read_hw_counter();
> >		delta = cur_val - prev;
> >	} while (local_cmpxchg(&prev_count, prev, cur_val) != prev);
> >	count += delta;
> 
> 
> I may need to update the comment.
> 
> rc_count stores the total bytes for RMIDs that were used for this event
> except for the count of current RMID.

Yeah, I got that, eventually.

> Say an event used RMID(1) .. RMID(k) from init to read and it had RMID(k)
> when read was called, the rc_count stores the values read from RMID1 ..
> RMID(k-1).
> 
> For MBM the patch is trying to do:
> count
> = total_bytes of RMID(1) + ... +total_bytes of RMID(k-1) + total_bytes of
> RMID(k))
> = rc_count + total_bytes of RMID(k).

How is the regular counting scheme as outlined above not dealing with
this properly?

[toc] | [prev] | [next] | [standalone]


#1386901 — Re: [PATCH 2/4] perf/x86/mbm: Store bytes counted for mbm during recycle

FromVikas Shivappa <vikas.shivappa@intel.com>
Date2016-04-25 23:20 +0200
SubjectRe: [PATCH 2/4] perf/x86/mbm: Store bytes counted for mbm during recycle
Message-ID<rrW5c-44b-21@gated-at.bofh.it>
In reply to#1386813

On Mon, 25 Apr 2016, Peter Zijlstra wrote:

> On Mon, Apr 25, 2016 at 11:04:38AM -0700, Vikas Shivappa wrote:
>>> This is a 'creative' solution; why don't you do the normal thing, which
>>> is:
>>>
>>> start:
>>> 	prev_count = read_hw_counter();
>>>
>>> read:
>>> 	do {
>>> 		prev = prev_count;
>>> 		cur_val = read_hw_counter();
>>> 		delta = cur_val - prev;
>>> 	} while (local_cmpxchg(&prev_count, prev, cur_val) != prev);
>>> 	count += delta;
>>
>>
>> I may need to update the comment.
>>
>> rc_count stores the total bytes for RMIDs that were used for this event
>> except for the count of current RMID.
>
> Yeah, I got that, eventually.
>
>> Say an event used RMID(1) .. RMID(k) from init to read and it had RMID(k)
>> when read was called, the rc_count stores the values read from RMID1 ..
>> RMID(k-1).
>>
>> For MBM the patch is trying to do:
>> count
>> = total_bytes of RMID(1) + ... +total_bytes of RMID(k-1) + total_bytes of
>> RMID(k))
>> = rc_count + total_bytes of RMID(k).
>
> How is the regular counting scheme as outlined above not dealing with
> this properly?
>
>

By regular if you mean the current upstream code
local64_set(&event->count, atomic64_read(&rr.value));

then note that the rr.value is just the current RMIDs total_bytes, then we loose 
the old values. So if RMID(1) counted 100MB , then RMID(2) counted 10MB and 
there was a read(which is actually count call for cqm) call after RMID(2) then 
it returns 10MB and not 100MB which is the real total_bytes..

if you mean the below -

>
> start:
>       prev_count = read_hw_counter();

I am assuming this means we keep the prev_count when event is initialized. This 
is done in the mbm_init which calls update_sample with first parameter set to 
true..



>
> read:
>       do {
>               prev = prev_count;
>               cur_val = read_hw_counter();
>               delta = cur_val - prev;
>       } while (local_cmpxchg(&prev_count, prev, cur_val) != prev);
>       count += delta;

the update_sample does the work to compute the delta and add the delta to 
total_bytes..  it has all the code except for the while loop.

So we miss the counter values of RMIDs which may 
be used by somebody else now.. they are stored during recycling just 
before we loose the RMID.
If you are tyring to count multiple RMIDs(that were used by the event) with the 
while loop(?) thats something we do but its done in the xchng when we loose the 
RMID.. as those counts are probably not there in those respective RMIDs anymore.

[toc] | [prev] | [next] | [standalone]


#1385546 — [PATCH 1/4] perf/x86/cqm,mbm: Store cqm,mbm count for all events when RMID is recycled

FromVikas Shivappa <vikas.shivappa@linux.intel.com>
Date2016-04-23 02:30 +0200
Subject[PATCH 1/4] perf/x86/cqm,mbm: Store cqm,mbm count for all events when RMID is recycled
Message-ID<rqTCq-2k1-11@gated-at.bofh.it>
In reply to#1385544
During RMID recycling, when an event loses the RMID we saved the counter
for group leader but it was not being saved for all the events in an
event group. This would lead to a situation where if 2 perf instances
are counting the same PID one of them would not see the updated count
which other perf instance is seeing. This patch tries to fix the issue
by saving the count for all the events in the same event group.

Signed-off-by: Vikas Shivappa <vikas.shivappa@linux.intel.com>
---
 arch/x86/events/intel/cqm.c | 39 ++++++++++++++++++++++++---------------
 1 file changed, 24 insertions(+), 15 deletions(-)

diff --git a/arch/x86/events/intel/cqm.c b/arch/x86/events/intel/cqm.c
index 7b5fd81..8dfba39 100644
--- a/arch/x86/events/intel/cqm.c
+++ b/arch/x86/events/intel/cqm.c
@@ -14,6 +14,14 @@
 #define MSR_IA32_QM_EVTSEL	0x0c8d
 
 #define MBM_CNTR_WIDTH		24
+
+#define __init_rr(old_rmid, config, val)	\
+((struct rmid_read) {				\
+	.rmid = old_rmid,			\
+	.evt_type = config,			\
+	.value = ATOMIC64_INIT(val),		\
+})
+
 /*
  * Guaranteed time in ms as per SDM where MBM counters will not overflow.
  */
@@ -478,7 +486,8 @@ static u32 intel_cqm_xchg_rmid(struct perf_event *group, u32 rmid)
 {
 	struct perf_event *event;
 	struct list_head *head = &group->hw.cqm_group_entry;
-	u32 old_rmid = group->hw.cqm_rmid;
+	u32 old_rmid = group->hw.cqm_rmid, evttype;
+	struct rmid_read rr;
 
 	lockdep_assert_held(&cache_mutex);
 
@@ -486,14 +495,21 @@ static u32 intel_cqm_xchg_rmid(struct perf_event *group, u32 rmid)
 	 * If our RMID is being deallocated, perform a read now.
 	 */
 	if (__rmid_valid(old_rmid) && !__rmid_valid(rmid)) {
-		struct rmid_read rr = {
-			.rmid = old_rmid,
-			.evt_type = group->attr.config,
-			.value = ATOMIC64_INIT(0),
-		};
 
+		rr = __init_rr(old_rmid, group->attr.config, 0);
 		cqm_mask_call(&rr);
 		local64_set(&group->count, atomic64_read(&rr.value));
+		list_for_each_entry(event, head, hw.cqm_group_entry) {
+			if (event->hw.is_group_event) {
+
+				evttype = event->attr.config;
+				rr = __init_rr(old_rmid, evttype, 0);
+
+				cqm_mask_call(&rr);
+					local64_set(&event->count,
+						    atomic64_read(&rr.value));
+			}
+		}
 	}
 
 	raw_spin_lock_irq(&cache_lock);
@@ -983,11 +999,7 @@ static void __intel_mbm_event_init(void *info)
 
 static void init_mbm_sample(u32 rmid, u32 evt_type)
 {
-	struct rmid_read rr = {
-		.rmid = rmid,
-		.evt_type = evt_type,
-		.value = ATOMIC64_INIT(0),
-	};
+	struct rmid_read rr = __init_rr(rmid, evt_type, 0);
 
 	/* on each socket, init sample */
 	on_each_cpu_mask(&cqm_cpumask, __intel_mbm_event_init, &rr, 1);
@@ -1181,10 +1193,7 @@ static void mbm_hrtimer_init(void)
 static u64 intel_cqm_event_count(struct perf_event *event)
 {
 	unsigned long flags;
-	struct rmid_read rr = {
-		.evt_type = event->attr.config,
-		.value = ATOMIC64_INIT(0),
-	};
+	struct rmid_read rr = __init_rr(-1, event->attr.config, 0);
 
 	/*
 	 * We only need to worry about task events. System-wide events
-- 
1.9.1

[toc] | [prev] | [next] | [standalone]


#1386170 — Re: [PATCH 1/4] perf/x86/cqm,mbm: Store cqm,mbm count for all events when RMID is recycled

FromPeter Zijlstra <peterz@infradead.org>
Date2016-04-25 11:30 +0200
SubjectRe: [PATCH 1/4] perf/x86/cqm,mbm: Store cqm,mbm count for all events when RMID is recycled
Message-ID<rrL06-3oi-31@gated-at.bofh.it>
In reply to#1385546
On Fri, Apr 22, 2016 at 05:27:18PM -0700, Vikas Shivappa wrote:
> During RMID recycling, when an event loses the RMID we saved the counter
> for group leader but it was not being saved for all the events in an
> event group. This would lead to a situation where if 2 perf instances
> are counting the same PID one of them would not see the updated count
> which other perf instance is seeing. This patch tries to fix the issue
> by saving the count for all the events in the same event group.


> @@ -486,14 +495,21 @@ static u32 intel_cqm_xchg_rmid(struct perf_event *group, u32 rmid)
>  	 * If our RMID is being deallocated, perform a read now.
>  	 */
>  	if (__rmid_valid(old_rmid) && !__rmid_valid(rmid)) {
>  
> +		rr = __init_rr(old_rmid, group->attr.config, 0);
>  		cqm_mask_call(&rr);
>  		local64_set(&group->count, atomic64_read(&rr.value));
> +		list_for_each_entry(event, head, hw.cqm_group_entry) {
> +			if (event->hw.is_group_event) {
> +
> +				evttype = event->attr.config;
> +				rr = __init_rr(old_rmid, evttype, 0);
> +
> +				cqm_mask_call(&rr);
> +					local64_set(&event->count,
> +						    atomic64_read(&rr.value));

Randomly indent much?

> +			}
> +		}
>  	}

[toc] | [prev] | [next] | [standalone]


#1386649 — Re: [PATCH 1/4] perf/x86/cqm,mbm: Store cqm,mbm count for all events when RMID is recycled

FromVikas Shivappa <vikas.shivappa@intel.com>
Date2016-04-25 18:30 +0200
SubjectRe: [PATCH 1/4] perf/x86/cqm,mbm: Store cqm,mbm count for all events when RMID is recycled
Message-ID<rrRyA-t4-65@gated-at.bofh.it>
In reply to#1386170

On Mon, 25 Apr 2016, Peter Zijlstra wrote:

> On Fri, Apr 22, 2016 at 05:27:18PM -0700, Vikas Shivappa wrote:
>> During RMID recycling, when an event loses the RMID we saved the counter
>> for group leader but it was not being saved for all the events in an
>> event group. This would lead to a situation where if 2 perf instances
>> are counting the same PID one of them would not see the updated count
>> which other perf instance is seeing. This patch tries to fix the issue
>> by saving the count for all the events in the same event group.
>
>
>> @@ -486,14 +495,21 @@ static u32 intel_cqm_xchg_rmid(struct perf_event *group, u32 rmid)
>>  	 * If our RMID is being deallocated, perform a read now.
>>  	 */
>>  	if (__rmid_valid(old_rmid) && !__rmid_valid(rmid)) {
>>
>> +		rr = __init_rr(old_rmid, group->attr.config, 0);
>>  		cqm_mask_call(&rr);
>>  		local64_set(&group->count, atomic64_read(&rr.value));
>> +		list_for_each_entry(event, head, hw.cqm_group_entry) {
>> +			if (event->hw.is_group_event) {
>> +
>> +				evttype = event->attr.config;
>> +				rr = __init_rr(old_rmid, evttype, 0);
>> +
>> +				cqm_mask_call(&rr);
>> +					local64_set(&event->count,
>> +						    atomic64_read(&rr.value));
>
> Randomly indent much?

Will fix. It has been added by mistake in advance for the next patch

Thanks,
Vikas

>
>> +			}
>> +		}
>>  	}
>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web