* [PATCH net-next] can: grcan: move napi_enable() from under spin lock
@ 2025-01-11 2:47 Jakub Kicinski
2025-01-11 14:20 ` Vincent Mailhol
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Jakub Kicinski @ 2025-01-11 2:47 UTC (permalink / raw)
To: davem
Cc: netdev, edumazet, pabeni, andrew+netdev, horms, Jakub Kicinski,
mkl, mailhol.vincent, linux-can
I don't see any reason why napi_enable() needs to be under the lock,
only reason I could think of is if the IRQ also took this lock
but it doesn't. napi_enable() will soon need to sleep.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
Marc, if this is correct is it okay for me to take via net-next
directly? I have a bunch of patches which depend on it.
CC: mkl@pengutronix.de
CC: mailhol.vincent@wanadoo.fr
CC: linux-can@vger.kernel.org
---
drivers/net/can/grcan.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/can/grcan.c b/drivers/net/can/grcan.c
index cdf0ec9fa7f3..21a61b86f67d 100644
--- a/drivers/net/can/grcan.c
+++ b/drivers/net/can/grcan.c
@@ -1073,9 +1073,10 @@ static int grcan_open(struct net_device *dev)
if (err)
goto exit_close_candev;
+ napi_enable(&priv->napi);
+
spin_lock_irqsave(&priv->lock, flags);
- napi_enable(&priv->napi);
grcan_start(dev);
if (!(priv->can.ctrlmode & CAN_CTRLMODE_LISTENONLY))
netif_start_queue(dev);
--
2.47.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] can: grcan: move napi_enable() from under spin lock
2025-01-11 2:47 [PATCH net-next] can: grcan: move napi_enable() from under spin lock Jakub Kicinski
@ 2025-01-11 14:20 ` Vincent Mailhol
2025-01-11 18:03 ` Francois Romieu
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Vincent Mailhol @ 2025-01-11 14:20 UTC (permalink / raw)
To: Jakub Kicinski, davem
Cc: netdev, edumazet, pabeni, andrew+netdev, horms, mkl, linux-can
On 11/01/2025 at 11:47, Jakub Kicinski wrote:
> I don't see any reason why napi_enable() needs to be under the lock,
> only reason I could think of is if the IRQ also took this lock
> but it doesn't. napi_enable() will soon need to sleep.
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Acked-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
> ---
> Marc, if this is correct is it okay for me to take via net-next
> directly? I have a bunch of patches which depend on it.
Even if the question is not addressed to me, I am personally fine if
this directly goes into net-next.
> CC: mkl@pengutronix.de
> CC: mailhol.vincent@wanadoo.fr
> CC: linux-can@vger.kernel.org
> ---
> drivers/net/can/grcan.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/can/grcan.c b/drivers/net/can/grcan.c
> index cdf0ec9fa7f3..21a61b86f67d 100644
> --- a/drivers/net/can/grcan.c
> +++ b/drivers/net/can/grcan.c
> @@ -1073,9 +1073,10 @@ static int grcan_open(struct net_device *dev)
> if (err)
> goto exit_close_candev;
>
> + napi_enable(&priv->napi);
> +
> spin_lock_irqsave(&priv->lock, flags);
>
> - napi_enable(&priv->napi);
> grcan_start(dev);
> if (!(priv->can.ctrlmode & CAN_CTRLMODE_LISTENONLY))
> netif_start_queue(dev);
Yours sincerely,
Vincent Mailhol
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] can: grcan: move napi_enable() from under spin lock
2025-01-11 2:47 [PATCH net-next] can: grcan: move napi_enable() from under spin lock Jakub Kicinski
2025-01-11 14:20 ` Vincent Mailhol
@ 2025-01-11 18:03 ` Francois Romieu
2025-01-13 9:52 ` Marc Kleine-Budde
2025-01-14 3:30 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 5+ messages in thread
From: Francois Romieu @ 2025-01-11 18:03 UTC (permalink / raw)
To: Jakub Kicinski
Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms, mkl,
mailhol.vincent, linux-can
Jakub Kicinski <kuba@kernel.org> :
> I don't see any reason why napi_enable() needs to be under the lock,
> only reason I could think of is if the IRQ also took this lock
> but it doesn't. napi_enable() will soon need to sleep.
Anything that depends on the napi handler being run may also behave
differently because of 'priv->resetting = false;' and
'priv->closing = false;' also done under the lock after napi_enable in
the original version.
Both priv->closing and priv->resetting are always accessed with lock
held so it's fine.
(nothing to chew in grcan_start either)
Reviewed-by: Francois Romieu <romieu@fr.zoreil.com>
--
Ueimor
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] can: grcan: move napi_enable() from under spin lock
2025-01-11 2:47 [PATCH net-next] can: grcan: move napi_enable() from under spin lock Jakub Kicinski
2025-01-11 14:20 ` Vincent Mailhol
2025-01-11 18:03 ` Francois Romieu
@ 2025-01-13 9:52 ` Marc Kleine-Budde
2025-01-14 3:30 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 5+ messages in thread
From: Marc Kleine-Budde @ 2025-01-13 9:52 UTC (permalink / raw)
To: Jakub Kicinski
Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms,
mailhol.vincent, linux-can
[-- Attachment #1: Type: text/plain, Size: 805 bytes --]
On 10.01.2025 18:47:42, Jakub Kicinski wrote:
> I don't see any reason why napi_enable() needs to be under the lock,
> only reason I could think of is if the IRQ also took this lock
> but it doesn't. napi_enable() will soon need to sleep.
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
> Marc, if this is correct is it okay for me to take via net-next
> directly? I have a bunch of patches which depend on it.
Yes, please take it via net-next directly.
Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung Nürnberg | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] can: grcan: move napi_enable() from under spin lock
2025-01-11 2:47 [PATCH net-next] can: grcan: move napi_enable() from under spin lock Jakub Kicinski
` (2 preceding siblings ...)
2025-01-13 9:52 ` Marc Kleine-Budde
@ 2025-01-14 3:30 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-01-14 3:30 UTC (permalink / raw)
To: Jakub Kicinski
Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms, mkl,
mailhol.vincent, linux-can
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Fri, 10 Jan 2025 18:47:42 -0800 you wrote:
> I don't see any reason why napi_enable() needs to be under the lock,
> only reason I could think of is if the IRQ also took this lock
> but it doesn't. napi_enable() will soon need to sleep.
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
> Marc, if this is correct is it okay for me to take via net-next
> directly? I have a bunch of patches which depend on it.
>
> [...]
Here is the summary with links:
- [net-next] can: grcan: move napi_enable() from under spin lock
https://git.kernel.org/netdev/net-next/c/7c125d5b767b
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-01-14 3:30 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-11 2:47 [PATCH net-next] can: grcan: move napi_enable() from under spin lock Jakub Kicinski
2025-01-11 14:20 ` Vincent Mailhol
2025-01-11 18:03 ` Francois Romieu
2025-01-13 9:52 ` Marc Kleine-Budde
2025-01-14 3:30 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).