The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] sh: remove unused setup_profiling_timer function
@ 2026-08-20 12:39 Anthony Iliopoulos
  2026-08-20 14:00 ` John Paul Adrian Glaubitz
  2026-08-21  7:36 ` Geert Uytterhoeven
  0 siblings, 2 replies; 6+ messages in thread
From: Anthony Iliopoulos @ 2026-08-20 12:39 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker, John Paul Adrian Glaubitz
  Cc: linux-sh, linux-kernel

setup_profiling_timer() is not used by any code at this point. Since a
default weak implementation exists, there is no need to keep this
arch-specific definition around. Remove it along with the now-redundant
profile header includes.

Signed-off-by: Anthony Iliopoulos <ailiop@suse.com>
---
 arch/sh/kernel/smp.c  | 9 ---------
 arch/sh/kernel/time.c | 1 -
 2 files changed, 10 deletions(-)

diff --git a/arch/sh/kernel/smp.c b/arch/sh/kernel/smp.c
index 108d808767fa..7209a72134be 100644
--- a/arch/sh/kernel/smp.c
+++ b/arch/sh/kernel/smp.c
@@ -21,7 +21,6 @@
 #include <linux/sched/hotplug.h>
 #include <linux/atomic.h>
 #include <linux/clockchips.h>
-#include <linux/profile.h>
 
 #include <asm/processor.h>
 #include <asm/mmu_context.h>
@@ -322,14 +321,6 @@ void smp_message_recv(unsigned int msg)
 	}
 }
 
-#ifdef CONFIG_PROFILING
-/* Not really SMP stuff ... */
-int setup_profiling_timer(unsigned int multiplier)
-{
-	return 0;
-}
-#endif
-
 #ifdef CONFIG_MMU
 
 static void flush_tlb_all_ipi(void *info)
diff --git a/arch/sh/kernel/time.c b/arch/sh/kernel/time.c
index 821a09cbd605..f3e70d2d573b 100644
--- a/arch/sh/kernel/time.c
+++ b/arch/sh/kernel/time.c
@@ -9,7 +9,6 @@
  */
 #include <linux/kernel.h>
 #include <linux/init.h>
-#include <linux/profile.h>
 #include <linux/timex.h>
 #include <linux/sched.h>
 #include <linux/clockchips.h>
-- 
2.55.0


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

* Re: [PATCH] sh: remove unused setup_profiling_timer function
  2026-08-20 12:39 [PATCH] sh: remove unused setup_profiling_timer function Anthony Iliopoulos
@ 2026-08-20 14:00 ` John Paul Adrian Glaubitz
  2026-08-21  9:41   ` Anthony Iliopoulos
  2026-08-21 13:15   ` Geert Uytterhoeven
  2026-08-21  7:36 ` Geert Uytterhoeven
  1 sibling, 2 replies; 6+ messages in thread
From: John Paul Adrian Glaubitz @ 2026-08-20 14:00 UTC (permalink / raw)
  To: Anthony Iliopoulos, Yoshinori Sato, Rich Felker; +Cc: linux-sh, linux-kernel

Hi Anthony,

On Thu, 2026-08-20 at 14:39 +0200, Anthony Iliopoulos wrote:
> setup_profiling_timer() is not used by any code at this point. Since a
> default weak implementation exists, there is no need to keep this
> arch-specific definition around. Remove it along with the now-redundant
> profile header includes.

Do you have any clue why it was still implemented for LoongArch which is
a rather new architecture? I'm also seeing that it's not used anywhere,
I'm just wondering why it was not removed before and why it was even
included when LoongArch was added.

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

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

