profile: setup_profiling_timer() is moslty not implemented
authorBen Dooks <ben-linux@fluff.org>
Thu, 21 Jul 2022 19:55:09 +0000 (20:55 +0100)
committerakpm <akpm@linux-foundation.org>
Sat, 30 Jul 2022 01:12:36 +0000 (18:12 -0700)
The setup_profiling_timer() is mostly un-implemented by many
architectures.  In many places it isn't guarded by CONFIG_PROFILE which is
needed for it to be used.  Make it a weak symbol in kernel/profile.c and
remove the 'return -EINVAL' implementations from the kenrel.

There are a couple of architectures which do return 0 from the
setup_profiling_timer() function but they don't seem to do anything else
with it.  To keep the /proc compatibility for now, leave these for a
future update or removal.

On ARM, this fixes the following sparse warning:
arch/arm/kernel/smp.c:793:5: warning: symbol 'setup_profiling_timer' was not declared. Should it be static?

Link: https://lkml.kernel.org/r/20220721195509.418205-1-ben-linux@fluff.org
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
16 files changed:
arch/alpha/kernel/smp.c
arch/arc/kernel/smp.c
arch/arm/kernel/smp.c
arch/arm64/kernel/smp.c
arch/csky/kernel/smp.c
arch/hexagon/kernel/smp.c
arch/ia64/kernel/smp.c
arch/openrisc/kernel/smp.c
arch/parisc/kernel/smp.c
arch/powerpc/kernel/smp.c
arch/riscv/kernel/smp.c
arch/sparc/kernel/smp_32.c
arch/sparc/kernel/smp_64.c
arch/x86/include/asm/apic.h
arch/x86/kernel/apic/apic.c
kernel/profile.c

index cb64e4797d2a89f2b15f8f44bab6be2203258e92..f4e20f75438f8bf47baa35e1a02dbbaff768fa8a 100644 (file)
@@ -497,12 +497,6 @@ smp_cpus_done(unsigned int max_cpus)
               ((bogosum + 2500) / (5000/HZ)) % 100);
 }
 
-int
-setup_profiling_timer(unsigned int multiplier)
-{
-       return -EINVAL;
-}
-
 static void
 send_ipi_message(const struct cpumask *to_whom, enum ipi_message_type operation)
 {
index d947473f1e6da5f906ba25c7841c99bb981055ad..ab9e75e90f729d4d96a3d6fb62702d81323fd02d 100644 (file)
@@ -232,14 +232,6 @@ int __cpu_up(unsigned int cpu, struct task_struct *idle)
        return 0;
 }
 
-/*
- * not supported here
- */
-int setup_profiling_timer(unsigned int multiplier)
-{
-       return -EINVAL;
-}
-
 /*****************************************************************************/
 /*              Inter Processor Interrupt Handling                           */
 /*****************************************************************************/
index 73fc645fc4c7e36f593c47f161329a6dccd88aaa..978db2d96b44691671eeedee7e598285a56b65f2 100644 (file)
@@ -787,14 +787,6 @@ void panic_smp_self_stop(void)
                cpu_relax();
 }
 
-/*
- * not supported here
- */
-int setup_profiling_timer(unsigned int multiplier)
-{
-       return -EINVAL;
-}
-
 #ifdef CONFIG_CPU_FREQ
 
 static DEFINE_PER_CPU(unsigned long, l_p_j_ref);
index 62ed361a4376ba6efd35ad9cc158ae6b799a456a..ffc5d76cf69555df322494bf95079d047097c6ea 100644 (file)
@@ -1078,14 +1078,6 @@ bool smp_crash_stop_failed(void)
 }
 #endif
 
-/*
- * not supported here
- */
-int setup_profiling_timer(unsigned int multiplier)
-{
-       return -EINVAL;
-}
-
 static bool have_cpu_die(void)
 {
 #ifdef CONFIG_HOTPLUG_CPU
index 6bb38bc2f39b4370807842a22a38e084b7be03c2..4b605aa2e1d65d474e1986ec7d217fa39fca51dc 100644 (file)
@@ -243,11 +243,6 @@ void __init smp_cpus_done(unsigned int max_cpus)
 {
 }
 
-int setup_profiling_timer(unsigned int multiplier)
-{
-       return -EINVAL;
-}
-
 void csky_start_secondary(void)
 {
        struct mm_struct *mm = &init_mm;
index 619c56420aa0c750ba6226791a89e49d33d3d5fd..4ba93e59370c4147ea04bc814b40e55c98277683 100644 (file)
@@ -240,11 +240,6 @@ void arch_send_call_function_ipi_mask(const struct cpumask *mask)
        send_ipi(mask, IPI_CALL_FUNC);
 }
 
-int setup_profiling_timer(unsigned int multiplier)
-{
-       return -EINVAL;
-}
-
 void smp_start_cpus(void)
 {
        int i;
index 7b7b64eb312975c6e677683f68a5abbbd3206f87..e2cc59db86bc2dc70314d7739ab47e793abd4d6c 100644 (file)
@@ -333,9 +333,3 @@ smp_send_stop (void)
 {
        send_IPI_allbutself(IPI_CPU_STOP);
 }
-
-int
-setup_profiling_timer (unsigned int multiplier)
-{
-       return -EINVAL;
-}
index 27041db2c8b0f53d293bea78e4f943d8a23c07cd..e1419095a6f0aff4ddbc3bb65cbfd25b3517f5e7 100644 (file)
@@ -197,12 +197,6 @@ void smp_send_stop(void)
        smp_call_function(stop_this_cpu, NULL, 0);
 }
 
-/* not supported, yet */
-int setup_profiling_timer(unsigned int multiplier)
-{
-       return -EINVAL;
-}
-
 void __init set_smp_cross_call(void (*fn)(const struct cpumask *, unsigned int))
 {
        smp_cross_call = fn;
index 24d0744c3b3abcaf72b7fdab3defc201c4be1c7e..7dbd92cafae38a56419fd12ed442b05ad4c4d1eb 100644 (file)
@@ -513,10 +513,3 @@ void __cpu_die(unsigned int cpu)
 
        pdc_cpu_rendezvous_unlock();
 }
-
-#ifdef CONFIG_PROC_FS
-int setup_profiling_timer(unsigned int multiplier)
-{
-       return -EINVAL;
-}
-#endif
index bcefab484ea61d28f1c163f386a539a17358d47e..c037c26540ddc6fc92cb2e0f336e723f7a2c5f6f 100644 (file)
@@ -1674,13 +1674,6 @@ void start_secondary(void *unused)
        BUG();
 }
 
