Patch "perf pmu: Treat the msr pmu as software" has been added to the 6.6-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 pmu: Treat the msr pmu as software

to the 6.6-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-pmu-treat-the-msr-pmu-as-software.patch
and it can be found in the queue-6.6 subdirectory.

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



commit f65914835ef30c2dc930b756ed44272cb8435f9e
Author: Ian Rogers <irogers@xxxxxxxxxx>
Date:   Wed Jan 24 15:42:00 2024 -0800

    perf pmu: Treat the msr pmu as software
    
    [ Upstream commit 24852ef2e2d5c555c2da05baff112ea414b6e0f5 ]
    
    The msr PMU is a software one, meaning msr events may be grouped
    with events in a hardware context. As the msr PMU isn't marked as a
    software PMU by perf_pmu__is_software, groups with the msr PMU in
    are broken and the msr events placed in a different group. This
    may lead to multiplexing errors where a hardware event isn't
    counted while the msr event, such as tsc, is. Fix all of this by
    marking the msr PMU as software, which agrees with the driver.
    
    Before:
    ```
    $ perf stat -e '{slots,tsc}' -a true
    WARNING: events were regrouped to match PMUs
    
     Performance counter stats for 'system wide':
    
             1,750,335      slots
             4,243,557      tsc
    
           0.001456717 seconds time elapsed
    ```
    
    After:
    ```
    $ perf stat -e '{slots,tsc}' -a true
     Performance counter stats for 'system wide':
    
            12,526,380      slots
             3,415,163      tsc
    
           0.001488360 seconds time elapsed
    ```
    
    Fixes: 251aa040244a ("perf parse-events: Wildcard most "numeric" events")
    Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>
    Reviewed-by: Kan Liang <kan.liang@xxxxxxxxxxxxxxx>
    Cc: James Clark <james.clark@xxxxxxx>
    Cc: Caleb Biggers <caleb.biggers@xxxxxxxxx>
    Cc: Edward Baker <edward.baker@xxxxxxxxx>
    Cc: Perry Taylor <perry.taylor@xxxxxxxxx>
    Cc: Samantha Alt <samantha.alt@xxxxxxxxx>
    Cc: Weilin Wang <weilin.wang@xxxxxxxxx>
    Link: https://lore.kernel.org/r/20240124234200.1510417-1-irogers@xxxxxxxxxx
    Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index d515ba8a0e160..a3c7814116c7c 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -1735,6 +1735,12 @@ bool pmu__name_match(const struct perf_pmu *pmu, const char *pmu_name)
 
 bool perf_pmu__is_software(const struct perf_pmu *pmu)
 {
+	const char *known_sw_pmus[] = {
+		"kprobe",
+		"msr",
+		"uprobe",
+	};
+
 	if (pmu->is_core || pmu->is_uncore || pmu->auxtrace)
 		return false;
 	switch (pmu->type) {
@@ -1746,7 +1752,11 @@ bool perf_pmu__is_software(const struct perf_pmu *pmu)
 	case PERF_TYPE_BREAKPOINT:	return true;
 	default: break;
 	}
-	return !strcmp(pmu->name, "kprobe") || !strcmp(pmu->name, "uprobe");
+	for (size_t i = 0; i < ARRAY_SIZE(known_sw_pmus); i++) {
+		if (!strcmp(pmu->name, known_sw_pmus[i]))
+			return true;
+	}
+	return false;
 }
 
 FILE *perf_pmu__open_file(struct perf_pmu *pmu, const char *name)




[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