Patch "perf evlist: Fix evlist__new_default() for > 1 core PMU" has been added to the 6.7-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 evlist: Fix evlist__new_default() for > 1 core PMU

to the 6.7-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-evlist-fix-evlist__new_default-for-1-core-pmu.patch
and it can be found in the queue-6.7 subdirectory.

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



commit 15e7f95216e5cd3a018a1bc40b28bc1050c48f37
Author: James Clark <james.clark@xxxxxxx>
Date:   Wed Jan 24 09:43:57 2024 +0000

    perf evlist: Fix evlist__new_default() for > 1 core PMU
    
    [ Upstream commit 7814fe24a6211a610db0b408d87420403b5b7a36 ]
    
    The 'Session topology' test currently fails with this message when
    evlist__new_default() opens more than one event:
    
      32: Session topology                                                :
      --- start ---
      templ file: /tmp/perf-test-vv5YzZ
      Using CPUID 0x00000000410fd070
      Opening: unknown-hardware:HG
      ------------------------------------------------------------
      perf_event_attr:
        type                             0 (PERF_TYPE_HARDWARE)
        config                           0xb00000000
        disabled                         1
      ------------------------------------------------------------
      sys_perf_event_open: pid 0  cpu -1  group_fd -1  flags 0x8 = 4
      Opening: unknown-hardware:HG
      ------------------------------------------------------------
      perf_event_attr:
        type                             0 (PERF_TYPE_HARDWARE)
        config                           0xa00000000
        disabled                         1
      ------------------------------------------------------------
      sys_perf_event_open: pid 0  cpu -1  group_fd -1  flags 0x8 = 5
      non matching sample_type
      FAILED tests/topology.c:73 can't get session
      ---- end ----
      Session topology: FAILED!
    
    This is because when re-opening the file and parsing the header, Perf
    expects that any file that has more than one event has the sample ID
    flag set. Perf record already sets the flag in a similar way when there
    is more than one event, so add the same logic to evlist__new_default().
    
    evlist__new_default() is only currently used in tests, so I don't
    expect this change to have any other side effects. The other tests that
    use it don't save and re-open the file so don't hit this issue.
    
    The session topology test has been failing on Arm big.LITTLE platforms
    since commit 251aa040244a3b17 ("perf parse-events: Wildcard most
    "numeric" events") when evlist__new_default() started opening multiple
    events for 'cycles'.
    
    Fixes: 251aa040244a3b17 ("perf parse-events: Wildcard most "numeric" events")
    Reviewed-by: Ian Rogers <irogers@xxxxxxxxxx>
    Signed-off-by: James Clark <james.clark@xxxxxxx>
    [ This was failing as well on a Rocket Lake Refresh/14700k Intel hybrid system - Arnaldo ]
    Tested-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
    Tested-by: Ian Rogers <irogers@xxxxxxxxxx>
    Tested-by: Kan Liang <kan.liang@xxxxxxxxxxxxxxx>
    Cc: Adrian Hunter <adrian.hunter@xxxxxxxxx>
    Cc: Alexander Shishkin <alexander.shishkin@xxxxxxxxxxxxxxx>
    Cc: Changbin Du <changbin.du@xxxxxxxxxx>
    Cc: Ingo Molnar <mingo@xxxxxxxxxx>
    Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
    Cc: Mark Rutland <mark.rutland@xxxxxxx>
    Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
    Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
    Cc: Yang Jihong <yangjihong1@xxxxxxxxxx>
    Closes: https://lore.kernel.org/lkml/CAP-5=fWVQ-7ijjK3-w1q+k2WYVNHbAcejb-xY0ptbjRw476VKA@xxxxxxxxxxxxxx/
    Link: https://lore.kernel.org/r/20240124094358.489372-1-james.clark@xxxxxxx
    Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index e36da58522ef..b0ed14a6da9d 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -103,7 +103,14 @@ struct evlist *evlist__new_default(void)
 	err = parse_event(evlist, can_profile_kernel ? "cycles:P" : "cycles:Pu");
 	if (err) {
 		evlist__delete(evlist);
-		evlist = NULL;
+		return NULL;
+	}
+
+	if (evlist->core.nr_entries > 1) {
+		struct evsel *evsel;
+
+		evlist__for_each_entry(evlist, evsel)
+			evsel__set_sample_id(evsel, /*can_sample_identifier=*/false);
 	}
 
 	return evlist;




[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