The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] kernel/profile: remove setup_profiling_timer
@ 2026-08-21  9:17 Anthony Iliopoulos
  2026-08-22 22:53 ` Bradley Morgan
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Anthony Iliopoulos @ 2026-08-21  9:17 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

No architecture uses setup_profiling_timer() at this point for setting a
multiplier, so it can be safely removed. This allows arch-specific stub
functions to be cleaned up in subsequent commits.

There are no functional changes, as writing to /proc/profile will still
reset the counters.

Signed-off-by: Anthony Iliopoulos <ailiop@suse.com>
---
 include/linux/profile.h |  1 -
 kernel/profile.c        | 20 --------------------
 2 files changed, 21 deletions(-)

diff --git a/include/linux/profile.h b/include/linux/profile.h
index 3f53cdb0c27c..68edf60173b9 100644
--- a/include/linux/profile.h
+++ b/include/linux/profile.h
@@ -32,7 +32,6 @@ extern int prof_on __read_mostly;
 int profile_init(void);
 int profile_setup(char *str);
 void profile_tick(int type);
-int setup_profiling_timer(unsigned int multiplier);
 
 /*
  * Add multiple profiler hits to a given address:
diff --git a/kernel/profile.c b/kernel/profile.c
index 1fcf1adcf4eb..5002ea558951 100644
--- a/kernel/profile.c
+++ b/kernel/profile.c
@@ -177,32 +177,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
- *
- * Writing a 'profiling multiplier' value into it also re-sets the profiling
- * interrupt frequency, on architectures that support this.
  */
 static ssize_t write_profile(struct file *file, const char __user *buf,
 			     size_t count, loff_t *ppos)
 {
-#ifdef CONFIG_SMP
-	if (count == sizeof(int)) {
-		unsigned int multiplier;
-
-		if (copy_from_user(&multiplier, buf, sizeof(int)))
-			return -EFAULT;
-
-		if (setup_profiling_timer(multiplier))
-			return -EINVAL;
-	}
-#endif
 	memset(prof_buffer, 0, prof_len * sizeof(atomic_t));
 	return count;
 }
-- 
2.55.0


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

* Re: [PATCH] kernel/profile: remove setup_profiling_timer
  2026-08-21  9:17 [PATCH] kernel/profile: remove setup_profiling_timer Anthony Iliopoulos
@ 2026-08-22 22:53 ` Bradley Morgan
  2026-08-23 12:08 ` [PATCH] profile: remove setup_profiling_timer() Nick Huang
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Bradley Morgan @ 2026-08-22 22:53 UTC (permalink / raw)
  To: ailiop; +Cc: akpm, linux-kernel

On 21 August 2026 10:17:44 BST, Anthony Iliopoulos <ailiop@suse.com> wrote:
>No architecture uses setup_profiling_timer() at this point for setting a
>multiplier, so it can be safely removed. This allows arch-specific stub
>functions to be cleaned up in subsequent commits.

ack.

>There are no functional changes, as writing to /proc/profile will still
>reset the counters.

Ok.


Reviewed-by: Bradley Morgan <include@grrlz.net>

(Good this is getting burnt)


>Signed-off-by: Anthony Iliopoulos <ailiop@suse.com>
>---
> include/linux/profile.h |  1 -
> kernel/profile.c        | 20 --------------------
> 2 files changed, 21 deletions(-)
>
>diff --git a/include/linux/profile.h b/include/linux/profile.h
>index 3f53cdb0c27c..68edf60173b9 100644
>--- a/include/linux/profile.h
>+++ b/include/linux/profile.h
>@@ -32,7 +32,6 @@ extern int prof_on __read_mostly;
> int profile_init(void);
> int profile_setup(char *str);
> void profile_tick(int type);
>-int setup_profiling_timer(unsigned int multiplier);
> 
> /*
>  * Add multiple profiler hits to a given address:
>diff --git a/kernel/profile.c b/kernel/profile.c
>index 1fcf1adcf4eb..5002ea558951 100644
>--- a/kernel/profile.c
>+++ b/kernel/profile.c
>@@ -177,32 +177,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
>- *
>- * Writing a 'profiling multiplier' value into it also re-sets the profiling
>- * interrupt frequency, on architectures that support this.
>  */
> static ssize_t write_profile(struct file *file, const char __user *buf,
> 			     size_t count, loff_t *ppos)
> {
>-#ifdef CONFIG_SMP
>-	if (count == sizeof(int)) {
>-		unsigned int multiplier;
>-
>-		if (copy_from_user(&multiplier, buf, sizeof(int)))
>-			return -EFAULT;
>-
>-		if (setup_profiling_timer(multiplier))
>-			return -EINVAL;
>-	}
>-#endif
> 	memset(prof_buffer, 0, prof_len * sizeof(atomic_t));
> 	return count;
> }
>

Thanks!

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

* Re: [PATCH] profile: remove setup_profiling_timer()
  2026-08-21  9:17 [PATCH] kernel/profile: remove setup_profiling_timer Anthony Iliopoulos
  2026-08-22 22:53 ` Bradley Morgan
