From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796424471; b=PbP7d4iHQ6w8WUF3FZMNowAevgIP6XScL+aWwVfQyC1TKWUFsLoyKHpeUJfwnCFJTC7K D+v/UIp6Vzxu52F8z6VvykZ4K891xPTjUMwzMBQvdS9GL6AMKZRRoMqFYCVJdpSeXmt1U wzuHGUwz3FMo1t5gZQWE7gwpdl3IoKAoH7VAR4/A6kww0fBgOtW/tWXVgH2VfvxWN2gn8 UbeZQ9XQO7+mSoR/n2+dDp/xaPFF/Pjs+eY43dDLxxM9Ri2Fd5ISpaCN99olZLvT43aJl huJj6duaFgVrzrEnz8mSAMVyBXvRiI6RfXkNd0YZRzCTA/706QyUYDwezzaTIc8evmw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796424471; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=IxTF9DuOwg+xB1VOyzQiWpKTHvpjp9i+ogvIKK5pk18=; b=1tMGD70ljMd/0Mxa4ZOy0stmaQb+6UdU0gPsPCjlB5e6aZNAnZ9Z+QdLK94FdvAorza4 49qPKhbRc9PF58xOQ37fWOWIbvTG8QwRHeyrTKV0Uyp+adk9yozYp1FWJ+Ixt/Os552xq u9Ykk5NJWten5PXFEp7/J9HGnQ0ve+QRNH2EhNxzVimFiiPaphbQMUv4MQJ0XB38+c4Fy pjflmmi8GCwMPmhS0pbHS+oH7dW8Elo/UU6RHzXipefvVcAz0SscYxv400cnZ+/tQBgAy eeFK1PWSBhAutHrfoIBHo/MbllH+16gqlaLfPWHlj2LjhE6ZYvbLqN/1sSkEC8+njyQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=RYi5TAMK; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AFFE7606A32C for ; Fri, 4 Dec 2026 22:47:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=RYi5TAMK Received: by smtp.kernel.org (Postfix) with ESMTPSA id 666621F00936; Fri, 4 Dec 2026 22:47:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796424471; bh=IxTF9DuOwg+xB1VOyzQiWpKTHvpjp9i+ogvIKK5pk18=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=RYi5TAMKVI8pTD1mGciZOWFZjekLP1vHtbDvb4erAuqZLVwNeWm1IMZDiSk5Ntr+M +qGbs7eBegpYVtPEhTD6TIzyuw1m52crXvSAJkRF/kfR4xX5n8aUZHdl6O1JVwsPt9 FudGE8dNX7FO9CVq1B865mNjqssb4Q+v/w54+Ih1vZgOPi2GF4j/WBxPV7cb9w2B7i DoY7aYDyYmPqRrj3Z2fy32gC0jBX8x39RkHK1+hM3/V1nTMMuxWQoBuxEH6mbCmyqM 7xa4b43FcTDQjAZhhvZReEI16qolTWgVaeSzzATYk1xd9aVH4Bjv4vPRKy303HOovM 7o9wwC+Mz2pHg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH RESEND v12 4/5] clocksource/timer-econet-en751221: Support EN751627 without percpu IRQ Reply-To: sashiko-reviews@lists.linux.dev To: "Caleb James DeLisle" Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org In-Reply-To: <20261204222334.1085123-5-cjd@cjdns.fr> References: <20261204222334.1085123-1-cjd@cjdns.fr> <20261204222334.1085123-5-cjd@cjdns.fr> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 22:47:50 +0000 X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list 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 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/clocks= ource/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 =3D clk_get_rate(clk); > clk_put(clk); > =20 > - for (int i =3D 0; i < num_blocks; i++) { > + econet_timer.num_irqs =3D num_irqs; > + econet_timer.irqs =3D 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 =3D 0; i < num_irqs; i++) { > + irq_set_status_flags(econet_timer.irqs[i], IRQ_NOAUTOEN); > + > + if (econet_timer.is_percpu) > + ret =3D request_percpu_irq(econet_timer.irqs[i], > + cevt_interrupt, np->name, > + &econet_timer_pcpu); > + else > + ret =3D 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. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204222334.1085= 123-1-cjd@cjdns.fr?part=3D4