Skip to contentSkip to conversation

powerpc/watchdog: Convert timers to use timer_setup()

PATCH In review Kees Cook 3 participants 7 messages Oct 16, 2017 – Oct 19, 2017 PowerPC

lore
Share & tools
lore

Kees Cook

author
#0 lore raw

PATCH 1/1 powerpc/watchdog: Convert timers to use timer_setup()

In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly.

Cc Benjamin Herrenschmidt <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Nicholas Piggin <[email protected]>
---
 arch/powerpc/kernel/watchdog.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
arch/powerpc/kernel/watchdog.c +2 -3
index 15e209a37c2d..50797528b5e1 100644
@@ -263,9 +263,8 @@ static void wd_timer_reset(unsigned int cpu, struct timer_list *t)
 	add_timer_on(t, cpu);
 }
 
-static void wd_timer_fn(unsigned long data)
+static void wd_timer_fn(struct timer_list *t)
 {
-	struct timer_list *t = this_cpu_ptr(&wd_timer);
 	int cpu = smp_processor_id();
 
 	watchdog_timer_interrupt(cpu);
@@ -292,7 +291,7 @@ static void start_watchdog_timer_on(unsigned int cpu)
 
 	per_cpu(wd_timer_tb, cpu) = get_tb();
 
-	setup_pinned_timer(t, wd_timer_fn, 0);
+	timer_setup(t, wd_timer_fn, TIMER_PINNED);
 	wd_timer_reset(cpu, t);
 }
 
Signature · 6 lines
2.7.4


-- 
Kees Cook
Pixel Security
reviewer Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · On Mon, 16 Oct 2017 16:47:10 -0700 Kees Cook <[email protected]> wrote:

In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly.

Cc Benjamin Herrenschmidt <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Nicholas Piggin <[email protected]>

Looks fine to me. Is this intended to be merged via the powerpc tree in the next merge window?

Quoted 28 lines
---
 arch/powerpc/kernel/watchdog.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
arch/powerpc/kernel/watchdog.c +2 -3
index 15e209a37c2d..50797528b5e1 100644
@@ -263,9 +263,8 @@ static void wd_timer_reset(unsigned int cpu, struct timer_list *t)
 	add_timer_on(t, cpu);
 }
 
-static void wd_timer_fn(unsigned long data)
+static void wd_timer_fn(struct timer_list *t)
 {
-	struct timer_list *t = this_cpu_ptr(&wd_timer);
 	int cpu = smp_processor_id();
 
 	watchdog_timer_interrupt(cpu);
@@ -292,7 +291,7 @@ static void start_watchdog_timer_on(unsigned int cpu)
 
 	per_cpu(wd_timer_tb, cpu) = get_tb();
 
-	setup_pinned_timer(t, wd_timer_fn, 0);
+	timer_setup(t, wd_timer_fn, TIMER_PINNED);
 	wd_timer_reset(cpu, t);
 }
 
#2 lore raw
Quoted 14 lines · Nicholas Piggin
Quoted 10 lines · On Mon, 16 Oct 2017 16:47:10 -0700 Kees Cook <[email protected]> wrote:

In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly.

Cc Benjamin Herrenschmidt <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Nicholas Piggin <[email protected]>
Quoted 2 lines

Looks fine to me. Is this intended to be merged via the powerpc tree in the next merge window?

It relies on the new timer_setup(), which is in one of tglx's trees (I think). So I expect it to go via that tree.

cheers

author
#3 lore raw
Quoted 16 lines · Michael Ellerman
Quoted 14 lines · Nicholas Piggin
Quoted 10 lines · On Mon, 16 Oct 2017 16:47:10 -0700 Kees Cook <[email protected]> wrote:

In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly.

Cc Benjamin Herrenschmidt <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Nicholas Piggin <[email protected]>
Quoted 5 lines
Quoted 2 lines

Looks fine to me. Is this intended to be merged via the powerpc tree in the next merge window?

