From: sashiko-bot@kernel.org
To: "Herve Codina (Schneider Electric)" <herve.codina@bootlin.com>
Cc: conor+dt@kernel.org, wsa+renesas@sang-engineering.com,
robh@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v5 2/4] clocksource/drivers: Add support for the Renesas RZ/N1 timers
Date: Fri, 11 Sep 2026 15:18:37 +0000 [thread overview]
Message-ID: <20260911151837.709F41F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260911150456.893761-3-herve.codina@bootlin.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] The 16-bit per-CPU timers will never be chosen over the arch timer due to their low rating, resulting in asymmetrical per-CPU tick devices.
- [Medium] Clocksource and sched_clock return raw decreasing values if the timer is a down-counter.
--
commit 0389aacef8150cde2d480116d05b7b23c573015b
Author: Herve Codina (Schneider Electric) <herve.codina@bootlin.com>
clocksource/drivers: Add support for the Renesas RZ/N1 timers
The Renesas RZ/N1 timer block controller is the controller in charge of
timers available in the Renesas RZ/N1 SoCs family. This controller handles
8 timers (6 16-bit, 2 32-bit). Each timer has its own interrupt and prescaler.
> diff --git a/drivers/clocksource/timer-rzn1.c b/drivers/clocksource/timer-rzn1.c
> new file mode 100644
> index 0000000000000..a66a045309f63
> --- /dev/null
> +++ b/drivers/clocksource/timer-rzn1.c
[ ... ]
> +static u64 notrace rzn1_sched_read(void)
> +{
> + return readl_relaxed(rzn1_sched_clock->base + RZN1_TIMER_CURRENT_COUNT_REG);
> +}
> +
> +static u64 rzn1_clksrc_read(struct clocksource *cs)
> +{
> + return readl_relaxed(rzn1_sched_clock->base + RZN1_TIMER_CURRENT_COUNT_REG);
> +}
[Severity: Medium]
If the timer is a down-counter, will these functions return a decreasing value?
The clocksource and sched_clock cores require monotonically increasing values.
If the timer counts down, returning the raw value could cause the
(now - last) & mask calculation to yield large forward time jumps, breaking
system timekeeping and scheduling.
[ ... ]
> +static int rzn1_local_timer_starting_cpu(unsigned int cpu)
> +{
> + struct rzn1_timer *timer;
> +
> + /* We assign the first and second 16-bit timer as per-cpu timers. */
> + if (cpu >= 2)
> + return 0;
> +
> + timer = &rzn1_tab_timers[cpu + RZN1_TIMER_BASE_INDEX_16BIT_TIMERS];
[ ... ]
> +static void rzn1_timer_clkevt_init_ced(struct rzn1_timer *timer, const char *name,
> + int irq)
> +{
[ ... ]
> + /*
> + * 32-bit timers are fed with a 25 MHz clock directly derived from the
> + * main PLL (1 GHz). The arch timer, ARMv7 CP15 in RZ/N1 SoCs, is fed
> + * with to a 6.25 MHz clock.
> + *
> + * The clock of the RZ/N1 timers block is a stable one and the RZ/N1
> + * timers have a higher resolution than the ARM CP15 one.
> + *
> + * Also those 32-bit RZ/N1 timers are assigned per-cpu.
> + *
> + * Use a high rating for the 32-bit RZ/N1 timers in order to have them
> + * chosen by the system.
> + */
> + timer->ced.rating = timer->width == 16 ? 200 : 460;
[Severity: High]
Is it intentional that the 16-bit per-CPU timers are assigned a rating of 200?
In rzn1_local_timer_starting_cpu(), the 16-bit timers are explicitly assigned
as the per-CPU tick devices. However, because the ARM arch timer typically has
a higher rating (400-450), won't the 16-bit timers always be outranked and
ignored by the clockevents core?
This appears to contradict the comment stating that 32-bit timers are assigned
per-cpu, and could leave CPU 1 falling back to the arch timer while CPU 0
might use the global 32-bit timer, resulting in asymmetrical per-CPU tick
devices.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260911150456.893761-1-herve.codina@bootlin.com?part=2
next prev parent reply other threads:[~2026-09-11 15:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-11 15:04 [PATCH v5 0/4] timers: Add support for RZ/N1 SoCs timers Herve Codina (Schneider Electric)
2026-09-11 15:04 ` [PATCH v5 1/4] dt-bindings: timer: Add the Renesas RZ/N1 timer Herve Codina (Schneider Electric)
2026-09-11 15:04 ` [PATCH v5 2/4] clocksource/drivers: Add support for the Renesas RZ/N1 timers Herve Codina (Schneider Electric)
2026-09-11 15:18 ` sashiko-bot [this message]
2026-09-11 15:04 ` [PATCH v5 3/4] ARM: dts: r9a06g032: Add support for timers Herve Codina (Schneider Electric)
2026-09-11 15:04 ` [PATCH v5 4/4] MAINTAINERS: Add the Renesas RZ/N1 timers driver entry Herve Codina (Schneider Electric)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260911151837.709F41F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=herve.codina@bootlin.com \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=wsa+renesas@sang-engineering.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.