RE: [PATCH net,v2] hv_netvsc: fix race of netvsc and VF register_netdevice

From: Haiyang Zhang
Date: Fri Nov 03 2023 - 18:44:19 EST




> -----Original Message-----
> From: Jakub Kicinski <kuba@xxxxxxxxxx>
> Sent: Thursday, November 2, 2023 1:08 AM
> To: Haiyang Zhang <haiyangz@xxxxxxxxxxxxx>
> Cc: linux-hyperv@xxxxxxxxxxxxxxx; netdev@xxxxxxxxxxxxxxx; KY Srinivasan
> <kys@xxxxxxxxxxxxx>; wei.liu@xxxxxxxxxx; Dexuan Cui
> <decui@xxxxxxxxxxxxx>; edumazet@xxxxxxxxxx; pabeni@xxxxxxxxxx;
> davem@xxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; stable@xxxxxxxxxxxxxxx
> Subject: Re: [PATCH net,v2] hv_netvsc: fix race of netvsc and VF
> register_netdevice
>
> On Thu, 26 Oct 2023 14:22:34 -0700 Haiyang Zhang wrote:
> > And, move register_netdevice_notifier() earlier, so the call back
> > function is set before probing.
>
> Are you sure you need this? I thought the netdev notifier "replays"
> registration events (i.e. sends "fake" events for already present
> netdevs).
>
> If I'm wrong this should still be a separate patch from the rtnl
> reorder.

I tested, NETDEV_REGISTER is indeed replayed, but NETDEV_POST_INIT
is not. And we will use NETDEV_POST_INIT soon.

Also, we want to get notified by NETDEV_POST_INIT immediately from
VF, before VF NIC shows up to upper layers. So, even if we make
NETDEV_POST_INIT to be replayed, that may be too late.

I will put the register_netdevice_notifier() change to a separate patch.

Thanks,
- Haiyang