* [PATCH net] net: drv: netdevsim: don't napi_complete() from netpoll
@ 2025-06-11 17:46 Jakub Kicinski
2025-06-11 22:23 ` Dave Marquardt
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Jakub Kicinski @ 2025-06-11 17:46 UTC (permalink / raw)
To: davem
Cc: netdev, edumazet, pabeni, andrew+netdev, horms, Jakub Kicinski,
Breno Leitao, dw
netdevsim supports netpoll. Make sure we don't call napi_complete()
from it, since it may not be scheduled. Breno reports hitting a
warning in napi_complete_done():
WARNING: CPU: 14 PID: 104 at net/core/dev.c:6592 napi_complete_done+0x2cc/0x560
__napi_poll+0x2d8/0x3a0
handle_softirqs+0x1fe/0x710
This is presumably after netpoll stole the SCHED bit prematurely.
Reported-by: Breno Leitao <leitao@debian.org>
Fixes: 3762ec05a9fb ("netdevsim: add NAPI support")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: dw@davidwei.uk
---
drivers/net/netdevsim/netdev.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c
index af545d42961c..fa5fbd97ad69 100644
--- a/drivers/net/netdevsim/netdev.c
+++ b/drivers/net/netdevsim/netdev.c
@@ -371,7 +371,8 @@ static int nsim_poll(struct napi_struct *napi, int budget)
int done;
done = nsim_rcv(rq, budget);
- napi_complete(napi);
+ if (done < budget)
+ napi_complete_done(napi, done);
return done;
}
--
2.49.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH net] net: drv: netdevsim: don't napi_complete() from netpoll
2025-06-11 17:46 [PATCH net] net: drv: netdevsim: don't napi_complete() from netpoll Jakub Kicinski
@ 2025-06-11 22:23 ` Dave Marquardt
2025-06-12 7:58 ` Breno Leitao
2025-06-12 8:53 ` Breno Leitao
2025-06-12 15:20 ` patchwork-bot+netdevbpf
2 siblings, 1 reply; 6+ messages in thread
From: Dave Marquardt @ 2025-06-11 22:23 UTC (permalink / raw)
To: Jakub Kicinski
Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms,
Breno Leitao, dw
Jakub Kicinski <kuba@kernel.org> writes:
> netdevsim supports netpoll. Make sure we don't call napi_complete()
> from it, since it may not be scheduled. Breno reports hitting a
> warning in napi_complete_done():
I decided to go learn a bit more about netdevsim, and ran across a typo
in Documentation/networking/devlink/netdevsim.rst:
The ``netdevsim`` driver supports rate objects management, which includes:
- registerging/unregistering leaf rate objects per VF devlink port;
^^^^^^^^^^^^
-Dave
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net] net: drv: netdevsim: don't napi_complete() from netpoll
2025-06-11 22:23 ` Dave Marquardt
@ 2025-06-12 7:58 ` Breno Leitao
2025-06-12 13:11 ` Dave Marquardt
0 siblings, 1 reply; 6+ messages in thread
From: Breno Leitao @ 2025-06-12 7:58 UTC (permalink / raw)
To: Dave Marquardt
Cc: Jakub Kicinski, davem, netdev, edumazet, pabeni, andrew+netdev,
horms, dw
Hello Dave,
On Wed, Jun 11, 2025 at 05:23:33PM -0500, Dave Marquardt wrote:
> Jakub Kicinski <kuba@kernel.org> writes:
>
> > netdevsim supports netpoll. Make sure we don't call napi_complete()
> > from it, since it may not be scheduled. Breno reports hitting a
> > warning in napi_complete_done():
>
> I decided to go learn a bit more about netdevsim, and ran across a typo
> in Documentation/networking/devlink/netdevsim.rst:
I acknowledge the bug exists in the latest netnext/main repo. Would you
like to send a patch and fix it, or, should we?
Thanks for reporting it.
--breno
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net] net: drv: netdevsim: don't napi_complete() from netpoll
2025-06-11 17:46 [PATCH net] net: drv: netdevsim: don't napi_complete() from netpoll Jakub Kicinski
2025-06-11 22:23 ` Dave Marquardt
@ 2025-06-12 8:53 ` Breno Leitao
2025-06-12 15:20 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 6+ messages in thread
From: Breno Leitao @ 2025-06-12 8:53 UTC (permalink / raw)
To: Jakub Kicinski; +Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms, dw
Hello Jakub,
On Wed, Jun 11, 2025 at 10:46:43AM -0700, Jakub Kicinski wrote:
> netdevsim supports netpoll. Make sure we don't call napi_complete()
> from it, since it may not be scheduled. Breno reports hitting a
> warning in napi_complete_done():
>
> WARNING: CPU: 14 PID: 104 at net/core/dev.c:6592 napi_complete_done+0x2cc/0x560
> __napi_poll+0x2d8/0x3a0
> handle_softirqs+0x1fe/0x710
>
> This is presumably after netpoll stole the SCHED bit prematurely.
>
> Reported-by: Breno Leitao <leitao@debian.org>
> Fixes: 3762ec05a9fb ("netdevsim: add NAPI support")
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Tested-by: Breno Leitao <leitao@debian.org>
Thanks for the quick fix,
--breno
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net] net: drv: netdevsim: don't napi_complete() from netpoll
2025-06-12 7:58 ` Breno Leitao
@ 2025-06-12 13:11 ` Dave Marquardt
0 siblings, 0 replies; 6+ messages in thread
From: Dave Marquardt @ 2025-06-12 13:11 UTC (permalink / raw)
To: Breno Leitao
Cc: Jakub Kicinski, davem, netdev, edumazet, pabeni, andrew+netdev,
horms, dw
Breno Leitao <leitao@debian.org> writes:
> Hello Dave,
>
> On Wed, Jun 11, 2025 at 05:23:33PM -0500, Dave Marquardt wrote:
>> Jakub Kicinski <kuba@kernel.org> writes:
>>
>> > netdevsim supports netpoll. Make sure we don't call napi_complete()
>> > from it, since it may not be scheduled. Breno reports hitting a
>> > warning in napi_complete_done():
>>
>> I decided to go learn a bit more about netdevsim, and ran across a typo
>> in Documentation/networking/devlink/netdevsim.rst:
>
> I acknowledge the bug exists in the latest netnext/main repo. Would you
> like to send a patch and fix it, or, should we?
I'll send in a patch. Thanks.
> Thanks for reporting it.
You're welcome!
-Dave
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net] net: drv: netdevsim: don't napi_complete() from netpoll
2025-06-11 17:46 [PATCH net] net: drv: netdevsim: don't napi_complete() from netpoll Jakub Kicinski
2025-06-11 22:23 ` Dave Marquardt
2025-06-12 8:53 ` Breno Leitao
@ 2025-06-12 15:20 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-06-12 15:20 UTC (permalink / raw)
To: Jakub Kicinski
Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms, leitao, dw
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Wed, 11 Jun 2025 10:46:43 -0700 you wrote:
> netdevsim supports netpoll. Make sure we don't call napi_complete()
> from it, since it may not be scheduled. Breno reports hitting a
> warning in napi_complete_done():
>
> WARNING: CPU: 14 PID: 104 at net/core/dev.c:6592 napi_complete_done+0x2cc/0x560
> __napi_poll+0x2d8/0x3a0
> handle_softirqs+0x1fe/0x710
>
> [...]
Here is the summary with links:
- [net] net: drv: netdevsim: don't napi_complete() from netpoll
https://git.kernel.org/netdev/net/c/1264971017b4
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] 6+ messages in thread
end of thread, other threads:[~2025-06-12 15:20 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-11 17:46 [PATCH net] net: drv: netdevsim: don't napi_complete() from netpoll Jakub Kicinski
2025-06-11 22:23 ` Dave Marquardt
2025-06-12 7:58 ` Breno Leitao
2025-06-12 13:11 ` Dave Marquardt
2025-06-12 8:53 ` Breno Leitao
2025-06-12 15:20 ` 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).