linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] perf jevents: Fix event code for events referencing std arch events
       [not found] ` <a7cbb1f7-1f7f-6bf9-6acf-fd5455aadd82@linux.ibm.com>
@ 2020-10-09 11:38   ` John Garry
  0 siblings, 0 replies; 4+ messages in thread
From: John Garry @ 2020-10-09 11:38 UTC (permalink / raw)
  To: kajoljain, peterz, mingo, acme, mark.rutland, alexander.shishkin,
	jolsa, namhyung, irogers, yao.jin, yeyunfeng
  Cc: linux-kernel, linux-arm-kernel, linuxarm

On 09/10/2020 12:26, kajoljain wrote:
> 
> On 10/8/20 8:49 PM, John Garry wrote:
>> The event code for events referencing std arch events is incorrectly
>> evaluated in json_events().
>>
>> The issue is that je.event is evaluated properly from try_fixup(), but
>> later NULLified from the real_event() call, as "event" may be NULL.
>>
>> Fix by setting "event" same je.event in try_fixup().
>>
>> Also remove support for overwriting event code for events using std arch
>> events, as it is not used.
> Patch looks good to me. Not sure if any adding any example with this issue
> is helpful.

So we get something like this in pmu-events.c:

{
         .name = "l1d_cache_wb_victim",
         .event = "event=0x0",
[...]
},

But event should "event=0x46".

I can add this if Arnaldo wants a v2.

> 
> Reviewed-By: Kajol Jain<kjain@linux.ibm.com>

thanks


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] perf jevents: Fix event code for events referencing std arch events
       [not found]     ` <20201012112419.GJ1099489@krava>
@ 2020-10-13  8:41       ` John Garry
       [not found]       ` <20201014164905.GN3100363@kernel.org>
  1 sibling, 0 replies; 4+ messages in thread
From: John Garry @ 2020-10-13  8:41 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: mark.rutland, irogers, peterz, kjain, linux-kernel, acme,
	linuxarm, alexander.shishkin, yao.jin, mingo, linux-arm-kernel,
	namhyung, yeyunfeng

On 12/10/2020 12:24, Jiri Olsa wrote:
> On Mon, Oct 12, 2020 at 12:15:04PM +0100, John Garry wrote:
>> On 12/10/2020 11:54, Jiri Olsa wrote:
>>>> ff --git a/tools/perf/pmu-events/jevents.c b/tools/perf/pmu-events/jevents.c
>>>> index 99df41a9543d..e47644cab3fa 100644
>>>> --- a/tools/perf/pmu-events/jevents.c
>>>> +++ b/tools/perf/pmu-events/jevents.c
>>>> @@ -505,20 +505,15 @@ static char *real_event(const char *name, char *event)
>>>>    }
>>>>    static int
>>>> -try_fixup(const char *fn, char *arch_std, unsigned long long eventcode,
>>>> -	  struct json_event *je)
>>>> +try_fixup(const char *fn, char *arch_std, struct json_event *je, char **event)
>>>>    {
>>>>    	/* try to find matching event from arch standard values */
>>>>    	struct event_struct *es;
>>>>    	list_for_each_entry(es, &arch_std_events, list) {
>>>>    		if (!strcmp(arch_std, es->name)) {
>>>> -			if (!eventcode && es->event) {
>>>> -				/* allow EventCode to be overridden */
>>>> -				free(je->event);
>>>> -				je->event = NULL;
>>>> -			}
>>>>    			FOR_ALL_EVENT_STRUCT_FIELDS(TRY_FIXUP_FIELD);
>>>> +			*event = je->event;
>>> I'm bit rusty on this code, but isn't je->event NULL at this point?
>>
>> je->event should be now assigned from es->event because of
>> FOR_ALL_EVENT_STRUCT_FIELDS(TRY_FIXUP_FIELD):
>>
>> #define TRY_FIXUP_FIELD(field) do { if (es->field && !*field) {\
>> 	*field = strdup(es->field);				\
>> 	if (!*field)						\
>> 		return -ENOMEM;					\
>> } } while (0)
>>
>> And es->event should be set.
> 
> right, thanks
> 
> Acked-by: Jiri Olsa <jolsa@redhat.com>
> 
> jirka
> 
> .
> 

"PMU events" testcase was still passing as it does not cover this 
scenario, so I'll look to expand the test to catch such problems.

Thanks,
John


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] perf jevents: Fix event code for events referencing std arch events
       [not found]         ` <fa6351ab-4d2d-8de7-96e1-102d6fa0dd50@huawei.com>
@ 2020-10-15 12:25           ` Arnaldo Carvalho de Melo
  2020-10-15 15:42             ` John Garry
  0 siblings, 1 reply; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2020-10-15 12:25 UTC (permalink / raw)
  To: John Garry
  Cc: mark.rutland, irogers, peterz, kjain, linux-kernel, linuxarm,
	alexander.shishkin, yao.jin, mingo, linux-arm-kernel, namhyung,
	Jiri Olsa, yeyunfeng

Em Wed, Oct 14, 2020 at 06:46:12PM +0100, John Garry escreveu:
> On 14/10/2020 17:49, Arnaldo Carvalho de Melo wrote:
> > Ok, applied,
> 
> Thanks
> 
> > please consider adding a Fixes tag next time.
> > 
> 
> Can do if it helps, but I only thought it appropriate when fixing something
> merged to mainline.

Please do, I think it appropriate in all cases, people doing backports
may decide to pick something and if it has some subtle issue this can be
automatically checked for by looking at any later Fixes for that
specific cset.

I decided not to do any rebase on perf/core, so those Fixes will remain
valid.

- Arnaldo

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] perf jevents: Fix event code for events referencing std arch events
  2020-10-15 12:25           ` Arnaldo Carvalho de Melo
@ 2020-10-15 15:42             ` John Garry
  0 siblings, 0 replies; 4+ messages in thread
From: John Garry @ 2020-10-15 15:42 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: mark.rutland, irogers, peterz, kjain, linux-kernel, linuxarm,
	alexander.shishkin, yao.jin, mingo, linux-arm-kernel, namhyung,
	Jiri Olsa, yeyunfeng


> 
> I decided not to do any rebase on perf/core, so those Fixes will remain
> valid.

Ah, ok. Then that should be fine wrt fixes tags.

Cheers,
John

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-10-15 15:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1602170368-11892-1-git-send-email-john.garry@huawei.com>
     [not found] ` <a7cbb1f7-1f7f-6bf9-6acf-fd5455aadd82@linux.ibm.com>
2020-10-09 11:38   ` [PATCH] perf jevents: Fix event code for events referencing std arch events John Garry
     [not found] ` <20201012105430.GH1099489@krava>
     [not found]   ` <5b0aefe2-e0d5-b5ff-654c-4e93c427050f@huawei.com>
     [not found]     ` <20201012112419.GJ1099489@krava>
2020-10-13  8:41       ` John Garry
     [not found]       ` <20201014164905.GN3100363@kernel.org>
     [not found]         ` <fa6351ab-4d2d-8de7-96e1-102d6fa0dd50@huawei.com>
2020-10-15 12:25           ` Arnaldo Carvalho de Melo
2020-10-15 15:42             ` John Garry

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).