diff mbox series

[04/10] perf: Rename PERF_PMU_CAP_NO_INTERRUPT

Message ID 0999a39f0a068979dbcc6119380f63d706101b4f.1710257512.git.robin.murphy@arm.com (mailing list archive)
State New, archived
Headers show
Series perf: Clean up common uncore boilerplate | expand

Commit Message

Robin Murphy March 12, 2024, 5:34 p.m. UTC
The PERF_PMU_CAP_NO_INTERRUPT flag is used by the core solely to
determine whether PMUs can support sampling events or not. It makes
sense to utilise the same capability for non-CPU-affine PMUs which have
no relevant state to sample, but it would be a rather confusing misnomer
when such PMUs do still have interrupts for handling overflows. Let's
rename it to represent what it actually means.

Signed-off-by: Robin Murphy <robin.murphy@arm.com>
---
 arch/arc/kernel/perf_event.c              | 2 +-
 arch/csky/kernel/perf_event.c             | 2 +-
 arch/powerpc/perf/8xx-pmu.c               | 2 +-
 arch/powerpc/perf/hv-24x7.c               | 2 +-
 arch/powerpc/perf/hv-gpci.c               | 2 +-
 arch/powerpc/platforms/pseries/papr_scm.c | 2 +-
 arch/s390/kernel/perf_cpum_cf.c           | 2 +-
 arch/sh/kernel/perf_event.c               | 2 +-
 arch/x86/events/amd/uncore.c              | 6 +++---
 arch/x86/events/core.c                    | 2 +-
 arch/x86/events/intel/cstate.c            | 6 +++---
 arch/x86/events/msr.c                     | 2 +-
 drivers/fpga/dfl-fme-perf.c               | 2 +-
 drivers/perf/arm_cspmu/arm_cspmu.c        | 2 +-
 drivers/perf/arm_pmu_platform.c           | 2 +-
 drivers/perf/marvell_cn10k_tad_pmu.c      | 2 +-
 drivers/perf/riscv_pmu_sbi.c              | 2 +-
 include/linux/perf_event.h                | 2 +-
 kernel/events/core.c                      | 2 +-
 19 files changed, 23 insertions(+), 23 deletions(-)

Comments

kernel test robot March 13, 2024, 12:05 p.m. UTC | #1
Hi Robin,

kernel test robot noticed the following build errors:

[auto build test ERROR on perf-tools-next/perf-tools-next]
[also build test ERROR on perf-tools/perf-tools linus/master v6.8 next-20240313]
[cannot apply to acme/perf/core tip/perf/core]
[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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Robin-Murphy/perf-alibaba_uncore_drw-Use-correct-CPU-affinity/20240313-013915
base:   https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git perf-tools-next
patch link:    https://lore.kernel.org/r/0999a39f0a068979dbcc6119380f63d706101b4f.1710257512.git.robin.murphy%40arm.com
patch subject: [PATCH 04/10] perf: Rename PERF_PMU_CAP_NO_INTERRUPT
config: x86_64-allnoconfig (https://download.01.org/0day-ci/archive/20240313/202403131930.sz1VjXDw-lkp@intel.com/config)
compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240313/202403131930.sz1VjXDw-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202403131930.sz1VjXDw-lkp@intel.com/

All errors (new ones prefixed by >>):

>> arch/x86/events/core.c:1815:46: error: expected ';' after expression
    1815 |         pmu.capabilities |= PERF_PMU_CAP_NO_SAMPLING
         |                                                     ^
         |                                                     ;
   1 error generated.


vim +1815 arch/x86/events/core.c

  1799	
  1800	static void __init pmu_check_apic(void)
  1801	{
  1802		if (boot_cpu_has(X86_FEATURE_APIC))
  1803			return;
  1804	
  1805		x86_pmu.apic = 0;
  1806		pr_info("no APIC, boot with the \"lapic\" boot parameter to force-enable it.\n");
  1807		pr_info("no hardware sampling interrupt available.\n");
  1808	
  1809		/*
  1810		 * If we have a PMU initialized but no APIC
  1811		 * interrupts, we cannot sample hardware
  1812		 * events (user-space has to fall back and
  1813		 * sample via a hrtimer based software event):
  1814		 */
> 1815		pmu.capabilities |= PERF_PMU_CAP_NO_SAMPLING
  1816
kernel test robot March 13, 2024, 3:44 p.m. UTC | #2
Hi Robin,

kernel test robot noticed the following build warnings:

[auto build test WARNING on perf-tools-next/perf-tools-next]
[also build test WARNING on perf-tools/perf-tools linus/master v6.8 next-20240313]
[cannot apply to acme/perf/core tip/perf/core]
[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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Robin-Murphy/perf-alibaba_uncore_drw-Use-correct-CPU-affinity/20240313-013915
base:   https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git perf-tools-next
patch link:    https://lore.kernel.org/r/0999a39f0a068979dbcc6119380f63d706101b4f.1710257512.git.robin.murphy%40arm.com
patch subject: [PATCH 04/10] perf: Rename PERF_PMU_CAP_NO_INTERRUPT
config: powerpc-allmodconfig (https://download.01.org/0day-ci/archive/20240313/202403132349.Ph0CYSV2-lkp@intel.com/config)
compiler: powerpc64-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240313/202403132349.Ph0CYSV2-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202403132349.Ph0CYSV2-lkp@intel.com/

All warnings (new ones prefixed by >>):

   arch/powerpc/perf/hv-24x7.c: In function 'hv_24x7_init':
   arch/powerpc/perf/hv-24x7.c:1742:9: error: expected ';' before 'r'
    1742 |         r = create_events_from_catalog(&event_group.attrs,
         |         ^
   arch/powerpc/perf/hv-24x7.c: At top level:
>> arch/powerpc/perf/hv-24x7.c:764:12: warning: 'create_events_from_catalog' defined but not used [-Wunused-function]
     764 | static int create_events_from_catalog(struct attribute ***events_,
         |            ^~~~~~~~~~~~~~~~~~~~~~~~~~


vim +/create_events_from_catalog +764 arch/powerpc/perf/hv-24x7.c

5c5cd7b502595f Cody P Schafer        2015-01-30   763  
7debc970ae7a55 Li Zhong              2015-04-13  @764  static int create_events_from_catalog(struct attribute ***events_,
5c5cd7b502595f Cody P Schafer        2015-01-30   765  				      struct attribute ***event_descs_,
5c5cd7b502595f Cody P Schafer        2015-01-30   766  				      struct attribute ***event_long_descs_)
5c5cd7b502595f Cody P Schafer        2015-01-30   767  {
38d81846106bb1 Thiago Jung Bauermann 2017-06-29   768  	long hret;
5c5cd7b502595f Cody P Schafer        2015-01-30   769  	size_t catalog_len, catalog_page_len, event_entry_count,
5c5cd7b502595f Cody P Schafer        2015-01-30   770  	       event_data_len, event_data_offs,
5c5cd7b502595f Cody P Schafer        2015-01-30   771  	       event_data_bytes, junk_events, event_idx, event_attr_ct, i,
5c5cd7b502595f Cody P Schafer        2015-01-30   772  	       attr_max, event_idx_last, desc_ct, long_desc_ct;
5c5cd7b502595f Cody P Schafer        2015-01-30   773  	ssize_t ct, ev_len;
12bf85a71000af Thiago Jung Bauermann 2017-06-29   774  	uint64_t catalog_version_num;
5c5cd7b502595f Cody P Schafer        2015-01-30   775  	struct attribute **events, **event_descs, **event_long_descs;
5c5cd7b502595f Cody P Schafer        2015-01-30   776  	struct hv_24x7_catalog_page_0 *page_0 =
5c5cd7b502595f Cody P Schafer        2015-01-30   777  		kmem_cache_alloc(hv_page_cache, GFP_KERNEL);
5c5cd7b502595f Cody P Schafer        2015-01-30   778  	void *page = page_0;
5c5cd7b502595f Cody P Schafer        2015-01-30   779  	void *event_data, *end;
5c5cd7b502595f Cody P Schafer        2015-01-30   780  	struct hv_24x7_event_data *event;
5c5cd7b502595f Cody P Schafer        2015-01-30   781  	struct rb_root ev_uniq = RB_ROOT;
7debc970ae7a55 Li Zhong              2015-04-13   782  	int ret = 0;
5c5cd7b502595f Cody P Schafer        2015-01-30   783  
7debc970ae7a55 Li Zhong              2015-04-13   784  	if (!page) {
7debc970ae7a55 Li Zhong              2015-04-13   785  		ret = -ENOMEM;
5c5cd7b502595f Cody P Schafer        2015-01-30   786  		goto e_out;
7debc970ae7a55 Li Zhong              2015-04-13   787  	}
5c5cd7b502595f Cody P Schafer        2015-01-30   788  
5c5cd7b502595f Cody P Schafer        2015-01-30   789  	hret = h_get_24x7_catalog_page(page, 0, 0);
7debc970ae7a55 Li Zhong              2015-04-13   790  	if (hret) {
7debc970ae7a55 Li Zhong              2015-04-13   791  		ret = -EIO;
5c5cd7b502595f Cody P Schafer        2015-01-30   792  		goto e_free;
7debc970ae7a55 Li Zhong              2015-04-13   793  	}
5c5cd7b502595f Cody P Schafer        2015-01-30   794  
5c5cd7b502595f Cody P Schafer        2015-01-30   795  	catalog_version_num = be64_to_cpu(page_0->version);
5c5cd7b502595f Cody P Schafer        2015-01-30   796  	catalog_page_len = be32_to_cpu(page_0->length);
5c5cd7b502595f Cody P Schafer        2015-01-30   797  
5c5cd7b502595f Cody P Schafer        2015-01-30   798  	if (MAX_4K < catalog_page_len) {
5c5cd7b502595f Cody P Schafer        2015-01-30   799  		pr_err("invalid page count: %zu\n", catalog_page_len);
7debc970ae7a55 Li Zhong              2015-04-13   800  		ret = -EIO;
5c5cd7b502595f Cody P Schafer        2015-01-30   801  		goto e_free;
5c5cd7b502595f Cody P Schafer        2015-01-30   802  	}
5c5cd7b502595f Cody P Schafer        2015-01-30   803  
5c5cd7b502595f Cody P Schafer        2015-01-30   804  	catalog_len = catalog_page_len * 4096;
5c5cd7b502595f Cody P Schafer        2015-01-30   805  
5c5cd7b502595f Cody P Schafer        2015-01-30   806  	event_entry_count = be16_to_cpu(page_0->event_entry_count);
5c5cd7b502595f Cody P Schafer        2015-01-30   807  	event_data_offs   = be16_to_cpu(page_0->event_data_offs);
5c5cd7b502595f Cody P Schafer        2015-01-30   808  	event_data_len    = be16_to_cpu(page_0->event_data_len);
5c5cd7b502595f Cody P Schafer        2015-01-30   809  
12bf85a71000af Thiago Jung Bauermann 2017-06-29   810  	pr_devel("cv %llu cl %zu eec %zu edo %zu edl %zu\n",
12bf85a71000af Thiago Jung Bauermann 2017-06-29   811  			catalog_version_num, catalog_len,
5c5cd7b502595f Cody P Schafer        2015-01-30   812  			event_entry_count, event_data_offs, event_data_len);
5c5cd7b502595f Cody P Schafer        2015-01-30   813  
5c5cd7b502595f Cody P Schafer        2015-01-30   814  	if ((MAX_4K < event_data_len)
5c5cd7b502595f Cody P Schafer        2015-01-30   815  			|| (MAX_4K < event_data_offs)
5c5cd7b502595f Cody P Schafer        2015-01-30   816  			|| (MAX_4K - event_data_offs < event_data_len)) {
5c5cd7b502595f Cody P Schafer        2015-01-30   817  		pr_err("invalid event data offs %zu and/or len %zu\n",
5c5cd7b502595f Cody P Schafer        2015-01-30   818  				event_data_offs, event_data_len);
7debc970ae7a55 Li Zhong              2015-04-13   819  		ret = -EIO;
5c5cd7b502595f Cody P Schafer        2015-01-30   820  		goto e_free;
5c5cd7b502595f Cody P Schafer        2015-01-30   821  	}
5c5cd7b502595f Cody P Schafer        2015-01-30   822  
5c5cd7b502595f Cody P Schafer        2015-01-30   823  	if ((event_data_offs + event_data_len) > catalog_page_len) {
5c5cd7b502595f Cody P Schafer        2015-01-30   824  		pr_err("event data %zu-%zu does not fit inside catalog 0-%zu\n",
5c5cd7b502595f Cody P Schafer        2015-01-30   825  				event_data_offs,
5c5cd7b502595f Cody P Schafer        2015-01-30   826  				event_data_offs + event_data_len,
5c5cd7b502595f Cody P Schafer        2015-01-30   827  				catalog_page_len);
7debc970ae7a55 Li Zhong              2015-04-13   828  		ret = -EIO;
5c5cd7b502595f Cody P Schafer        2015-01-30   829  		goto e_free;
5c5cd7b502595f Cody P Schafer        2015-01-30   830  	}
5c5cd7b502595f Cody P Schafer        2015-01-30   831  
8f69dc701aac17 Sukadev Bhattiprolu   2016-02-16   832  	if (SIZE_MAX - 1 < event_entry_count) {
8f69dc701aac17 Sukadev Bhattiprolu   2016-02-16   833  		pr_err("event_entry_count %zu is invalid\n", event_entry_count);
7debc970ae7a55 Li Zhong              2015-04-13   834  		ret = -EIO;
5c5cd7b502595f Cody P Schafer        2015-01-30   835  		goto e_free;
5c5cd7b502595f Cody P Schafer        2015-01-30   836  	}
5c5cd7b502595f Cody P Schafer        2015-01-30   837  
5c5cd7b502595f Cody P Schafer        2015-01-30   838  	event_data_bytes = event_data_len * 4096;
5c5cd7b502595f Cody P Schafer        2015-01-30   839  
5c5cd7b502595f Cody P Schafer        2015-01-30   840  	/*
5c5cd7b502595f Cody P Schafer        2015-01-30   841  	 * event data can span several pages, events can cross between these
5c5cd7b502595f Cody P Schafer        2015-01-30   842  	 * pages. Use vmalloc to make this easier.
5c5cd7b502595f Cody P Schafer        2015-01-30   843  	 */
5c5cd7b502595f Cody P Schafer        2015-01-30   844  	event_data = vmalloc(event_data_bytes);
5c5cd7b502595f Cody P Schafer        2015-01-30   845  	if (!event_data) {
5c5cd7b502595f Cody P Schafer        2015-01-30   846  		pr_err("could not allocate event data\n");
7debc970ae7a55 Li Zhong              2015-04-13   847  		ret = -ENOMEM;
5c5cd7b502595f Cody P Schafer        2015-01-30   848  		goto e_free;
5c5cd7b502595f Cody P Schafer        2015-01-30   849  	}
5c5cd7b502595f Cody P Schafer        2015-01-30   850  
5c5cd7b502595f Cody P Schafer        2015-01-30   851  	end = event_data + event_data_bytes;
5c5cd7b502595f Cody P Schafer        2015-01-30   852  
5c5cd7b502595f Cody P Schafer        2015-01-30   853  	/*
5c5cd7b502595f Cody P Schafer        2015-01-30   854  	 * using vmalloc_to_phys() like this only works if PAGE_SIZE is
5c5cd7b502595f Cody P Schafer        2015-01-30   855  	 * divisible by 4096
5c5cd7b502595f Cody P Schafer        2015-01-30   856  	 */
5c5cd7b502595f Cody P Schafer        2015-01-30   857  	BUILD_BUG_ON(PAGE_SIZE % 4096);
5c5cd7b502595f Cody P Schafer        2015-01-30   858  
5c5cd7b502595f Cody P Schafer        2015-01-30   859  	for (i = 0; i < event_data_len; i++) {
5c5cd7b502595f Cody P Schafer        2015-01-30   860  		hret = h_get_24x7_catalog_page_(
5c5cd7b502595f Cody P Schafer        2015-01-30   861  				vmalloc_to_phys(event_data + i * 4096),
5c5cd7b502595f Cody P Schafer        2015-01-30   862  				catalog_version_num,
5c5cd7b502595f Cody P Schafer        2015-01-30   863  				i + event_data_offs);
5c5cd7b502595f Cody P Schafer        2015-01-30   864  		if (hret) {
12bf85a71000af Thiago Jung Bauermann 2017-06-29   865  			pr_err("Failed to get event data in page %zu: rc=%ld\n",
12bf85a71000af Thiago Jung Bauermann 2017-06-29   866  			       i + event_data_offs, hret);
7debc970ae7a55 Li Zhong              2015-04-13   867  			ret = -EIO;
5c5cd7b502595f Cody P Schafer        2015-01-30   868  			goto e_event_data;
5c5cd7b502595f Cody P Schafer        2015-01-30   869  		}
5c5cd7b502595f Cody P Schafer        2015-01-30   870  	}
5c5cd7b502595f Cody P Schafer        2015-01-30   871  
5c5cd7b502595f Cody P Schafer        2015-01-30   872  	/*
5c5cd7b502595f Cody P Schafer        2015-01-30   873  	 * scan the catalog to determine the number of attributes we need, and
5c5cd7b502595f Cody P Schafer        2015-01-30   874  	 * verify it at the same time.
5c5cd7b502595f Cody P Schafer        2015-01-30   875  	 */
5c5cd7b502595f Cody P Schafer        2015-01-30   876  	for (junk_events = 0, event = event_data, event_idx = 0, attr_max = 0;
5c5cd7b502595f Cody P Schafer        2015-01-30   877  	     ;
5c5cd7b502595f Cody P Schafer        2015-01-30   878  	     event_idx++, event = (void *)event + ev_len) {
5c5cd7b502595f Cody P Schafer        2015-01-30   879  		size_t offset = (void *)event - (void *)event_data;
5c5cd7b502595f Cody P Schafer        2015-01-30   880  		char *name;
5c5cd7b502595f Cody P Schafer        2015-01-30   881  		int nl;
5c5cd7b502595f Cody P Schafer        2015-01-30   882  
5c5cd7b502595f Cody P Schafer        2015-01-30   883  		ev_len = catalog_event_len_validate(event, event_idx,
5c5cd7b502595f Cody P Schafer        2015-01-30   884  						    event_data_bytes,
5c5cd7b502595f Cody P Schafer        2015-01-30   885  						    event_entry_count,
5c5cd7b502595f Cody P Schafer        2015-01-30   886  						    offset, end);
5c5cd7b502595f Cody P Schafer        2015-01-30   887  		if (ev_len < 0)
5c5cd7b502595f Cody P Schafer        2015-01-30   888  			break;
5c5cd7b502595f Cody P Schafer        2015-01-30   889  
5c5cd7b502595f Cody P Schafer        2015-01-30   890  		name = event_name(event, &nl);
5c5cd7b502595f Cody P Schafer        2015-01-30   891  
e5f9d8858612c1 Kajol Jain            2020-12-28   892  		if (ignore_event(name)) {
e5f9d8858612c1 Kajol Jain            2020-12-28   893  			junk_events++;
e5f9d8858612c1 Kajol Jain            2020-12-28   894  			continue;
e5f9d8858612c1 Kajol Jain            2020-12-28   895  		}
5c5cd7b502595f Cody P Schafer        2015-01-30   896  		if (event->event_group_record_len == 0) {
5c5cd7b502595f Cody P Schafer        2015-01-30   897  			pr_devel("invalid event %zu (%.*s): group_record_len == 0, skipping\n",
5c5cd7b502595f Cody P Schafer        2015-01-30   898  					event_idx, nl, name);
5c5cd7b502595f Cody P Schafer        2015-01-30   899  			junk_events++;
5c5cd7b502595f Cody P Schafer        2015-01-30   900  			continue;
5c5cd7b502595f Cody P Schafer        2015-01-30   901  		}
5c5cd7b502595f Cody P Schafer        2015-01-30   902  
5c5cd7b502595f Cody P Schafer        2015-01-30   903  		if (!catalog_entry_domain_is_valid(event->domain)) {
5c5cd7b502595f Cody P Schafer        2015-01-30   904  			pr_info("event %zu (%.*s) has invalid domain %d\n",
5c5cd7b502595f Cody P Schafer        2015-01-30   905  					event_idx, nl, name, event->domain);
5c5cd7b502595f Cody P Schafer        2015-01-30   906  			junk_events++;
5c5cd7b502595f Cody P Schafer        2015-01-30   907  			continue;
5c5cd7b502595f Cody P Schafer        2015-01-30   908  		}
5c5cd7b502595f Cody P Schafer        2015-01-30   909  
8f69dc701aac17 Sukadev Bhattiprolu   2016-02-16   910  		attr_max++;
5c5cd7b502595f Cody P Schafer        2015-01-30   911  	}
5c5cd7b502595f Cody P Schafer        2015-01-30   912  
5c5cd7b502595f Cody P Schafer        2015-01-30   913  	event_idx_last = event_idx;
5c5cd7b502595f Cody P Schafer        2015-01-30   914  	if (event_idx_last != event_entry_count)
5c5cd7b502595f Cody P Schafer        2015-01-30   915  		pr_warn("event buffer ended before listed # of events were parsed (got %zu, wanted %zu, junk %zu)\n",
5c5cd7b502595f Cody P Schafer        2015-01-30   916  				event_idx_last, event_entry_count, junk_events);
5c5cd7b502595f Cody P Schafer        2015-01-30   917  
5c5cd7b502595f Cody P Schafer        2015-01-30   918  	events = kmalloc_array(attr_max + 1, sizeof(*events), GFP_KERNEL);
7debc970ae7a55 Li Zhong              2015-04-13   919  	if (!events) {
7debc970ae7a55 Li Zhong              2015-04-13   920  		ret = -ENOMEM;
5c5cd7b502595f Cody P Schafer        2015-01-30   921  		goto e_event_data;
7debc970ae7a55 Li Zhong              2015-04-13   922  	}
5c5cd7b502595f Cody P Schafer        2015-01-30   923  
5c5cd7b502595f Cody P Schafer        2015-01-30   924  	event_descs = kmalloc_array(event_idx + 1, sizeof(*event_descs),
5c5cd7b502595f Cody P Schafer        2015-01-30   925  				GFP_KERNEL);
7debc970ae7a55 Li Zhong              2015-04-13   926  	if (!event_descs) {
7debc970ae7a55 Li Zhong              2015-04-13   927  		ret = -ENOMEM;
5c5cd7b502595f Cody P Schafer        2015-01-30   928  		goto e_event_attrs;
7debc970ae7a55 Li Zhong              2015-04-13   929  	}
5c5cd7b502595f Cody P Schafer        2015-01-30   930  
5c5cd7b502595f Cody P Schafer        2015-01-30   931  	event_long_descs = kmalloc_array(event_idx + 1,
5c5cd7b502595f Cody P Schafer        2015-01-30   932  			sizeof(*event_long_descs), GFP_KERNEL);
7debc970ae7a55 Li Zhong              2015-04-13   933  	if (!event_long_descs) {
7debc970ae7a55 Li Zhong              2015-04-13   934  		ret = -ENOMEM;
5c5cd7b502595f Cody P Schafer        2015-01-30   935  		goto e_event_descs;
7debc970ae7a55 Li Zhong              2015-04-13   936  	}
5c5cd7b502595f Cody P Schafer        2015-01-30   937  
5c5cd7b502595f Cody P Schafer        2015-01-30   938  	/* Iterate over the catalog filling in the attribute vector */
5c5cd7b502595f Cody P Schafer        2015-01-30   939  	for (junk_events = 0, event_attr_ct = 0, desc_ct = 0, long_desc_ct = 0,
5c5cd7b502595f Cody P Schafer        2015-01-30   940  				event = event_data, event_idx = 0;
5c5cd7b502595f Cody P Schafer        2015-01-30   941  			event_idx < event_idx_last;
5c5cd7b502595f Cody P Schafer        2015-01-30   942  			event_idx++, ev_len = be16_to_cpu(event->length),
5c5cd7b502595f Cody P Schafer        2015-01-30   943  				event = (void *)event + ev_len) {
5c5cd7b502595f Cody P Schafer        2015-01-30   944  		char *name;
5c5cd7b502595f Cody P Schafer        2015-01-30   945  		int nl;
5c5cd7b502595f Cody P Schafer        2015-01-30   946  		int nonce;
5c5cd7b502595f Cody P Schafer        2015-01-30   947  		/*
5c5cd7b502595f Cody P Schafer        2015-01-30   948  		 * these are the only "bad" events that are intermixed and that
5c5cd7b502595f Cody P Schafer        2015-01-30   949  		 * we can ignore without issue. make sure to skip them here
5c5cd7b502595f Cody P Schafer        2015-01-30   950  		 */
5c5cd7b502595f Cody P Schafer        2015-01-30   951  		if (event->event_group_record_len == 0)
5c5cd7b502595f Cody P Schafer        2015-01-30   952  			continue;
5c5cd7b502595f Cody P Schafer        2015-01-30   953  		if (!catalog_entry_domain_is_valid(event->domain))
5c5cd7b502595f Cody P Schafer        2015-01-30   954  			continue;
5c5cd7b502595f Cody P Schafer        2015-01-30   955  
5c5cd7b502595f Cody P Schafer        2015-01-30   956  		name  = event_name(event, &nl);
e5f9d8858612c1 Kajol Jain            2020-12-28   957  		if (ignore_event(name))
e5f9d8858612c1 Kajol Jain            2020-12-28   958  			continue;
e5f9d8858612c1 Kajol Jain            2020-12-28   959  
5c5cd7b502595f Cody P Schafer        2015-01-30   960  		nonce = event_uniq_add(&ev_uniq, name, nl, event->domain);
5c5cd7b502595f Cody P Schafer        2015-01-30   961  		ct    = event_data_to_attrs(event_idx, events + event_attr_ct,
5c5cd7b502595f Cody P Schafer        2015-01-30   962  					    event, nonce);
8f69dc701aac17 Sukadev Bhattiprolu   2016-02-16   963  		if (ct < 0) {
5c5cd7b502595f Cody P Schafer        2015-01-30   964  			pr_warn("event %zu (%.*s) creation failure, skipping\n",
5c5cd7b502595f Cody P Schafer        2015-01-30   965  				event_idx, nl, name);
5c5cd7b502595f Cody P Schafer        2015-01-30   966  			junk_events++;
5c5cd7b502595f Cody P Schafer        2015-01-30   967  		} else {
8f69dc701aac17 Sukadev Bhattiprolu   2016-02-16   968  			event_attr_ct++;
5c5cd7b502595f Cody P Schafer        2015-01-30   969  			event_descs[desc_ct] = event_to_desc_attr(event, nonce);
5c5cd7b502595f Cody P Schafer        2015-01-30   970  			if (event_descs[desc_ct])
5c5cd7b502595f Cody P Schafer        2015-01-30   971  				desc_ct++;
5c5cd7b502595f Cody P Schafer        2015-01-30   972  			event_long_descs[long_desc_ct] =
5c5cd7b502595f Cody P Schafer        2015-01-30   973  					event_to_long_desc_attr(event, nonce);
5c5cd7b502595f Cody P Schafer        2015-01-30   974  			if (event_long_descs[long_desc_ct])
5c5cd7b502595f Cody P Schafer        2015-01-30   975  				long_desc_ct++;
5c5cd7b502595f Cody P Schafer        2015-01-30   976  		}
5c5cd7b502595f Cody P Schafer        2015-01-30   977  	}
5c5cd7b502595f Cody P Schafer        2015-01-30   978  
5c5cd7b502595f Cody P Schafer        2015-01-30   979  	pr_info("read %zu catalog entries, created %zu event attrs (%zu failures), %zu descs\n",
5c5cd7b502595f Cody P Schafer        2015-01-30   980  			event_idx, event_attr_ct, junk_events, desc_ct);
5c5cd7b502595f Cody P Schafer        2015-01-30   981  
5c5cd7b502595f Cody P Schafer        2015-01-30   982  	events[event_attr_ct] = NULL;
5c5cd7b502595f Cody P Schafer        2015-01-30   983  	event_descs[desc_ct] = NULL;
5c5cd7b502595f Cody P Schafer        2015-01-30   984  	event_long_descs[long_desc_ct] = NULL;
5c5cd7b502595f Cody P Schafer        2015-01-30   985  
5c5cd7b502595f Cody P Schafer        2015-01-30   986  	event_uniq_destroy(&ev_uniq);
5c5cd7b502595f Cody P Schafer        2015-01-30   987  	vfree(event_data);
5c5cd7b502595f Cody P Schafer        2015-01-30   988  	kmem_cache_free(hv_page_cache, page);
5c5cd7b502595f Cody P Schafer        2015-01-30   989  
5c5cd7b502595f Cody P Schafer        2015-01-30   990  	*events_ = events;
5c5cd7b502595f Cody P Schafer        2015-01-30   991  	*event_descs_ = event_descs;
5c5cd7b502595f Cody P Schafer        2015-01-30   992  	*event_long_descs_ = event_long_descs;
7debc970ae7a55 Li Zhong              2015-04-13   993  	return 0;
5c5cd7b502595f Cody P Schafer        2015-01-30   994  
5c5cd7b502595f Cody P Schafer        2015-01-30   995  e_event_descs:
5c5cd7b502595f Cody P Schafer        2015-01-30   996  	kfree(event_descs);
5c5cd7b502595f Cody P Schafer        2015-01-30   997  e_event_attrs:
5c5cd7b502595f Cody P Schafer        2015-01-30   998  	kfree(events);
5c5cd7b502595f Cody P Schafer        2015-01-30   999  e_event_data:
5c5cd7b502595f Cody P Schafer        2015-01-30  1000  	vfree(event_data);
5c5cd7b502595f Cody P Schafer        2015-01-30  1001  e_free:
5c5cd7b502595f Cody P Schafer        2015-01-30  1002  	kmem_cache_free(hv_page_cache, page);
5c5cd7b502595f Cody P Schafer        2015-01-30  1003  e_out:
5c5cd7b502595f Cody P Schafer        2015-01-30  1004  	*events_ = NULL;
5c5cd7b502595f Cody P Schafer        2015-01-30  1005  	*event_descs_ = NULL;
5c5cd7b502595f Cody P Schafer        2015-01-30  1006  	*event_long_descs_ = NULL;
7debc970ae7a55 Li Zhong              2015-04-13  1007  	return ret;
5c5cd7b502595f Cody P Schafer        2015-01-30  1008  }
5c5cd7b502595f Cody P Schafer        2015-01-30  1009
diff mbox series

Patch

diff --git a/arch/arc/kernel/perf_event.c b/arch/arc/kernel/perf_event.c
index adff957962da..cd02cf7904e8 100644
--- a/arch/arc/kernel/perf_event.c
+++ b/arch/arc/kernel/perf_event.c
@@ -819,7 +819,7 @@  static int arc_pmu_device_probe(struct platform_device *pdev)
 	}
 
 	if (irq == -1)
-		arc_pmu->pmu.capabilities |= PERF_PMU_CAP_NO_INTERRUPT;
+		arc_pmu->pmu.capabilities |= PERF_PMU_CAP_NO_SAMPLING;
 
 	/*
 	 * perf parser doesn't really like '-' symbol in events name, so let's
diff --git a/arch/csky/kernel/perf_event.c b/arch/csky/kernel/perf_event.c
index e5f18420ce64..c733fb29114f 100644
--- a/arch/csky/kernel/perf_event.c
+++ b/arch/csky/kernel/perf_event.c
@@ -1315,7 +1315,7 @@  int csky_pmu_device_probe(struct platform_device *pdev,
 
 	ret = csky_pmu_request_irq(csky_pmu_handle_irq);
 	if (ret) {
-		csky_pmu.pmu.capabilities |= PERF_PMU_CAP_NO_INTERRUPT;
+		csky_pmu.pmu.capabilities |= PERF_PMU_CAP_NO_SAMPLING;
 		pr_notice("[perf] PMU request irq fail!\n");
 	}
 
diff --git a/arch/powerpc/perf/8xx-pmu.c b/arch/powerpc/perf/8xx-pmu.c
index 308a2e40d7be..456de23c2ea7 100644
--- a/arch/powerpc/perf/8xx-pmu.c
+++ b/arch/powerpc/perf/8xx-pmu.c
@@ -181,7 +181,7 @@  static struct pmu mpc8xx_pmu = {
 	.add		= mpc8xx_pmu_add,
 	.del		= mpc8xx_pmu_del,
 	.read		= mpc8xx_pmu_read,
-	.capabilities	= PERF_PMU_CAP_NO_INTERRUPT |
+	.capabilities	= PERF_PMU_CAP_NO_SAMPLING|
 			  PERF_PMU_CAP_NO_NMI,
 };
 
diff --git a/arch/powerpc/perf/hv-24x7.c b/arch/powerpc/perf/hv-24x7.c
index 057ec2e3451d..74821bb193c1 100644
--- a/arch/powerpc/perf/hv-24x7.c
+++ b/arch/powerpc/perf/hv-24x7.c
@@ -1737,7 +1737,7 @@  static int hv_24x7_init(void)
 		return -ENOMEM;
 
 	/* sampling not supported */
-	h_24x7_pmu.capabilities |= PERF_PMU_CAP_NO_INTERRUPT;
+	h_24x7_pmu.capabilities |= PERF_PMU_CAP_NO_SAMPLING
 
 	r = create_events_from_catalog(&event_group.attrs,
 				   &event_desc_group.attrs,
diff --git a/arch/powerpc/perf/hv-gpci.c b/arch/powerpc/perf/hv-gpci.c
index 27f18119fda1..25842f61662c 100644
--- a/arch/powerpc/perf/hv-gpci.c
+++ b/arch/powerpc/perf/hv-gpci.c
@@ -984,7 +984,7 @@  static int hv_gpci_init(void)
 		return r;
 
 	/* sampling not supported */
-	h_gpci_pmu.capabilities |= PERF_PMU_CAP_NO_INTERRUPT;
+	h_gpci_pmu.capabilities |= PERF_PMU_CAP_NO_SAMPLING
 
 	arg = (void *)get_cpu_var(hv_gpci_reqb);
 	memset(arg, 0, HGPCI_REQ_BUFFER_SIZE);
diff --git a/arch/powerpc/platforms/pseries/papr_scm.c b/arch/powerpc/platforms/pseries/papr_scm.c
index 1a53e048ceb7..6415cdabe403 100644
--- a/arch/powerpc/platforms/pseries/papr_scm.c
+++ b/arch/powerpc/platforms/pseries/papr_scm.c
@@ -501,7 +501,7 @@  static void papr_scm_pmu_register(struct papr_scm_priv *p)
 	nd_pmu->pmu.add = papr_scm_pmu_add;
 	nd_pmu->pmu.del = papr_scm_pmu_del;
 
-	nd_pmu->pmu.capabilities = PERF_PMU_CAP_NO_INTERRUPT |
+	nd_pmu->pmu.capabilities = PERF_PMU_CAP_NO_SAMPLING |
 				PERF_PMU_CAP_NO_EXCLUDE;
 
 	/*updating the cpumask variable */
diff --git a/arch/s390/kernel/perf_cpum_cf.c b/arch/s390/kernel/perf_cpum_cf.c
index 41ed6e0f0a2a..8474aafa2075 100644
--- a/arch/s390/kernel/perf_cpum_cf.c
+++ b/arch/s390/kernel/perf_cpum_cf.c
@@ -1054,7 +1054,7 @@  static void cpumf_pmu_del(struct perf_event *event, int flags)
 /* Performance monitoring unit for s390x */
 static struct pmu cpumf_pmu = {
 	.task_ctx_nr  = perf_sw_context,
-	.capabilities = PERF_PMU_CAP_NO_INTERRUPT,
+	.capabilities = PERF_PMU_CAP_NO_SAMPLING
 	.pmu_enable   = cpumf_pmu_enable,
 	.pmu_disable  = cpumf_pmu_disable,
 	.event_init   = cpumf_pmu_event_init,
diff --git a/arch/sh/kernel/perf_event.c b/arch/sh/kernel/perf_event.c
index 1d2507f22437..4bade9b7d357 100644
--- a/arch/sh/kernel/perf_event.c
+++ b/arch/sh/kernel/perf_event.c
@@ -352,7 +352,7 @@  int register_sh_pmu(struct sh_pmu *_pmu)
 	 * no interrupts, and are therefore unable to do sampling without
 	 * further work and timer assistance.
 	 */
-	pmu.capabilities |= PERF_PMU_CAP_NO_INTERRUPT;
+	pmu.capabilities |= PERF_PMU_CAP_NO_SAMPLING
 
 	WARN_ON(_pmu->num_events > MAX_HWEVENTS);
 
diff --git a/arch/x86/events/amd/uncore.c b/arch/x86/events/amd/uncore.c
index 5bf03c575812..4220bf556962 100644
--- a/arch/x86/events/amd/uncore.c
+++ b/arch/x86/events/amd/uncore.c
@@ -700,7 +700,7 @@  int amd_uncore_df_ctx_init(struct amd_uncore *uncore, unsigned int cpu)
 		.start		= amd_uncore_start,
 		.stop		= amd_uncore_stop,
 		.read		= amd_uncore_read,
-		.capabilities	= PERF_PMU_CAP_NO_EXCLUDE | PERF_PMU_CAP_NO_INTERRUPT,
+		.capabilities	= PERF_PMU_CAP_NO_EXCLUDE | PERF_PMU_CAP_NO_SAMPLING,
 		.module		= THIS_MODULE,
 	};
 
@@ -833,7 +833,7 @@  int amd_uncore_l3_ctx_init(struct amd_uncore *uncore, unsigned int cpu)
 		.start		= amd_uncore_start,
 		.stop		= amd_uncore_stop,
 		.read		= amd_uncore_read,
-		.capabilities	= PERF_PMU_CAP_NO_EXCLUDE | PERF_PMU_CAP_NO_INTERRUPT,
+		.capabilities	= PERF_PMU_CAP_NO_EXCLUDE | PERF_PMU_CAP_NO_SAMPLING,
 		.module		= THIS_MODULE,
 	};
 
@@ -958,7 +958,7 @@  int amd_uncore_umc_ctx_init(struct amd_uncore *uncore, unsigned int cpu)
 				.start		= amd_uncore_umc_start,
 				.stop		= amd_uncore_stop,
 				.read		= amd_uncore_read,
-				.capabilities	= PERF_PMU_CAP_NO_EXCLUDE | PERF_PMU_CAP_NO_INTERRUPT,
+				.capabilities	= PERF_PMU_CAP_NO_EXCLUDE | PERF_PMU_CAP_NO_SAMPLING,
 				.module		= THIS_MODULE,
 			};
 
diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c
index 09050641ce5d..20cded91716f 100644
--- a/arch/x86/events/core.c
+++ b/arch/x86/events/core.c
@@ -1812,7 +1812,7 @@  static void __init pmu_check_apic(void)
 	 * events (user-space has to fall back and
 	 * sample via a hrtimer based software event):
 	 */
-	pmu.capabilities |= PERF_PMU_CAP_NO_INTERRUPT;
+	pmu.capabilities |= PERF_PMU_CAP_NO_SAMPLING
 
 }
 
diff --git a/arch/x86/events/intel/cstate.c b/arch/x86/events/intel/cstate.c
index 4b50a3a9818a..3e4ab89d440c 100644
--- a/arch/x86/events/intel/cstate.c
+++ b/arch/x86/events/intel/cstate.c
@@ -530,7 +530,7 @@  static struct pmu cstate_core_pmu = {
 	.start		= cstate_pmu_event_start,
 	.stop		= cstate_pmu_event_stop,
 	.read		= cstate_pmu_event_update,
-	.capabilities	= PERF_PMU_CAP_NO_INTERRUPT | PERF_PMU_CAP_NO_EXCLUDE,
+	.capabilities	= PERF_PMU_CAP_NO_SAMPLING| PERF_PMU_CAP_NO_EXCLUDE,
 	.module		= THIS_MODULE,
 };
 
@@ -545,7 +545,7 @@  static struct pmu cstate_pkg_pmu = {
 	.start		= cstate_pmu_event_start,
 	.stop		= cstate_pmu_event_stop,
 	.read		= cstate_pmu_event_update,
-	.capabilities	= PERF_PMU_CAP_NO_INTERRUPT | PERF_PMU_CAP_NO_EXCLUDE,
+	.capabilities	= PERF_PMU_CAP_NO_SAMPLING| PERF_PMU_CAP_NO_EXCLUDE,
 	.module		= THIS_MODULE,
 };
 
@@ -560,7 +560,7 @@  static struct pmu cstate_module_pmu = {
 	.start		= cstate_pmu_event_start,
 	.stop		= cstate_pmu_event_stop,
 	.read		= cstate_pmu_event_update,
-	.capabilities	= PERF_PMU_CAP_NO_INTERRUPT | PERF_PMU_CAP_NO_EXCLUDE,
+	.capabilities	= PERF_PMU_CAP_NO_SAMPLING | PERF_PMU_CAP_NO_EXCLUDE,
 	.module		= THIS_MODULE,
 };
 
diff --git a/arch/x86/events/msr.c b/arch/x86/events/msr.c
index 9e237b30f017..b33c0931d61d 100644
--- a/arch/x86/events/msr.c
+++ b/arch/x86/events/msr.c
@@ -296,7 +296,7 @@  static struct pmu pmu_msr = {
 	.start		= msr_event_start,
 	.stop		= msr_event_stop,
 	.read		= msr_event_update,
-	.capabilities	= PERF_PMU_CAP_NO_INTERRUPT | PERF_PMU_CAP_NO_EXCLUDE,
+	.capabilities	= PERF_PMU_CAP_NO_SAMPLING | PERF_PMU_CAP_NO_EXCLUDE,
 	.attr_update	= attr_update,
 };
 
diff --git a/drivers/fpga/dfl-fme-perf.c b/drivers/fpga/dfl-fme-perf.c
index 7422d2bc6f37..b5bafea06a55 100644
--- a/drivers/fpga/dfl-fme-perf.c
+++ b/drivers/fpga/dfl-fme-perf.c
@@ -921,7 +921,7 @@  static int fme_perf_pmu_register(struct platform_device *pdev,
 	pmu->start =		fme_perf_event_start;
 	pmu->stop =		fme_perf_event_stop;
 	pmu->read =		fme_perf_event_read;
-	pmu->capabilities =	PERF_PMU_CAP_NO_INTERRUPT |
+	pmu->capabilities =	PERF_PMU_CAP_NO_SAMPLING |
 				PERF_PMU_CAP_NO_EXCLUDE;
 
 	name = devm_kasprintf(priv->dev, GFP_KERNEL, "dfl_fme%d", pdev->id);
diff --git a/drivers/perf/arm_cspmu/arm_cspmu.c b/drivers/perf/arm_cspmu/arm_cspmu.c
index d408cbb84ed7..32ffea50cd7a 100644
--- a/drivers/perf/arm_cspmu/arm_cspmu.c
+++ b/drivers/perf/arm_cspmu/arm_cspmu.c
@@ -1186,7 +1186,7 @@  static int arm_cspmu_register_pmu(struct arm_cspmu *cspmu)
 	capabilities = PERF_PMU_CAP_NO_EXCLUDE |
 		       PERF_PMU_CAP_NO_COMMON_EVENTS;
 	if (cspmu->irq == 0)
-		capabilities |= PERF_PMU_CAP_NO_INTERRUPT;
+		capabilities |= PERF_PMU_CAP_NO_SAMPLING;
 
 	cspmu->pmu = (struct pmu){
 		.task_ctx_nr	= perf_invalid_context,
diff --git a/drivers/perf/arm_pmu_platform.c b/drivers/perf/arm_pmu_platform.c
index 3596db36cbff..e96c003f8555 100644
--- a/drivers/perf/arm_pmu_platform.c
+++ b/drivers/perf/arm_pmu_platform.c
@@ -109,7 +109,7 @@  static int pmu_parse_irqs(struct arm_pmu *pmu)
 	 */
 	if (num_irqs == 0) {
 		dev_warn(dev, "no irqs for PMU, sampling events not supported\n");
-		pmu->pmu.capabilities |= PERF_PMU_CAP_NO_INTERRUPT;
+		pmu->pmu.capabilities |= PERF_PMU_CAP_NO_SAMPLING;
 		cpumask_setall(&pmu->supported_cpus);
 		return 0;
 	}
diff --git a/drivers/perf/marvell_cn10k_tad_pmu.c b/drivers/perf/marvell_cn10k_tad_pmu.c
index bc2d642e87e8..aaedb5715d69 100644
--- a/drivers/perf/marvell_cn10k_tad_pmu.c
+++ b/drivers/perf/marvell_cn10k_tad_pmu.c
@@ -318,7 +318,7 @@  static int tad_pmu_probe(struct platform_device *pdev)
 		.module		= THIS_MODULE,
 		.attr_groups	= tad_pmu_attr_groups,
 		.capabilities	= PERF_PMU_CAP_NO_EXCLUDE |
-				  PERF_PMU_CAP_NO_INTERRUPT |
+				  PERF_PMU_CAP_NO_SAMPLING |
 				  PERF_PMU_CAP_NO_COMMON_EVENTS,
 		.task_ctx_nr	= perf_invalid_context,
 
diff --git a/drivers/perf/riscv_pmu_sbi.c b/drivers/perf/riscv_pmu_sbi.c
index 16acd4dcdb96..aa562520ecfd 100644
--- a/drivers/perf/riscv_pmu_sbi.c
+++ b/drivers/perf/riscv_pmu_sbi.c
@@ -1049,7 +1049,7 @@  static int pmu_sbi_device_probe(struct platform_device *pdev)
 	ret = pmu_sbi_setup_irqs(pmu, pdev);
 	if (ret < 0) {
 		pr_info("Perf sampling/filtering is not supported as sscof extension is not available\n");
-		pmu->pmu.capabilities |= PERF_PMU_CAP_NO_INTERRUPT;
+		pmu->pmu.capabilities |= PERF_PMU_CAP_NO_SAMPLING;
 		pmu->pmu.capabilities |= PERF_PMU_CAP_NO_EXCLUDE;
 	}
 
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 983201f21dd2..b1fd832ed8bf 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -282,7 +282,7 @@  struct perf_event_pmu_context;
 /**
  * pmu::capabilities flags
  */
-#define PERF_PMU_CAP_NO_INTERRUPT		0x0001
+#define PERF_PMU_CAP_NO_SAMPLING		0x0001
 #define PERF_PMU_CAP_NO_NMI			0x0002
 #define PERF_PMU_CAP_AUX_NO_SG			0x0004
 #define PERF_PMU_CAP_EXTENDED_REGS		0x0008
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 7ad80826c218..892212aae85e 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -12539,7 +12539,7 @@  SYSCALL_DEFINE5(perf_event_open,
 	}
 
 	if (is_sampling_event(event)) {
-		if (event->pmu->capabilities & PERF_PMU_CAP_NO_INTERRUPT) {
+		if (event->pmu->capabilities & PERF_PMU_CAP_NO_SAMPLING) {
 			err = -EOPNOTSUPP;
 			goto err_alloc;
 		}