Re: [PATCH net-next v3 1/4] udp_tunnel: remove rtnl_lock dependency

2025-06-12 Thread Jakub Kicinski
On Wed, 11 Jun 2025 19:47:54 -0700 Stanislav Fomichev wrote:
> > There are multiple entry points to this code, basically each member of
> > struct udp_tunnel_nic_ops and the netdev notifiers. In this patch only
> > reset and work are locked. I'm a bit confused as to what is the new
> > lock protecting :S  
> 
> I though that most of the callers are from do_setlink and there we have
> rtnl and we grab rtnl+lock during the sync. But that doesn't
> address the suspend/resume vs do_setlink race, that's true :-(

It's the UDP tunnels that add and remove the ports usually.



Re: [PATCH net-next v3 1/4] udp_tunnel: remove rtnl_lock dependency

2025-06-11 Thread Stanislav Fomichev
On 06/11, Jakub Kicinski wrote:
> On Tue, 10 Jun 2025 10:15:19 -0700 Stanislav Fomichev wrote:
> > Drivers that are using ops lock and don't depend on RTNL lock
> > still need to manage it because udp_tunnel's RTNL dependency.
> > Introduce new udp_tunnel_nic_lock and use it instead of
> > rtnl_lock. Drop non-UDP_TUNNEL_NIC_INFO_MAY_SLEEP mode from
> > udp_tunnel infra (udp_tunnel_nic_device_sync_work needs to
> > grab udp_tunnel_nic_lock mutex and might sleep).
> 
> There are multiple entry points to this code, basically each member of
> struct udp_tunnel_nic_ops and the netdev notifiers. In this patch only
> reset and work are locked. I'm a bit confused as to what is the new
> lock protecting :S

I though that most of the callers are from do_setlink and there we have
rtnl and we grab rtnl+lock during the sync. But that doesn't
address the suspend/resume vs do_setlink race, that's true :-(

Did not look deep into the notifiers, assuming they are a way to push
the info down to the devices (under rtnl) plus trigger the sync work,
will take a closer look.



Re: [PATCH net-next v3 1/4] udp_tunnel: remove rtnl_lock dependency

2025-06-11 Thread Jakub Kicinski
On Tue, 10 Jun 2025 10:15:19 -0700 Stanislav Fomichev wrote:
> Drivers that are using ops lock and don't depend on RTNL lock
> still need to manage it because udp_tunnel's RTNL dependency.
> Introduce new udp_tunnel_nic_lock and use it instead of
> rtnl_lock. Drop non-UDP_TUNNEL_NIC_INFO_MAY_SLEEP mode from
> udp_tunnel infra (udp_tunnel_nic_device_sync_work needs to
> grab udp_tunnel_nic_lock mutex and might sleep).

There are multiple entry points to this code, basically each member of
struct udp_tunnel_nic_ops and the netdev notifiers. In this patch only
reset and work are locked. I'm a bit confused as to what is the new
lock protecting :S