lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <201803170151.rTZuY1Yd%fengguang.wu@intel.com>
Date:   Sat, 17 Mar 2018 01:19:54 +0800
From:   kbuild test robot <fengguang.wu@...el.com>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     kbuild-all@...org, linux-kernel@...r.kernel.org,
        tipbuild@...or.com, Thomas Gleixner <tglx@...utronix.de>
Subject: [tip:perf/core 1/2] drivers//perf/qcom_l2_pmu.c:598:13: error:
 invalid storage class for function 'l2_cache_event_start'

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf/core
head:   bbb68468641547d56c83012670bcaf77f3dacd64
commit: 7eb709f29593aced51901cb53565477762800722 [1/2] perf: Fix sibling iteration
config: arm64-allyesconfig (attached as .config)
compiler: aarch64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        git checkout 7eb709f29593aced51901cb53565477762800722
        # save the attached .config to linux build tree
        make.cross ARCH=arm64 

All error/warnings (new ones prefixed by >>):

   drivers//perf/qcom_l2_pmu.c: In function 'l2_cache_event_init':
>> drivers//perf/qcom_l2_pmu.c:598:13: error: invalid storage class for function 'l2_cache_event_start'
    static void l2_cache_event_start(struct perf_event *event, int flags)
                ^~~~~~~~~~~~~~~~~~~~
>> drivers//perf/qcom_l2_pmu.c:598:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
    static void l2_cache_event_start(struct perf_event *event, int flags)
    ^~~~~~
>> drivers//perf/qcom_l2_pmu.c:629:13: error: invalid storage class for function 'l2_cache_event_stop'
    static void l2_cache_event_stop(struct perf_event *event, int flags)
                ^~~~~~~~~~~~~~~~~~~
>> drivers//perf/qcom_l2_pmu.c:645:12: error: invalid storage class for function 'l2_cache_event_add'
    static int l2_cache_event_add(struct perf_event *event, int flags)
               ^~~~~~~~~~~~~~~~~~
>> drivers//perf/qcom_l2_pmu.c:672:13: error: invalid storage class for function 'l2_cache_event_del'
    static void l2_cache_event_del(struct perf_event *event, int flags)
                ^~~~~~~~~~~~~~~~~~
>> drivers//perf/qcom_l2_pmu.c:687:13: error: invalid storage class for function 'l2_cache_event_read'
    static void l2_cache_event_read(struct perf_event *event)
                ^~~~~~~~~~~~~~~~~~~
>> drivers//perf/qcom_l2_pmu.c:692:16: error: invalid storage class for function 'l2_cache_pmu_cpumask_show'
    static ssize_t l2_cache_pmu_cpumask_show(struct device *dev,
                   ^~~~~~~~~~~~~~~~~~~~~~~~~
   In file included from include/linux/kobject.h:20:0,
                    from include/linux/device.h:16,
                    from include/linux/acpi.h:27,
                    from drivers//perf/qcom_l2_pmu.c:12:
>> drivers//perf/qcom_l2_pmu.c:702:28: error: initializer element is not constant
      __ATTR(cpumask, S_IRUGO, l2_cache_pmu_cpumask_show, NULL);
                               ^
   include/linux/sysfs.h:104:10: note: in definition of macro '__ATTR'
     .show = _show,      \
             ^~~~~
   drivers//perf/qcom_l2_pmu.c:702:28: note: (near initialization for 'l2_cache_pmu_cpumask_attr.show')
      __ATTR(cpumask, S_IRUGO, l2_cache_pmu_cpumask_show, NULL);
                               ^
   include/linux/sysfs.h:104:10: note: in definition of macro '__ATTR'
     .show = _show,      \
             ^~~~~
   In file included from drivers//perf/qcom_l2_pmu.c:24:0:
>> drivers//perf/qcom_l2_pmu.c:714:17: error: invalid storage class for function 'l2_code_show'
    PMU_FORMAT_ATTR(l2_code,   "config:4-11");
                    ^
   include/linux/perf_event.h:1377:1: note: in definition of macro 'PMU_FORMAT_ATTR'
    _name##_show(struct device *dev,     \
    ^~~~~
   In file included from include/linux/kobject.h:20:0,
                    from include/linux/device.h:16,
                    from include/linux/acpi.h:27,
                    from drivers//perf/qcom_l2_pmu.c:12:
   drivers//perf/qcom_l2_pmu.c:714:17: error: initializer element is not constant
    PMU_FORMAT_ATTR(l2_code,   "config:4-11");
                    ^
   include/linux/sysfs.h:117:10: note: in definition of macro '__ATTR_RO'
     .show = _name##_show,      \
             ^~~~~
>> drivers//perf/qcom_l2_pmu.c:714:1: note: in expansion of macro 'PMU_FORMAT_ATTR'
    PMU_FORMAT_ATTR(l2_code,   "config:4-11");
    ^~~~~~~~~~~~~~~
   drivers//perf/qcom_l2_pmu.c:714:17: note: (near initialization for 'format_attr_l2_code.show')
    PMU_FORMAT_ATTR(l2_code,   "config:4-11");
                    ^
   include/linux/sysfs.h:117:10: note: in definition of macro '__ATTR_RO'
     .show = _name##_show,      \
             ^~~~~
>> drivers//perf/qcom_l2_pmu.c:714:1: note: in expansion of macro 'PMU_FORMAT_ATTR'
    PMU_FORMAT_ATTR(l2_code,   "config:4-11");
    ^~~~~~~~~~~~~~~
   In file included from drivers//perf/qcom_l2_pmu.c:24:0:
>> drivers//perf/qcom_l2_pmu.c:715:17: error: invalid storage class for function 'l2_group_show'
    PMU_FORMAT_ATTR(l2_group,  "config:0-3");
                    ^
   include/linux/perf_event.h:1377:1: note: in definition of macro 'PMU_FORMAT_ATTR'
    _name##_show(struct device *dev,     \
    ^~~~~
   In file included from include/linux/kobject.h:20:0,
                    from include/linux/device.h:16,
                    from include/linux/acpi.h:27,
                    from drivers//perf/qcom_l2_pmu.c:12:
   drivers//perf/qcom_l2_pmu.c:715:17: error: initializer element is not constant
    PMU_FORMAT_ATTR(l2_group,  "config:0-3");
                    ^
   include/linux/sysfs.h:117:10: note: in definition of macro '__ATTR_RO'
     .show = _name##_show,      \
             ^~~~~
   drivers//perf/qcom_l2_pmu.c:715:1: note: in expansion of macro 'PMU_FORMAT_ATTR'
    PMU_FORMAT_ATTR(l2_group,  "config:0-3");
    ^~~~~~~~~~~~~~~
   drivers//perf/qcom_l2_pmu.c:715:17: note: (near initialization for 'format_attr_l2_group.show')
    PMU_FORMAT_ATTR(l2_group,  "config:0-3");
                    ^
   include/linux/sysfs.h:117:10: note: in definition of macro '__ATTR_RO'
     .show = _name##_show,      \
             ^~~~~
   drivers//perf/qcom_l2_pmu.c:715:1: note: in expansion of macro 'PMU_FORMAT_ATTR'
    PMU_FORMAT_ATTR(l2_group,  "config:0-3");
    ^~~~~~~~~~~~~~~
   In file included from drivers//perf/qcom_l2_pmu.c:24:0:
>> drivers//perf/qcom_l2_pmu.c:716:17: error: invalid storage class for function 'event_show'
    PMU_FORMAT_ATTR(event,     "config:0-11");
                    ^
   include/linux/perf_event.h:1377:1: note: in definition of macro 'PMU_FORMAT_ATTR'
    _name##_show(struct device *dev,     \
    ^~~~~
   In file included from include/linux/kobject.h:20:0,
                    from include/linux/device.h:16,
                    from include/linux/acpi.h:27,
                    from drivers//perf/qcom_l2_pmu.c:12:
   drivers//perf/qcom_l2_pmu.c:716:17: error: initializer element is not constant
    PMU_FORMAT_ATTR(event,     "config:0-11");
                    ^
   include/linux/sysfs.h:117:10: note: in definition of macro '__ATTR_RO'
     .show = _name##_show,      \
             ^~~~~
   drivers//perf/qcom_l2_pmu.c:716:1: note: in expansion of macro 'PMU_FORMAT_ATTR'
    PMU_FORMAT_ATTR(event,     "config:0-11");
    ^~~~~~~~~~~~~~~
   drivers//perf/qcom_l2_pmu.c:716:17: note: (near initialization for 'format_attr_event.show')
    PMU_FORMAT_ATTR(event,     "config:0-11");
                    ^
   include/linux/sysfs.h:117:10: note: in definition of macro '__ATTR_RO'
     .show = _name##_show,      \
             ^~~~~
   drivers//perf/qcom_l2_pmu.c:716:1: note: in expansion of macro 'PMU_FORMAT_ATTR'
    PMU_FORMAT_ATTR(event,     "config:0-11");
    ^~~~~~~~~~~~~~~
>> drivers//perf/qcom_l2_pmu.c:730:16: error: invalid storage class for function 'l2cache_pmu_event_show'
    static ssize_t l2cache_pmu_event_show(struct device *dev,
                   ^~~~~~~~~~~~~~~~~~~~~~
   drivers//perf/qcom_l2_pmu.c:740:2: error: initializer element is not constant
     (&((struct perf_pmu_events_attr[]) {         \
     ^
>> drivers//perf/qcom_l2_pmu.c:746:2: note: in expansion of macro 'L2CACHE_EVENT_ATTR'
     L2CACHE_EVENT_ATTR(cycles, L2_EVENT_CYCLES),
     ^~~~~~~~~~~~~~~~~~
   drivers//perf/qcom_l2_pmu.c:740:2: note: (near initialization for 'l2_cache_pmu_events[0]')
     (&((struct perf_pmu_events_attr[]) {         \
     ^
>> drivers//perf/qcom_l2_pmu.c:746:2: note: in expansion of macro 'L2CACHE_EVENT_ATTR'
     L2CACHE_EVENT_ATTR(cycles, L2_EVENT_CYCLES),
     ^~~~~~~~~~~~~~~~~~
>> drivers//perf/qcom_l2_pmu.c:781:12: error: invalid storage class for function 'get_num_counters'
    static int get_num_counters(void)
               ^~~~~~~~~~~~~~~~
>> drivers//perf/qcom_l2_pmu.c:794:28: error: invalid storage class for function 'l2_cache_associate_cpu_with_cluster'
    static struct cluster_pmu *l2_cache_associate_cpu_with_cluster(
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers//perf/qcom_l2_pmu.c:827:12: error: invalid storage class for function 'l2cache_pmu_online_cpu'
    static int l2cache_pmu_online_cpu(unsigned int cpu, struct hlist_node *node)
               ^~~~~~~~~~~~~~~~~~~~~~
>> drivers//perf/qcom_l2_pmu.c:862:12: error: invalid storage class for function 'l2cache_pmu_offline_cpu'
    static int l2cache_pmu_offline_cpu(unsigned int cpu, struct hlist_node *node)
               ^~~~~~~~~~~~~~~~~~~~~~~

vim +/l2_cache_event_start +598 drivers//perf/qcom_l2_pmu.c

21bdbb710 Neil Leeder 2017-02-07  597  
21bdbb710 Neil Leeder 2017-02-07 @598  static void l2_cache_event_start(struct perf_event *event, int flags)
21bdbb710 Neil Leeder 2017-02-07  599  {
21bdbb710 Neil Leeder 2017-02-07  600  	struct cluster_pmu *cluster;
21bdbb710 Neil Leeder 2017-02-07  601  	struct hw_perf_event *hwc = &event->hw;
21bdbb710 Neil Leeder 2017-02-07  602  	int idx = hwc->idx;
21bdbb710 Neil Leeder 2017-02-07  603  	u32 config;
21bdbb710 Neil Leeder 2017-02-07  604  	u32 event_cc, event_group;
21bdbb710 Neil Leeder 2017-02-07  605  
21bdbb710 Neil Leeder 2017-02-07  606  	hwc->state = 0;
21bdbb710 Neil Leeder 2017-02-07  607  
21bdbb710 Neil Leeder 2017-02-07  608  	cluster = get_cluster_pmu(to_l2cache_pmu(event->pmu), event->cpu);
21bdbb710 Neil Leeder 2017-02-07  609  
21bdbb710 Neil Leeder 2017-02-07  610  	l2_cache_cluster_set_period(cluster, hwc);
21bdbb710 Neil Leeder 2017-02-07  611  
21bdbb710 Neil Leeder 2017-02-07  612  	if (hwc->config_base == L2CYCLE_CTR_RAW_CODE) {
21bdbb710 Neil Leeder 2017-02-07  613  		cluster_pmu_set_evccntcr(0);
21bdbb710 Neil Leeder 2017-02-07  614  	} else {
21bdbb710 Neil Leeder 2017-02-07  615  		config = hwc->config_base;
21bdbb710 Neil Leeder 2017-02-07  616  		event_cc    = L2_EVT_CODE(config);
21bdbb710 Neil Leeder 2017-02-07  617  		event_group = L2_EVT_GROUP(config);
21bdbb710 Neil Leeder 2017-02-07  618  
21bdbb710 Neil Leeder 2017-02-07  619  		cluster_pmu_set_evcntcr(idx, 0);
21bdbb710 Neil Leeder 2017-02-07  620  		cluster_pmu_set_evtyper(idx, event_group);
21bdbb710 Neil Leeder 2017-02-07  621  		cluster_pmu_set_resr(cluster, event_group, event_cc);
21bdbb710 Neil Leeder 2017-02-07  622  		cluster_pmu_set_evfilter_sys_mode(idx);
21bdbb710 Neil Leeder 2017-02-07  623  	}
21bdbb710 Neil Leeder 2017-02-07  624  
21bdbb710 Neil Leeder 2017-02-07  625  	cluster_pmu_counter_enable_interrupt(idx);
21bdbb710 Neil Leeder 2017-02-07  626  	cluster_pmu_counter_enable(idx);
21bdbb710 Neil Leeder 2017-02-07  627  }
21bdbb710 Neil Leeder 2017-02-07  628  
21bdbb710 Neil Leeder 2017-02-07 @629  static void l2_cache_event_stop(struct perf_event *event, int flags)
21bdbb710 Neil Leeder 2017-02-07  630  {
21bdbb710 Neil Leeder 2017-02-07  631  	struct hw_perf_event *hwc = &event->hw;
21bdbb710 Neil Leeder 2017-02-07  632  	int idx = hwc->idx;
21bdbb710 Neil Leeder 2017-02-07  633  
21bdbb710 Neil Leeder 2017-02-07  634  	if (hwc->state & PERF_HES_STOPPED)
21bdbb710 Neil Leeder 2017-02-07  635  		return;
21bdbb710 Neil Leeder 2017-02-07  636  
21bdbb710 Neil Leeder 2017-02-07  637  	cluster_pmu_counter_disable_interrupt(idx);
21bdbb710 Neil Leeder 2017-02-07  638  	cluster_pmu_counter_disable(idx);
21bdbb710 Neil Leeder 2017-02-07  639  
21bdbb710 Neil Leeder 2017-02-07  640  	if (flags & PERF_EF_UPDATE)
21bdbb710 Neil Leeder 2017-02-07  641  		l2_cache_event_update(event);
21bdbb710 Neil Leeder 2017-02-07  642  	hwc->state |= PERF_HES_STOPPED | PERF_HES_UPTODATE;
21bdbb710 Neil Leeder 2017-02-07  643  }
21bdbb710 Neil Leeder 2017-02-07  644  
21bdbb710 Neil Leeder 2017-02-07 @645  static int l2_cache_event_add(struct perf_event *event, int flags)
21bdbb710 Neil Leeder 2017-02-07  646  {
21bdbb710 Neil Leeder 2017-02-07  647  	struct hw_perf_event *hwc = &event->hw;
21bdbb710 Neil Leeder 2017-02-07  648  	int idx;
21bdbb710 Neil Leeder 2017-02-07  649  	int err = 0;
21bdbb710 Neil Leeder 2017-02-07  650  	struct cluster_pmu *cluster;
21bdbb710 Neil Leeder 2017-02-07  651  
21bdbb710 Neil Leeder 2017-02-07  652  	cluster = get_cluster_pmu(to_l2cache_pmu(event->pmu), event->cpu);
21bdbb710 Neil Leeder 2017-02-07  653  
21bdbb710 Neil Leeder 2017-02-07  654  	idx = l2_cache_get_event_idx(cluster, event);
21bdbb710 Neil Leeder 2017-02-07  655  	if (idx < 0)
21bdbb710 Neil Leeder 2017-02-07  656  		return idx;
21bdbb710 Neil Leeder 2017-02-07  657  
21bdbb710 Neil Leeder 2017-02-07  658  	hwc->idx = idx;
21bdbb710 Neil Leeder 2017-02-07  659  	hwc->state = PERF_HES_STOPPED | PERF_HES_UPTODATE;
21bdbb710 Neil Leeder 2017-02-07  660  	cluster->events[idx] = event;
21bdbb710 Neil Leeder 2017-02-07  661  	local64_set(&hwc->prev_count, 0);
21bdbb710 Neil Leeder 2017-02-07  662  
21bdbb710 Neil Leeder 2017-02-07  663  	if (flags & PERF_EF_START)
21bdbb710 Neil Leeder 2017-02-07  664  		l2_cache_event_start(event, flags);
21bdbb710 Neil Leeder 2017-02-07  665  
21bdbb710 Neil Leeder 2017-02-07  666  	/* Propagate changes to the userspace mapping. */
21bdbb710 Neil Leeder 2017-02-07  667  	perf_event_update_userpage(event);
21bdbb710 Neil Leeder 2017-02-07  668  
21bdbb710 Neil Leeder 2017-02-07  669  	return err;
21bdbb710 Neil Leeder 2017-02-07  670  }
21bdbb710 Neil Leeder 2017-02-07  671  
21bdbb710 Neil Leeder 2017-02-07 @672  static void l2_cache_event_del(struct perf_event *event, int flags)
21bdbb710 Neil Leeder 2017-02-07  673  {
21bdbb710 Neil Leeder 2017-02-07  674  	struct hw_perf_event *hwc = &event->hw;
21bdbb710 Neil Leeder 2017-02-07  675  	struct cluster_pmu *cluster;
21bdbb710 Neil Leeder 2017-02-07  676  	int idx = hwc->idx;
21bdbb710 Neil Leeder 2017-02-07  677  
21bdbb710 Neil Leeder 2017-02-07  678  	cluster = get_cluster_pmu(to_l2cache_pmu(event->pmu), event->cpu);
21bdbb710 Neil Leeder 2017-02-07  679  
21bdbb710 Neil Leeder 2017-02-07  680  	l2_cache_event_stop(event, flags | PERF_EF_UPDATE);
21bdbb710 Neil Leeder 2017-02-07  681  	cluster->events[idx] = NULL;
21bdbb710 Neil Leeder 2017-02-07  682  	l2_cache_clear_event_idx(cluster, event);
21bdbb710 Neil Leeder 2017-02-07  683  
21bdbb710 Neil Leeder 2017-02-07  684  	perf_event_update_userpage(event);
21bdbb710 Neil Leeder 2017-02-07  685  }
21bdbb710 Neil Leeder 2017-02-07  686  
21bdbb710 Neil Leeder 2017-02-07 @687  static void l2_cache_event_read(struct perf_event *event)
21bdbb710 Neil Leeder 2017-02-07  688  {
21bdbb710 Neil Leeder 2017-02-07  689  	l2_cache_event_update(event);
21bdbb710 Neil Leeder 2017-02-07  690  }
21bdbb710 Neil Leeder 2017-02-07  691  
21bdbb710 Neil Leeder 2017-02-07 @692  static ssize_t l2_cache_pmu_cpumask_show(struct device *dev,
21bdbb710 Neil Leeder 2017-02-07  693  					 struct device_attribute *attr,
21bdbb710 Neil Leeder 2017-02-07  694  					 char *buf)
21bdbb710 Neil Leeder 2017-02-07  695  {
21bdbb710 Neil Leeder 2017-02-07  696  	struct l2cache_pmu *l2cache_pmu = to_l2cache_pmu(dev_get_drvdata(dev));
21bdbb710 Neil Leeder 2017-02-07  697  
21bdbb710 Neil Leeder 2017-02-07  698  	return cpumap_print_to_pagebuf(true, buf, &l2cache_pmu->cpumask);
21bdbb710 Neil Leeder 2017-02-07  699  }
21bdbb710 Neil Leeder 2017-02-07  700  
21bdbb710 Neil Leeder 2017-02-07  701  static struct device_attribute l2_cache_pmu_cpumask_attr =
21bdbb710 Neil Leeder 2017-02-07 @702  		__ATTR(cpumask, S_IRUGO, l2_cache_pmu_cpumask_show, NULL);
21bdbb710 Neil Leeder 2017-02-07  703  
21bdbb710 Neil Leeder 2017-02-07  704  static struct attribute *l2_cache_pmu_cpumask_attrs[] = {
21bdbb710 Neil Leeder 2017-02-07  705  	&l2_cache_pmu_cpumask_attr.attr,
21bdbb710 Neil Leeder 2017-02-07  706  	NULL,
21bdbb710 Neil Leeder 2017-02-07  707  };
21bdbb710 Neil Leeder 2017-02-07  708  
21bdbb710 Neil Leeder 2017-02-07  709  static struct attribute_group l2_cache_pmu_cpumask_group = {
21bdbb710 Neil Leeder 2017-02-07  710  	.attrs = l2_cache_pmu_cpumask_attrs,
21bdbb710 Neil Leeder 2017-02-07  711  };
21bdbb710 Neil Leeder 2017-02-07  712  
21bdbb710 Neil Leeder 2017-02-07  713  /* CCG format for perf RAW codes. */
21bdbb710 Neil Leeder 2017-02-07 @714  PMU_FORMAT_ATTR(l2_code,   "config:4-11");
21bdbb710 Neil Leeder 2017-02-07 @715  PMU_FORMAT_ATTR(l2_group,  "config:0-3");
b65423ed4 Neil Leeder 2017-09-14 @716  PMU_FORMAT_ATTR(event,     "config:0-11");
b65423ed4 Neil Leeder 2017-09-14  717  
21bdbb710 Neil Leeder 2017-02-07  718  static struct attribute *l2_cache_pmu_formats[] = {
21bdbb710 Neil Leeder 2017-02-07  719  	&format_attr_l2_code.attr,
21bdbb710 Neil Leeder 2017-02-07  720  	&format_attr_l2_group.attr,
b65423ed4 Neil Leeder 2017-09-14  721  	&format_attr_event.attr,
21bdbb710 Neil Leeder 2017-02-07  722  	NULL,
21bdbb710 Neil Leeder 2017-02-07  723  };
21bdbb710 Neil Leeder 2017-02-07  724  
21bdbb710 Neil Leeder 2017-02-07  725  static struct attribute_group l2_cache_pmu_format_group = {
21bdbb710 Neil Leeder 2017-02-07  726  	.name = "format",
21bdbb710 Neil Leeder 2017-02-07  727  	.attrs = l2_cache_pmu_formats,
21bdbb710 Neil Leeder 2017-02-07  728  };
21bdbb710 Neil Leeder 2017-02-07  729  
b65423ed4 Neil Leeder 2017-09-14 @730  static ssize_t l2cache_pmu_event_show(struct device *dev,
b65423ed4 Neil Leeder 2017-09-14  731  				      struct device_attribute *attr, char *page)
b65423ed4 Neil Leeder 2017-09-14  732  {
b65423ed4 Neil Leeder 2017-09-14  733  	struct perf_pmu_events_attr *pmu_attr;
b65423ed4 Neil Leeder 2017-09-14  734  
b65423ed4 Neil Leeder 2017-09-14  735  	pmu_attr = container_of(attr, struct perf_pmu_events_attr, attr);
b65423ed4 Neil Leeder 2017-09-14  736  	return sprintf(page, "event=0x%02llx\n", pmu_attr->id);
b65423ed4 Neil Leeder 2017-09-14  737  }
b65423ed4 Neil Leeder 2017-09-14  738  
b65423ed4 Neil Leeder 2017-09-14  739  #define L2CACHE_EVENT_ATTR(_name, _id)					     \
b65423ed4 Neil Leeder 2017-09-14 @740  	(&((struct perf_pmu_events_attr[]) {				     \
b65423ed4 Neil Leeder 2017-09-14  741  		{ .attr = __ATTR(_name, 0444, l2cache_pmu_event_show, NULL), \
b65423ed4 Neil Leeder 2017-09-14  742  		  .id = _id, }						     \
b65423ed4 Neil Leeder 2017-09-14  743  	})[0].attr.attr)
b65423ed4 Neil Leeder 2017-09-14  744  
b65423ed4 Neil Leeder 2017-09-14  745  static struct attribute *l2_cache_pmu_events[] = {
b65423ed4 Neil Leeder 2017-09-14 @746  	L2CACHE_EVENT_ATTR(cycles, L2_EVENT_CYCLES),
b65423ed4 Neil Leeder 2017-09-14  747  	L2CACHE_EVENT_ATTR(dcache-ops, L2_EVENT_DCACHE_OPS),
b65423ed4 Neil Leeder 2017-09-14  748  	L2CACHE_EVENT_ATTR(icache-ops, L2_EVENT_ICACHE_OPS),
b65423ed4 Neil Leeder 2017-09-14  749  	L2CACHE_EVENT_ATTR(tlbi, L2_EVENT_TLBI),
b65423ed4 Neil Leeder 2017-09-14  750  	L2CACHE_EVENT_ATTR(barriers, L2_EVENT_BARRIERS),
b65423ed4 Neil Leeder 2017-09-14  751  	L2CACHE_EVENT_ATTR(total-reads, L2_EVENT_TOTAL_READS),
b65423ed4 Neil Leeder 2017-09-14  752  	L2CACHE_EVENT_ATTR(total-writes, L2_EVENT_TOTAL_WRITES),
b65423ed4 Neil Leeder 2017-09-14  753  	L2CACHE_EVENT_ATTR(total-requests, L2_EVENT_TOTAL_REQUESTS),
b65423ed4 Neil Leeder 2017-09-14  754  	L2CACHE_EVENT_ATTR(ldrex, L2_EVENT_LDREX),
b65423ed4 Neil Leeder 2017-09-14  755  	L2CACHE_EVENT_ATTR(strex, L2_EVENT_STREX),
b65423ed4 Neil Leeder 2017-09-14  756  	L2CACHE_EVENT_ATTR(clrex, L2_EVENT_CLREX),
b65423ed4 Neil Leeder 2017-09-14  757  	NULL
b65423ed4 Neil Leeder 2017-09-14  758  };
b65423ed4 Neil Leeder 2017-09-14  759  
b65423ed4 Neil Leeder 2017-09-14  760  static struct attribute_group l2_cache_pmu_events_group = {
b65423ed4 Neil Leeder 2017-09-14  761  	.name = "events",
b65423ed4 Neil Leeder 2017-09-14  762  	.attrs = l2_cache_pmu_events,
b65423ed4 Neil Leeder 2017-09-14  763  };
b65423ed4 Neil Leeder 2017-09-14  764  
21bdbb710 Neil Leeder 2017-02-07  765  static const struct attribute_group *l2_cache_pmu_attr_grps[] = {
21bdbb710 Neil Leeder 2017-02-07  766  	&l2_cache_pmu_format_group,
21bdbb710 Neil Leeder 2017-02-07  767  	&l2_cache_pmu_cpumask_group,
b65423ed4 Neil Leeder 2017-09-14  768  	&l2_cache_pmu_events_group,
21bdbb710 Neil Leeder 2017-02-07  769  	NULL,
21bdbb710 Neil Leeder 2017-02-07  770  };
21bdbb710 Neil Leeder 2017-02-07  771  
21bdbb710 Neil Leeder 2017-02-07  772  /*
21bdbb710 Neil Leeder 2017-02-07  773   * Generic device handlers
21bdbb710 Neil Leeder 2017-02-07  774   */
21bdbb710 Neil Leeder 2017-02-07  775  
21bdbb710 Neil Leeder 2017-02-07  776  static const struct acpi_device_id l2_cache_pmu_acpi_match[] = {
21bdbb710 Neil Leeder 2017-02-07  777  	{ "QCOM8130", },
21bdbb710 Neil Leeder 2017-02-07  778  	{ }
21bdbb710 Neil Leeder 2017-02-07  779  };
21bdbb710 Neil Leeder 2017-02-07  780  
21bdbb710 Neil Leeder 2017-02-07 @781  static int get_num_counters(void)
21bdbb710 Neil Leeder 2017-02-07  782  {
21bdbb710 Neil Leeder 2017-02-07  783  	int val;
21bdbb710 Neil Leeder 2017-02-07  784  
21bdbb710 Neil Leeder 2017-02-07  785  	val = get_l2_indirect_reg(L2PMCR);
21bdbb710 Neil Leeder 2017-02-07  786  
21bdbb710 Neil Leeder 2017-02-07  787  	/*
21bdbb710 Neil Leeder 2017-02-07  788  	 * Read number of counters from L2PMCR and add 1
21bdbb710 Neil Leeder 2017-02-07  789  	 * for the cycle counter.
21bdbb710 Neil Leeder 2017-02-07  790  	 */
21bdbb710 Neil Leeder 2017-02-07  791  	return ((val >> L2PMCR_NUM_EV_SHIFT) & L2PMCR_NUM_EV_MASK) + 1;
21bdbb710 Neil Leeder 2017-02-07  792  }
21bdbb710 Neil Leeder 2017-02-07  793  
21bdbb710 Neil Leeder 2017-02-07 @794  static struct cluster_pmu *l2_cache_associate_cpu_with_cluster(
21bdbb710 Neil Leeder 2017-02-07  795  	struct l2cache_pmu *l2cache_pmu, int cpu)
21bdbb710 Neil Leeder 2017-02-07  796  {
21bdbb710 Neil Leeder 2017-02-07  797  	u64 mpidr;
21bdbb710 Neil Leeder 2017-02-07  798  	int cpu_cluster_id;
21bdbb710 Neil Leeder 2017-02-07  799  	struct cluster_pmu *cluster = NULL;
21bdbb710 Neil Leeder 2017-02-07  800  
21bdbb710 Neil Leeder 2017-02-07  801  	/*
21bdbb710 Neil Leeder 2017-02-07  802  	 * This assumes that the cluster_id is in MPIDR[aff1] for
21bdbb710 Neil Leeder 2017-02-07  803  	 * single-threaded cores, and MPIDR[aff2] for multi-threaded
21bdbb710 Neil Leeder 2017-02-07  804  	 * cores. This logic will have to be updated if this changes.
21bdbb710 Neil Leeder 2017-02-07  805  	 */
21bdbb710 Neil Leeder 2017-02-07  806  	mpidr = read_cpuid_mpidr();
21bdbb710 Neil Leeder 2017-02-07  807  	if (mpidr & MPIDR_MT_BITMASK)
21bdbb710 Neil Leeder 2017-02-07  808  		cpu_cluster_id = MPIDR_AFFINITY_LEVEL(mpidr, 2);
21bdbb710 Neil Leeder 2017-02-07  809  	else
21bdbb710 Neil Leeder 2017-02-07  810  		cpu_cluster_id = MPIDR_AFFINITY_LEVEL(mpidr, 1);
21bdbb710 Neil Leeder 2017-02-07  811  
21bdbb710 Neil Leeder 2017-02-07  812  	list_for_each_entry(cluster, &l2cache_pmu->clusters, next) {
21bdbb710 Neil Leeder 2017-02-07  813  		if (cluster->cluster_id != cpu_cluster_id)
21bdbb710 Neil Leeder 2017-02-07  814  			continue;
21bdbb710 Neil Leeder 2017-02-07  815  
21bdbb710 Neil Leeder 2017-02-07  816  		dev_info(&l2cache_pmu->pdev->dev,
21bdbb710 Neil Leeder 2017-02-07  817  			 "CPU%d associated with cluster %d\n", cpu,
21bdbb710 Neil Leeder 2017-02-07  818  			 cluster->cluster_id);
21bdbb710 Neil Leeder 2017-02-07  819  		cpumask_set_cpu(cpu, &cluster->cluster_cpus);
21bdbb710 Neil Leeder 2017-02-07  820  		*per_cpu_ptr(l2cache_pmu->pmu_cluster, cpu) = cluster;
21bdbb710 Neil Leeder 2017-02-07  821  		break;
21bdbb710 Neil Leeder 2017-02-07  822  	}
21bdbb710 Neil Leeder 2017-02-07  823  
21bdbb710 Neil Leeder 2017-02-07  824  	return cluster;
21bdbb710 Neil Leeder 2017-02-07  825  }
21bdbb710 Neil Leeder 2017-02-07  826  

:::::: The code at line 598 was first introduced by commit
:::::: 21bdbb7102edeaebb5ec4ef530c8f442f7562c96 perf: add qcom l2 cache perf events driver

:::::: TO: Neil Leeder <nleeder@...eaurora.org>
:::::: CC: Will Deacon <will.deacon@....com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Download attachment ".config.gz" of type "application/gzip" (59081 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