linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf/core: introduced stub APIs for exported APIs
@ 2023-03-05  5:39 Manish Bhardwaj
  2023-03-05  7:36 ` kernel test robot
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Manish Bhardwaj @ 2023-03-05  5:39 UTC (permalink / raw)
  Cc: Manish Bhardwaj, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, Ian Rogers, linux-perf-users,
	linux-kernel

Introduced stub APIs for exported APIs so that we can build
independent module without any error if CONFIG_PERF_EVENT
feature is disabled in kernel.

drivers/platform/tegra/uncore_pmu/tegra23x_perf_uncore.c:
In function _scf_pmu_device_probe_:
drivers/platform/tegra/uncore_pmu/tegra23x_perf_uncore.c:596:    8:
error: implicit declaration of function _perf_pmu_register_
[-Werror=implicit-function-declaration]
  err = perf_pmu_register(&uncore_pmu->pmu, uncore_pmu->pmu.name,
531       |        ^~~~~~~~~~~~~~~~~
drivers/platform/tegra/uncore_pmu/tegra23x_perf_uncore.c: In
function _scf_pmu_device_remove_:
drivers/platform/tegra/uncore_pmu/tegra23x_perf_uncore.c:611:    2:
error: implicit declaration of function _perf_pmu_unregister_; did you
mean _device_unregister_? [-Werror=implicit-function-declaration]
  611 |  perf_pmu_unregister(&uncore_pmu->pmu);
      |  ^~~~~~~~~~~~~~~~~~~
      |  device_unregister
cc1: some warnings being treated as errors
scripts/Makefile.build:297: recipe for target
'drivers/platform/tegra/uncore_pmu/tegra23x_perf_uncore.o' failed
make[7]: *** [drivers/platform/tegra/
uncore_pmu/tegra23x_perf_uncore.o] Error 1

Signed-off-by: Manish Bhardwaj <bhardwajmanish18@gmail.com>
---
 include/linux/perf_event.h | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index d5628a7b5eaa..f3361f6f348e 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -1679,6 +1679,42 @@ extern int perf_event_account_interrupt(struct perf_event *event);
 extern int perf_event_period(struct perf_event *event, u64 value);
 extern u64 perf_event_pause(struct perf_event *event, bool reset);
 #else /* !CONFIG_PERF_EVENTS: */
+static void perf_event_addr_filters_sync(struct perf_event *event)		{ }
+static u64 perf_event_read_value(struct perf_event *event,
+				 u64 *enabled, u64 *running)
+{
+	return 0;
+}
+static void perf_event_update_userpage(struct perf_event *event)			{ }
+static void perf_register_guest_info_callbacks(struct perf_guest_info_callbacks *cbs)	{ }
+static void perf_unregister_guest_info_callbacks(struct perf_guest_info_callbacks *cbs)	{ }
+static void perf_report_aux_output_id(struct perf_event *event, u64 hw_id)		{ }
+static void perf_tp_event(u16 event_type, u64 count, void *record,
+			  int entry_size, struct pt_regs *regs,
+			  struct hlist_head *head, int rctx,
+			  struct task_struct *task)
+{
+}
+static int perf_pmu_register(struct pmu *pmu, const char *name, int type)
+{
+	return -1;
+}
+extern void perf_pmu_unregister(struct pmu *pmu)					{ }
+static struct perf_event *
+perf_event_create_kernel_counter(struct perf_event_attr *attr,
+				int cpu,
+				struct task_struct *task,
+				perf_overflow_handler_t callback,
+				void *context)
+{
+	return NULL;
+}
+static void perf_pmu_migrate_context(struct pmu *pmu, int src_cpu, int dst_cpu)		{ }
+static ssize_t perf_event_sysfs_show(struct device *dev, struct device_attribute *attr,
+			      char *page)
+{
+	return -1;
+}
 static inline void *
 perf_aux_output_begin(struct perf_output_handle *handle,
 		      struct perf_event *event)				{ return NULL; }
-- 
2.39.2


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

* Re: [PATCH] perf/core: introduced stub APIs for exported APIs
  2023-03-05  5:39 [PATCH] perf/core: introduced stub APIs for exported APIs Manish Bhardwaj
@ 2023-03-05  7:36 ` kernel test robot
  2023-03-05  7:36 ` kernel test robot
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: kernel test robot @ 2023-03-05  7:36 UTC (permalink / raw)
  To: Manish Bhardwaj
  Cc: oe-kbuild-all, Manish Bhardwaj, Ingo Molnar,
	Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, Ian Rogers, linux-perf-users,
	linux-kernel

Hi Manish,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on tip/perf/core]
[also build test ERROR on acme/perf/core tip/master tip/auto-latest linus/master v6.2 next-20230303]
[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/Manish-Bhardwaj/perf-core-introduced-stub-APIs-for-exported-APIs/20230305-134024
patch link:    https://lore.kernel.org/r/20230305053934.9948-1-bhardwajmanish18%40gmail.com
patch subject: [PATCH] perf/core: introduced stub APIs for exported APIs
config: powerpc-allnoconfig (https://download.01.org/0day-ci/archive/20230305/202303051529.2PHyXSBM-lkp@intel.com/config)
compiler: powerpc-linux-gcc (GCC) 12.1.0
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/intel-lab-lkp/linux/commit/2636181e6d3f39c8485077cb15927f84f00a617c
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Manish-Bhardwaj/perf-core-introduced-stub-APIs-for-exported-APIs/20230305-134024
        git checkout 2636181e6d3f39c8485077cb15927f84f00a617c
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=powerpc olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=powerpc SHELL=/bin/bash arch/powerpc/kernel/ fs/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202303051529.2PHyXSBM-lkp@intel.com/

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

   In file included from include/linux/trace_events.h:10,
                    from include/trace/syscall.h:7,
                    from include/linux/syscalls.h:88,
                    from fs/open.c:27:
>> include/linux/perf_event.h:1702:13: warning: no previous prototype for 'perf_pmu_unregister' [-Wmissing-prototypes]
    1702 | extern void perf_pmu_unregister(struct pmu *pmu)                                        { }
         |             ^~~~~~~~~~~~~~~~~~~
   include/linux/perf_event.h:1713:16: warning: 'perf_event_sysfs_show' defined but not used [-Wunused-function]
    1713 | static ssize_t perf_event_sysfs_show(struct device *dev, struct device_attribute *attr,
         |                ^~~~~~~~~~~~~~~~~~~~~
   include/linux/perf_event.h:1712:13: warning: 'perf_pmu_migrate_context' defined but not used [-Wunused-function]
    1712 | static void perf_pmu_migrate_context(struct pmu *pmu, int src_cpu, int dst_cpu)         { }
         |             ^~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/perf_event.h:1704:1: warning: 'perf_event_create_kernel_counter' defined but not used [-Wunused-function]
    1704 | perf_event_create_kernel_counter(struct perf_event_attr *attr,
         | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/perf_event.h:1698:12: warning: 'perf_pmu_register' defined but not used [-Wunused-function]
    1698 | static int perf_pmu_register(struct pmu *pmu, const char *name, int type)
         |            ^~~~~~~~~~~~~~~~~
   include/linux/perf_event.h:1692:13: warning: 'perf_tp_event' defined but not used [-Wunused-function]
    1692 | static void perf_tp_event(u16 event_type, u64 count, void *record,
         |             ^~~~~~~~~~~~~
   include/linux/perf_event.h:1691:13: warning: 'perf_report_aux_output_id' defined but not used [-Wunused-function]
    1691 | static void perf_report_aux_output_id(struct perf_event *event, u64 hw_id)              { }
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/perf_event.h:1690:13: warning: 'perf_unregister_guest_info_callbacks' defined but not used [-Wunused-function]
    1690 | static void perf_unregister_guest_info_callbacks(struct perf_guest_info_callbacks *cbs) { }
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/perf_event.h:1689:13: warning: 'perf_register_guest_info_callbacks' defined but not used [-Wunused-function]
    1689 | static void perf_register_guest_info_callbacks(struct perf_guest_info_callbacks *cbs)   { }
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/perf_event.h:1688:13: warning: 'perf_event_update_userpage' defined but not used [-Wunused-function]
    1688 | static void perf_event_update_userpage(struct perf_event *event)                        { }
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/perf_event.h:1683:12: warning: 'perf_event_read_value' defined but not used [-Wunused-function]
    1683 | static u64 perf_event_read_value(struct perf_event *event,
         |            ^~~~~~~~~~~~~~~~~~~~~
   include/linux/perf_event.h:1682:13: warning: 'perf_event_addr_filters_sync' defined but not used [-Wunused-function]
    1682 | static void perf_event_addr_filters_sync(struct perf_event *event)              { }
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
   In file included from include/linux/trace_events.h:10,
                    from include/trace/syscall.h:7,
                    from include/linux/syscalls.h:88,
                    from fs/pipe.c:24:
>> include/linux/perf_event.h:1702:13: warning: no previous prototype for 'perf_pmu_unregister' [-Wmissing-prototypes]
    1702 | extern void perf_pmu_unregister(struct pmu *pmu)                                        { }
         |             ^~~~~~~~~~~~~~~~~~~
   fs/pipe.c:757:15: warning: no previous prototype for 'account_pipe_buffers' [-Wmissing-prototypes]
     757 | unsigned long account_pipe_buffers(struct user_struct *user,
         |               ^~~~~~~~~~~~~~~~~~~~
   fs/pipe.c:763:6: warning: no previous prototype for 'too_many_pipe_buffers_soft' [-Wmissing-prototypes]
     763 | bool too_many_pipe_buffers_soft(unsigned long user_bufs)
         |      ^~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/pipe.c:770:6: warning: no previous prototype for 'too_many_pipe_buffers_hard' [-Wmissing-prototypes]
     770 | bool too_many_pipe_buffers_hard(unsigned long user_bufs)
         |      ^~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/pipe.c:777:6: warning: no previous prototype for 'pipe_is_unprivileged_user' [-Wmissing-prototypes]
     777 | bool pipe_is_unprivileged_user(void)
         |      ^~~~~~~~~~~~~~~~~~~~~~~~~
   fs/pipe.c:1253:5: warning: no previous prototype for 'pipe_resize_ring' [-Wmissing-prototypes]
    1253 | int pipe_resize_ring(struct pipe_inode_info *pipe, unsigned int nr_slots)
         |     ^~~~~~~~~~~~~~~~
   include/linux/perf_event.h:1713:16: warning: 'perf_event_sysfs_show' defined but not used [-Wunused-function]
    1713 | static ssize_t perf_event_sysfs_show(struct device *dev, struct device_attribute *attr,
         |                ^~~~~~~~~~~~~~~~~~~~~
   include/linux/perf_event.h:1712:13: warning: 'perf_pmu_migrate_context' defined but not used [-Wunused-function]
    1712 | static void perf_pmu_migrate_context(struct pmu *pmu, int src_cpu, int dst_cpu)         { }
         |             ^~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/perf_event.h:1704:1: warning: 'perf_event_create_kernel_counter' defined but not used [-Wunused-function]
    1704 | perf_event_create_kernel_counter(struct perf_event_attr *attr,
         | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/perf_event.h:1698:12: warning: 'perf_pmu_register' defined but not used [-Wunused-function]
    1698 | static int perf_pmu_register(struct pmu *pmu, const char *name, int type)
         |            ^~~~~~~~~~~~~~~~~
   include/linux/perf_event.h:1692:13: warning: 'perf_tp_event' defined but not used [-Wunused-function]
    1692 | static void perf_tp_event(u16 event_type, u64 count, void *record,
         |             ^~~~~~~~~~~~~
   include/linux/perf_event.h:1691:13: warning: 'perf_report_aux_output_id' defined but not used [-Wunused-function]
    1691 | static void perf_report_aux_output_id(struct perf_event *event, u64 hw_id)              { }
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/perf_event.h:1690:13: warning: 'perf_unregister_guest_info_callbacks' defined but not used [-Wunused-function]
    1690 | static void perf_unregister_guest_info_callbacks(struct perf_guest_info_callbacks *cbs) { }
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/perf_event.h:1689:13: warning: 'perf_register_guest_info_callbacks' defined but not used [-Wunused-function]
    1689 | static void perf_register_guest_info_callbacks(struct perf_guest_info_callbacks *cbs)   { }
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/perf_event.h:1688:13: warning: 'perf_event_update_userpage' defined but not used [-Wunused-function]
    1688 | static void perf_event_update_userpage(struct perf_event *event)                        { }
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/perf_event.h:1683:12: warning: 'perf_event_read_value' defined but not used [-Wunused-function]
    1683 | static u64 perf_event_read_value(struct perf_event *event,
         |            ^~~~~~~~~~~~~~~~~~~~~
   include/linux/perf_event.h:1682:13: warning: 'perf_event_addr_filters_sync' defined but not used [-Wunused-function]
    1682 | static void perf_event_addr_filters_sync(struct perf_event *event)              { }
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
   In file included from include/linux/trace_events.h:10,
                    from include/trace/syscall.h:7,
                    from include/linux/syscalls.h:88,
                    from fs/d_path.c:2:
>> include/linux/perf_event.h:1702:13: warning: no previous prototype for 'perf_pmu_unregister' [-Wmissing-prototypes]
    1702 | extern void perf_pmu_unregister(struct pmu *pmu)                                        { }
         |             ^~~~~~~~~~~~~~~~~~~
   fs/d_path.c:317:7: warning: no previous prototype for 'simple_dname' [-Wmissing-prototypes]
     317 | char *simple_dname(struct dentry *dentry, char *buffer, int buflen)
         |       ^~~~~~~~~~~~
   include/linux/perf_event.h:1713:16: warning: 'perf_event_sysfs_show' defined but not used [-Wunused-function]
    1713 | static ssize_t perf_event_sysfs_show(struct device *dev, struct device_attribute *attr,
         |                ^~~~~~~~~~~~~~~~~~~~~
   include/linux/perf_event.h:1712:13: warning: 'perf_pmu_migrate_context' defined but not used [-Wunused-function]
    1712 | static void perf_pmu_migrate_context(struct pmu *pmu, int src_cpu, int dst_cpu)         { }
         |             ^~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/perf_event.h:1704:1: warning: 'perf_event_create_kernel_counter' defined but not used [-Wunused-function]
    1704 | perf_event_create_kernel_counter(struct perf_event_attr *attr,
         | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/perf_event.h:1698:12: warning: 'perf_pmu_register' defined but not used [-Wunused-function]
    1698 | static int perf_pmu_register(struct pmu *pmu, const char *name, int type)
         |            ^~~~~~~~~~~~~~~~~
   include/linux/perf_event.h:1692:13: warning: 'perf_tp_event' defined but not used [-Wunused-function]
    1692 | static void perf_tp_event(u16 event_type, u64 count, void *record,
         |             ^~~~~~~~~~~~~
   include/linux/perf_event.h:1691:13: warning: 'perf_report_aux_output_id' defined but not used [-Wunused-function]
    1691 | static void perf_report_aux_output_id(struct perf_event *event, u64 hw_id)              { }
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/perf_event.h:1690:13: warning: 'perf_unregister_guest_info_callbacks' defined but not used [-Wunused-function]
    1690 | static void perf_unregister_guest_info_callbacks(struct perf_guest_info_callbacks *cbs) { }
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/perf_event.h:1689:13: warning: 'perf_register_guest_info_callbacks' defined but not used [-Wunused-function]
    1689 | static void perf_register_guest_info_callbacks(struct perf_guest_info_callbacks *cbs)   { }
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/perf_event.h:1688:13: warning: 'perf_event_update_userpage' defined but not used [-Wunused-function]
    1688 | static void perf_event_update_userpage(struct perf_event *event)                        { }
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/perf_event.h:1683:12: warning: 'perf_event_read_value' defined but not used [-Wunused-function]
    1683 | static u64 perf_event_read_value(struct perf_event *event,
         |            ^~~~~~~~~~~~~~~~~~~~~
   include/linux/perf_event.h:1682:13: warning: 'perf_event_addr_filters_sync' defined but not used [-Wunused-function]
    1682 | static void perf_event_addr_filters_sync(struct perf_event *event)              { }
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
   In file included from include/linux/trace_events.h:10,
                    from include/trace/syscall.h:7,
                    from include/linux/syscalls.h:88,
                    from arch/powerpc/kernel/syscalls.c:19:
>> include/linux/perf_event.h:1702:13: error: no previous prototype for 'perf_pmu_unregister' [-Werror=missing-prototypes]
    1702 | extern void perf_pmu_unregister(struct pmu *pmu)                                        { }
         |             ^~~~~~~~~~~~~~~~~~~
>> include/linux/perf_event.h:1713:16: error: 'perf_event_sysfs_show' defined but not used [-Werror=unused-function]
    1713 | static ssize_t perf_event_sysfs_show(struct device *dev, struct device_attribute *attr,
         |                ^~~~~~~~~~~~~~~~~~~~~
>> include/linux/perf_event.h:1712:13: error: 'perf_pmu_migrate_context' defined but not used [-Werror=unused-function]
    1712 | static void perf_pmu_migrate_context(struct pmu *pmu, int src_cpu, int dst_cpu)         { }
         |             ^~~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/perf_event.h:1704:1: error: 'perf_event_create_kernel_counter' defined but not used [-Werror=unused-function]
    1704 | perf_event_create_kernel_counter(struct perf_event_attr *attr,
         | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/perf_event.h:1698:12: error: 'perf_pmu_register' defined but not used [-Werror=unused-function]
    1698 | static int perf_pmu_register(struct pmu *pmu, const char *name, int type)
         |            ^~~~~~~~~~~~~~~~~
>> include/linux/perf_event.h:1692:13: error: 'perf_tp_event' defined but not used [-Werror=unused-function]
    1692 | static void perf_tp_event(u16 event_type, u64 count, void *record,
         |             ^~~~~~~~~~~~~
>> include/linux/perf_event.h:1691:13: error: 'perf_report_aux_output_id' defined but not used [-Werror=unused-function]
    1691 | static void perf_report_aux_output_id(struct perf_event *event, u64 hw_id)              { }
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/perf_event.h:1690:13: error: 'perf_unregister_guest_info_callbacks' defined but not used [-Werror=unused-function]
    1690 | static void perf_unregister_guest_info_callbacks(struct perf_guest_info_callbacks *cbs) { }
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/perf_event.h:1689:13: error: 'perf_register_guest_info_callbacks' defined but not used [-Werror=unused-function]
    1689 | static void perf_register_guest_info_callbacks(struct perf_guest_info_callbacks *cbs)   { }
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/perf_event.h:1688:13: error: 'perf_event_update_userpage' defined but not used [-Werror=unused-function]
    1688 | static void perf_event_update_userpage(struct perf_event *event)                        { }
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/perf_event.h:1683:12: error: 'perf_event_read_value' defined but not used [-Werror=unused-function]
    1683 | static u64 perf_event_read_value(struct perf_event *event,
         |            ^~~~~~~~~~~~~~~~~~~~~
>> include/linux/perf_event.h:1682:13: error: 'perf_event_addr_filters_sync' defined but not used [-Werror=unused-function]
    1682 | static void perf_event_addr_filters_sync(struct perf_event *event)              { }
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   cc1: all warnings being treated as errors


vim +/perf_pmu_unregister +1702 include/linux/perf_event.h

  1649	
  1650	extern int perf_output_begin(struct perf_output_handle *handle,
  1651				     struct perf_sample_data *data,
  1652				     struct perf_event *event, unsigned int size);
  1653	extern int perf_output_begin_forward(struct perf_output_handle *handle,
  1654					     struct perf_sample_data *data,
  1655					     struct perf_event *event,
  1656					     unsigned int size);
  1657	extern int perf_output_begin_backward(struct perf_output_handle *handle,
  1658					      struct perf_sample_data *data,
  1659					      struct perf_event *event,
  1660					      unsigned int size);
  1661	
  1662	extern void perf_output_end(struct perf_output_handle *handle);
  1663	extern unsigned int perf_output_copy(struct perf_output_handle *handle,
  1664				     const void *buf, unsigned int len);
  1665	extern unsigned int perf_output_skip(struct perf_output_handle *handle,
  1666					     unsigned int len);
  1667	extern long perf_output_copy_aux(struct perf_output_handle *aux_handle,
  1668					 struct perf_output_handle *handle,
  1669					 unsigned long from, unsigned long to);
  1670	extern int perf_swevent_get_recursion_context(void);
  1671	extern void perf_swevent_put_recursion_context(int rctx);
  1672	extern u64 perf_swevent_set_period(struct perf_event *event);
  1673	extern void perf_event_enable(struct perf_event *event);
  1674	extern void perf_event_disable(struct perf_event *event);
  1675	extern void perf_event_disable_local(struct perf_event *event);
  1676	extern void perf_event_disable_inatomic(struct perf_event *event);
  1677	extern void perf_event_task_tick(void);
  1678	extern int perf_event_account_interrupt(struct perf_event *event);
  1679	extern int perf_event_period(struct perf_event *event, u64 value);
  1680	extern u64 perf_event_pause(struct perf_event *event, bool reset);
  1681	#else /* !CONFIG_PERF_EVENTS: */
> 1682	static void perf_event_addr_filters_sync(struct perf_event *event)		{ }
> 1683	static u64 perf_event_read_value(struct perf_event *event,
  1684					 u64 *enabled, u64 *running)
  1685	{
  1686		return 0;
  1687	}
> 1688	static void perf_event_update_userpage(struct perf_event *event)			{ }
> 1689	static void perf_register_guest_info_callbacks(struct perf_guest_info_callbacks *cbs)	{ }
> 1690	static void perf_unregister_guest_info_callbacks(struct perf_guest_info_callbacks *cbs)	{ }
> 1691	static void perf_report_aux_output_id(struct perf_event *event, u64 hw_id)		{ }
> 1692	static void perf_tp_event(u16 event_type, u64 count, void *record,
  1693				  int entry_size, struct pt_regs *regs,
  1694				  struct hlist_head *head, int rctx,
  1695				  struct task_struct *task)
  1696	{
  1697	}
> 1698	static int perf_pmu_register(struct pmu *pmu, const char *name, int type)
  1699	{
  1700		return -1;
  1701	}
> 1702	extern void perf_pmu_unregister(struct pmu *pmu)					{ }
  1703	static struct perf_event *
> 1704	perf_event_create_kernel_counter(struct perf_event_attr *attr,
  1705					int cpu,
  1706					struct task_struct *task,
  1707					perf_overflow_handler_t callback,
  1708					void *context)
  1709	{
  1710		return NULL;
  1711	}
> 1712	static void perf_pmu_migrate_context(struct pmu *pmu, int src_cpu, int dst_cpu)		{ }
> 1713	static ssize_t perf_event_sysfs_show(struct device *dev, struct device_attribute *attr,
  1714				      char *page)
  1715	{
  1716		return -1;
  1717	}
  1718	static inline void *
  1719	perf_aux_output_begin(struct perf_output_handle *handle,
  1720			      struct perf_event *event)				{ return NULL; }
  1721	static inline void
  1722	perf_aux_output_end(struct perf_output_handle *handle, unsigned long size)
  1723										{ }
  1724	static inline int
  1725	perf_aux_output_skip(struct perf_output_handle *handle,
  1726			     unsigned long size)				{ return -EINVAL; }
  1727	static inline void *
  1728	perf_get_aux(struct perf_output_handle *handle)				{ return NULL; }
  1729	static inline void
  1730	perf_event_task_migrate(struct task_struct *task)			{ }
  1731	static inline void
  1732	perf_event_task_sched_in(struct task_struct *prev,
  1733				 struct task_struct *task)			{ }
  1734	static inline void
  1735	perf_event_task_sched_out(struct task_struct *prev,
  1736				  struct task_struct *next)			{ }
  1737	static inline int perf_event_init_task(struct task_struct *child,
  1738					       u64 clone_flags)			{ return 0; }
  1739	static inline void perf_event_exit_task(struct task_struct *child)	{ }
  1740	static inline void perf_event_free_task(struct task_struct *task)	{ }
  1741	static inline void perf_event_delayed_put(struct task_struct *task)	{ }
  1742	static inline struct file *perf_event_get(unsigned int fd)	{ return ERR_PTR(-EINVAL); }
  1743	static inline const struct perf_event *perf_get_event(struct file *file)
  1744	{
  1745		return ERR_PTR(-EINVAL);
  1746	}
  1747	static inline const struct perf_event_attr *perf_event_attrs(struct perf_event *event)
  1748	{
  1749		return ERR_PTR(-EINVAL);
  1750	}
  1751	static inline int perf_event_read_local(struct perf_event *event, u64 *value,
  1752						u64 *enabled, u64 *running)
  1753	{
  1754		return -EINVAL;
  1755	}
  1756	static inline void perf_event_print_debug(void)				{ }
  1757	static inline int perf_event_task_disable(void)				{ return -EINVAL; }
  1758	static inline int perf_event_task_enable(void)				{ return -EINVAL; }
  1759	static inline int perf_event_refresh(struct perf_event *event, int refresh)
  1760	{
  1761		return -EINVAL;
  1762	}
  1763	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests

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

* Re: [PATCH] perf/core: introduced stub APIs for exported APIs
  2023-03-05  5:39 [PATCH] perf/core: introduced stub APIs for exported APIs Manish Bhardwaj
  2023-03-05  7:36 ` kernel test robot
