Re: [PATCH net-next 5/8] xdp: double protect netdev->xdp_flags with netdev->lock

Joe Damato
2025-04-08T02:30:06Z

On Mon, Apr 07, 2025 at 12:01:14PM -0700, Jakub Kicinski wrote:
> Protect xdp_features with netdev->lock. This way pure readers
> no longer have to take rtnl_lock to access the field.
>
> This includes calling NETDEV_XDP_FEAT_CHANGE under the lock.
> Looks like that's fine for bonding, the only "real" listener,
> it's the same as ethtool feature change.
>
> In terms of normal drivers - only GVE need special consideration
> (other drivers don't use instance lock or don't support XDP).
> It calls xdp_set_features_flag() helper from gve_init_priv() which
> in turn is called from gve_reset_recovery() (locked), or prior
> to netdev registration. So switch to _locked.
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
> CC: bpf@vger.kernel.org
> ---
> Documentation/networking/netdevices.rst | 1 +
> include/linux/netdevice.h | 2 +-
> include/net/xdp.h | 1 +
> drivers/net/ethernet/google/gve/gve_main.c | 2 +-
> net/core/lock_debug.c | 2 +-
> net/core/xdp.c | 12 +++++++++++-
> 6 files changed, 16 insertions(+), 4 deletions(-)

Reviewed-by: Joe Damato <jdamato@fastly.com>