]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
perf: Add irq and exception return branch types
authorAnshuman Khandual <anshuman.khandual@arm.com>
Thu, 24 Feb 2022 05:36:54 +0000 (11:06 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 25 Oct 2023 09:58:58 +0000 (11:58 +0200)
[ Upstream commit cedd3614e5d9c80908099c19f8716714ce0610b1 ]

This expands generic branch type classification by adding two more entries
there in i.e irq and exception return. Also updates the x86 implementation
to process X86_BR_IRET and X86_BR_IRQ records as appropriate. This changes
branch types reported to user space on x86 platform but it should not be a
problem. The possible scenarios and impacts are enumerated here.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/1645681014-3346-1-git-send-email-anshuman.khandual@arm.com
Stable-dep-of: e53899771a02 ("perf/x86/lbr: Filter vsyscall addresses")
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/x86/events/intel/lbr.c
include/uapi/linux/perf_event.h
tools/include/uapi/linux/perf_event.h
tools/perf/util/branch.c

index b3f92255cbd2d4843dd01ded78847d066c7af7df..bc3e40184719fa5d08f2fec3d71a6df44361e3ad 100644 (file)
@@ -1352,10 +1352,10 @@ static int branch_map[X86_BR_TYPE_MAP_MAX] = {
        PERF_BR_SYSCALL,        /* X86_BR_SYSCALL */
        PERF_BR_SYSRET,         /* X86_BR_SYSRET */
        PERF_BR_UNKNOWN,        /* X86_BR_INT */
-       PERF_BR_UNKNOWN,        /* X86_BR_IRET */
+       PERF_BR_ERET,           /* X86_BR_IRET */
        PERF_BR_COND,           /* X86_BR_JCC */
        PERF_BR_UNCOND,         /* X86_BR_JMP */
-       PERF_BR_UNKNOWN,        /* X86_BR_IRQ */
+       PERF_BR_IRQ,            /* X86_BR_IRQ */
        PERF_BR_IND_CALL,       /* X86_BR_IND_CALL */
        PERF_BR_UNKNOWN,        /* X86_BR_ABORT */
        PERF_BR_UNKNOWN,        /* X86_BR_IN_TX */
index f92880a15645a4177406eca6e153665ea1ce0ea0..a7fb8d2b77096bca3ae37ecb34f7686b91bf166a 100644 (file)
@@ -251,6 +251,8 @@ enum {
        PERF_BR_SYSRET          = 8,    /* syscall return */
        PERF_BR_COND_CALL       = 9,    /* conditional function call */
        PERF_BR_COND_RET        = 10,   /* conditional function return */
+       PERF_BR_ERET            = 11,   /* exception return */
+       PERF_BR_IRQ             = 12,   /* irq */
        PERF_BR_MAX,
 };
 
index f92880a15645a4177406eca6e153665ea1ce0ea0..a7fb8d2b77096bca3ae37ecb34f7686b91bf166a 100644 (file)
@@ -251,6 +251,8 @@ enum {
        PERF_BR_SYSRET          = 8,    /* syscall return */
        PERF_BR_COND_CALL       = 9,    /* conditional function call */
        PERF_BR_COND_RET        = 10,   /* conditional function return */
+       PERF_BR_ERET            = 11,   /* exception return */
+       PERF_BR_IRQ             = 12,   /* irq */
        PERF_BR_MAX,
 };
 
index 2285b1eb3128d7eb2d9d8b710992cde074fe035e..a9a909db8cc7fd9f6aa37426b53945db32e9721f 100644 (file)
@@ -49,7 +49,9 @@ const char *branch_type_name(int type)
                "SYSCALL",
                "SYSRET",
                "COND_CALL",
-               "COND_RET"
+               "COND_RET",
+               "ERET",
+               "IRQ"
        };
 
        if (type >= 0 && type < PERF_BR_MAX)