Patch "drivers/perf: pmuv3: don't expose SW_INCR event in sysfs" has been added to the 5.15-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

    drivers/perf: pmuv3: don't expose SW_INCR event in sysfs

to the 5.15-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:
     drivers-perf-pmuv3-don-t-expose-sw_incr-event-in-sys.patch
and it can be found in the queue-5.15 subdirectory.

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



commit f2a03fe33857fe5b491edd8a247b749ed3159234
Author: Mark Rutland <mark.rutland@xxxxxxx>
Date:   Mon Dec 4 11:58:47 2023 +0000

    drivers/perf: pmuv3: don't expose SW_INCR event in sysfs
    
    [ Upstream commit ca6f537e459e2da4b331fe8928d1a0b0f9301f42 ]
    
    The SW_INCR event is somewhat unusual, and depends on the specific HW
    counter that it is programmed into. When programmed into PMEVCNTR<n>,
    SW_INCR will count any writes to PMSWINC_EL0 with bit n set, ignoring
    writes to SW_INCR with bit n clear.
    
    Event rotation means that there's no fixed relationship between
    perf_events and HW counters, so this isn't all that useful.
    
    Further, we program PMUSERENR.{SW,EN}=={0,0}, which causes EL0 writes to
    PMSWINC_EL0 to be trapped and handled as UNDEFINED, resulting in a
    SIGILL to userspace.
    
    Given that, it's not a good idea to expose SW_INCR in sysfs. Hide it as
    we did for CHAIN back in commit:
    
      4ba2578fa7b55701 ("arm64: perf: don't expose CHAIN event in sysfs")
    
    Signed-off-by: Mark Rutland <mark.rutland@xxxxxxx>
    Cc: Will Deacon <will@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20231204115847.2993026-1-mark.rutland@xxxxxxx
    Signed-off-by: Will Deacon <will@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c
index b4044469527e..c77b9460d63e 100644
--- a/arch/arm64/kernel/perf_event.c
+++ b/arch/arm64/kernel/perf_event.c
@@ -168,7 +168,11 @@ armv8pmu_events_sysfs_show(struct device *dev,
 	PMU_EVENT_ATTR_ID(name, armv8pmu_events_sysfs_show, config)
 
 static struct attribute *armv8_pmuv3_event_attrs[] = {
-	ARMV8_EVENT_ATTR(sw_incr, ARMV8_PMUV3_PERFCTR_SW_INCR),
+	/*
+	 * Don't expose the sw_incr event in /sys. It's not usable as writes to
+	 * PMSWINC_EL0 will trap as PMUSERENR.{SW,EN}=={0,0} and event rotation
+	 * means we don't have a fixed event<->counter relationship regardless.
+	 */
 	ARMV8_EVENT_ATTR(l1i_cache_refill, ARMV8_PMUV3_PERFCTR_L1I_CACHE_REFILL),
 	ARMV8_EVENT_ATTR(l1i_tlb_refill, ARMV8_PMUV3_PERFCTR_L1I_TLB_REFILL),
 	ARMV8_EVENT_ATTR(l1d_cache_refill, ARMV8_PMUV3_PERFCTR_L1D_CACHE_REFILL),




[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