From: sashiko-bot@kernel.org
To: "Caleb James DeLisle" <cjd@cjdns.fr>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH RESEND v12 4/5] clocksource/timer-econet-en751221: Support EN751627 without percpu IRQ
Date: Fri, 04 Dec 2026 22:47:50 +0000 [thread overview]
Message-ID: <sashiko-outbox-250772@kernel.org> (raw)
In-Reply-To: <20261204222334.1085123-5-cjd@cjdns.fr>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] clocksource/econet: missing hotplug teardown and NULL dev_id
on EN751627
- [Low] clocksource/econet: leak of init-only econet_timer.irqs in
timer_init()
--
commit 57cf37a70d5daa46ac2e5a390a95923f9e1a9b59
Author: Caleb James DeLisle <cjd@cjdns.fr>
clocksource/timer-econet-en751221: Support EN751627 without percpu IRQ
This commit extends the EcoNet high-precision timer driver to support the
EN751627 SoC, which uses a separate interrupt per 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..edb3db3125ce3 100644
> --- a/drivers/clocksource/timer-econet-en751221.c
> +++ b/drivers/clocksource/timer-econet-en751221.c
[ ... ]
> @@ -164,7 +221,13 @@ static int __init timer_init(struct device_node *np)
> econet_timer.freq_hz = clk_get_rate(clk);
> clk_put(clk);
>
> - for (int i = 0; i < num_blocks; i++) {
> + econet_timer.num_irqs = num_irqs;
> + econet_timer.irqs = kcalloc(num_irqs, sizeof(*econet_timer.irqs),
> + GFP_KERNEL);
> + if (!econet_timer.irqs)
> + return -ENOMEM;
[Severity: Low]
Does timer_init() leak econet_timer.irqs on the success path?
Only __init cevt_init() reads econet_timer.irqs and econet_timer.num_irqs,
and timer_init() only frees econet_timer.irqs on the error path. Keeping
irqs local to timer_init() and freeing it before returning 0 would avoid
the boot-time leak and drop the two unused __ro_after_init fields.
Also, timer-econet-en751221.c calls kcalloc() and kfree() without directly
including linux/slab.h.
[ ... ]
> + 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: Medium]
Can CPU offlining on EN751627 corrupt the clockevent_devices list or trigger
an unhandled IRQ storm?
Dual-core MIPS 1004Kc uses CONFIG_MIPS_CPS, which selects
SYS_SUPPORTS_HOTPLUG_CPU and GENERIC_IRQ_MIGRATION. Because timer_init()
registers cevt_init_cpu() at CPUHP_AP_ONLINE_DYN with a NULL teardown and
never calls cpu_hotplug_disable_offlining(), CPU offlining is still active.
Even if cps_cpu_disable() rejects offlining with -EINVAL, _cpu_down() rolls
back up and re-invokes cevt_init_cpu(), which calls
clockevents_config_and_register() on an already-linked clock_event_device
and enable_irq() on an already-enabled IRQ.
If offlining succeeds, irq_migrate_all_off_this_cpu() migrates the active
level-triggered IRQ to another CPU despite IRQF_NOBALANCING. Because
request_irq() passes a NULL dev_id and cevt_interrupt() uses
this_cpu_ptr(&econet_timer_pcpu), the handler inspects the wrong CPU's timer
and returns IRQ_NONE without acknowledging the interrupt.
Either adding hotplug teardown (stopping the timer, disabling the IRQ, and
passing per_cpu_ptr(&econet_timer_pcpu, i) as dev_id) or calling
cpu_hotplug_disable_offlining() in timer_init() would prevent this.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204222334.1085123-1-cjd@cjdns.fr?part=4
next prev parent reply other threads:[~2026-12-04 22:47 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 22:23 [PATCH RESEND v12 0/5] clocksource/timer-econet-en751221: Support irq number per timer Caleb James DeLisle
2026-12-04 22:23 ` [PATCH RESEND v12 1/5] dt-bindings: timer: econet: Update EN751627 for multi-IRQ Caleb James DeLisle
2026-12-04 22:35 ` sashiko-bot
2026-12-04 22:23 ` [PATCH RESEND v12 2/5] clocksource/timer-econet-en751221: Init teardown on error if possible Caleb James DeLisle
2026-12-04 22:23 ` [PATCH RESEND v12 3/5] clocksource/timer-econet-en751221: Disable IRQ until cevt registered Caleb James DeLisle
2026-12-04 22:39 ` sashiko-bot
2026-12-04 22:23 ` [PATCH RESEND v12 4/5] clocksource/timer-econet-en751221: Support EN751627 without percpu IRQ Caleb James DeLisle
2026-12-04 22:47 ` sashiko-bot [this message]
2026-12-04 22:23 ` [PATCH RESEND v12 5/5] clocksource/timer-econet-en751221: Do not use NR_CPUS for resource array size 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=sashiko-outbox-250772@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 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.