-#ifdef CONFIG_PROFILING
-int setup_profiling_timer(unsigned int multiplier)
-{
-       return 0;
-}
-#endif
-
 static void __init fixup_topology(void)
 {
        int i;
index b5d30ea922925fbfacd7f97d552d260119512e41..441d0ceb80adbca8d091562532125966dd85c89e 100644 (file)
@@ -64,12 +64,6 @@ bool arch_match_cpu_phys_id(int cpu, u64 phys_id)
        return phys_id == cpuid_to_hartid_map(cpu);
 }
 
-/* Unsupported */
-int setup_profiling_timer(unsigned int multiplier)
-{
-       return -EINVAL;
-}
-
 static void ipi_stop(void)
 {
        set_cpu_online(smp_processor_id(), false);
index 22b148e5a5f88c76c46b17b87c53f7df510940c8..ad8094d955eba6b3e6ec6cae8817929f63df9b37 100644 (file)
@@ -174,11 +174,6 @@ void smp_call_function_interrupt(void)
        irq_exit();
 }
 
-int setup_profiling_timer(unsigned int multiplier)
-{
-       return -EINVAL;
-}
-
 void __init smp_prepare_cpus(unsigned int max_cpus)
 {
        int i, cpuid, extra;
index a1f78e9ddaf371a9a84d445fb3036f1ad00c8b6d..a55295d1b924481f50a9541c88af49d823bc1083 100644 (file)
@@ -1186,12 +1186,6 @@ void __irq_entry smp_penguin_jailcell(int irq, struct pt_regs *regs)
        preempt_enable();
 }
 
-/* /proc/profile writes can call this, don't __init it please. */
-int setup_profiling_timer(unsigned int multiplier)
-{
-       return -EINVAL;
-}
-
 void __init smp_prepare_cpus(unsigned int max_cpus)
 {
 }
index bd8ae0a7010ae572159e20d1c8011219e78cc743..3415321c8240c4b0b2b4536b147c0ce586c69c4f 100644 (file)
@@ -98,8 +98,6 @@ static inline bool apic_from_smp_config(void)
 #include <asm/paravirt.h>
 #endif
 
-extern int setup_profiling_timer(unsigned int);
-
 static inline void native_apic_mem_write(u32 reg, u32 v)
 {
        volatile u32 *addr = (volatile u32 *)(APIC_BASE + reg);
index 189d3a5e471adc43c44b7d6aa8d2805a0a9a475b..df764ceac2c85dfcec75d021977641d275d0c376 100644 (file)
@@ -1115,11 +1115,6 @@ DEFINE_IDTENTRY_SYSVEC(sysvec_apic_timer_interrupt)
        set_irq_regs(old_regs);
 }
 
-int setup_profiling_timer(unsigned int multiplier)
-{
-       return -EINVAL;
-}
-
 /*
  * Local APIC start and shutdown
  */
index ae82ddfc6a6845072d9db474464307f990f57ef3..7ea01ba30e757ef11235ba2702cab5c50751ec01 100644 (file)
@@ -425,6 +425,12 @@ read_profile(struct file *file, char __user *buf, size_t count, loff_t *ppos)
        return read;
 }
 
+/* default is to not implement this call */
+int __weak setup_profiling_timer(unsigned mult)
+{
+       return -EINVAL;
+}
+
 /*
  * Writing to /proc/profile resets the counters
  *
@@ -435,8 +441,6 @@ static ssize_t write_profile(struct file *file, const char __user *buf,
                             size_t count, loff_t *ppos)
 {
 #ifdef CONFIG_SMP
-       extern int setup_profiling_timer(unsigned int multiplier);
-
        if (count == sizeof(int)) {
                unsigned int multiplier;