From: sashiko-bot@kernel.org
To: "Herve Codina (Schneider Electric)" <herve.codina@bootlin.com>
Cc: conor+dt@kernel.org, robh@kernel.org,
wsa+renesas@sang-engineering.com, devicetree@vger.kernel.org
Subject: Re: [PATCH v7 2/4] clocksource/drivers: Add support for the Renesas RZ/N1 timers
Date: Thu, 01 Oct 2026 08:36:22 +0000 [thread overview]
Message-ID: <20261001083622.C31B61F00898@smtp.kernel.org> (raw)
In-Reply-To: <20261001082225.125956-3-herve.codina@bootlin.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] time: rzn1: missing bitwise inversion of down-counter breaks timekeeping
- [Medium] time: rzn1: low clocksource rating prevents selection of high-res timer
--
commit 0212f7a729b347a614f1987ed20d902b4286e999
Author: Herve Codina (Schneider Electric) <herve.codina@bootlin.com>
clocksource/drivers: Add support for the Renesas RZ/N1 timers
This commit introduces a new clocksource driver for the Renesas RZ/N1 SoCs
timer block. It provides support for the 8 available timers (6 16-bit and
2 32-bit timers) to be used as clock events, clocksource, and sched_clock.
> diff --git a/drivers/clocksource/timer-rzn1.c b/drivers/clocksource/timer-rzn1.c
> new file mode 100644
> index 0000000000000..25ebebff3c639
> --- /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: High]
The RZ/N1 timer is a down-counter (it uses a LOAD_COUNT register and counts
down to 0), but the sched_clock and clocksource subsystems require
monotonically increasing counter values.
Will returning the raw down-counter value cause the delta between consecutive
reads to be negative, underflowing into a massive positive time jump? This
breaks core timekeeping, scheduling, and RCU.
Does this require bitwise inversion of the read value (e.g.,
~readl_relaxed(...)) to return an increasing counter?
> +static struct clocksource rzn1_clocksource = {
> + .name = "rzn1_timer_clocksource",
> + .rating = 200,
> + .flags = CLOCK_SOURCE_IS_CONTINUOUS,
> + .read = rzn1_clksrc_read,
> +};
[Severity: Medium]
The 32-bit RZ/N1 timer has a higher resolution (25 MHz) than the ARM arch
timer (6.25 MHz), but the standard ARM arch timer has a rating of 400.
Will statically defining this clocksource's rating as 200 prevent it from
being selected over the lower-resolution ARM arch timer?
(Note that the clock event device correctly receives a rating of 460 in
rzn1_timer_clkevt_init_ced() for this exact reason.)
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261001082225.125956-1-herve.codina@bootlin.com?part=2
next prev parent reply other threads:[~2026-10-01 8:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-01 8:22 [PATCH v7 0/4] timers: Add support for RZ/N1 SoCs timers Herve Codina (Schneider Electric)
2026-10-01 8:22 ` [PATCH v7 1/4] dt-bindings: timer: Add the Renesas RZ/N1 timer Herve Codina (Schneider Electric)
2026-10-01 8:22 ` [PATCH v7 2/4] clocksource/drivers: Add support for the Renesas RZ/N1 timers Herve Codina (Schneider Electric)
2026-10-01 8:36 ` sashiko-bot [this message]
2026-10-01 8:22 ` [PATCH v7 3/4] ARM: dts: r9a06g032: Add support for timers Herve Codina (Schneider Electric)
2026-10-01 8:22 ` [PATCH v7 4/4] MAINTAINERS: Add the Renesas RZ/N1 timers driver entry Herve Codina (Schneider Electric)
2026-10-02 9:49 ` [PATCH v7 0/4] timers: Add support for RZ/N1 SoCs timers Daniel Lezcano
2026-10-12 9:16 ` Herve Codina
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=20261001083622.C31B61F00898@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.