@ 2026-08-23 12:08 ` Nick Huang
  2026-08-23 13:23 ` [PATCH] kernel/profile: remove setup_profiling_timer kernel test robot
  2026-08-24 10:46 ` Nick Huang
  3 siblings, 0 replies; 5+ messages in thread
From: Nick Huang @ 2026-08-23 12:08 UTC (permalink / raw)
  To: ailiop; +Cc: akpm, linux-kernel, Nick Huang

Tested on x86_64. /proc/profile counters are reset after a write.

Tested-by: Nick Huang <sef1548@gmail.com>

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

* Re: [PATCH] kernel/profile: remove setup_profiling_timer
  2026-08-21  9:17 [PATCH] kernel/profile: remove setup_profiling_timer Anthony Iliopoulos
  2026-08-22 22:53 ` Bradley Morgan
  2026-08-23 12:08 ` [PATCH] profile: remove setup_profiling_timer() Nick Huang
@ 2026-08-23 13:23 ` kernel test robot
  2026-08-24 10:46 ` Nick Huang
  3 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2026-08-23 13:23 UTC (permalink / raw)
  To: Anthony Iliopoulos, Andrew Morton
  Cc: llvm, oe-kbuild-all, Linux Memory Management List, linux-kernel

Hi Anthony,

kernel test robot noticed the following build warnings:

[auto build test WARNING on akpm-mm/mm-everything]
[also build test WARNING on linus/master v7.2 next-20260821]
[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/Anthony-Iliopoulos/kernel-profile-remove-setup_profiling_timer/20260821-111744
base:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link:    https://lore.kernel.org/r/20260821091744.91496-1-ailiop%40suse.com
patch subject: [PATCH] kernel/profile: remove setup_profiling_timer
config: loongarch-randconfig-001-20260823 (https://download.01.org/0day-ci/archive/20260823/202608231532.dENn2OSP-lkp@intel.com/config)
compiler: clang version 24.0.0git (https://github.com/llvm/llvm-project 935bfc708590c60147a79c7df145bb6e68b1d388)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260823/202608231532.dENn2OSP-lkp@intel.com/reproduce)

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

All warnings (new ones prefixed by >>):

>> arch/loongarch/kernel/smp.c:720:5: warning: no previous prototype for function 'setup_profiling_timer' [-Wmissing-prototypes]
     720 | int setup_profiling_timer(unsigned int multiplier)
         |     ^
   arch/loongarch/kernel/smp.c:720:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
     720 | int setup_profiling_timer(unsigned int multiplier)
         | ^
         | static 
   1 warning generated.


vim +/setup_profiling_timer +720 arch/loongarch/kernel/smp.c

46859ac8af52ae Huacai Chen 2022-05-31  718  
c718a0bad75cce Bibo Mao    2023-09-20  719  #ifdef CONFIG_PROFILING
46859ac8af52ae Huacai Chen 2022-05-31 @720  int setup_profiling_timer(unsigned int multiplier)
46859ac8af52ae Huacai Chen 2022-05-31  721  {
46859ac8af52ae Huacai Chen 2022-05-31  722  	return 0;
46859ac8af52ae Huacai Chen 2022-05-31  723  }
c718a0bad75cce Bibo Mao    2023-09-20  724  #endif
46859ac8af52ae Huacai Chen 2022-05-31  725  

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

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

* Re: [PATCH] kernel/profile: remove setup_profiling_timer
  2026-08-21  9:17 [PATCH] kernel/profile: remove setup_profiling_timer Anthony Iliopoulos
                   ` (2 preceding siblings ...)
  2026-08-23 13:23 ` [PATCH] kernel/profile: remove setup_profiling_timer kernel test robot
@ 2026-08-24 10:46 ` Nick Huang
  3 siblings, 0 replies; 5+ messages in thread
From: Nick Huang @ 2026-08-24 10:46 UTC (permalink / raw)
  To: ailiop; +Cc: akpm, linux-kernel

Hi Anthony,

It looks like there are a few other architecture-specific implementations
of setup_profiling_timer() still left after this change:

arch/loongarch/kernel/smp.c
arch/mips/kernel/smp.c
arch/s390/kernel/smp.c
arch/sh/kernel/smp.c
arch/xtensa/kernel/smp.c

s390 also still has a declaration in arch/s390/kernel/entry.h.

These may be worth removing as part of the cleanup as well if there are no
remaining callers.

Thanks,
Nick

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

end of thread, other threads:[~2026-08-24 10:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-21  9:17 [PATCH] kernel/profile: remove setup_profiling_timer Anthony Iliopoulos
2026-08-22 22:53 ` Bradley Morgan
2026-08-23 12:08 ` [PATCH] profile: remove setup_profiling_timer() Nick Huang
2026-08-23 13:23 ` [PATCH] kernel/profile: remove setup_profiling_timer kernel test robot
2026-08-24 10:46 ` Nick Huang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox