Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Caleb James DeLisle" <cjd@cjdns.fr>
Cc: robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v6 5/5] clocksource/timer-econet-en751221: Support EN751627 without percpu IRQ
Date: Thu, 28 May 2026 16:41:58 +0000	[thread overview]
Message-ID: <20260528164158.CDE151F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260528140046.2897674-6-cjd@cjdns.fr>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] The interrupt handler incorrectly relies on `this_cpu_ptr` for standard IRQs, causing an interrupt storm if the IRQ executes on a different CPU.
- [Medium] Missing CPU hotplug teardown callback causes an unbalanced `enable_irq()` kernel warning when a CPU is offlined and then onlined again.
--

commit 0de42286a034bc944e765e97434f913831bc2960
Author: Caleb James DeLisle <cjd@cjdns.fr>
Subject: clocksource/timer-econet-en751221: Support EN751627 without percpu IRQ

This commit adds support for the EN751627 timer, which uses a different
interrupt number for each CPU timer instead of a single percpu interrupt.

> diff --git a/drivers/clocksource/timer-econet-en751221.c b/drivers/clocksource/timer-econet-en751221.c
> index f2c4c1ee0a56b..040386ded132a 100644
> --- a/drivers/clocksource/timer-econet-en751221.c
> +++ b/drivers/clocksource/timer-econet-en751221.c
> @@ -110,7 +131,10 @@ static int cevt_init_cpu(uint cpu)
>  	clockevents_config_and_register(cd, econet_timer.freq_hz,
>  					ECONET_MIN_DELTA, ECONET_MAX_DELTA);
>  
> -	enable_percpu_irq(cd->irq, IRQ_TYPE_NONE);
> +	if (econet_timer.is_percpu)
> +		enable_percpu_irq(cd->irq, IRQ_TYPE_NONE);
> +	else
> +		enable_irq(cd->irq);

[Severity: Medium]
Will this cause an unbalanced enable_irq() warning if a CPU is offlined
and onlined again?

The driver registers a dynamic CPU hotplug state via cpuhp_setup_state()
with cevt_init_cpu() as the starting callback, but passes NULL for the
teardown callback.

Because there is no teardown callback to call disable_irq() when a CPU is
offlined, the IRQ descriptor's enable depth remains 0. When the CPU is
brought back online, cevt_init_cpu() will execute again and call
enable_irq() a second time.

While this missing teardown existed before this patch, it was hidden
because enable_percpu_irq() does not track descriptor depth. The warning
appears to be newly exposed by the introduction of enable_irq().

[ ... ]

> @@ -173,22 +230,32 @@ static int __init timer_init(struct device_node *np)

[ ... ]

> +	for (i = 0; i < num_irqs; i++) {
> +		irq_set_status_flags(econet_timer.irqs[i], IRQ_NOAUTOEN);
> +
> +		if (econet_timer.is_percpu)
> +			ret = request_percpu_irq(econet_timer.irqs[i],
> +						 cevt_interrupt, np->name,
> +						 &econet_timer_pcpu);
> +		else
> +			ret = request_irq(econet_timer.irqs[i], cevt_interrupt,
> +					  IRQF_TIMER | IRQF_NOBALANCING,
> +					  np->name, NULL);

[Severity: High]
Could passing NULL for dev_id lead to an interrupt storm if the IRQ
executes on a different CPU?

For standard (non-percpu) IRQs, cevt_interrupt() currently calculates the
timer device using this_cpu_ptr(). If the interrupt fires on a different
CPU (e.g., due to CPU hotplug migrating the IRQ, or a spurious interrupt),
this_cpu_ptr() will return the timer for the currently executing CPU, not
the CPU for which the interrupt was intended.

The handler would then check the wrong CPU's status, find it not pending,
and return IRQ_NONE. The actual pending interrupt would be left
unacknowledged.

Would it be better to pass the specific CPU's timer pointer as dev_id here
and update cevt_interrupt() to use it instead of this_cpu_ptr()?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260528140046.2897674-1-cjd@cjdns.fr?part=5

  reply	other threads:[~2026-05-28 16:41 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-28 14:00 [PATCH v6 0/5] clocksource/timer-econet-en751221: Support irq number per timer Caleb James DeLisle
2026-05-28 14:00 ` [PATCH v6 1/5] clocksource/timer-econet-en751221: fix refcount leak Caleb James DeLisle
2026-05-28 14:00 ` [PATCH v6 2/5] dt-bindings: timer: econet: Update EN751627 for multi-IRQ Caleb James DeLisle
2026-05-28 14:45   ` sashiko-bot
2026-05-28 15:28     ` Caleb James DeLisle
2026-05-28 14:00 ` [PATCH v6 3/5] clocksource/timer-econet-en751221: Init teardown on error if possible Caleb James DeLisle
2026-05-28 15:23   ` sashiko-bot
2026-05-28 15:46     ` Caleb James DeLisle
2026-05-28 14:00 ` [PATCH v6 4/5] clocksource/timer-econet-en751221: Disable IRQ until cevt registered Caleb James DeLisle
2026-05-28 16:03   ` sashiko-bot
2026-05-28 14:00 ` [PATCH v6 5/5] clocksource/timer-econet-en751221: Support EN751627 without percpu IRQ Caleb James DeLisle
2026-05-28 16:41   ` sashiko-bot [this message]
2026-05-29 10:45     ` Caleb James DeLisle

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=20260528164158.CDE151F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=cjd@cjdns.fr \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox