lkml.org 
[lkml]   [2022]   [May]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subject[peterz-queue:perf/wip.cleanup 9/10] arch/x86/events/intel/pt.c:719:2: warning: array index -1 is before the beginning of the array
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git perf/wip.cleanup
head: 012bb7ae4eb84ae93ded12888ccd1e123c64200f
commit: c838cb5fbb27ca829668a88691b07ca63f91fde7 [9/10] perf/x86/intel: Optimize short PEBS counters
config: i386-randconfig-a013 (https://download.01.org/0day-ci/archive/20220526/202205262245.87lBx9Fw-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 6f4644d194da594562027a5d458d9fb7a20ebc39)
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://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git/commit/?id=c838cb5fbb27ca829668a88691b07ca63f91fde7
git remote add peterz-queue https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git
git fetch --no-tags peterz-queue perf/wip.cleanup
git checkout c838cb5fbb27ca829668a88691b07ca63f91fde7
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash arch/x86/

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

All warnings (new ones prefixed by >>):

In file included from arch/x86/events/intel/pt.c:27:
arch/x86/events/intel/../perf_event.h:1056:16: error: call to undeclared function 'this_cpu_load'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
s64 counter = this_cpu_load(pmc_prev_left[hwc->idx]);
^
arch/x86/events/intel/../perf_event.h:1057:13: error: call to undeclared function 'load64_read'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
s64 left = load64_read(&hwc->period_left);
^
>> arch/x86/events/intel/pt.c:719:2: warning: array index -1 is before the beginning of the array [-Warray-bounds]
TOPA_ENTRY(last, -1)->base = topa_pfn(topa);
^ ~~
arch/x86/events/intel/pt.c:619:6: note: expanded from macro 'TOPA_ENTRY'
: &topa_to_page(t)->table[(i)])
^ ~
arch/x86/events/intel/pt.c:596:2: note: array 'table' declared here
struct topa_entry table[TENTS_PER_PAGE];
^
arch/x86/events/intel/pt.c:720:2: warning: array index -1 is before the beginning of the array [-Warray-bounds]
TOPA_ENTRY(last, -1)->end = 1;
^ ~~
arch/x86/events/intel/pt.c:619:6: note: expanded from macro 'TOPA_ENTRY'
: &topa_to_page(t)->table[(i)])
^ ~
arch/x86/events/intel/pt.c:596:2: note: array 'table' declared here
struct topa_entry table[TENTS_PER_PAGE];
^
arch/x86/events/intel/pt.c:769:2: warning: array index -1 is before the beginning of the array [-Warray-bounds]
TOPA_ENTRY(topa, -1)->base = page_to_phys(p) >> TOPA_SHIFT;
^ ~~
arch/x86/events/intel/pt.c:619:6: note: expanded from macro 'TOPA_ENTRY'
: &topa_to_page(t)->table[(i)])
^ ~
arch/x86/events/intel/pt.c:596:2: note: array 'table' declared here
struct topa_entry table[TENTS_PER_PAGE];
^
arch/x86/events/intel/pt.c:770:2: warning: array index -1 is before the beginning of the array [-Warray-bounds]
TOPA_ENTRY(topa, -1)->size = order;
^ ~~
arch/x86/events/intel/pt.c:619:6: note: expanded from macro 'TOPA_ENTRY'
: &topa_to_page(t)->table[(i)])
^ ~
arch/x86/events/intel/pt.c:596:2: note: array 'table' declared here
struct topa_entry table[TENTS_PER_PAGE];
^
arch/x86/events/intel/pt.c:773:3: warning: array index -1 is before the beginning of the array [-Warray-bounds]
TOPA_ENTRY(topa, -1)->intr = 1;
^ ~~
arch/x86/events/intel/pt.c:619:6: note: expanded from macro 'TOPA_ENTRY'
: &topa_to_page(t)->table[(i)])
^ ~
arch/x86/events/intel/pt.c:596:2: note: array 'table' declared here
struct topa_entry table[TENTS_PER_PAGE];
^
arch/x86/events/intel/pt.c:774:3: warning: array index -1 is before the beginning of the array [-Warray-bounds]
TOPA_ENTRY(topa, -1)->stop = 1;
^ ~~
arch/x86/events/intel/pt.c:619:6: note: expanded from macro 'TOPA_ENTRY'
: &topa_to_page(t)->table[(i)])
^ ~
arch/x86/events/intel/pt.c:596:2: note: array 'table' declared here
struct topa_entry table[TENTS_PER_PAGE];
^
arch/x86/events/intel/pt.c:1235:3: warning: array index -1 is before the beginning of the array [-Warray-bounds]
TOPA_ENTRY(buf->last, -1)->base = topa_pfn(buf->first);
^ ~~
arch/x86/events/intel/pt.c:619:6: note: expanded from macro 'TOPA_ENTRY'
: &topa_to_page(t)->table[(i)])
^ ~
arch/x86/events/intel/pt.c:596:2: note: array 'table' declared here
struct topa_entry table[TENTS_PER_PAGE];
^
arch/x86/events/intel/pt.c:1236:3: warning: array index -1 is before the beginning of the array [-Warray-bounds]
TOPA_ENTRY(buf->last, -1)->end = 1;
^ ~~
arch/x86/events/intel/pt.c:619:6: note: expanded from macro 'TOPA_ENTRY'
: &topa_to_page(t)->table[(i)])
^ ~
arch/x86/events/intel/pt.c:596:2: note: array 'table' declared here
struct topa_entry table[TENTS_PER_PAGE];
^
8 warnings and 2 errors generated.


