diff mbox series

[v2,07/15] parisc: use legacy_timer_tick

Message ID 20201030151758.1241164-8-arnd@kernel.org (mailing list archive)
State New, archived
Headers show
Series timers: clean up ARCH_GETTIMEOFFSET, LEGACY_TIMER_TICK | expand

Commit Message

Arnd Bergmann Oct. 30, 2020, 3:17 p.m. UTC
From: Arnd Bergmann <arnd@arndb.de>

parisc has selected CONFIG_GENERIC_CLOCKEVENTS since commit 43b1f6abd590
("parisc: Switch to generic sched_clock implementation"), but does not
appear to actually be using it, and instead calls the low-level
timekeeping functions directly.

Remove the GENERIC_CLOCKEVENTS select again, and instead convert to
the newly added legacy_timer_tick() helper.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 Documentation/features/time/clockevents/arch-support.txt | 2 +-
 arch/parisc/Kconfig                                      | 2 +-
 arch/parisc/kernel/time.c                                | 9 +++------
 3 files changed, 5 insertions(+), 8 deletions(-)

Comments

Helge Deller Oct. 30, 2020, 5:13 p.m. UTC | #1
On 10/30/20 4:17 PM, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> parisc has selected CONFIG_GENERIC_CLOCKEVENTS since commit 43b1f6abd590
> ("parisc: Switch to generic sched_clock implementation"), but does not
> appear to actually be using it, and instead calls the low-level
> timekeeping functions directly.

Arnd, thank you for this patch!
It reminded me that I really missed to fully implement the clockevents on parisc!

Your other patch ("RFC: m68k: mac: convert to generic clockevent")
was a big help too, as it showed how it might work on parisc as well.

Here is now a current version of the clockevents-enabling-patch for parisc:
https://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux.git/commit/?h=for-next&id=3b7ab4a74a2d1972dbeb33285d85f1500b2ff96a

> Remove the GENERIC_CLOCKEVENTS select again, and instead convert to
> the newly added legacy_timer_tick() helper.

My patch still needs more testing, but if it turns to work
out right, would you mind to drop your patch for parisc?

Helge


> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  Documentation/features/time/clockevents/arch-support.txt | 2 +-
>  arch/parisc/Kconfig                                      | 2 +-
>  arch/parisc/kernel/time.c                                | 9 +++------
>  3 files changed, 5 insertions(+), 8 deletions(-)
>
> diff --git a/Documentation/features/time/clockevents/arch-support.txt b/Documentation/features/time/clockevents/arch-support.txt
> index 8287b6aa522e..61a5c9d68c15 100644
> --- a/Documentation/features/time/clockevents/arch-support.txt
> +++ b/Documentation/features/time/clockevents/arch-support.txt
> @@ -21,7 +21,7 @@
>      |       nds32: |  ok  |
>      |       nios2: |  ok  |
>      |    openrisc: |  ok  |
> -    |      parisc: |  ok  |
> +    |      parisc: | TODO |
>      |     powerpc: |  ok  |
>      |       riscv: |  ok  |
>      |        s390: |  ok  |
> diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
> index b234e8154cbd..78b17621ee4a 100644
> --- a/arch/parisc/Kconfig
> +++ b/arch/parisc/Kconfig
> @@ -52,7 +52,7 @@ config PARISC
>  	select HAVE_REGS_AND_STACK_ACCESS_API
>  	select GENERIC_SCHED_CLOCK
>  	select HAVE_UNSTABLE_SCHED_CLOCK if SMP
> -	select GENERIC_CLOCKEVENTS
> +	select LEGACY_TIMER_TICK
>  	select CPU_NO_EFFICIENT_FFS
>  	select NEED_DMA_MAP_STATE
>  	select NEED_SG_DMA_LENGTH
> diff --git a/arch/parisc/kernel/time.c b/arch/parisc/kernel/time.c
> index 13d94f0f94a0..08e4d480abe1 100644
> --- a/arch/parisc/kernel/time.c
> +++ b/arch/parisc/kernel/time.c
> @@ -70,8 +70,6 @@ irqreturn_t __irq_entry timer_interrupt(int irq, void *dev_id)
>  	/* gcc can optimize for "read-only" case with a local clocktick */
>  	unsigned long cpt = clocktick;
>
> -	profile_tick(CPU_PROFILING);
> -
>  	/* Initialize next_tick to the old expected tick time. */
>  	next_tick = cpuinfo->it_value;
>
> @@ -86,10 +84,9 @@ irqreturn_t __irq_entry timer_interrupt(int irq, void *dev_id)
>  	cpuinfo->it_value = next_tick;
>
>  	/* Go do system house keeping. */
> -	if (cpu == 0)
> -		xtime_update(ticks_elapsed);
> -
> -	update_process_times(user_mode(get_irq_regs()));
> +	if (cpu != 0)
> +		ticks_elapsed = 0;
> +	legacy_timer_tick(ticks_elapsed);
>
>  	/* Skip clockticks on purpose if we know we would miss those.
>  	 * The new CR16 must be "later" than current CR16 otherwise
>
Arnd Bergmann Oct. 30, 2020, 7:33 p.m. UTC | #2
On Fri, Oct 30, 2020 at 6:13 PM Helge Deller <deller@gmx.de> wrote:
>
> On 10/30/20 4:17 PM, Arnd Bergmann wrote:
> > From: Arnd Bergmann <arnd@arndb.de>
> >
> > parisc has selected CONFIG_GENERIC_CLOCKEVENTS since commit 43b1f6abd590
> > ("parisc: Switch to generic sched_clock implementation"), but does not
> > appear to actually be using it, and instead calls the low-level
> > timekeeping functions directly.
>
> Arnd, thank you for this patch!
> It reminded me that I really missed to fully implement the clockevents on parisc!
>
> Your other patch ("RFC: m68k: mac: convert to generic clockevent")
> was a big help too, as it showed how it might work on parisc as well.
>
> Here is now a current version of the clockevents-enabling-patch for parisc:
> https://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux.git/commit/?h=for-next&id=3b7ab4a74a2d1972dbeb33285d85f1500b2ff96a

Ah, nice!

> > Remove the GENERIC_CLOCKEVENTS select again, and instead convert to
> > the newly added legacy_timer_tick() helper.
>
> My patch still needs more testing, but if it turns to work
> out right, would you mind to drop your patch for parisc?

I think it would be easier if you could base your patch on top of
my series, as they would otherwise inevitably conflict. I could either
add it to my tree, or you could merge my branch into your tree.

      Arnd
Helge Deller Oct. 30, 2020, 7:48 p.m. UTC | #3
On 10/30/20 8:33 PM, Arnd Bergmann wrote:
> On Fri, Oct 30, 2020 at 6:13 PM Helge Deller <deller@gmx.de> wrote:
>>
>> On 10/30/20 4:17 PM, Arnd Bergmann wrote:
>>> From: Arnd Bergmann <arnd@arndb.de>
>>>
>>> parisc has selected CONFIG_GENERIC_CLOCKEVENTS since commit 43b1f6abd590
>>> ("parisc: Switch to generic sched_clock implementation"), but does not
>>> appear to actually be using it, and instead calls the low-level
>>> timekeeping functions directly.
>>
>> Arnd, thank you for this patch!
>> It reminded me that I really missed to fully implement the clockevents on parisc!
>>
>> Your other patch ("RFC: m68k: mac: convert to generic clockevent")
>> was a big help too, as it showed how it might work on parisc as well.
>>
>> Here is now a current version of the clockevents-enabling-patch for parisc:
>> https://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux.git/commit/?h=for-next&id=3b7ab4a74a2d1972dbeb33285d85f1500b2ff96a
>
> Ah, nice!
>
>>> Remove the GENERIC_CLOCKEVENTS select again, and instead convert to
>>> the newly added legacy_timer_tick() helper.
>>
>> My patch still needs more testing, but if it turns to work
>> out right, would you mind to drop your patch for parisc?
>
> I think it would be easier if you could base your patch on top of
> my series, as they would otherwise inevitably conflict. I could either
> add it to my tree, or you could merge my branch into your tree.

Couldn't you drop your patch and include mine in your tree instead?
That way nothing conflicts, and they get merged together?

Helge
Arnd Bergmann Oct. 30, 2020, 8:37 p.m. UTC | #4
On Fri, Oct 30, 2020 at 8:48 PM Helge Deller <deller@gmx.de> wrote:
> On 10/30/20 8:33 PM, Arnd Bergmann wrote:
> > On Fri, Oct 30, 2020 at 6:13 PM Helge Deller <deller@gmx.de> wrote:
> >>
> >> On 10/30/20 4:17 PM, Arnd Bergmann wrote:
> >>> From: Arnd Bergmann <arnd@arndb.de>
> >>>
> >>> parisc has selected CONFIG_GENERIC_CLOCKEVENTS since commit 43b1f6abd590
> >>> ("parisc: Switch to generic sched_clock implementation"), but does not
> >>> appear to actually be using it, and instead calls the low-level
> >>> timekeeping functions directly.
> >>
> >> Arnd, thank you for this patch!
> >> It reminded me that I really missed to fully implement the clockevents on parisc!
> >>
> >> Your other patch ("RFC: m68k: mac: convert to generic clockevent")
> >> was a big help too, as it showed how it might work on parisc as well.
> >>
> >> Here is now a current version of the clockevents-enabling-patch for parisc:
> >> https://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux.git/commit/?h=for-next&id=3b7ab4a74a2d1972dbeb33285d85f1500b2ff96a
> >
> > Ah, nice!
> >
> >>> Remove the GENERIC_CLOCKEVENTS select again, and instead convert to
> >>> the newly added legacy_timer_tick() helper.
> >>
> >> My patch still needs more testing, but if it turns to work
> >> out right, would you mind to drop your patch for parisc?
> >
> > I think it would be easier if you could base your patch on top of
> > my series, as they would otherwise inevitably conflict. I could either
> > add it to my tree, or you could merge my branch into your tree.
>
> Couldn't you drop your patch and include mine in your tree instead?
> That way nothing conflicts, and they get merged together?

That only works if nobody merges this branch into another one,
otherwise we end up with multiple copies of the later commits.

       Arnd
diff mbox series

Patch

diff --git a/Documentation/features/time/clockevents/arch-support.txt b/Documentation/features/time/clockevents/arch-support.txt
index 8287b6aa522e..61a5c9d68c15 100644
--- a/Documentation/features/time/clockevents/arch-support.txt
+++ b/Documentation/features/time/clockevents/arch-support.txt
@@ -21,7 +21,7 @@ 
     |       nds32: |  ok  |
     |       nios2: |  ok  |
     |    openrisc: |  ok  |
-    |      parisc: |  ok  |
+    |      parisc: | TODO |
     |     powerpc: |  ok  |
     |       riscv: |  ok  |
     |        s390: |  ok  |
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index b234e8154cbd..78b17621ee4a 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -52,7 +52,7 @@  config PARISC
 	select HAVE_REGS_AND_STACK_ACCESS_API
 	select GENERIC_SCHED_CLOCK
 	select HAVE_UNSTABLE_SCHED_CLOCK if SMP
-	select GENERIC_CLOCKEVENTS
+	select LEGACY_TIMER_TICK
 	select CPU_NO_EFFICIENT_FFS
 	select NEED_DMA_MAP_STATE
 	select NEED_SG_DMA_LENGTH
diff --git a/arch/parisc/kernel/time.c b/arch/parisc/kernel/time.c
index 13d94f0f94a0..08e4d480abe1 100644
--- a/arch/parisc/kernel/time.c
+++ b/arch/parisc/kernel/time.c
@@ -70,8 +70,6 @@  irqreturn_t __irq_entry timer_interrupt(int irq, void *dev_id)
 	/* gcc can optimize for "read-only" case with a local clocktick */
 	unsigned long cpt = clocktick;
 
-	profile_tick(CPU_PROFILING);
-
 	/* Initialize next_tick to the old expected tick time. */
 	next_tick = cpuinfo->it_value;
 
@@ -86,10 +84,9 @@  irqreturn_t __irq_entry timer_interrupt(int irq, void *dev_id)
 	cpuinfo->it_value = next_tick;
 
 	/* Go do system house keeping. */
-	if (cpu == 0)
-		xtime_update(ticks_elapsed);
-
-	update_process_times(user_mode(get_irq_regs()));
+	if (cpu != 0)
+		ticks_elapsed = 0;
+	legacy_timer_tick(ticks_elapsed);
 
 	/* Skip clockticks on purpose if we know we would miss those.
 	 * The new CR16 must be "later" than current CR16 otherwise