riscv: perf_event: Make some funciton static
Subsystems (2)
PATCH 1/1 riscv: perf_event: Make some funciton static
Fixes the following warning detected when running make with W=1, ../arch/riscv/kernel/perf_event.c:150:5: warning: no previous prototype for ‘riscv_map_cache_decode’ [-Wmissing-prototypes]
int riscv_map_cache_decode(u64 config, unsigned int *type,
^~~~~~~~~~~~~~~~~~~~~~
../arch/riscv/kernel/perf_event.c:345:13: warning: no previous prototype for ‘riscv_base_pmu_handle_irq’ [-Wmissing-prototypes]
irqreturn_t riscv_base_pmu_handle_irq(int irq_num, void *dev)
^~~~~~~~~~~~~~~~~~~~~~~~~
../arch/riscv/kernel/perf_event.c:364:6: warning: no previous prototype for ‘release_pmc_hardware’ [-Wmissing-prototypes]
void release_pmc_hardware(void)
^~~~~~~~~~~~~~~~~~~~
../arch/riscv/kernel/perf_event.c:467:12: warning: no previous prototype for ‘init_hw_perf_events’ [-Wmissing-prototypes]
int __init init_hw_perf_events(void)
^~~~~~~~~~~~~~~~~~~--- arch/riscv/kernel/perf_event.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/riscv/kernel/perf_event.c +4 -4
@@ -147,7 +147,7 @@ static int riscv_map_hw_event(u64 config)return riscv_pmu->hw_events[config]; } -int riscv_map_cache_decode (u64 config,unsigned int *type, +static int riscv_map_cache_decode (u64 config,unsigned int *type,unsigned int *op,unsigned int *result) {return -ENOENT ;
@@ -342,7 +342,7 @@ static void riscv_pmu_del(struct perf_event *event, int flags)static DEFINE_MUTEX (pmc_reserve_mutex); -irqreturn_t riscv_base_pmu_handle_irq (int irq_num,void *dev) +static irqreturn_t riscv_base_pmu_handle_irq (int irq_num,void *dev) {return IRQ_NONE ; }
@@ -361,7 +361,7 @@ static int reserve_pmc_hardware(void)return err; } -void release_pmc_hardware (void ) +static void release_pmc_hardware (void ) {mutex_lock (&pmc_reserve_mutex);if (riscv_pmu->irq >=0 )
@@ -464,7 +464,7 @@ static const struct of_device_id riscv_pmu_of_ids[] = { {/* sentinel value */ } }; -int __init init_hw_perf_events (void ) +static int __init init_hw_perf_events (void ) {struct device_node *node =of_find_node_by_type (NULL ,"pmu" );const struct of_device_id *of_id;
Signature · 1 line
2.26.2
PATCH 1/1 riscv: perf: RISCV_BASE_PMU should be closeable
As 178e9fc47aae("perf: riscv: preliminary RISC-V support") said, For RISCV_BASE_PMU, 'this option can also be disable to reduce kernel size', but it could not work well, we need diable both RISCV_BASE_PMU and PERF_EVENTS manually, or build error will occur when only disable RISCV_BASE_PMU.
--- arch/riscv/include/asm/perf_event.h | 8 ++------ arch/riscv/kernel/Makefile | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-)
arch/riscv/include/asm/perf_event.h +2 -6
@@ -12,19 +12,14 @@#include <linux/ptrace.h> #include <linux/interrupt.h> +#ifdef CONFIG_RISCV_BASE_PMU #define RISCV_BASE_COUNTERS 2/* * The RISCV_MAX_COUNTERS parameter should be specified. */ -#ifdef CONFIG_RISCV_BASE_PMU #define RISCV_MAX_COUNTERS 2 -#endif - -#ifndef RISCV_MAX_COUNTERS -#error "Please provide a valid RISCV_MAX_COUNTERS for the PMU." -#endif /* * These are the indexes of bits in counteren register *minus* 1,
@@ -82,6 +77,7 @@ struct riscv_pmu { int irq; }; +#endif #ifdef CONFIG_PERF_EVENTS #define perf_arch_bpf_user_pt_regs (regs) (struct user_regs_struct *)regs#endif
arch/riscv/kernel/Makefile +1 -1
@@ -43,7 +43,7 @@ obj-$(CONFIG_MODULE_SECTIONS) += module-sections.o obj-$(CONFIG_FUNCTION_TRACER) += mcount.o ftrace.o obj-$(CONFIG_DYNAMIC_FTRACE) += mcount-dyn.o -obj-$(CONFIG_PERF_EVENTS) += perf_event.o +obj-$(CONFIG_RISCV_BASE_PMU) += perf_event.o obj-$(CONFIG_PERF_EVENTS) += perf_callchain.o obj-$(CONFIG_HAVE_PERF_REGS) += perf_regs.o obj-$(CONFIG_RISCV_SBI) += sbi.o
Signature · 1 line
2.26.2
Palmer Dabbelt
maintainerRe: [PATCH -next] riscv: perf: RISCV_BASE_PMU should be closeable
Quoted 5 lines · On Thu, 07 May 2020 08:04:45 PDT (-0700), [email protected] wrote:
As 178e9fc47aae("perf: riscv: preliminary RISC-V support") said, For
RISCV_BASE_PMU, 'this option can also be disable to reduce kernel size', but it could not work well, we need diable bothRISCV_BASE_PMUandPERF_EVENTSmanually, or build error will occur when only disableRISCV_BASE_PMU.
I'm worried this belies a larger issue related to how this PMU stuff works, but we have only one PMU right now so it's not a pressing issue. I've taken this onto fixes.
Thanks!
Quoted 54 lines
Cc Alan Kao <[email protected]>Signed-off-by Kefeng Wang <[email protected]>--- arch/riscv/include/asm/perf_event.h | 8 ++------ arch/riscv/kernel/Makefile | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-)arch/riscv/include/asm/perf_event.h +2
-6@@ -12,19 +12,14 @@#include <linux/ptrace.h> #include <linux/interrupt.h> +#ifdef CONFIG_RISCV_BASE_PMU #define RISCV_BASE_COUNTERS 2/* * The RISCV_MAX_COUNTERS parameter should be specified. */ -#ifdef CONFIG_RISCV_BASE_PMU #define RISCV_MAX_COUNTERS 2 -#endif - -#ifndef RISCV_MAX_COUNTERS -#error "Please provide a valid RISCV_MAX_COUNTERS for the PMU." -#endif /* * These are the indexes of bits in counteren register *minus* 1, @@ -82,6 +77,7 @@ struct riscv_pmu { int irq; }; +#endif #ifdef CONFIG_PERF_EVENTS #define perf_arch_bpf_user_pt_regs (regs) (struct user_regs_struct *)regs#endif arch/riscv/kernel/Makefile +1
-1@@ -43,7 +43,7 @@ obj-$(CONFIG_MODULE_SECTIONS) += module-sections.o obj-$(CONFIG_FUNCTION_TRACER) += mcount.o ftrace.o obj-$(CONFIG_DYNAMIC_FTRACE) += mcount-dyn.o -obj-$(CONFIG_PERF_EVENTS) += perf_event.o +obj-$(CONFIG_RISCV_BASE_PMU) += perf_event.o obj-$(CONFIG_PERF_EVENTS) += perf_callchain.o obj-$(CONFIG_HAVE_PERF_REGS) += perf_regs.o obj-$(CONFIG_RISCV_SBI) += sbi.o
What's the "-next" for? This seems appropriate for an RC to me, as it's a build fix.
Quoted 52 lines · On Thu, 07 May 2020 08:04:44 PDT (-0700), [email protected] wrote:
Fixes the following warning detected when running make with W=1,
../arch/riscv/kernel/perf_event.c:150:5: warning: no previous prototype for ‘riscv_map_cache_decode’ [-Wmissing-prototypes]
int riscv_map_cache_decode(u64 config, unsigned int *type,^~~~~~~~~~~~~~~~~~~~~~ ../arch/riscv/kernel/perf_event.c:345:13: warning: no previous prototype for ‘riscv_base_pmu_handle_irq’ [-Wmissing-prototypes] irqreturn_t riscv_base_pmu_handle_irq(int irq_num, void *dev) ^~~~~~~~~~~~~~~~~~~~~~~~~ ../arch/riscv/kernel/perf_event.c:364:6: warning: no previous prototype for ‘release_pmc_hardware’ [-Wmissing-prototypes] void release_pmc_hardware(void) ^~~~~~~~~~~~~~~~~~~~ ../arch/riscv/kernel/perf_event.c:467:12: warning: no previous prototype for ‘init_hw_perf_events’ [-Wmissing-prototypes] int __init init_hw_perf_events(void) ^~~~~~~~~~~~~~~~~~~Cc Alan Kao <[email protected]>Signed-off-by Kefeng Wang <[email protected]>--- arch/riscv/kernel/perf_event.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)arch/riscv/kernel/perf_event.c +3
-3@@ -147,7 +147,7 @@ static int riscv_map_hw_event(u64 config)return riscv_pmu->hw_events[config]; } -int riscv_map_cache_decode (u64 config,unsigned int *type, +static int riscv_map_cache_decode (u64 config,unsigned int *type,unsigned int *op,unsigned int *result) {return -ENOENT ;@@ -342,7 +342,7 @@ static void riscv_pmu_del(struct perf_event *event, int flags)static DEFINE_MUTEX (pmc_reserve_mutex); -irqreturn_t riscv_base_pmu_handle_irq (int irq_num,void *dev) +static irqreturn_t riscv_base_pmu_handle_irq (int irq_num,void *dev) {return IRQ_NONE ; }@@ -361,7 +361,7 @@ static int reserve_pmc_hardware(void)return err; } -void release_pmc_hardware (void ) +static void release_pmc_hardware (void ) {mutex_lock (&pmc_reserve_mutex);if (riscv_pmu->irq >=0 )
arch/riscv/kernel/perf_event.c static const struct of_device_id riscv_pmu_of_ids[] = { · line 470
Quoted 8 lines
arch/riscv/kernel/perf_event.c +1
-1@@ -464,7 +464,7 @@ static const struct of_device_id riscv_pmu_of_ids[] = { {/* sentinel value */ } }; -int __init init_hw_perf_events (void ) +static int __init init_hw_perf_events (void ) {struct device_node *node =of_find_node_by_type (NULL ,"pmu" );const struct of_device_id *of_id;
Quoted 2 lines · Palmer Dabbelt
What's the "-next" for? This seems appropriate for an RC to me, as it's a build fix.
Thanks for your review, this patch and "[PATCH -next] riscv: perf: RISCV_BASE_PMU
should be closeable", I fix the issue based on linux-next, so add the next prefix ; )
and we also found some another build issue when add RISCV arch to huawei build robot,
will send out the patches later.
Quoted 69 lines · On Thu, 07 May 2020 08:04:44 PDT (-0700), [email protected] wrote:
Quoted 61 lines
Fixes the following warning detected when running make with W=1,
../arch/riscv/kernel/perf_event.c:150:5: warning: no previous prototype for ‘riscv_map_cache_decode’ [-Wmissing-prototypes] int riscv_map_cache_decode(u64 config, unsigned int *type,
^~~~~~~~~~~~~~~~~~~~~~../arch/riscv/kernel/perf_event.c:345:13: warning: no previous prototype for ‘riscv_base_pmu_handle_irq’ [-Wmissing-prototypes]irqreturn_triscv_base_pmu_handle_irq(int irq_num, void *dev)
^~~~~~~~~~~~~~~~~~~~~~~~~../arch/riscv/kernel/perf_event.c:364:6: warning: no previous prototype for ‘release_pmc_hardware’ [-Wmissing-prototypes] voidrelease_pmc_hardware(void)
^~~~~~~~~~~~~~~~~~~~../arch/riscv/kernel/perf_event.c:467:12: warning: no previous prototype for ‘init_hw_perf_events’ [-Wmissing-prototypes] int__initinit_hw_perf_events(void)
^~~~~~~~~~~~~~~~~~~Cc Alan Kao <[email protected]>Signed-off-by Kefeng Wang <[email protected]>---
arch/riscv/kernel/perf_event.c | 8 ++++----1 file changed, 4 insertions(+), 4 deletions(-)arch/riscv/kernel/perf_event.c +2
-2@@ -147,7 +147,7 @@ static int riscv_map_hw_event(u64 config) return riscv_pmu->hw_events[config]; } -int riscv_map_cache_decode (u64 config,unsigned int *type, +static int riscv_map_cache_decode (u64 config,unsigned int *type, unsigned int *op, unsigned int *result) { return -ENOENT;@@ -342,7 +342,7 @@ static void riscv_pmu_del(struct perf_event *event, int flags) static DEFINE_MUTEX(pmc_reserve_mutex); -irqreturn_t riscv_base_pmu_handle_irq (int irq_num,void *dev) +static irqreturn_t riscv_base_pmu_handle_irq (int irq_num,void *dev) { return IRQ_NONE;}
arch/riscv/kernel/perf_event.c +2
-2@@ -361,7 +361,7 @@ static int reserve_pmc_hardware(void) return err; } -void release_pmc_hardware (void ) +static void release_pmc_hardware (void ) { mutex_lock(&pmc_reserve_mutex); if (riscv_pmu->irq >= 0)@@ -464,7 +464,7 @@ static const struct of_device_id riscv_pmu_of_ids[] = { { /* sentinel value */ } }; -int __init init_hw_perf_events (void ) +static int __init init_hw_perf_events (void ) { struct device_node *node = of_find_node_by_type(NULL, "pmu");Quoted 1 line
const struct
of_device_id*of_id;Reviewed-by Palmer Dabbelt <[email protected]>.
Palmer Dabbelt
maintainerQuoted 11 lines · On Sun, 10 May 2020 18:30:36 PDT (-0700), [email protected] wrote:
Quoted 3 lines · Palmer Dabbelt
What's the "-next" for? This seems appropriate for an RC to me, as it's a
build fix.Thanks for your review, this patch and "[PATCH -next] riscv: perf:
RISCV_BASE_PMUshould be closeable", I fix the issue based on linux-next, so add the next prefix ; )
OK, makes sense. I've put it on fixes.
Quoted 5 lines
and we also found some another build issue when add RISCV arch to huawei build robot,
will send out the patches later.
Thanks!
Quoted 75 lines
Quoted 75 lines
Quoted 66 lines · On Thu, 07 May 2020 08:04:44 PDT (-0700), [email protected] wrote:
Fixes the following warning detected when running make with W=1,
../arch/riscv/kernel/perf_event.c:150:5: warning: no previous prototype for ‘riscv_map_cache_decode’ [-Wmissing-prototypes] int riscv_map_cache_decode(u64 config, unsigned int *type, ^~~~~~~~~~~~~~~~~~~~~~../arch/riscv/kernel/perf_event.c:345:13: warning: no previous prototype for ‘riscv_base_pmu_handle_irq’ [-Wmissing-prototypes]irqreturn_triscv_base_pmu_handle_irq(int irq_num, void *dev)^~~~~~~~~~~~~~~~~~~~~~~~~../arch/riscv/kernel/perf_event.c:364:6: warning: no previous prototype for ‘release_pmc_hardware’ [-Wmissing-prototypes] voidrelease_pmc_hardware(void)
^~~~~~~~~~~~~~~~~~~~../arch/riscv/kernel/perf_event.c:467:12: warning: no previous prototype for ‘init_hw_perf_events’ [-Wmissing-prototypes] int__initinit_hw_perf_events(void)^~~~~~~~~~~~~~~~~~~Cc Alan Kao <[email protected]>Signed-off-by Kefeng Wang <[email protected]>---
arch/riscv/kernel/perf_event.c | 8 ++++----1 file changed, 4 insertions(+), 4 deletions(-)arch/riscv/kernel/perf_event.c +2
-2@@ -147,7 +147,7 @@ static int riscv_map_hw_event(u64 config) return riscv_pmu->hw_events[config]; } -int riscv_map_cache_decode (u64 config,unsigned int *type, +static int riscv_map_cache_decode (u64 config,unsigned int *type, unsigned int *op, unsigned int *result) { return -ENOENT;@@ -342,7 +342,7 @@ static void riscv_pmu_del(struct perf_event *event, int flags) static DEFINE_MUTEX(pmc_reserve_mutex); -irqreturn_t riscv_base_pmu_handle_irq (int irq_num,void *dev) +static irqreturn_t riscv_base_pmu_handle_irq (int irq_num,void *dev) { return IRQ_NONE;}
arch/riscv/kernel/perf_event.c +2
-2@@ -361,7 +361,7 @@ static int reserve_pmc_hardware(void) return err; } -void release_pmc_hardware (void ) +static void release_pmc_hardware (void ) { mutex_lock(&pmc_reserve_mutex); if (riscv_pmu->irq >= 0)@@ -464,7 +464,7 @@ static const struct of_device_id riscv_pmu_of_ids[] = { { /* sentinel value */ } }; -int __init init_hw_perf_events (void ) +static int __init init_hw_perf_events (void ) { struct device_node *node = of_find_node_by_type(NULL, "pmu");Quoted 1 line
const struct
of_device_id*of_id;Reviewed-by Palmer Dabbelt <[email protected]>.