diff mbox series

clocksource/drivers/arm_arch_timer: Mark validate_timer_rate() init

Message ID 20240502233017.419365-1-swboyd@chromium.org (mailing list archive)
State New, archived
Headers show
Series clocksource/drivers/arm_arch_timer: Mark validate_timer_rate() init | expand

Commit Message

Stephen Boyd May 2, 2024, 11:30 p.m. UTC
Add the __init marking to validate_timer_rate() so that it gets
discarded after init.

  $ ./scripts/bloat-o-meter vmlinux.before vmlinux.after
  add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-8 (-8)
  Function                                     old     new   delta
  arch_timer_register                         1724    1716      -8
  Total: Before=69177808, After=69177800, chg -0.00%

Cc: Jisheng Zhang <jszhang@kernel.org>
Cc: Ionela Voinescu <ionela.voinescu@arm.com>
Cc: Marc Zyngier <maz@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---
 drivers/clocksource/arm_arch_timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


base-commit: 4cece764965020c22cff7665b18a012006359095

Comments

Mukesh Ojha May 3, 2024, 11:27 a.m. UTC | #1
On 5/3/2024 5:00 AM, Stephen Boyd wrote:
> Add the __init marking to validate_timer_rate() so that it gets
> discarded after init.
> 
>    $ ./scripts/bloat-o-meter vmlinux.before vmlinux.after
>    add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-8 (-8)
>    Function                                     old     new   delta
>    arch_timer_register                         1724    1716      -8

Have not used this tool bloat-o-meter
Just a question, why is it showing arch_timer_register is shrunk ?

-Mukesh
Stephen Boyd May 4, 2024, 5:59 a.m. UTC | #2
Quoting Mukesh Ojha (2024-05-03 04:27:52)
>
>
> On 5/3/2024 5:00 AM, Stephen Boyd wrote:
> > Add the __init marking to validate_timer_rate() so that it gets
> > discarded after init.
> >
> >    $ ./scripts/bloat-o-meter vmlinux.before vmlinux.after
> >    add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-8 (-8)
> >    Function                                     old     new   delta
> >    arch_timer_register                         1724    1716      -8
>
> Have not used this tool bloat-o-meter
> Just a question, why is it showing arch_timer_register is shrunk ?

Hmm good question. There shouldn't be any difference if it gets inlined.

It's an allmodconfig build. It looks like that causes noise in the build so it
isn't stable. :( I diffed the objdump and the function is missing this ror and
nop instruction. But then I built it again, and it became more different. If I
build an allnoconfig it has zero difference.

Before:

  ffff800083021ed4:       974ba12d        bl      ffff80008030a388
<free_percpu_irq>
  ffff800083021ed8:       93d3f273        ror     x19, x19, #60
  ffff800083021edc:       d503201f        nop
  ffff800083021ee0:       d29858e0        mov     x0, #0xc2c7
           // #49863
  ffff800083021ee4:       910102b6        add     x22, x21, #0x40
  ffff800083021ee8:       f2aeea20        movk    x0, #0x7751, lsl #16
  ffff800083021eec:       f2ce7680        movk    x0, #0x73b4, lsl #32
  ffff800083021ef0:       f2f09e20        movk    x0, #0x84f1, lsl #48
  ffff800083021ef4:       ca000273        eor     x19, x19, x0
  ffff800083021ef8:       97527f02        bl      ffff8000804c1b00
<__sanitizer_cov_trace_pc>

After:

  ffff800083021ed4:       974ba12d        bl      ffff80008030a388
<free_percpu_irq>
  ffff800083021ed8:       d29f9f00        mov     x0, #0xfcf8
           // #64760
  ffff800083021edc:       910102b6        add     x22, x21, #0x40
  ffff800083021ee0:       f2b03940        movk    x0, #0x81ca, lsl #16
  ffff800083021ee4:       f2d5e700        movk    x0, #0xaf38, lsl #32
  ffff800083021ee8:       f2ee1340        movk    x0, #0x709a, lsl #48
  ffff800083021eec:       ca000273        eor     x19, x19, x0
  ffff800083021ef0:       97527f04        bl      ffff8000804c1b00
<__sanitizer_cov_trace_pc>

Maybe kcov is making things different?
diff mbox series

Patch

diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
index 8d4a52056684..9c4a4af25d2c 100644
--- a/drivers/clocksource/arm_arch_timer.c
+++ b/drivers/clocksource/arm_arch_timer.c
@@ -1045,7 +1045,7 @@  static int arch_timer_starting_cpu(unsigned int cpu)
 	return 0;
 }
 
-static int validate_timer_rate(void)
+static int __init validate_timer_rate(void)
 {
 	if (!arch_timer_rate)
 		return -EINVAL;