[PATCH v2 1/8] powerpc/perf/hv-24x7: Fix inconsistent output values incase multiple hv-24x7 events run

kajoljain kjain at linux.ibm.com
Mon Feb 24 16:17:38 AEDT 2020



On 2/23/20 8:21 AM, Sukadev Bhattiprolu wrote:
> Kajol Jain [kjain at linux.ibm.com] wrote:
>> Commit 2b206ee6b0df ("powerpc/perf/hv-24x7: Display change in counter
>> values")' added to print _change_ in the counter value rather then raw
>> value for 24x7 counters. Incase of transactions, the event count
>> is set to 0 at the beginning of the transaction. It also sets
>> the event's prev_count to the raw value at the time of initialization.
>> Because of setting event count to 0, we are seeing some weird behaviour,
>> whenever we run multiple 24x7 events at a time.
> 
> Interesting. Are we taking delta of a delta and ending up with large
> negative values in the -I case?  However...
> 

Hi Sukadev,
       That's right, we are ending up in calculating delta of delta which may give us negative values
because of which we are getting these large values in -I case.

> <snip>
> 
>>
>> Signed-off-by: Kajol Jain <kjain at linux.ibm.com>
>> ---
>>  arch/powerpc/perf/hv-24x7.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/powerpc/perf/hv-24x7.c b/arch/powerpc/perf/hv-24x7.c
>> index 573e0b309c0c..6dbbf70232aa 100644
>> --- a/arch/powerpc/perf/hv-24x7.c
>> +++ b/arch/powerpc/perf/hv-24x7.c
>> @@ -1409,7 +1409,7 @@ static void h_24x7_event_read(struct perf_event *event)
>>  			 * that would require issuing a hcall, which would then
>>  			 * defeat the purpose of using the txn interface.
>>  			 */
>> -			local64_set(&event->count, 0);
>> +			local64_add(0, &event->count);
> 
> ... not sure, how adding zero to the count helps. Should we just remove the
> line (and the comment block above it)?  Or does it help to clear the event
> count in ->start_txn() rather than on read()?

Its not impacting much as we are just adding and not setting event count.I think we can remove that line
with the comment added. Will it be ok if I remove that whole part?

> 
> How does the change impact the counts when run without the -I?

There won't be much impact because from my understanding you did add 
`(void)local64_xchg(&event->hw.prev_count, ct);`, to print change value in your
Commit 2b206ee6b0df in function 'h_24x7_event_init()'.
And we will go through this path in case of 'without -I'. Please let me know if my
understanding is correct.

Thanks,
Kajol

> 
> Thanks for chasing this down.
> 
> Sukadev
> 


More information about the Linuxppc-dev mailing list