mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] clocksource/drivers/riscv: Increase the clock source rating
@ 2022-12-28  0:44 Samuel Holland
  2022-12-28  3:58 ` Anup Patel
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Samuel Holland @ 2022-12-28  0:44 UTC (permalink / raw)
  To: Palmer Dabbelt, Daniel Lezcano, Thomas Gleixner
  Cc: Prabhakar Lad, Samuel Holland, Albert Ou, Paul Walmsley,
	linux-kernel, linux-riscv

RISC-V provides an architectural clock source via the time CSR. This
clock source exposes a 64-bit counter synchronized across all CPUs.
Because it is accessed using a CSR, it is much more efficient to read
than MMIO clock sources. For example, on the Allwinner D1, reading the
sun4i timer in a loop takes 131 cycles/iteration, while reading the
RISC-V time CSR takes only 5 cycles/iteration.

Adjust the RISC-V clock source rating so it is preferred over the
various platform-specific MMIO clock sources.

Signed-off-by: Samuel Holland <samuel@sholland.org>
---

 drivers/clocksource/timer-riscv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clocksource/timer-riscv.c b/drivers/clocksource/timer-riscv.c
index a0d66fabf073..55dad7965f43 100644
--- a/drivers/clocksource/timer-riscv.c
+++ b/drivers/clocksource/timer-riscv.c
@@ -73,7 +73,7 @@ static u64 notrace riscv_sched_clock(void)
 
 static struct clocksource riscv_clocksource = {
 	.name		= "riscv_clocksource",
-	.rating		= 300,
+	.rating		= 400,
 	.mask		= CLOCKSOURCE_MASK(64),
 	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
 	.read		= riscv_clocksource_rdtime,
-- 
2.37.4


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

end of thread, other threads:[~2023-02-13 18:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-28  0:44 [PATCH] clocksource/drivers/riscv: Increase the clock source rating Samuel Holland
2022-12-28  3:58 ` Anup Patel
2022-12-28 23:29 ` Lad, Prabhakar
2022-12-29 16:22 ` Palmer Dabbelt
2022-12-29 17:21   ` Samuel Holland
2023-01-04 22:29 ` Daniel Lezcano
2023-02-13 18:26 ` [tip: timers/core] " tip-bot2 for Samuel Holland

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

all inboxes | Powered by JetHome®