can: grcan: move napi_enable() from under spin lock
Subsystems (3)
Jakub Kicinski
maintainerPATCH 1/1 can: grcan: move napi_enable() from under spin lock
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.
---
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.
--- drivers/net/can/grcan.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/can/grcan.c +2 -1
@@ -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);
Signature · 1 line
2.47.1
Quoted 5 lines · Jakub Kicinski
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 <[email protected]>
Quoted 3 lines
---
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.
Quoted 13 lines
--- drivers/net/can/grcan.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/net/can/grcan.c +0
-0@@ -1073,9 +1073,10 @@ static int grcan_open(struct net_device *dev)if (err)
drivers/net/can/grcan.c static int grcan_open(struct net_device *dev) · line 1082
Quoted 10 lines
drivers/net/can/grcan.c +2
-1goto 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
Jakub Kicinski <[email protected]> :
Quoted 3 lines
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)
Signature · 1 line
Ueimor
Quoted 8 lines · Jakub Kicinski
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 <[email protected]>---
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.
Marc
Signature · 4 lines
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 |
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 10 lines · 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 <[email protected]>---
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!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html