* Re: [PATCH] sh: remove unused setup_profiling_timer function
  2026-08-20 12:39 [PATCH] sh: remove unused setup_profiling_timer function Anthony Iliopoulos
  2026-08-20 14:00 ` John Paul Adrian Glaubitz
@ 2026-08-21  7:36 ` Geert Uytterhoeven
  2026-08-21  9:51   ` Anthony Iliopoulos
  1 sibling, 1 reply; 6+ messages in thread
From: Geert Uytterhoeven @ 2026-08-21  7:36 UTC (permalink / raw)
  To: Anthony Iliopoulos
  Cc: Yoshinori Sato, Rich Felker, John Paul Adrian Glaubitz, linux-sh,
	linux-kernel

Hi Anthony,

Thanks for your patch!

On Fri, 21 Aug 2026 at 09:27, Anthony Iliopoulos <ailiop@suse.com> wrote:
> setup_profiling_timer() is not used by any code at this point. Since a

It is used in write_profile()
https://elixir.bootlin.com/linux/v7.2/source/kernel/profile.c#L202

> default weak implementation exists, there is no need to keep this
> arch-specific definition around. Remove it along with the now-redundant
> profile header includes.
>
> Signed-off-by: Anthony Iliopoulos <ailiop@suse.com>

> --- a/arch/sh/kernel/smp.c
> +++ b/arch/sh/kernel/smp.c
> @@ -21,7 +21,6 @@
>  #include <linux/sched/hotplug.h>
>  #include <linux/atomic.h>
>  #include <linux/clockchips.h>
> -#include <linux/profile.h>
>
>  #include <asm/processor.h>
>  #include <asm/mmu_context.h>
> @@ -322,14 +321,6 @@ void smp_message_recv(unsigned int msg)
>         }
>  }
>
> -#ifdef CONFIG_PROFILING
> -/* Not really SMP stuff ... */
> -int setup_profiling_timer(unsigned int multiplier)
> -{
> -       return 0;

This returns zero (success), while the default weak implementation
returns -EINVAL, so your change breaks write_profile().
https://elixir.bootlin.com/linux/v7.2/source/kernel/profile.c#L181

> -}
> -#endif
> -
>  #ifdef CONFIG_MMU
>
>  static void flush_tlb_all_ipi(void *info)

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH] sh: remove unused setup_profiling_timer function
  2026-08-20 14:00 ` John Paul Adrian Glaubitz
@ 2026-08-21  9:41   ` Anthony Iliopoulos
  2026-08-21 13:15   ` Geert Uytterhoeven
  1 sibling, 0 replies; 6+ messages in thread
From: Anthony Iliopoulos @ 2026-08-21  9:41 UTC (permalink / raw)
  To: John Paul Adrian Glaubitz
  Cc: Yoshinori Sato, Rich Felker, linux-sh, linux-kernel

On Thu, Aug 20, 2026 at 04:00:37PM +0200, John Paul Adrian Glaubitz wrote:
> Hi Anthony,
> 
> On Thu, 2026-08-20 at 14:39 +0200, Anthony Iliopoulos wrote:
> > setup_profiling_timer() is not used by any code at this point. Since a
> > default weak implementation exists, there is no need to keep this
> > arch-specific definition around. Remove it along with the now-redundant
> > profile header includes.
> 
> Do you have any clue why it was still implemented for LoongArch which is
> a rather new architecture? I'm also seeing that it's not used anywhere,
> I'm just wondering why it was not removed before and why it was even
> included when LoongArch was added.

Its addition to LoongArch [1] slightly predates converting it to a weak
function [2], so up until that point all archs had to include the stub.

Regards,
Anthony

[1] 46859ac8af52 ("LoongArch: Add multi-processor (SMP) support")
[2] 787dbea11a5d ("profile: setup_profiling_timer() is moslty not implemented")

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

* Re: [PATCH] sh: remove unused setup_profiling_timer function
  2026-08-21  7:36 ` Geert Uytterhoeven
@ 2026-08-21  9:51   ` Anthony Iliopoulos
  0 siblings, 0 replies; 6+ messages in thread
From: Anthony Iliopoulos @ 2026-08-21  9:51 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Yoshinori Sato, Rich Felker, John Paul Adrian Glaubitz, linux-sh,
	linux-kernel

On Fri, Aug 21, 2026 at 09:36:46AM +0200, Geert Uytterhoeven wrote:
> Hi Anthony,
> 
> Thanks for your patch!
> 
> On Fri, 21 Aug 2026 at 09:27, Anthony Iliopoulos <ailiop@suse.com> wrote:
> > setup_profiling_timer() is not used by any code at this point. Since a
> 
> It is used in write_profile()
> https://elixir.bootlin.com/linux/v7.2/source/kernel/profile.c#L202
> 
> > default weak implementation exists, there is no need to keep this
> > arch-specific definition around. Remove it along with the now-redundant
> > profile header includes.
> >
> > Signed-off-by: Anthony Iliopoulos <ailiop@suse.com>
> 
> > --- a/arch/sh/kernel/smp.c
> > +++ b/arch/sh/kernel/smp.c
> > @@ -21,7 +21,6 @@
> >  #include <linux/sched/hotplug.h>
> >  #include <linux/atomic.h>
> >  #include <linux/clockchips.h>
> > -#include <linux/profile.h>
> >
> >  #include <asm/processor.h>
> >  #include <asm/mmu_context.h>
> > @@ -322,14 +321,6 @@ void smp_message_recv(unsigned int msg)
> >         }
> >  }
> >
> > -#ifdef CONFIG_PROFILING
> > -/* Not really SMP stuff ... */
> > -int setup_profiling_timer(unsigned int multiplier)
> > -{
> > -       return 0;
> 
> This returns zero (success), while the default weak implementation
> returns -EINVAL, so your change breaks write_profile().
> https://elixir.bootlin.com/linux/v7.2/source/kernel/profile.c#L181

Thanks for the review, yes the plan was to also remove the call entirely
from profile code itself, so that the resetting functionality can remain
and the arch-specific stubs could be dropped. I should clearly have sent
that patch first. I just did it now:

https://lore.kernel.org/all/20260821091744.91496-1-ailiop@suse.com/

Regards,
Anthony

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

* Re: [PATCH] sh: remove unused setup_profiling_timer function
  2026-08-20 14:00 ` John Paul Adrian Glaubitz
  2026-08-21  9:41   ` Anthony Iliopoulos
@ 2026-08-21 13:15   ` Geert Uytterhoeven
  1 sibling, 0 replies; 6+ messages in thread
From: Geert Uytterhoeven @ 2026-08-21 13:15 UTC (permalink / raw)
  To: John Paul Adrian Glaubitz
  Cc: Anthony Iliopoulos, Yoshinori Sato, Rich Felker, linux-sh,
	linux-kernel

Hi Adrian,

On Fri, 21 Aug 2026 at 14:11, John Paul Adrian Glaubitz
<glaubitz@physik.fu-berlin.de> wrote:
> On Thu, 2026-08-20 at 14:39 +0200, Anthony Iliopoulos wrote:
> > setup_profiling_timer() is not used by any code at this point. Since a
> > default weak implementation exists, there is no need to keep this
> > arch-specific definition around. Remove it along with the now-redundant
> > profile header includes.
>
> Do you have any clue why it was still implemented for LoongArch which is
> a rather new architecture? I'm also seeing that it's not used anywhere,
> I'm just wondering why it was not removed before and why it was even
> included when LoongArch was added.

To make it _succeed_ when writing an integer value to that file?
The default weak implementation returns an error code.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

end of thread, other threads:[~2026-08-21 13:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-20 12:39 [PATCH] sh: remove unused setup_profiling_timer function Anthony Iliopoulos
2026-08-20 14:00 ` John Paul Adrian Glaubitz
2026-08-21  9:41   ` Anthony Iliopoulos
2026-08-21 13:15   ` Geert Uytterhoeven
2026-08-21  7:36 ` Geert Uytterhoeven
2026-08-21  9:51   ` Anthony Iliopoulos

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