It relies on the new timer_setup(), which is in one of tglx's trees (I think). So I expect it to go via that tree.

It's in -rc3, but the timer tree can carry it if you want. Which do you prefer?

-Kees

Signature · 2 lines
Kees Cook
Pixel Security
#4 lore raw
Quoted 17 lines · Kees Cook
Quoted 16 lines · Michael Ellerman
Quoted 14 lines · Nicholas Piggin
Quoted 10 lines · On Mon, 16 Oct 2017 16:47:10 -0700 Kees Cook <[email protected]> wrote:

In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly.

Cc Benjamin Herrenschmidt <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Nicholas Piggin <[email protected]>
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Looks fine to me. Is this intended to be merged via the powerpc tree in the next merge window?

It relies on the new timer_setup(), which is in one of tglx's trees (I think). So I expect it to go via that tree.

It's in -rc3, but the timer tree can carry it if you want. Which do you prefer?

Oh sorry, I assumed it was in only in linux-next.

I'll take this. Thanks.

cheers

#5 lore raw
Quoted 22 lines · Michael Ellerman
Quoted 21 lines · Kees Cook
Quoted 19 lines · Michael Ellerman
Quoted 13 lines · Nicholas Piggin
Quoted 10 lines · On Mon, 16 Oct 2017 16:47:10 -0700 Kees Cook <[email protected]> wrote:

In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly.

Cc Benjamin Herrenschmidt <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Nicholas Piggin <[email protected]>
Quoted 2 lines

Looks fine to me. Is this intended to be merged via the powerpc tree in the next merge window?

It relies on the new timer_setup(), which is in one of tglx's trees (I think). So I expect it to go via that tree.

Quoted 6 lines
Quoted 2 lines

It's in -rc3, but the timer tree can carry it if you want. Which do you prefer?

Oh sorry, I assumed it was in only in linux-next.

I'll take this. Thanks.

Ugh, I'm an <expletive deleted>.

My next is based on rc2, so I can't take this.

Can you please pick it up.

cheers

reviewer Acked-by on v1 1/1
#6 lore raw
In reply to Kees Cook
Quoted 19 lines · Kees Cook

In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly.

Cc Benjamin Herrenschmidt <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Nicholas Piggin <[email protected]>
---
 arch/powerpc/kernel/watchdog.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
arch/powerpc/kernel/watchdog.c +0 -0
index 15e209a37c2d..50797528b5e1 100644

arch/powerpc/kernel/watchdog.c static void wd_timer_reset(unsigned int cpu, struct timer_list *t) · line 266

Quoted 5 lines
arch/powerpc/kernel/watchdog.c +1 -1
@@ -263,9 +263,8 @@ static void wd_timer_reset(unsigned int cpu, struct timer_list *t)
 	add_timer_on(t, cpu);
 }
 
-static void wd_timer_fn(unsigned long data)
+static void wd_timer_fn(struct timer_list *t)

At first glance this looks like it will break, changing the signature, but the new timer_setup() force-casts to the old signature (for now), and we can fit a pointer in an unsigned long so it's OK.

Quoted 6 lines
arch/powerpc/kernel/watchdog.c +0 -1
 {
-	struct timer_list *t = this_cpu_ptr(&wd_timer);
 	int cpu = smp_processor_id();
 
 	watchdog_timer_interrupt(cpu);

arch/powerpc/kernel/watchdog.c static void start_watchdog_timer_on(unsigned int cpu) · line 297

Quoted 8 lines
arch/powerpc/kernel/watchdog.c +1 -1
@@ -292,7 +291,7 @@ static void start_watchdog_timer_on(unsigned int cpu)
 
 	per_cpu(wd_timer_tb, cpu) = get_tb();
 
-	setup_pinned_timer(t, wd_timer_fn, 0);
+	timer_setup(t, wd_timer_fn, TIMER_PINNED);
 	wd_timer_reset(cpu, t);
 }
 

cheers