Skip to contentSkip to conversation

x86/perf: Move events_sysfs_show() outside CPU_SUP_INTEL

PATCH New Huang Rui 2 participants 2 messages Mar 25, 2016

Subsystems (3)
lore
Share & tools
lore

Huang Rui

author
#0 lore raw

PATCH 1/1 x86/perf: Move events_sysfs_show() outside CPU_SUP_INTEL

This patch moves events_sysfs_show outside CONFIG_CPU_SUP_INTEL, because this interface will be also used in an AMD power reporting PMU driver.

Otherwise, below build error would be encountered:

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

In file included from include/linux/kobject.h:21:0,
from include/linux/module.h:17,
from arch/x86/kernel/cpu/perf_event_amd_power.c:13:

Quoted 1 line
Quoted 1 line

arch/x86/kernel/cpu/perf_event.h:663:31: error: 'events_sysfs_show' undeclared here (not in a function)

       .attr  = __ATTR(_name, 0444, events_sysfs_show, NULL), \
                                    ^
     include/linux/sysfs.h:103:10: note: in definition of macro '__ATTR'
       .show = _show,      \
               ^
Quoted 1 line
Quoted 1 line

arch/x86/kernel/cpu/perf_event_amd_power.c:244:1: note: in expansion of macro 'EVENT_ATTR_STR'

      EVENT_ATTR_STR(power-pkg, power_pkg, "event=0x01");
      ^

---

Hi Peter, Ingo, Randy,

According to the comments of below thread, I rebased this fix to latest kernel.

http://lkml.kernel.org/r/[email protected]

Orignal patch:
https://git.kernel.org/cgit/linux/kernel/git/bp/bp.git/commit/?h=tip-perf&id=f5ba42d22cb478d32363b2b8e92e14b1fd190ce1

Thanks,
Rui

---
 arch/x86/events/perf_event.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/x86/events/perf_event.h +3 -3
index ba6ef18..a6771e2 100644
@@ -795,6 +795,9 @@ ssize_t intel_event_sysfs_show(char *page, u64 config);
 
 struct attribute **merge_attr(struct attribute **a, struct attribute **b);
 
+ssize_t events_sysfs_show(struct device *dev, struct device_attribute *attr,
+			  char *page);
+
 #ifdef CONFIG_CPU_SUP_AMD
 
 int amd_pmu_init(void);
@@ -925,9 +928,6 @@ int p6_pmu_init(void);
 
 int knc_pmu_init(void);
 
-ssize_t events_sysfs_show(struct device *dev, struct device_attribute *attr,
-			  char *page);
-
 static inline int is_ht_workaround_enabled(void)
 {
 	return !!(x86_pmu.flags & PMU_FL_EXCL_ENABLED);
Signature · 1 line
1.9.1
#1 lore raw

[tip:perf/urgent] perf/x86: Move events_sysfs_show() outside CPU_SUP_INTEL

perf/x86: Move events_sysfs_show() outside CPU_SUP_INTEL
Commit-ID:  a49ac9f83b31e41c8311d64bd2b3f97a23dcb38d
Gitweb:     http://git.kernel.org/tip/a49ac9f83b31e41c8311d64bd2b3f97a23dcb38d
Author:     Huang Rui <[email protected]>
AuthorDate: Fri, 25 Mar 2016 11:18:25 +0800
Committer:  Ingo Molnar <[email protected]>
CommitDate: Fri, 25 Mar 2016 09:46:53 +0100

perf/x86: Move events_sysfs_show() outside CPU_SUP_INTEL

randconfig builds can sometimes disable CONFIG_CPU_SUP_INTEL while enabling the AMD power reporting PMU driver, resulting in this build failure:

arch/x86/kernel/cpu/perf_event.h:663:31: error: 'events_sysfs_show' undeclared here (not in a function)

To fix it, move events_sysfs_show() outside of #ifdef CONFIG_CPU_SUP_INTEL.

---
 arch/x86/events/perf_event.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/x86/events/perf_event.h +3 -3
index ba6ef18..a6771e2 100644
@@ -795,6 +795,9 @@ ssize_t intel_event_sysfs_show(char *page, u64 config);
 
 struct attribute **merge_attr(struct attribute **a, struct attribute **b);
 
+ssize_t events_sysfs_show(struct device *dev, struct device_attribute *attr,
+			  char *page);
+
 #ifdef CONFIG_CPU_SUP_AMD
 
 int amd_pmu_init(void);
@@ -925,9 +928,6 @@ int p6_pmu_init(void);
 
 int knc_pmu_init(void);
 
-ssize_t events_sysfs_show(struct device *dev, struct device_attribute *attr,
-			  char *page);
-
 static inline int is_ht_workaround_enabled(void)
 {
 	return !!(x86_pmu.flags & PMU_FL_EXCL_ENABLED);