vim +719 arch/x86/events/intel/pt.c

52ca9ced3f7077 arch/x86/kernel/cpu/perf_event_intel_pt.c Alexander Shishkin 2015-01-30 690
52ca9ced3f7077 arch/x86/kernel/cpu/perf_event_intel_pt.c Alexander Shishkin 2015-01-30 691 /**
52ca9ced3f7077 arch/x86/kernel/cpu/perf_event_intel_pt.c Alexander Shishkin 2015-01-30 692 * topa_insert_table() - insert a ToPA table into a buffer
52ca9ced3f7077 arch/x86/kernel/cpu/perf_event_intel_pt.c Alexander Shishkin 2015-01-30 693 * @buf: PT buffer that's being extended.
52ca9ced3f7077 arch/x86/kernel/cpu/perf_event_intel_pt.c Alexander Shishkin 2015-01-30 694 * @topa: New topa table to be inserted.
52ca9ced3f7077 arch/x86/kernel/cpu/perf_event_intel_pt.c Alexander Shishkin 2015-01-30 695 *
52ca9ced3f7077 arch/x86/kernel/cpu/perf_event_intel_pt.c Alexander Shishkin 2015-01-30 696 * If it's the first table in this buffer, set up buffer's pointers
52ca9ced3f7077 arch/x86/kernel/cpu/perf_event_intel_pt.c Alexander Shishkin 2015-01-30 697 * accordingly; otherwise, add a END=1 link entry to @topa to the current
52ca9ced3f7077 arch/x86/kernel/cpu/perf_event_intel_pt.c Alexander Shishkin 2015-01-30 698 * "last" table and adjust the last table pointer to @topa.
52ca9ced3f7077 arch/x86/kernel/cpu/perf_event_intel_pt.c Alexander Shishkin 2015-01-30 699 */
52ca9ced3f7077 arch/x86/kernel/cpu/perf_event_intel_pt.c Alexander Shishkin 2015-01-30 700 static void topa_insert_table(struct pt_buffer *buf, struct topa *topa)
52ca9ced3f7077 arch/x86/kernel/cpu/perf_event_intel_pt.c Alexander Shishkin 2015-01-30 701 {
52ca9ced3f7077 arch/x86/kernel/cpu/perf_event_intel_pt.c Alexander Shishkin 2015-01-30 702 struct topa *last = buf->last;
52ca9ced3f7077 arch/x86/kernel/cpu/perf_event_intel_pt.c Alexander Shishkin 2015-01-30 703
52ca9ced3f7077 arch/x86/kernel/cpu/perf_event_intel_pt.c Alexander Shishkin 2015-01-30 704 list_add_tail(&topa->list, &buf->tables);
52ca9ced3f7077 arch/x86/kernel/cpu/perf_event_intel_pt.c Alexander Shishkin 2015-01-30 705
52ca9ced3f7077 arch/x86/kernel/cpu/perf_event_intel_pt.c Alexander Shishkin 2015-01-30 706 if (!buf->first) {
52ca9ced3f7077 arch/x86/kernel/cpu/perf_event_intel_pt.c Alexander Shishkin 2015-01-30 707 buf->first = buf->last = buf->cur = topa;
52ca9ced3f7077 arch/x86/kernel/cpu/perf_event_intel_pt.c Alexander Shishkin 2015-01-30 708 return;
52ca9ced3f7077 arch/x86/kernel/cpu/perf_event_intel_pt.c Alexander Shishkin 2015-01-30 709 }
52ca9ced3f7077 arch/x86/kernel/cpu/perf_event_intel_pt.c Alexander Shishkin 2015-01-30 710
52ca9ced3f7077 arch/x86/kernel/cpu/perf_event_intel_pt.c Alexander Shishkin 2015-01-30 711 topa->offset = last->offset + last->size;
52ca9ced3f7077 arch/x86/kernel/cpu/perf_event_intel_pt.c Alexander Shishkin 2015-01-30 712 buf->last = topa;
52ca9ced3f7077 arch/x86/kernel/cpu/perf_event_intel_pt.c Alexander Shishkin 2015-01-30 713
f6d079ce867d67 arch/x86/events/intel/pt.c Chao Peng 2018-10-24 714 if (!intel_pt_validate_hw_cap(PT_CAP_topa_multiple_entries))
52ca9ced3f7077 arch/x86/kernel/cpu/perf_event_intel_pt.c Alexander Shishkin 2015-01-30 715 return;
52ca9ced3f7077 arch/x86/kernel/cpu/perf_event_intel_pt.c Alexander Shishkin 2015-01-30 716
52ca9ced3f7077 arch/x86/kernel/cpu/perf_event_intel_pt.c Alexander Shishkin 2015-01-30 717 BUG_ON(last->last != TENTS_PER_PAGE - 1);
52ca9ced3f7077 arch/x86/kernel/cpu/perf_event_intel_pt.c Alexander Shishkin 2015-01-30 718
91feca5e2ecc97 arch/x86/events/intel/pt.c Alexander Shishkin 2019-08-21 @719 TOPA_ENTRY(last, -1)->base = topa_pfn(topa);
52ca9ced3f7077 arch/x86/kernel/cpu/perf_event_intel_pt.c Alexander Shishkin 2015-01-30 720 TOPA_ENTRY(last, -1)->end = 1;
52ca9ced3f7077 arch/x86/kernel/cpu/perf_event_intel_pt.c Alexander Shishkin 2015-01-30 721 }
52ca9ced3f7077 arch/x86/kernel/cpu/perf_event_intel_pt.c Alexander Shishkin 2015-01-30 722

:::::: The code at line 719 was first introduced by commit
:::::: 91feca5e2ecc9752894d57c9a72c2645471929c3 perf/x86/intel/pt: Free up space in a ToPA descriptor

:::::: TO: Alexander Shishkin <alexander.shishkin@linux.intel.com>
:::::: CC: Ingo Molnar <mingo@kernel.org>

--
0-DAY CI Kernel Test Service
https://01.org/lkp

\
 
 \ /
  Last update: 2022-05-26 16:23    [W:0.030 / U:0.188 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site