All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 00/13] perf/x86/amd: Add AMD Fam19h Branch Sampling support
@ 2021-12-01  1:02 Stephane Eranian
  2021-12-01  1:02 ` [PATCH v3 01/13] perf/core: add perf_clear_branch_entry_bitfields() helper Stephane Eranian
                   ` (12 more replies)
  0 siblings, 13 replies; 24+ messages in thread
From: Stephane Eranian @ 2021-12-01  1:02 UTC (permalink / raw)
  To: linux-kernel
  Cc: peterz, kim.phillips, acme, jolsa, songliubraving, mpe, maddy

This patch series adds support for the AMD Fam19h 16-deep branch sampling
feature as described in the AMD PPR Fam19h Model 01h Revision B1 section
2.1.13. This is a model specific extension. It is not an architected AMD
feature.

The Branch Sampling Feature (BRS) provides the statistical taken branch
information necessary to enable autoFDO-style optimization by compilers,
i.e., basic block execution counts.

BRS operates with a 16-deep saturating buffer in MSR registers. There is no
hardware branch type filtering. All control flow changes are captured. BRS
relies on specific programming of the core PMU of Fam19h.  In particular,
the following requirements must be met:
 - the sampling period be greater than 16 (BRS depth)
 - the sampling period must use fixed and not frequency mode

BRS interacts with the NMI interrupt as well. Because enabling BRS is
expensive, it is only activated after P event occurrences, where P is the
desired sampling period. At P occurrences of the event, the counter
overflows, the CPU catches the NMI interrupt, activates BRS for 16 branches
until it saturates, and then delivers the NMI to the kernel. Between the
overflow and the time BRS activates more branches may be executed skewing the
period. All along, the sampling event keeps counting. The skid may be
attenuated by reducing the sampling period by 16.

BRS is integrated into perf_events seamlessly via the same
PERF_RECORD_BRANCH_STACK sample format. BRS generates branch
perf_branch_entry records in the sampling buffer. There is no prediction or
latency information supported. The branches are stored in reverse order of
execution.  The most recent branch is the first entry in each record.

Because BRS must be stopped when a CPU goes into low power mode, the series
includes patches to add callbacks on ACPI low power entry and exit which is
used on AMD processors.

Given that there is no privilege filterting with BRS, the kernel implements
filtering on privlege level.

This version adds a few simple modifications to perf record and report.
1. add the branch-brs event as a builtin such as it can used directly:
   perf record -e branch-brs ...
2. improve error handling for AMD IBS and is contributed by Kim Phillips.
3. use the better error handling to improve error handling for BRS.
4. add two new sort dimensions to help display the branch sampling
   information. Because there is no latency information associated with the
   branch sampling feature perf report would collapse all samples within a
   function into a single histogram entry. This is expected because the
   default sort mode for PERF_SAMPLE_BRANCH_STACK is symbol_from/symbol_to.
   This propagates to the annotation.

For more detailed view of the branch samples, the new sort dimensions
addr_from,addr_to can be used instead as follows:

$ perf report --sort=overhead,comm,dso,addr_from,addr_to 
# Overhead  Command    Shared Object     Source Address   Target Address
# ........  .......... ..............  ..............     ..............
#
     4.21%  test_prg   test_prg       [.] test_threa+0x3c [.] test_threa+0x4
     4.14%  test_prg   test_prg       [.] test_threa+0x3e [.] test_threa+0x2
     4.10%  test_prg   test_prg       [.] test_threa+0x4  [.] test_threa+0x3a
     4.07%  test_prg   test_prg       [.] test_threa+0x2  [.] test_threa+0x3c

Versus the default output:

$ perf report 
# Overhead  Command   Source Shared Object Source Symbol    Target Symbol      Basic Block Cycles
# ........  ......... .................... ................ .................  ..................
#
    99.52%  test_prg  test_prg             [.] test_thread  [.] test_thread    -                 

BRS can be used with any sampling event. However, it is recommended to use
the RETIRED_BRANCH event because it matches what the BRS captures. For
convenience, a pseudo event matching the branches captured by BRS is
exported by the kernel (branch-brs):

$ perf record -b -e cpu/branch-brs/ -c 1000037 test

$ perf report -D
56531696056126 0x193c000 [0x1a8]: PERF_RECORD_SAMPLE(IP, 0x2): 18122/18230: 0x401d24 period: 1000037 addr: 0
... branch stack: nr:16
.....  0: 0000000000401d24 -> 0000000000401d5a 0 cycles      0
.....  1: 0000000000401d5c -> 0000000000401d24 0 cycles      0
.....  2: 0000000000401d22 -> 0000000000401d5c 0 cycles      0
.....  3: 0000000000401d5e -> 0000000000401d22 0 cycles      0
.....  4: 0000000000401d20 -> 0000000000401d5e 0 cycles      0
.....  5: 0000000000401d3e -> 0000000000401d20 0 cycles      0
.....  6: 0000000000401d42 -> 0000000000401d3e 0 cycles      0
.....  7: 0000000000401d3c -> 0000000000401d42 0 cycles      0
.....  8: 0000000000401d44 -> 0000000000401d3c 0 cycles      0
.....  9: 0000000000401d3a -> 0000000000401d44 0 cycles      0
..... 10: 0000000000401d46 -> 0000000000401d3a 0 cycles      0
..... 11: 0000000000401d38 -> 0000000000401d46 0 cycles      0
..... 12: 0000000000401d48 -> 0000000000401d38 0 cycles      0
..... 13: 0000000000401d36 -> 0000000000401d48 0 cycles      0
..... 14: 0000000000401d4a -> 0000000000401d36 0 cycles      0
..... 15: 0000000000401d34 -> 0000000000401d4a 0 cycles      0
 ... thread: test:18230
 ...... dso: test

Special thanks to Kim Phillips @ AMD for the testing, reviews and
contributions.

V2 makes the following changes:
  - the low power callback code has be reworked completly. It is not
    impacting the generic perf_events code anymore. This is all handled
    via x86 code and only for ACPI low power driver which seems to be the
    default on AMD. The change in acpi_pad.c and processor_idle.c has no
    impact on non x86 architectures, on Intel x86 or AMD without BRS, a
    jump label is used to void the code unless necessary

  - BRS is an opt-in compile time option for the kernel

  - branch_stack bit clearing helper is introduced

  - As for the fact that BRS holds the NMI and that it may conflict with
    other sampling events and introduced skid, this is not really a problem
    because AMD PMI skid is already very large prompting special handling in
    amd_pmu_wait_on_overflow(), so adding a few cycles while the CPU executes
    at most 16 taken branches is not a problem.


V3 makes the following changes:
   - simplifies the handling of BRS enable/disable to mimic the Intel LBR code
     path more closely. That removes some callbacks in generic x86 code

   - add config option to compile BRS as an opt-in (off by default)

   - updated perf tool error reporting patch updates by Kim Phillips

Kim Phillips (1):
  perf tools: improve IBS error handling

Stephane Eranian (12):
  perf/core: add perf_clear_branch_entry_bitfields() helper
  x86/cpufeatures: add AMD Fam19h Branch Sampling feature
  perf/x86/amd: add AMD Fam19h Branch Sampling support
  perf/x86/amd: add branch-brs helper event for Fam19h BRS
  perf/x86/amd: enable branch sampling priv level filtering
  perf/x86/amd: add AMD branch sampling period adjustment
  perf/x86/amd: make Zen3 branch sampling opt-in
  ACPI: add perf low power callback
  perf/x86/amd: add idle hooks for branch sampling
  perf tools: add branch-brs as a new event
  perf tools: improve error handling of AMD Branch Sampling
  perf report: add addr_from/addr_to sort dimensions

 arch/x86/events/Kconfig            |   8 +
 arch/x86/events/amd/Makefile       |   1 +
 arch/x86/events/amd/brs.c          | 363 +++++++++++++++++++++++++++++
 arch/x86/events/amd/core.c         | 217 ++++++++++++++++-
 arch/x86/events/core.c             |  17 +-
 arch/x86/events/intel/lbr.c        |  36 ++-
 arch/x86/events/perf_event.h       | 143 ++++++++++--
 arch/x86/include/asm/cpufeatures.h |   1 +
 arch/x86/include/asm/msr-index.h   |   4 +
 arch/x86/include/asm/perf_event.h  |  21 ++
 drivers/acpi/acpi_pad.c            |   6 +
 drivers/acpi/processor_idle.c      |   5 +
 include/linux/perf_event.h         |  22 ++
 tools/perf/util/evsel.c            |  56 +++++
 tools/perf/util/hist.c             |   2 +
 tools/perf/util/hist.h             |   2 +
 tools/perf/util/parse-events.l     |   1 +
 tools/perf/util/sort.c             | 128 ++++++++++
 tools/perf/util/sort.h             |   2 +
 19 files changed, 995 insertions(+), 40 deletions(-)
 create mode 100644 arch/x86/events/amd/brs.c

-- 
2.34.0.rc2.393.gf8c9666880-goog


^ permalink raw reply	[flat|nested] 24+ messages in thread
* Re: [PATCH v3 03/13] perf/x86/amd: add AMD Fam19h Branch Sampling support
@ 2021-12-08 15:22 kernel test robot
  0 siblings, 0 replies; 24+ messages in thread
From: kernel test robot @ 2021-12-08 15:22 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 16407 bytes --]

CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
In-Reply-To: <20211201010217.886919-4-eranian@google.com>
References: <20211201010217.886919-4-eranian@google.com>
TO: Stephane Eranian <eranian@google.com>
TO: linux-kernel(a)vger.kernel.org
CC: peterz(a)infradead.org
CC: kim.phillips(a)amd.com
CC: acme(a)redhat.com
CC: jolsa(a)redhat.com
CC: songliubraving(a)fb.com
CC: mpe(a)ellerman.id.au
CC: maddy(a)linux.ibm.com

Hi Stephane,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on tip/perf/core]
[also build test WARNING on tip/x86/core rafael-pm/linux-next v5.16-rc4 next-20211207]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Stephane-Eranian/perf-x86-amd-Add-AMD-Fam19h-Branch-Sampling-support/20211201-090506
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git a9f4a6e92b3b319296fb078da2615f618f6cd80c
:::::: branch date: 8 days ago
:::::: commit date: 8 days ago
config: x86_64-randconfig-c007-20211128 (https://download.01.org/0day-ci/archive/20211208/202112082317.3QE5iOQk-lkp(a)intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 25eb7fa01d7ebbe67648ea03841cda55b4239ab2)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/c6b0817d81501a8bc31ddd7067697dba4408d75f
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Stephane-Eranian/perf-x86-amd-Add-AMD-Fam19h-Branch-Sampling-support/20211201-090506
        git checkout c6b0817d81501a8bc31ddd7067697dba4408d75f
        # save the config file to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 clang-analyzer 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


clang-analyzer warnings: (new ones prefixed by >>)
                                          ~~~~~~~~~~ ^
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   fs/proc/proc_sysctl.c:1056:2: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
           ret = 0;
           ^     ~
   fs/proc/proc_sysctl.c:1056:2: note: Value stored to 'ret' is never read
           ret = 0;
           ^     ~
   fs/proc/proc_sysctl.c:1214:3: warning: Value stored to 'link' is never read [clang-analyzer-deadcode.DeadStores]
                   link = find_entry(&head, dir, procname, strlen(procname));
                   ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/proc/proc_sysctl.c:1214:3: note: Value stored to 'link' is never read
                   link = find_entry(&head, dir, procname, strlen(procname));
                   ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   1 warning generated.
   fs/kernfs/dir.c:672:6: warning: Value stored to 'gen' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           u32 gen = kernfs_id_gen(id);
               ^~~   ~~~~~~~~~~~~~~~~~
   fs/kernfs/dir.c:672:6: note: Value stored to 'gen' during its initialization is never read
           u32 gen = kernfs_id_gen(id);
               ^~~   ~~~~~~~~~~~~~~~~~
   1 warning generated.
   Suppressed 1 warnings (1 with check filters).
   1 warning generated.
   fs/kernfs/symlink.c:76:3: warning: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
                   strcpy(s, "../");
                   ^~~~~~
   fs/kernfs/symlink.c:76:3: note: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
                   strcpy(s, "../");
                   ^~~~~~
   11 warnings generated.
   kernel/sched/core.c:5250:34: warning: Branch condition evaluates to a garbage value [clang-analyzer-core.uninitialized.Branch]
           if (sched_feat(LATENCY_WARN) && resched_latency)
                                           ^~~~~~~~~~~~~~~
   kernel/sched/core.c:5229:18: note: Loop condition is false.  Exiting loop
           struct rq *rq = cpu_rq(cpu);
                           ^
   kernel/sched/sched.h:1365:24: note: expanded from macro 'cpu_rq'
   #define cpu_rq(cpu)             (&per_cpu(runqueues, (cpu)))
                                     ^
   include/linux/percpu-defs.h:269:29: note: expanded from macro 'per_cpu'
   #define per_cpu(var, cpu)       (*per_cpu_ptr(&(var), cpu))
                                     ^
   include/linux/percpu-defs.h:263:47: note: expanded from macro 'per_cpu_ptr'
   #define per_cpu_ptr(ptr, cpu)   ({ (void)(cpu); VERIFY_PERCPU_PTR(ptr); })
                                                   ^
   include/linux/percpu-defs.h:259:2: note: expanded from macro 'VERIFY_PERCPU_PTR'
           __verify_pcpu_ptr(__p);                                         \
           ^
   include/linux/percpu-defs.h:217:37: note: expanded from macro '__verify_pcpu_ptr'
   #define __verify_pcpu_ptr(ptr)                                          \
                                                                           ^
   kernel/sched/core.c:5233:2: note: 'resched_latency' declared without an initial value
           u64 resched_latency;
           ^~~~~~~~~~~~~~~~~~~
   kernel/sched/core.c:5244:6: note: Assuming the condition is false
           if (sched_feat(LATENCY_WARN))
               ^
   kernel/sched/sched.h:1964:24: note: expanded from macro 'sched_feat'
   #define sched_feat(x) (sysctl_sched_features & (1UL << __SCHED_FEAT_##x))
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   kernel/sched/core.c:5244:2: note: Taking false branch
           if (sched_feat(LATENCY_WARN))
           ^
   kernel/sched/core.c:5250:6: note: Assuming the condition is true
           if (sched_feat(LATENCY_WARN) && resched_latency)
               ^
   kernel/sched/sched.h:1964:24: note: expanded from macro 'sched_feat'
   #define sched_feat(x) (sysctl_sched_features & (1UL << __SCHED_FEAT_##x))
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   kernel/sched/core.c:5250:6: note: Left side of '&&' is true
           if (sched_feat(LATENCY_WARN) && resched_latency)
               ^
   kernel/sched/sched.h:1964:23: note: expanded from macro 'sched_feat'
   #define sched_feat(x) (sysctl_sched_features & (1UL << __SCHED_FEAT_##x))
                         ^
   kernel/sched/core.c:5250:34: note: Branch condition evaluates to a garbage value
           if (sched_feat(LATENCY_WARN) && resched_latency)
                                           ^~~~~~~~~~~~~~~
   kernel/sched/core.c:6253:3: warning: Value stored to 'rq' is never read [clang-analyzer-deadcode.DeadStores]
                   rq = context_switch(rq, prev, next, &rf);
                   ^    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   kernel/sched/core.c:6253:3: note: Value stored to 'rq' is never read
                   rq = context_switch(rq, prev, next, &rf);
                   ^    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   kernel/sched/core.c:9288:3: warning: Value stored to 'ptr' is never read [clang-analyzer-deadcode.DeadStores]
                   ptr = (unsigned long)kzalloc(ptr, GFP_NOWAIT);
                   ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   kernel/sched/core.c:9288:3: note: Value stored to 'ptr' is never read
                   ptr = (unsigned long)kzalloc(ptr, GFP_NOWAIT);
                   ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   Suppressed 8 warnings (2 in non-user code, 6 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   1 warning generated.
   Suppressed 1 warnings (1 with check filters).
   1 warning generated.
   Suppressed 1 warnings (1 with check filters).
   2 warnings generated.
>> arch/x86/events/amd/core.c:682:3: warning: Value stored to 'hwc' is never read [clang-analyzer-deadcode.DeadStores]
                   hwc = &cpuc->events[idx]->hw;
                   ^     ~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/events/amd/core.c:682:3: note: Value stored to 'hwc' is never read
                   hwc = &cpuc->events[idx]->hw;
                   ^     ~~~~~~~~~~~~~~~~~~~~~~
   Suppressed 1 warnings (1 with check filters).
   1 warning generated.
   arch/x86/events/amd/ibs.c:669:37: warning: The left operand of '&' is a garbage value [clang-analyzer-core.UndefinedBinaryOperatorResult]
           if (check_rip && (ibs_data.regs[2] & IBS_RIP_INVALID)) {
                                              ^
   arch/x86/events/amd/ibs.c:720:13: note: Calling 'perf_ibs_handle_irq'
           handled += perf_ibs_handle_irq(&perf_ibs_op, regs);
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/events/amd/ibs.c:587:30: note: Loop condition is false.  Exiting loop
           struct cpu_perf_ibs *pcpu = this_cpu_ptr(perf_ibs->pcpu);
                                       ^
   include/linux/percpu-defs.h:265:27: note: expanded from macro 'this_cpu_ptr'
   #define this_cpu_ptr(ptr)       raw_cpu_ptr(ptr)
                                   ^
   include/linux/percpu-defs.h:264:26: note: expanded from macro 'raw_cpu_ptr'
   #define raw_cpu_ptr(ptr)        per_cpu_ptr(ptr, 0)
                                   ^
   include/linux/percpu-defs.h:263:47: note: expanded from macro 'per_cpu_ptr'
   #define per_cpu_ptr(ptr, cpu)   ({ (void)(cpu); VERIFY_PERCPU_PTR(ptr); })
                                                   ^
   include/linux/percpu-defs.h:259:2: note: expanded from macro 'VERIFY_PERCPU_PTR'
           __verify_pcpu_ptr(__p);                                         \
           ^
   include/linux/percpu-defs.h:217:37: note: expanded from macro '__verify_pcpu_ptr'
   #define __verify_pcpu_ptr(ptr)                                          \
                                                                           ^
   arch/x86/events/amd/ibs.c:598:6: note: Assuming the condition is false
           if (!test_bit(IBS_STARTED, pcpu->state)) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/events/amd/ibs.c:598:2: note: Taking false branch
           if (!test_bit(IBS_STARTED, pcpu->state)) {
           ^
   arch/x86/events/amd/ibs.c:612:19: note: Assuming 'event' is non-null
           if (WARN_ON_ONCE(!event))
                            ^
   include/asm-generic/bug.h:104:25: note: expanded from macro 'WARN_ON_ONCE'
           int __ret_warn_on = !!(condition);                      \
                                  ^~~~~~~~~
   arch/x86/events/amd/ibs.c:612:6: note: Taking false branch
           if (WARN_ON_ONCE(!event))
               ^
   include/asm-generic/bug.h:105:2: note: expanded from macro 'WARN_ON_ONCE'
           if (unlikely(__ret_warn_on))                            \
           ^
   arch/x86/events/amd/ibs.c:612:2: note: Taking false branch
           if (WARN_ON_ONCE(!event))
           ^
   arch/x86/events/amd/ibs.c:619:6: note: Assuming the condition is false
           if (!(*buf++ & perf_ibs->valid_mask))
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/events/amd/ibs.c:619:2: note: Taking false branch
           if (!(*buf++ & perf_ibs->valid_mask))
           ^
   arch/x86/events/amd/ibs.c:623:2: note: Calling 'perf_ibs_event_update'
           perf_ibs_event_update(perf_ibs, event, config);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/events/amd/ibs.c:361:2: note: Loop condition is false. Execution continues on line 361
           while (!perf_event_try_update(event, count, 64)) {
           ^
   arch/x86/events/amd/ibs.c:623:2: note: Returning from 'perf_ibs_event_update'
           perf_ibs_event_update(perf_ibs, event, config);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/events/amd/ibs.c:625:7: note: Calling 'perf_ibs_set_period'
           if (!perf_ibs_set_period(perf_ibs, hwc, &period))
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/events/amd/ibs.c:316:13: note: Calling 'perf_event_set_period'
           overflow = perf_event_set_period(hwc, 1<<4, perf_ibs->max_period, period);
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/events/amd/ibs.c:114:6: note: Assuming the condition is true
           if (unlikely(left <= -period)) {
               ^
   include/linux/compiler.h:48:24: note: expanded from macro 'unlikely'
   #  define unlikely(x)   (__branch_check__(x, 0, __builtin_constant_p(x)))
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:23:50: note: expanded from macro '__branch_check__'
   #define __branch_check__(x, expect, is_constant) ({                     \
                                                    ^~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/events/amd/ibs.c:114:2: note: Taking true branch
           if (unlikely(left <= -period)) {
           ^
   arch/x86/events/amd/ibs.c:121:15: note: Assuming 'left' is >= 'min'
           if (unlikely(left < (s64)min)) {
                        ^
   include/linux/compiler.h:48:41: note: expanded from macro 'unlikely'
   #  define unlikely(x)   (__branch_check__(x, 0, __builtin_constant_p(x)))
                                             ^
   include/linux/compiler.h:33:34: note: expanded from macro '__branch_check__'
                           ______r = __builtin_expect(!!(x), expect);      \
                                                         ^
   arch/x86/events/amd/ibs.c:121:15: note: 'left' is >= 'min'
           if (unlikely(left < (s64)min)) {
                        ^
   include/linux/compiler.h:48:68: note: expanded from macro 'unlikely'
   #  define unlikely(x)   (__branch_check__(x, 0, __builtin_constant_p(x)))
                                                                        ^

vim +/hwc +682 arch/x86/events/amd/core.c

c6b0817d81501a8 Stephane Eranian 2021-11-30  672  
c6b0817d81501a8 Stephane Eranian 2021-11-30  673  static void amd_pmu_enable_all(int added)
c6b0817d81501a8 Stephane Eranian 2021-11-30  674  {
c6b0817d81501a8 Stephane Eranian 2021-11-30  675  	struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
c6b0817d81501a8 Stephane Eranian 2021-11-30  676  	struct hw_perf_event *hwc;
c6b0817d81501a8 Stephane Eranian 2021-11-30  677  	int idx;
c6b0817d81501a8 Stephane Eranian 2021-11-30  678  
c6b0817d81501a8 Stephane Eranian 2021-11-30  679  	amd_brs_enable_all();
c6b0817d81501a8 Stephane Eranian 2021-11-30  680  
c6b0817d81501a8 Stephane Eranian 2021-11-30  681  	for (idx = 0; idx < x86_pmu.num_counters; idx++) {
c6b0817d81501a8 Stephane Eranian 2021-11-30 @682  		hwc = &cpuc->events[idx]->hw;
c6b0817d81501a8 Stephane Eranian 2021-11-30  683  
c6b0817d81501a8 Stephane Eranian 2021-11-30  684  		/* only activate events which are marked as active */
c6b0817d81501a8 Stephane Eranian 2021-11-30  685  		if (!test_bit(idx, cpuc->active_mask))
c6b0817d81501a8 Stephane Eranian 2021-11-30  686  			continue;
c6b0817d81501a8 Stephane Eranian 2021-11-30  687  
c6b0817d81501a8 Stephane Eranian 2021-11-30  688  		amd_pmu_enable_event(cpuc->events[idx]);
c6b0817d81501a8 Stephane Eranian 2021-11-30  689  	}
c6b0817d81501a8 Stephane Eranian 2021-11-30  690  }
c6b0817d81501a8 Stephane Eranian 2021-11-30  691  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2021-12-08 15:22 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-01  1:02 [PATCH v3 00/13] perf/x86/amd: Add AMD Fam19h Branch Sampling support Stephane Eranian
2021-12-01  1:02 ` [PATCH v3 01/13] perf/core: add perf_clear_branch_entry_bitfields() helper Stephane Eranian
2021-12-01  1:02 ` [PATCH v3 02/13] x86/cpufeatures: add AMD Fam19h Branch Sampling feature Stephane Eranian
2021-12-01  1:02 ` [PATCH v3 03/13] perf/x86/amd: add AMD Fam19h Branch Sampling support Stephane Eranian
2021-12-01  4:02   ` kernel test robot
2021-12-01  4:02     ` kernel test robot
2021-12-01  8:08   ` kernel test robot
2021-12-01  8:08     ` kernel test robot
2021-12-01  1:02 ` [PATCH v3 04/13] perf/x86/amd: add branch-brs helper event for Fam19h BRS Stephane Eranian
2021-12-01  1:02 ` [PATCH v3 05/13] perf/x86/amd: enable branch sampling priv level filtering Stephane Eranian
2021-12-01  1:02 ` [PATCH v3 06/13] perf/x86/amd: add AMD branch sampling period adjustment Stephane Eranian
2021-12-01  1:02 ` [PATCH v3 07/13] perf/x86/amd: make Zen3 branch sampling opt-in Stephane Eranian
2021-12-01  1:02 ` [PATCH v3 08/13] ACPI: add perf low power callback Stephane Eranian
2021-12-01  6:14   ` kernel test robot
2021-12-01  6:14     ` kernel test robot
2021-12-01  1:02 ` [PATCH v3 09/13] perf/x86/amd: add idle hooks for branch sampling Stephane Eranian
2021-12-01  1:02 ` [PATCH v3 10/13] perf tools: add branch-brs as a new event Stephane Eranian
2021-12-01  1:02 ` [PATCH v3 11/13] perf tools: improve IBS error handling Stephane Eranian
2021-12-01 15:30   ` Kim Phillips
2021-12-01 20:40     ` Stephane Eranian
2021-12-01 23:05       ` Kim Phillips
2021-12-01  1:02 ` [PATCH v3 12/13] perf tools: improve error handling of AMD Branch Sampling Stephane Eranian
2021-12-01  1:02 ` [PATCH v3 13/13] perf report: add addr_from/addr_to sort dimensions Stephane Eranian
2021-12-08 15:22 [PATCH v3 03/13] perf/x86/amd: add AMD Fam19h Branch Sampling support kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.