@ 2023-03-05  7:36 ` kernel test robot
  2023-03-05  7:57 ` kernel test robot
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: kernel test robot @ 2023-03-05  7:36 UTC (permalink / raw)
  To: Manish Bhardwaj
  Cc: oe-kbuild-all, Manish Bhardwaj, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, Ian Rogers, linux-perf-users,
	linux-kernel

Hi Manish,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on tip/perf/core]
[also build test ERROR on acme/perf/core tip/master tip/auto-latest linus/master v6.2 next-20230303]
[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/Manish-Bhardwaj/perf-core-introduced-stub-APIs-for-exported-APIs/20230305-134024
patch link:    https://lore.kernel.org/r/20230305053934.9948-1-bhardwajmanish18%40gmail.com
patch subject: [PATCH] perf/core: introduced stub APIs for exported APIs
config: nios2-randconfig-r021-20230305 (https://download.01.org/0day-ci/archive/20230305/202303051558.FF5cjvLT-lkp@intel.com/config)
compiler: nios2-linux-gcc (GCC) 12.1.0
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/intel-lab-lkp/linux/commit/2636181e6d3f39c8485077cb15927f84f00a617c
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Manish-Bhardwaj/perf-core-introduced-stub-APIs-for-exported-APIs/20230305-134024
        git checkout 2636181e6d3f39c8485077cb15927f84f00a617c
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=nios2 olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=nios2 SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202303051558.FF5cjvLT-lkp@intel.com/

All errors (new ones prefixed by >>):

   nios2-linux-ld: init/do_mounts.o: in function `perf_pmu_unregister':
>> do_mounts.c:(.text+0x184): multiple definition of `perf_pmu_unregister'; init/main.o:main.c:(.text+0x18): first defined here
   nios2-linux-ld: init/do_mounts_initrd.o: in function `perf_pmu_unregister':
   do_mounts_initrd.c:(.text+0x0): multiple definition of `perf_pmu_unregister'; init/main.o:main.c:(.text+0x18): first defined here
   nios2-linux-ld: init/initramfs.o: in function `perf_pmu_unregister':
   initramfs.c:(.text+0x48): multiple definition of `perf_pmu_unregister'; init/main.o:main.c:(.text+0x18): first defined here
   nios2-linux-ld: arch/nios2/kernel/sys_nios2.o: in function `perf_pmu_unregister':
   sys_nios2.c:(.text+0x0): multiple definition of `perf_pmu_unregister'; init/main.o:main.c:(.text+0x18): first defined here
   nios2-linux-ld: arch/nios2/kernel/syscall_table.o: in function `perf_pmu_unregister':
   syscall_table.c:(.text+0x0): multiple definition of `perf_pmu_unregister'; init/main.o:main.c:(.text+0x18): first defined here
   nios2-linux-ld: arch/nios2/mm/fault.o: in function `perf_pmu_unregister':
   fault.c:(.text+0x0): multiple definition of `perf_pmu_unregister'; init/main.o:main.c:(.text+0x18): first defined here
   nios2-linux-ld: kernel/fork.o: in function `perf_pmu_unregister':
   fork.c:(.text+0xa78): multiple definition of `perf_pmu_unregister'; init/main.o:main.c:(.text+0x18): first defined here
   nios2-linux-ld: kernel/exec_domain.o: in function `perf_pmu_unregister':
   exec_domain.c:(.text+0x0): multiple definition of `perf_pmu_unregister'; init/main.o:main.c:(.text+0x18): first defined here
   nios2-linux-ld: kernel/cpu.o: in function `perf_pmu_unregister':
   cpu.c:(.text+0x584): multiple definition of `perf_pmu_unregister'; init/main.o:main.c:(.text+0x18): first defined here
   nios2-linux-ld: kernel/exit.o: in function `perf_pmu_unregister':
   exit.c:(.text+0xf58): multiple definition of `perf_pmu_unregister'; init/main.o:main.c:(.text+0x18): first defined here
   nios2-linux-ld: kernel/sysctl.o: in function `perf_pmu_unregister':
   sysctl.c:(.text+0x60): multiple definition of `perf_pmu_unregister'; init/main.o:main.c:(.text+0x18): first defined here
   nios2-linux-ld: kernel/capability.o: in function `perf_pmu_unregister':
   capability.c:(.text+0x5dc): multiple definition of `perf_pmu_unregister'; init/main.o:main.c:(.text+0x18): first defined here
   nios2-linux-ld: kernel/ptrace.o: in function `perf_pmu_unregister':
   ptrace.c:(.text+0x600): multiple definition of `perf_pmu_unregister'; init/main.o:main.c:(.text+0x18): first defined here
   nios2-linux-ld: kernel/signal.o: in function `perf_pmu_unregister':
   signal.c:(.text+0x16bc): multiple definition of `perf_pmu_unregister'; init/main.o:main.c:(.text+0x18): first defined here
   nios2-linux-ld: kernel/sys.o: in function `perf_pmu_unregister':
   sys.c:(.text+0x1478): multiple definition of `perf_pmu_unregister'; init/main.o:main.c:(.text+0x18): first defined here
   nios2-linux-ld: kernel/umh.o: in function `perf_pmu_unregister':
   umh.c:(.text+0xa08): multiple definition of `perf_pmu_unregister'; init/main.o:main.c:(.text+0x18): first defined here
   nios2-linux-ld: kernel/pid.o: in function `perf_pmu_unregister':
   pid.c:(.text+0x5f8): multiple definition of `perf_pmu_unregister'; init/main.o:main.c:(.text+0x18): first defined here
   nios2-linux-ld: kernel/nsproxy.o: in function `perf_pmu_unregister':
   nsproxy.c:(.text+0x26c): multiple definition of `perf_pmu_unregister'; init/main.o:main.c:(.text+0x18): first defined here
   nios2-linux-ld: kernel/reboot.o: in function `perf_pmu_unregister':
   reboot.c:(.text+0xa74): multiple definition of `perf_pmu_unregister'; init/main.o:main.c:(.text+0x18): first defined here
   nios2-linux-ld: kernel/kmod.o: in function `perf_pmu_unregister':
   kmod.c:(.text+0x358): multiple definition of `perf_pmu_unregister'; init/main.o:main.c:(.text+0x18): first defined here
   nios2-linux-ld: kernel/groups.o: in function `perf_pmu_unregister':
   groups.c:(.text+0x270): multiple definition of `perf_pmu_unregister'; init/main.o:main.c:(.text+0x18): first defined here
   nios2-linux-ld: kernel/sched/core.o: in function `perf_pmu_unregister':
   core.c:(.text+0xc04): multiple definition of `perf_pmu_unregister'; init/main.o:main.c:(.text+0x18): first defined here
   nios2-linux-ld: kernel/sched/fair.o: in function `perf_pmu_unregister':
   fair.c:(.text+0x2184): multiple definition of `perf_pmu_unregister'; init/main.o:main.c:(.text+0x18): first defined here
   nios2-linux-ld: kernel/sched/build_policy.o: in function `perf_pmu_unregister':
   build_policy.c:(.text+0x3318): multiple definition of `perf_pmu_unregister'; init/main.o:main.c:(.text+0x18): first defined here
   nios2-linux-ld: kernel/sched/build_utility.o: in function `perf_pmu_unregister':
   build_utility.c:(.text+0x38a8): multiple definition of `perf_pmu_unregister'; init/main.o:main.c:(.text+0x18): first defined here
   nios2-linux-ld: kernel/power/qos.o: in function `perf_pmu_unregister':
   qos.c:(.text+0xe0): multiple definition of `perf_pmu_unregister'; init/main.o:main.c:(.text+0x18): first defined here
   nios2-linux-ld: kernel/printk/printk.o: in function `perf_pmu_unregister':
   printk.c:(.text+0xb5c): multiple definition of `perf_pmu_unregister'; init/main.o:main.c:(.text+0x18): first defined here
   nios2-linux-ld: kernel/rcu/tree.o: in function `perf_pmu_unregister':
   tree.c:(.text+0x7a00): multiple definition of `perf_pmu_unregister'; init/main.o:main.c:(.text+0x18): first defined here
   nios2-linux-ld: kernel/module/main.o: in function `perf_pmu_unregister':
   main.c:(.text+0xeb4): multiple definition of `perf_pmu_unregister'; init/main.o:main.c:(.text+0x18): first defined here
   nios2-linux-ld: kernel/kcmp.o: in function `perf_pmu_unregister':
   kcmp.c:(.text+0x570): multiple definition of `perf_pmu_unregister'; init/main.o:main.c:(.text+0x18): first defined here
   nios2-linux-ld: kernel/time/time.o: in function `perf_pmu_unregister':
   time.c:(.text+0xc98): multiple definition of `perf_pmu_unregister'; init/main.o:main.c:(.text+0x18): first defined here
   nios2-linux-ld: kernel/time/timer.o: in function `perf_pmu_unregister':
   timer.c:(.text+0x1650): multiple definition of `perf_pmu_unregister'; init/main.o:main.c:(.text+0x18): first defined here
   nios2-linux-ld: kernel/time/hrtimer.o: in function `perf_pmu_unregister':
   hrtimer.c:(.text+0x13c4): multiple definition of `perf_pmu_unregister'; init/main.o:main.c:(.text+0x18): first defined here
   nios2-linux-ld: kernel/time/posix-stubs.o: in function `perf_pmu_unregister':
   posix-stubs.c:(.text+0x0): multiple definition of `perf_pmu_unregister'; init/main.o:main.c:(.text+0x18): first defined here
   nios2-linux-ld: kernel/time/tick-common.o: in function `perf_pmu_unregister':
   tick-common.c:(.text+0x1a0): multiple definition of `perf_pmu_unregister'; init/main.o:main.c:(.text+0x18): first defined here
   nios2-linux-ld: kernel/bpf/core.o: in function `perf_pmu_unregister':
   core.c:(.text+0x4c0): multiple definition of `perf_pmu_unregister'; init/main.o:main.c:(.text+0x18): first defined here
   nios2-linux-ld: mm/oom_kill.o: in function `perf_pmu_unregister':
   oom_kill.c:(.text+0x748): multiple definition of `perf_pmu_unregister'; init/main.o:main.c:(.text+0x18): first defined here
   nios2-linux-ld: mm/fadvise.o: in function `perf_pmu_unregister':
   fadvise.c:(.text+0x324): multiple definition of `perf_pmu_unregister'; init/main.o:main.c:(.text+0x18): first defined here
   nios2-linux-ld: mm/page-writeback.o: in function `perf_pmu_unregister':
   page-writeback.c:(.text+0x287c): multiple definition of `perf_pmu_unregister'; init/main.o:main.c:(.text+0x18): first defined here
   nios2-linux-ld: mm/readahead.o: in function `perf_pmu_unregister':
   readahead.c:(.text+0xb6c): multiple definition of `perf_pmu_unregister'; init/main.o:main.c:(.text+0x18): first defined here
   nios2-linux-ld: mm/shmem.o: in function `perf_pmu_unregister':
   shmem.c:(.text+0x5968): multiple definition of `perf_pmu_unregister'; init/main.o:main.c:(.text+0x18): first defined here
   nios2-linux-ld: mm/debug.o: in function `perf_pmu_unregister':
   debug.c:(.text+0x1a8): multiple definition of `perf_pmu_unregister'; init/main.o:main.c:(.text+0x18): first defined here
   nios2-linux-ld: mm/mmap_lock.o: in function `perf_pmu_unregister':
   mmap_lock.c:(.text+0x0): multiple definition of `perf_pmu_unregister'; init/main.o:main.c:(.text+0x18): first defined here
   nios2-linux-ld: mm/memory.o: in function `perf_pmu_unregister':
   memory.c:(.text+0x1130): multiple definition of `perf_pmu_unregister'; init/main.o:main.c:(.text+0x18): first defined here
   nios2-linux-ld: mm/mincore.o: in function `perf_pmu_unregister':
   mincore.c:(.text+0x52c): multiple definition of `perf_pmu_unregister'; init/main.o:main.c:(.text+0x18): first defined here
   nios2-linux-ld: mm/mlock.o: in function `perf_pmu_unregister':
   mlock.c:(.text+0x1c34): multiple definition of `perf_pmu_unregister'; init/main.o:main.c:(.text+0x18): first defined here
   nios2-linux-ld: mm/mmap.o: in function `perf_pmu_unregister':
   mmap.c:(.text+0xa34): multiple definition of `perf_pmu_unregister'; init/main.o:main.c:(.text+0x18): first defined here
   nios2-linux-ld: mm/mprotect.o: in function `perf_pmu_unregister':
   mprotect.c:(.text+0x0): multiple definition of `perf_pmu_unregister'; init/main.o:main.c:(.text+0x18): first defined here
   nios2-linux-ld: mm/mremap.o: in function `perf_pmu_unregister':
   mremap.c:(.text+0x121c): multiple definition of `perf_pmu_unregister'; init/main.o:main.c:(.text+0x18): first defined here
   nios2-linux-ld: mm/msync.o: in function `perf_pmu_unregister':
   msync.c:(.text+0x24c): multiple definition of `perf_pmu_unregister'; init/main.o:main.c:(.text+0x18): first defined here
   nios2-linux-ld: mm/process_vm_access.o: in function `perf_pmu_unregister':
   process_vm_access.c:(.text+0x5b4): multiple definition of `perf_pmu_unregister'; init/main.o:main.c:(.text+0x18): first defined here

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests

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

* Re: [PATCH] perf/core: introduced stub APIs for exported APIs
  2023-03-05  5:39 [PATCH] perf/core: introduced stub APIs for exported APIs Manish Bhardwaj
  2023-03-05  7:36 ` kernel test robot
  2023-03-05  7:36 ` kernel test robot
@ 2023-03-05  7:57 ` kernel test robot
  2023-03-05  9:27 ` Manish Bhardwaj
  2023-03-06 16:56 ` Mark Rutland
  4 siblings, 0 replies; 9+ messages in thread
From: kernel test robot @ 2023-03-05  7:57 UTC (permalink / raw)
  To: Manish Bhardwaj
  Cc: llvm, oe-kbuild-all, Manish Bhardwaj, Ingo Molnar,
	Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, Ian Rogers, linux-perf-users,
	linux-kernel

Hi Manish,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on tip/perf/core]
[also build test WARNING on acme/perf/core tip/master tip/auto-latest linus/master v6.2 next-20230303]
[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/Manish-Bhardwaj/perf-core-introduced-stub-APIs-for-exported-APIs/20230305-134024
patch link:    https://lore.kernel.org/r/20230305053934.9948-1-bhardwajmanish18%40gmail.com
patch subject: [PATCH] perf/core: introduced stub APIs for exported APIs
config: riscv-randconfig-r033-20230305 (https://download.01.org/0day-ci/archive/20230305/202303051534.Ni7GS2vf-lkp@intel.com/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project 67409911353323ca5edf2049ef0df54132fa1ca7)
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
        # install riscv cross compiling tool for clang build
        # apt-get install binutils-riscv-linux-gnu
        # https://github.com/intel-lab-lkp/linux/commit/2636181e6d3f39c8485077cb15927f84f00a617c
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Manish-Bhardwaj/perf-core-introduced-stub-APIs-for-exported-APIs/20230305-134024
        git checkout 2636181e6d3f39c8485077cb15927f84f00a617c
        # 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=riscv olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=riscv SHELL=/bin/bash arch/riscv/kernel/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202303051534.Ni7GS2vf-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from arch/riscv/kernel/ptrace.c:23:
   In file included from include/trace/events/syscalls.h:73:
   In file included from include/trace/define_trace.h:102:
   In file included from include/trace/trace_events.h:21:
   In file included from include/linux/trace_events.h:10:
>> include/linux/perf_event.h:1702:13: warning: no previous prototype for function 'perf_pmu_unregister' [-Wmissing-prototypes]
   extern void perf_pmu_unregister(struct pmu *pmu)                                        { }
               ^
   include/linux/perf_event.h:1702:8: note: declare 'static' if the function is not intended to be used outside of this translation unit
   extern void perf_pmu_unregister(struct pmu *pmu)                                        { }
          ^
   include/linux/perf_event.h:1682:13: warning: unused function 'perf_event_addr_filters_sync' [-Wunused-function]
   static void perf_event_addr_filters_sync(struct perf_event *event)              { }
               ^
   include/linux/perf_event.h:1683:12: warning: unused function 'perf_event_read_value' [-Wunused-function]
   static u64 perf_event_read_value(struct perf_event *event,
              ^
   include/linux/perf_event.h:1688:13: warning: unused function 'perf_event_update_userpage' [-Wunused-function]
   static void perf_event_update_userpage(struct perf_event *event)                        { }
               ^
   include/linux/perf_event.h:1689:13: warning: unused function 'perf_register_guest_info_callbacks' [-Wunused-function]
   static void perf_register_guest_info_callbacks(struct perf_guest_info_callbacks *cbs)   { }
               ^
   include/linux/perf_event.h:1690:13: warning: unused function 'perf_unregister_guest_info_callbacks' [-Wunused-function]
   static void perf_unregister_guest_info_callbacks(struct perf_guest_info_callbacks *cbs) { }
               ^
   include/linux/perf_event.h:1691:13: warning: unused function 'perf_report_aux_output_id' [-Wunused-function]
   static void perf_report_aux_output_id(struct perf_event *event, u64 hw_id)              { }
               ^
   include/linux/perf_event.h:1692:13: warning: unused function 'perf_tp_event' [-Wunused-function]
   static void perf_tp_event(u16 event_type, u64 count, void *record,
               ^
   include/linux/perf_event.h:1698:12: warning: unused function 'perf_pmu_register' [-Wunused-function]
   static int perf_pmu_register(struct pmu *pmu, const char *name, int type)
              ^
   include/linux/perf_event.h:1704:1: warning: unused function 'perf_event_create_kernel_counter' [-Wunused-function]
   perf_event_create_kernel_counter(struct perf_event_attr *attr,
   ^
   include/linux/perf_event.h:1712:13: warning: unused function 'perf_pmu_migrate_context' [-Wunused-function]
   static void perf_pmu_migrate_context(struct pmu *pmu, int src_cpu, int dst_cpu)         { }
               ^
   include/linux/perf_event.h:1713:16: warning: unused function 'perf_event_sysfs_show' [-Wunused-function]
   static ssize_t perf_event_sysfs_show(struct device *dev, struct device_attribute *attr,
                  ^
   12 warnings generated.
--
   In file included from arch/riscv/kernel/signal.c:12:
   In file included from include/linux/syscalls.h:88:
   In file included from include/trace/syscall.h:7:
   In file included from include/linux/trace_events.h:10:
>> include/linux/perf_event.h:1702:13: warning: no previous prototype for function 'perf_pmu_unregister' [-Wmissing-prototypes]
   extern void perf_pmu_unregister(struct pmu *pmu)                                        { }
               ^
   include/linux/perf_event.h:1702:8: note: declare 'static' if the function is not intended to be used outside of this translation unit
   extern void perf_pmu_unregister(struct pmu *pmu)                                        { }
          ^
   arch/riscv/kernel/signal.c:319:27: warning: no previous prototype for function 'do_work_pending' [-Wmissing-prototypes]
   asmlinkage __visible void do_work_pending(struct pt_regs *regs,
                             ^
   arch/riscv/kernel/signal.c:319:22: note: declare 'static' if the function is not intended to be used outside of this translation unit
   asmlinkage __visible void do_work_pending(struct pt_regs *regs,
                        ^
                        static 
   In file included from arch/riscv/kernel/signal.c:12:
   In file included from include/linux/syscalls.h:88:
   In file included from include/trace/syscall.h:7:
   In file included from include/linux/trace_events.h:10:
   include/linux/perf_event.h:1682:13: warning: unused function 'perf_event_addr_filters_sync' [-Wunused-function]
   static void perf_event_addr_filters_sync(struct perf_event *event)              { }
               ^
   include/linux/perf_event.h:1683:12: warning: unused function 'perf_event_read_value' [-Wunused-function]
   static u64 perf_event_read_value(struct perf_event *event,
              ^
   include/linux/perf_event.h:1688:13: warning: unused function 'perf_event_update_userpage' [-Wunused-function]
   static void perf_event_update_userpage(struct perf_event *event)                        { }
               ^
   include/linux/perf_event.h:1689:13: warning: unused function 'perf_register_guest_info_callbacks' [-Wunused-function]
   static void perf_register_guest_info_callbacks(struct perf_guest_info_callbacks *cbs)   { }
               ^
   include/linux/perf_event.h:1690:13: warning: unused function 'perf_unregister_guest_info_callbacks' [-Wunused-function]
   static void perf_unregister_guest_info_callbacks(struct perf_guest_info_callbacks *cbs) { }
               ^
   include/linux/perf_event.h:1691:13: warning: unused function 'perf_report_aux_output_id' [-Wunused-function]
   static void perf_report_aux_output_id(struct perf_event *event, u64 hw_id)              { }
               ^
   include/linux/perf_event.h:1692:13: warning: unused function 'perf_tp_event' [-Wunused-function]
   static void perf_tp_event(u16 event_type, u64 count, void *record,
               ^
   include/linux/perf_event.h:1698:12: warning: unused function 'perf_pmu_register' [-Wunused-function]
   static int perf_pmu_register(struct pmu *pmu, const char *name, int type)
              ^
   include/linux/perf_event.h:1704:1: warning: unused function 'perf_event_create_kernel_counter' [-Wunused-function]
   perf_event_create_kernel_counter(struct perf_event_attr *attr,
   ^
   include/linux/perf_event.h:1712:13: warning: unused function 'perf_pmu_migrate_context' [-Wunused-function]
   static void perf_pmu_migrate_context(struct pmu *pmu, int src_cpu, int dst_cpu)         { }
               ^
   include/linux/perf_event.h:1713:16: warning: unused function 'perf_event_sysfs_show' [-Wunused-function]
   static ssize_t perf_event_sysfs_show(struct device *dev, struct device_attribute *attr,
                  ^
   13 warnings generated.


vim +/perf_pmu_unregister +1702 include/linux/perf_event.h

  1649	
  1650	extern int perf_output_begin(struct perf_output_handle *handle,
  1651				     struct perf_sample_data *data,
  1652				     struct perf_event *event, unsigned int size);
  1653	extern int perf_output_begin_forward(struct perf_output_handle *handle,
  1654					     struct perf_sample_data *data,
  1655					     struct perf_event *event,
  1656					     unsigned int size);
  1657	extern int perf_output_begin_backward(struct perf_output_handle *handle,
  1658					      struct perf_sample_data *data,
  1659					      struct perf_event *event,
  1660					      unsigned int size);
  1661	
  1662	extern void perf_output_end(struct perf_output_handle *handle);
  1663	extern unsigned int perf_output_copy(struct perf_output_handle *handle,
  1664				     const void *buf, unsigned int len);
  1665	extern unsigned int perf_output_skip(struct perf_output_handle *handle,
  1666					     unsigned int len);
  1667	extern long perf_output_copy_aux(struct perf_output_handle *aux_handle,
  1668					 struct perf_output_handle *handle,
  1669					 unsigned long from, unsigned long to);
  1670	extern int perf_swevent_get_recursion_context(void);
  1671	extern void perf_swevent_put_recursion_context(int rctx);
  1672	extern u64 perf_swevent_set_period(struct perf_event *event);
  1673	extern void perf_event_enable(struct perf_event *event);
  1674	extern void perf_event_disable(struct perf_event *event);
  1675	extern void perf_event_disable_local(struct perf_event *event);
  1676	extern void perf_event_disable_inatomic(struct perf_event *event);
  1677	extern void perf_event_task_tick(void);
  1678	extern int perf_event_account_interrupt(struct perf_event *event);
  1679	extern int perf_event_period(struct perf_event *event, u64 value);
  1680	extern u64 perf_event_pause(struct perf_event *event, bool reset);
  1681	#else /* !CONFIG_PERF_EVENTS: */
  1682	static void perf_event_addr_filters_sync(struct perf_event *event)		{ }
  1683	static u64 perf_event_read_value(struct perf_event *event,
  1684					 u64 *enabled, u64 *running)
  1685	{
  1686		return 0;
  1687	}
  1688	static void perf_event_update_userpage(struct perf_event *event)			{ }
  1689	static void perf_register_guest_info_callbacks(struct perf_guest_info_callbacks *cbs)	{ }
  1690	static void perf_unregister_guest_info_callbacks(struct perf_guest_info_callbacks *cbs)	{ }
  1691	static void perf_report_aux_output_id(struct perf_event *event, u64 hw_id)		{ }
  1692	static void perf_tp_event(u16 event_type, u64 count, void *record,
  1693				  int entry_size, struct pt_regs *regs,
  1694				  struct hlist_head *head, int rctx,
  1695				  struct task_struct *task)
  1696	{
  1697	}
  1698	static int perf_pmu_register(struct pmu *pmu, const char *name, int type)
  1699	{
  1700		return -1;
  1701	}
> 1702	extern void perf_pmu_unregister(struct pmu *pmu)					{ }
  1703	static struct perf_event *
  1704	perf_event_create_kernel_counter(struct perf_event_attr *attr,
  1705					int cpu,
  1706					struct task_struct *task,
  1707					perf_overflow_handler_t callback,
  1708					void *context)
  1709	{
  1710		return NULL;
  1711	}
  1712	static void perf_pmu_migrate_context(struct pmu *pmu, int src_cpu, int dst_cpu)		{ }
  1713	static ssize_t perf_event_sysfs_show(struct device *dev, struct device_attribute *attr,
  1714				      char *page)
  1715	{
  1716		return -1;
  1717	}
  1718	static inline void *
  1719	perf_aux_output_begin(struct perf_output_handle *handle,
  1720			      struct perf_event *event)				{ return NULL; }
  1721	static inline void
  1722	perf_aux_output_end(struct perf_output_handle *handle, unsigned long size)
  1723										{ }
  1724	static inline int
  1725	perf_aux_output_skip(struct perf_output_handle *handle,
  1726			     unsigned long size)				{ return -EINVAL; }
  1727	static inline void *
  1728	perf_get_aux(struct perf_output_handle *handle)				{ return NULL; }
  1729	static inline void
  1730	perf_event_task_migrate(struct task_struct *task)			{ }
  1731	static inline void
  1732	perf_event_task_sched_in(struct task_struct *prev,
  1733				 struct task_struct *task)			{ }
  1734	static inline void
  1735	perf_event_task_sched_out(struct task_struct *prev,
  1736				  struct task_struct *next)			{ }
  1737	static inline int perf_event_init_task(struct task_struct *child,
  1738					       u64 clone_flags)			{ return 0; }
  1739	static inline void perf_event_exit_task(struct task_struct *child)	{ }
  1740	static inline void perf_event_free_task(struct task_struct *task)	{ }
  1741	static inline void perf_event_delayed_put(struct task_struct *task)	{ }
  1742	static inline struct file *perf_event_get(unsigned int fd)	{ return ERR_PTR(-EINVAL); }
  1743	static inline const struct perf_event *perf_get_event(struct file *file)
  1744	{
  1745		return ERR_PTR(-EINVAL);
  1746	}
  1747	static inline const struct perf_event_attr *perf_event_attrs(struct perf_event *event)
  1748	{
  1749		return ERR_PTR(-EINVAL);
  1750	}
  1751	static inline int perf_event_read_local(struct perf_event *event, u64 *value,
  1752						u64 *enabled, u64 *running)
  1753	{
  1754		return -EINVAL;
  1755	}
  1756	static inline void perf_event_print_debug(void)				{ }
  1757	static inline int perf_event_task_disable(void)				{ return -EINVAL; }
  1758	static inline int perf_event_task_enable(void)				{ return -EINVAL; }
  1759	static inline int perf_event_refresh(struct perf_event *event, int refresh)
  1760	{
  1761		return -EINVAL;
  1762	}
  1763	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests

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

* [PATCH] perf/core: introduced stub APIs for exported APIs
  2023-03-05  5:39 [PATCH] perf/core: introduced stub APIs for exported APIs Manish Bhardwaj
                   ` (2 preceding siblings ...)
  2023-03-05  7:57 ` kernel test robot
@ 2023-03-05  9:27 ` Manish Bhardwaj
  2023-03-05 10:20   ` kernel test robot
                     ` (2 more replies)
  2023-03-06 16:56 ` Mark Rutland
  4 siblings, 3 replies; 9+ messages in thread
From: Manish Bhardwaj @ 2023-03-05  9:27 UTC (permalink / raw)
  To: bhardwajmanish18
  Cc: acme, alexander.shishkin, irogers, jolsa, linux-kernel,
	linux-perf-users, mark.rutland, mingo, namhyung, peterz

Introduced stub APIs for exported APIs so that we can build
independent module without any error if CONFIG_PERF_EVENT
feature is disabled in kernel.

drivers/platform/tegra/uncore_pmu/tegra23x_perf_uncore.c:
In function _scf_pmu_device_probe_:
drivers/platform/tegra/uncore_pmu/tegra23x_perf_uncore.c:596:    8:
error: implicit declaration of function _perf_pmu_register_
[-Werror=implicit-function-declaration]
  err = perf_pmu_register(&uncore_pmu->pmu, uncore_pmu->pmu.name,
531       |        ^~~~~~~~~~~~~~~~~
drivers/platform/tegra/uncore_pmu/tegra23x_perf_uncore.c: In
function _scf_pmu_device_remove_:
drivers/platform/tegra/uncore_pmu/tegra23x_perf_uncore.c:611:    2:
error: implicit declaration of function _perf_pmu_unregister_; did you
mean _device_unregister_? [-Werror=implicit-function-declaration]
  611 |  perf_pmu_unregister(&uncore_pmu->pmu);
      |  ^~~~~~~~~~~~~~~~~~~
      |  device_unregister
cc1: some warnings being treated as errors
scripts/Makefile.build:297: recipe for target
'drivers/platform/tegra/uncore_pmu/tegra23x_perf_uncore.o' failed
make[7]: *** [drivers/platform/tegra/
uncore_pmu/tegra23x_perf_uncore.o] Error 1

Signed-off-by: Manish Bhardwaj <bhardwajmanish18@gmail.com>
---
 include/linux/perf_event.h | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index d5628a7b5eaa..96259320aff1 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -1679,6 +1679,42 @@ extern int perf_event_account_interrupt(struct perf_event *event);
 extern int perf_event_period(struct perf_event *event, u64 value);
 extern u64 perf_event_pause(struct perf_event *event, bool reset);
 #else /* !CONFIG_PERF_EVENTS: */
+static void perf_event_addr_filters_sync(struct perf_event *event)		{ }
+static u64 perf_event_read_value(struct perf_event *event,
+				 u64 *enabled, u64 *running)
+{
+	return 0;
+}
+static void perf_event_update_userpage(struct perf_event *event)			{ }
+static void perf_register_guest_info_callbacks(struct perf_guest_info_callbacks *cbs)	{ }
+static void perf_unregister_guest_info_callbacks(struct perf_guest_info_callbacks *cbs)	{ }
+static void perf_report_aux_output_id(struct perf_event *event, u64 hw_id)		{ }
+static void perf_tp_event(u16 event_type, u64 count, void *record,
+			  int entry_size, struct pt_regs *regs,
+			  struct hlist_head *head, int rctx,
+			  struct task_struct *task)
+{
+}
+static int perf_pmu_register(struct pmu *pmu, const char *name, int type)
+{
+	return -1;
+}
+static void perf_pmu_unregister(struct pmu *pmu)					{ }
+static struct perf_event *
+perf_event_create_kernel_counter(struct perf_event_attr *attr,
+				int cpu,
+				struct task_struct *task,
+				perf_overflow_handler_t callback,
+				void *context)
+{
+	return NULL;
+}
+static void perf_pmu_migrate_context(struct pmu *pmu, int src_cpu, int dst_cpu)		{ }
+static ssize_t perf_event_sysfs_show(struct device *dev, struct device_attribute *attr,
+			      char *page)
+{
+	return -1;
+}
 static inline void *
 perf_aux_output_begin(struct perf_output_handle *handle,
 		      struct perf_event *event)				{ return NULL; }

base-commit: b01fe98d34f3bed944a93bd8119fed80c856fad8
-- 
2.39.2


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

* Re: [PATCH] perf/core: introduced stub APIs for exported APIs
  2023-03-05  9:27 ` Manish Bhardwaj
@ 2023-03-05 10:20   ` kernel test robot
  2023-03-06 11:45   ` Peter Zijlstra
       [not found]   ` <CAPLwjC7=SS2v2qU==mAUrS=SH1Fmg0bXQx4Swnqh8ndSCvULEw@mail.gmail.com>
  2 siblings, 0 replies; 9+ messages in thread
From: kernel test robot @ 2023-03-05 10:20 UTC (permalink / raw)
  To: Manish Bhardwaj
  Cc: oe-kbuild-all, acme, alexander.shishkin, irogers, jolsa,
	linux-kernel, linux-perf-users, mark.rutland, mingo, namhyung

Hi Manish,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on b01fe98d34f3bed944a93bd8119fed80c856fad8]

url:    https://github.com/intel-lab-lkp/linux/commits/Manish-Bhardwaj/perf-core-introduced-stub-APIs-for-exported-APIs/20230305-172840
base:   b01fe98d34f3bed944a93bd8119fed80c856fad8
patch link:    https://lore.kernel.org/r/20230305092759.10754-1-bhardwajmanish18%40gmail.com
patch subject: [PATCH] perf/core: introduced stub APIs for exported APIs
config: powerpc-allnoconfig (https://download.01.org/0day-ci/archive/20230305/202303051803.g6sS9VOE-lkp@intel.com/config)
compiler: powerpc-linux-gcc (GCC) 12.1.0
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/intel-lab-lkp/linux/commit/abd3574667ce6899f498ffc1be32ade8ac01e4cb
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Manish-Bhardwaj/perf-core-introduced-stub-APIs-for-exported-APIs/20230305-172840
        git checkout abd3574667ce6899f498ffc1be32ade8ac01e4cb
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=powerpc olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=powerpc SHELL=/bin/bash arch/powerpc/kernel/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202303051803.g6sS9VOE-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from include/linux/trace_events.h:10,
                    from include/trace/syscall.h:7,
                    from include/linux/syscalls.h:88,
                    from arch/powerpc/kernel/syscalls.c:19:
   include/linux/perf_event.h:1713:16: error: 'perf_event_sysfs_show' defined but not used [-Werror=unused-function]
    1713 | static ssize_t perf_event_sysfs_show(struct device *dev, struct device_attribute *attr,
         |                ^~~~~~~~~~~~~~~~~~~~~
   include/linux/perf_event.h:1712:13: error: 'perf_pmu_migrate_context' defined but not used [-Werror=unused-function]
    1712 | static void perf_pmu_migrate_context(struct pmu *pmu, int src_cpu, int dst_cpu)         { }
         |             ^~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/perf_event.h:1704:1: error: 'perf_event_create_kernel_counter' defined but not used [-Werror=unused-function]
    1704 | perf_event_create_kernel_counter(struct perf_event_attr *attr,
         | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/perf_event.h:1702:13: error: 'perf_pmu_unregister' defined but not used [-Werror=unused-function]
    1702 | static void perf_pmu_unregister(struct pmu *pmu)                                        { }
         |             ^~~~~~~~~~~~~~~~~~~
   include/linux/perf_event.h:1698:12: error: 'perf_pmu_register' defined but not used [-Werror=unused-function]
    1698 | static int perf_pmu_register(struct pmu *pmu, const char *name, int type)
         |            ^~~~~~~~~~~~~~~~~
   include/linux/perf_event.h:1692:13: error: 'perf_tp_event' defined but not used [-Werror=unused-function]
    1692 | static void perf_tp_event(u16 event_type, u64 count, void *record,
         |             ^~~~~~~~~~~~~
   include/linux/perf_event.h:1691:13: error: 'perf_report_aux_output_id' defined but not used [-Werror=unused-function]
    1691 | static void perf_report_aux_output_id(struct perf_event *event, u64 hw_id)              { }
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/perf_event.h:1690:13: error: 'perf_unregister_guest_info_callbacks' defined but not used [-Werror=unused-function]
    1690 | static void perf_unregister_guest_info_callbacks(struct perf_guest_info_callbacks *cbs) { }
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/perf_event.h:1689:13: error: 'perf_register_guest_info_callbacks' defined but not used [-Werror=unused-function]
    1689 | static void perf_register_guest_info_callbacks(struct perf_guest_info_callbacks *cbs)   { }
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/perf_event.h:1688:13: error: 'perf_event_update_userpage' defined but not used [-Werror=unused-function]
    1688 | static void perf_event_update_userpage(struct perf_event *event)                        { }
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/perf_event.h:1683:12: error: 'perf_event_read_value' defined but not used [-Werror=unused-function]
    1683 | static u64 perf_event_read_value(struct perf_event *event,
         |            ^~~~~~~~~~~~~~~~~~~~~
   include/linux/perf_event.h:1682:13: error: 'perf_event_addr_filters_sync' defined but not used [-Werror=unused-function]
    1682 | static void perf_event_addr_filters_sync(struct perf_event *event)              { }
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   cc1: all warnings being treated as errors


vim +/perf_pmu_unregister +1702 include/linux/perf_event.h

  1649	
  1650	extern int perf_output_begin(struct perf_output_handle *handle,
  1651				     struct perf_sample_data *data,
  1652				     struct perf_event *event, unsigned int size);
  1653	extern int perf_output_begin_forward(struct perf_output_handle *handle,
  1654					     struct perf_sample_data *data,
  1655					     struct perf_event *event,
  1656					     unsigned int size);
  1657	extern int perf_output_begin_backward(struct perf_output_handle *handle,
  1658					      struct perf_sample_data *data,
  1659					      struct perf_event *event,
  1660					      unsigned int size);
  1661	
  1662	extern void perf_output_end(struct perf_output_handle *handle);
  1663	extern unsigned int perf_output_copy(struct perf_output_handle *handle,
  1664				     const void *buf, unsigned int len);
  1665	extern unsigned int perf_output_skip(struct perf_output_handle *handle,
  1666					     unsigned int len);
  1667	extern long perf_output_copy_aux(struct perf_output_handle *aux_handle,
  1668					 struct perf_output_handle *handle,
  1669					 unsigned long from, unsigned long to);
  1670	extern int perf_swevent_get_recursion_context(void);
  1671	extern void perf_swevent_put_recursion_context(int rctx);
  1672	extern u64 perf_swevent_set_period(struct perf_event *event);
  1673	extern void perf_event_enable(struct perf_event *event);
  1674	extern void perf_event_disable(struct perf_event *event);
  1675	extern void perf_event_disable_local(struct perf_event *event);
  1676	extern void perf_event_disable_inatomic(struct perf_event *event);
  1677	extern void perf_event_task_tick(void);
  1678	extern int perf_event_account_interrupt(struct perf_event *event);
  1679	extern int perf_event_period(struct perf_event *event, u64 value);
  1680	extern u64 perf_event_pause(struct perf_event *event, bool reset);
  1681	#else /* !CONFIG_PERF_EVENTS: */
  1682	static void perf_event_addr_filters_sync(struct perf_event *event)		{ }
  1683	static u64 perf_event_read_value(struct perf_event *event,
  1684					 u64 *enabled, u64 *running)
  1685	{
  1686		return 0;
  1687	}
  1688	static void perf_event_update_userpage(struct perf_event *event)			{ }
  1689	static void perf_register_guest_info_callbacks(struct perf_guest_info_callbacks *cbs)	{ }
  1690	static void perf_unregister_guest_info_callbacks(struct perf_guest_info_callbacks *cbs)	{ }
  1691	static void perf_report_aux_output_id(struct perf_event *event, u64 hw_id)		{ }
  1692	static void perf_tp_event(u16 event_type, u64 count, void *record,
  1693				  int entry_size, struct pt_regs *regs,
  1694				  struct hlist_head *head, int rctx,
  1695				  struct task_struct *task)
  1696	{
  1697	}
  1698	static int perf_pmu_register(struct pmu *pmu, const char *name, int type)
  1699	{
  1700		return -1;
  1701	}
> 1702	static void perf_pmu_unregister(struct pmu *pmu)					{ }
  1703	static struct perf_event *
  1704	perf_event_create_kernel_counter(struct perf_event_attr *attr,
  1705					int cpu,
  1706					struct task_struct *task,
  1707					perf_overflow_handler_t callback,
  1708					void *context)
  1709	{
  1710		return NULL;
  1711	}
  1712	static void perf_pmu_migrate_context(struct pmu *pmu, int src_cpu, int dst_cpu)		{ }
  1713	static ssize_t perf_event_sysfs_show(struct device *dev, struct device_attribute *attr,
  1714				      char *page)
  1715	{
  1716		return -1;
  1717	}
  1718	static inline void *
  1719	perf_aux_output_begin(struct perf_output_handle *handle,
  1720			      struct perf_event *event)				{ return NULL; }
  1721	static inline void
  1722	perf_aux_output_end(struct perf_output_handle *handle, unsigned long size)
  1723										{ }
  1724	static inline int
  1725	perf_aux_output_skip(struct perf_output_handle *handle,
  1726			     unsigned long size)				{ return -EINVAL; }
  1727	static inline void *
  1728	perf_get_aux(struct perf_output_handle *handle)				{ return NULL; }
  1729	static inline void
  1730	perf_event_task_migrate(struct task_struct *task)			{ }
  1731	static inline void
  1732	perf_event_task_sched_in(struct task_struct *prev,
  1733				 struct task_struct *task)			{ }
  1734	static inline void
  1735	perf_event_task_sched_out(struct task_struct *prev,
  1736				  struct task_struct *next)			{ }
  1737	static inline int perf_event_init_task(struct task_struct *child,
  1738					       u64 clone_flags)			{ return 0; }
  1739	static inline void perf_event_exit_task(struct task_struct *child)	{ }
  1740	static inline void perf_event_free_task(struct task_struct *task)	{ }
  1741	static inline void perf_event_delayed_put(struct task_struct *task)	{ }
  1742	static inline struct file *perf_event_get(unsigned int fd)	{ return ERR_PTR(-EINVAL); }
  1743	static inline const struct perf_event *perf_get_event(struct file *file)
  1744	{
  1745		return ERR_PTR(-EINVAL);
  1746	}
  1747	static inline const struct perf_event_attr *perf_event_attrs(struct perf_event *event)
  1748	{
  1749		return ERR_PTR(-EINVAL);
  1750	}
  1751	static inline int perf_event_read_local(struct perf_event *event, u64 *value,
  1752						u64 *enabled, u64 *running)
  1753	{
  1754		return -EINVAL;
  1755	}
  1756	static inline void perf_event_print_debug(void)				{ }
  1757	static inline int perf_event_task_disable(void)				{ return -EINVAL; }
  1758	static inline int perf_event_task_enable(void)				{ return -EINVAL; }
  1759	static inline int perf_event_refresh(struct perf_event *event, int refresh)
  1760	{
  1761		return -EINVAL;
  1762	}
  1763	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests

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

* Re: [PATCH] perf/core: introduced stub APIs for exported APIs
  2023-03-05  9:27 ` Manish Bhardwaj
  2023-03-05 10:20   ` kernel test robot
@ 2023-03-06 11:45   ` Peter Zijlstra
       [not found]   ` <CAPLwjC7=SS2v2qU==mAUrS=SH1Fmg0bXQx4Swnqh8ndSCvULEw@mail.gmail.com>
  2 siblings, 0 replies; 9+ messages in thread
From: Peter Zijlstra @ 2023-03-06 11:45 UTC (permalink / raw)
  To: Manish Bhardwaj
  Cc: acme, alexander.shishkin, irogers, jolsa, linux-kernel,
	linux-perf-users, mark.rutland, mingo, namhyung

On Sun, Mar 05, 2023 at 02:57:59PM +0530, Manish Bhardwaj wrote:
> Introduced stub APIs for exported APIs so that we can build
> independent module without any error if CONFIG_PERF_EVENT
> feature is disabled in kernel.

WTH would you build these drivers when PERF_EVENT=n ?!?

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

* Re: [PATCH] perf/core: introduced stub APIs for exported APIs
       [not found]   ` <CAPLwjC7=SS2v2qU==mAUrS=SH1Fmg0bXQx4Swnqh8ndSCvULEw@mail.gmail.com>
@ 2023-03-06 11:46     ` Peter Zijlstra
  0 siblings, 0 replies; 9+ messages in thread
From: Peter Zijlstra @ 2023-03-06 11:46 UTC (permalink / raw)
  Cc: acme, alexander.shishkin, irogers, jolsa, linux-kernel,
	linux-perf-users, mark.rutland, mingo, namhyung

On Sun, Mar 05, 2023 at 03:24:27PM +0530, manish bhardwaj wrote:
> Can you guys, please let me know how and where I can track this patch in
> patchwork?

What's a patchwork, also top posting, srsly?

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

* Re: [PATCH] perf/core: introduced stub APIs for exported APIs
  2023-03-05  5:39 [PATCH] perf/core: introduced stub APIs for exported APIs Manish Bhardwaj
                   ` (3 preceding siblings ...)
  2023-03-05  9:27 ` Manish Bhardwaj
@ 2023-03-06 16:56 ` Mark Rutland
  4 siblings, 0 replies; 9+ messages in thread
From: Mark Rutland @ 2023-03-06 16:56 UTC (permalink / raw)
  To: Manish Bhardwaj
  Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Alexander Shishkin, Jiri Olsa, Namhyung Kim, Ian Rogers,
	linux-perf-users, linux-kernel

On Sun, Mar 05, 2023 at 11:09:34AM +0530, Manish Bhardwaj wrote:
> Introduced stub APIs for exported APIs so that we can build
> independent module without any error if CONFIG_PERF_EVENT
> feature is disabled in kernel.
> 
> drivers/platform/tegra/uncore_pmu/tegra23x_perf_uncore.c:

This file and folders do not exist in mainline (looking at v6.3-rc1), and I'd
expect this driver to live under drivers/perf/ unless it's tied to some other
component, which the naming implies it is not.

There is no point bulding a PMU driver when CONFIG_PERF_EVENT=n, since it
cannot register with perf and so the code will bloat the kernel for no reason.

The better option is to fix the Kconfig for the driver to depend upon
CONFIG_PERF_EVENT=y so that it cannot be built in this case.

Thanks,
Mark.

> In function _scf_pmu_device_probe_:
> drivers/platform/tegra/uncore_pmu/tegra23x_perf_uncore.c:596:    8:
> error: implicit declaration of function _perf_pmu_register_
> [-Werror=implicit-function-declaration]
>   err = perf_pmu_register(&uncore_pmu->pmu, uncore_pmu->pmu.name,
> 531       |        ^~~~~~~~~~~~~~~~~
> drivers/platform/tegra/uncore_pmu/tegra23x_perf_uncore.c: In
> function _scf_pmu_device_remove_:
> drivers/platform/tegra/uncore_pmu/tegra23x_perf_uncore.c:611:    2:
> error: implicit declaration of function _perf_pmu_unregister_; did you
> mean _device_unregister_? [-Werror=implicit-function-declaration]
>   611 |  perf_pmu_unregister(&uncore_pmu->pmu);
>       |  ^~~~~~~~~~~~~~~~~~~
>       |  device_unregister
> cc1: some warnings being treated as errors
> scripts/Makefile.build:297: recipe for target
> 'drivers/platform/tegra/uncore_pmu/tegra23x_perf_uncore.o' failed
> make[7]: *** [drivers/platform/tegra/
> uncore_pmu/tegra23x_perf_uncore.o] Error 1
> 
> Signed-off-by: Manish Bhardwaj <bhardwajmanish18@gmail.com>
> ---
>  include/linux/perf_event.h | 36 ++++++++++++++++++++++++++++++++++++
>  1 file changed, 36 insertions(+)
> 
> diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
> index d5628a7b5eaa..f3361f6f348e 100644
> --- a/include/linux/perf_event.h
> +++ b/include/linux/perf_event.h
> @@ -1679,6 +1679,42 @@ extern int perf_event_account_interrupt(struct perf_event *event);
>  extern int perf_event_period(struct perf_event *event, u64 value);
>  extern u64 perf_event_pause(struct perf_event *event, bool reset);
>  #else /* !CONFIG_PERF_EVENTS: */
> +static void perf_event_addr_filters_sync(struct perf_event *event)		{ }
> +static u64 perf_event_read_value(struct perf_event *event,
> +				 u64 *enabled, u64 *running)
> +{
> +	return 0;
> +}
> +static void perf_event_update_userpage(struct perf_event *event)			{ }
> +static void perf_register_guest_info_callbacks(struct perf_guest_info_callbacks *cbs)	{ }
> +static void perf_unregister_guest_info_callbacks(struct perf_guest_info_callbacks *cbs)	{ }
> +static void perf_report_aux_output_id(struct perf_event *event, u64 hw_id)		{ }
> +static void perf_tp_event(u16 event_type, u64 count, void *record,
> +			  int entry_size, struct pt_regs *regs,
> +			  struct hlist_head *head, int rctx,
> +			  struct task_struct *task)
> +{
> +}
> +static int perf_pmu_register(struct pmu *pmu, const char *name, int type)
> +{
> +	return -1;
> +}
> +extern void perf_pmu_unregister(struct pmu *pmu)					{ }
> +static struct perf_event *
> +perf_event_create_kernel_counter(struct perf_event_attr *attr,
> +				int cpu,
> +				struct task_struct *task,
> +				perf_overflow_handler_t callback,
> +				void *context)
> +{
> +	return NULL;
> +}
> +static void perf_pmu_migrate_context(struct pmu *pmu, int src_cpu, int dst_cpu)		{ }
> +static ssize_t perf_event_sysfs_show(struct device *dev, struct device_attribute *attr,
> +			      char *page)
> +{
> +	return -1;
> +}
>  static inline void *
>  perf_aux_output_begin(struct perf_output_handle *handle,
>  		      struct perf_event *event)				{ return NULL; }
> -- 
> 2.39.2
> 

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

end of thread, other threads:[~2023-03-06 16:57 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-05  5:39 [PATCH] perf/core: introduced stub APIs for exported APIs Manish Bhardwaj
2023-03-05  7:36 ` kernel test robot
2023-03-05  7:36 ` kernel test robot
2023-03-05  7:57 ` kernel test robot
2023-03-05  9:27 ` Manish Bhardwaj
2023-03-05 10:20   ` kernel test robot
2023-03-06 11:45   ` Peter Zijlstra
     [not found]   ` <CAPLwjC7=SS2v2qU==mAUrS=SH1Fmg0bXQx4Swnqh8ndSCvULEw@mail.gmail.com>
2023-03-06 11:46     ` Peter Zijlstra
2023-03-06 16:56 ` Mark Rutland

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).