Patch "perf jevents: Fix event syntax error caused by ExtSel" has been added to the 5.18-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    perf jevents: Fix event syntax error caused by ExtSel

to the 5.18-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     perf-jevents-fix-event-syntax-error-caused-by-extsel.patch
and it can be found in the queue-5.18 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit d5093a5792492f68711bf9a4fe98459c75f70678
Author: Zhengjun Xing <zhengjun.xing@xxxxxxxxxxxxxxx>
Date:   Wed May 25 22:04:10 2022 +0800

    perf jevents: Fix event syntax error caused by ExtSel
    
    [ Upstream commit f4df0dbbe62ee8e4405a57b27ccd54393971c773 ]
    
    In the origin code, when "ExtSel" is 1, the eventcode will change to
    "eventcode |= 1 << 21”. For event “UNC_Q_RxL_CREDITS_CONSUMED_VN0.DRS",
    its "ExtSel" is "1", its eventcode will change from 0x1E to 0x20001E,
    but in fact the eventcode should <=0x1FF, so this will cause the parse
    fail:
    
      # perf stat -e "UNC_Q_RxL_CREDITS_CONSUMED_VN0.DRS" -a sleep 0.1
      event syntax error: '.._RxL_CREDITS_CONSUMED_VN0.DRS'
                                        \___ value too big for format, maximum is 511
    
    On the perf kernel side, the kernel assumes the valid bits are continuous.
    It will adjust the 0x100 (bit 8 for perf tool) to bit 21 in HW.
    
    DEFINE_UNCORE_FORMAT_ATTR(event_ext, event, "config:0-7,21");
    
    So the perf tool follows the kernel side and just set bit8 other than bit21.
    
    Fixes: fedb2b518239cbc0 ("perf jevents: Add support for parsing uncore json files")
    Reviewed-by: Kan Liang <kan.liang@xxxxxxxxxxxxxxx>
    Signed-off-by: Xing Zhengjun <zhengjun.xing@xxxxxxxxxxxxxxx>
    Acked-by: Ian Rogers <irogers@xxxxxxxxxx>
    Cc: Adrian Hunter <adrian.hunter@xxxxxxxxx>
    Cc: Alexander Shishkin <alexander.shishkin@xxxxxxxxx>
    Cc: Andi Kleen <ak@xxxxxxxxxxxxxxx>
    Cc: Ingo Molnar <mingo@xxxxxxxxxx>
    Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
    Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20220525140410.1706851-1-zhengjun.xing@xxxxxxxxxxxxxxx
    Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/tools/perf/pmu-events/jevents.c b/tools/perf/pmu-events/jevents.c
index 159d9eab6e79..b1eb68c861e7 100644
--- a/tools/perf/pmu-events/jevents.c
+++ b/tools/perf/pmu-events/jevents.c
@@ -612,7 +612,7 @@ static int json_events(const char *fn,
 			} else if (json_streq(map, field, "ExtSel")) {
 				char *code = NULL;
 				addfield(map, &code, "", "", val);
-				eventcode |= strtoul(code, NULL, 0) << 21;
+				eventcode |= strtoul(code, NULL, 0) << 8;
 				free(code);
 			} else if (json_streq(map, field, "EventName")) {
 				addfield(map, &je.name, "", "", val);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux