Re: [PATCH 1/2] net: Assert proper context while calling napi_schedule()

Breno Leitao
2025-02-13T18:14:08Z

Hello Jakub,

On Thu, Feb 13, 2025 at 07:14:26AM -0800, Jakub Kicinski wrote:
> On Thu, 13 Feb 2025 01:58:17 -0800 Breno Leitao wrote:
> > > Looks like netcons is hitting this warning in netdevsim:
> > >
> > > [ 16.063196][ T219] nsim_start_xmit+0x4e0/0x6f0 [netdevsim]
> > > [ 16.063219][ T219] ? netif_skb_features+0x23e/0xa80
> > > [ 16.063237][ T219] netpoll_start_xmit+0x3c3/0x670
> > > [ 16.063258][ T219] __netpoll_send_skb+0x3e9/0x800
> > > [ 16.063287][ T219] netpoll_send_skb+0x2a/0xa0
> > > [ 16.063298][ T219] send_ext_msg_udp+0x286/0x350 [netconsole]
> > > [ 16.063325][ T219] write_ext_msg+0x1c6/0x230 [netconsole]
> > > [ 16.063346][ T219] console_emit_next_record+0x20d/0x430
> > >
> > > https://netdev-3.bots.linux.dev/vmksft-net-drv-dbg/results/990261/7-netcons-basic-sh/stderr
> > >
> > > We gotta fix that first.
> >
> > Thanks Jakub,
> >
> > I understand that it will be fixed by this patchset, right?
>
> The problem is a bit nasty, on a closer look. We don't know if netcons
> is called in IRQ context or not. How about we add an hrtimer to netdevsim,
> schedule it to fire 5usec in the future instead of scheduling NAPI
> immediately? We can call napi_schedule() from a timer safely.
>
> Unless there's another driver which schedules NAPI from xmit.
> Then we'd need to try harder to fix this in netpoll.
> veth does use NAPI on xmit but it sets IFF_DISABLE_NETPOLL already.

Just to make sure I follow the netpoll issue. What would you like to fix
in netpoll exactly?