From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dl1-f45.google.com (mail-dl1-f45.google.com [74.125.82.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3C8891FB1 for ; Fri, 20 Feb 2026 00:30:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771547446; cv=none; b=DMAzfzSusZUESPfR8gmxzi4IAS+cLVL1reBVx60fo5M9mOn8HO/mF7KzvZ62ndmbE8//k/xXbv2QUIPxewue+PGL8vmWSMghmKwvMKD9Rvgg3+Ghj88BIWcspEzD7bE5xg4bBu4HSYRKKwtaCZL8CrQV8H6gpdje5lhEZFTwoK8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771547446; c=relaxed/simple; bh=JHQUE5GOzFNyvc1ZCVCk74Z1cDW9iwN2hrJNEY5Vb58=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=jGZ0G9SjjpURu90a9sxmO24f44hG5D+Lz45UQnrlp5ahH44GqPFKthoPMcD/RPokf6dtcCCIbtkGf2TyJfFMG4aFmmaGTzAR21Idv7fCxQPJmEzhZL9BEZAzBRRIz530gE2fGevjd5pbEobU57M/hiz/gd46XYDyTZk2c+XFb2M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=WLUqycTF; arc=none smtp.client-ip=74.125.82.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WLUqycTF" Received: by mail-dl1-f45.google.com with SMTP id a92af1059eb24-127380532eeso1598330c88.1 for ; Thu, 19 Feb 2026 16:30:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1771547444; x=1772152244; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=T2PIPxpQNA63NGLvP9npisU2Bb/eGAYAhx+E8CbqwmE=; b=WLUqycTF2HMidqTQ7nBvl7mTxp8UCExHtH6g7ygM5ga5KWtu0XmZgrzO84RcFrsJTZ cyfXaLLC6Mufb8SpQIycGgug1oQZUAOztsfXhMPp7ntQdnz8wVTV29MXGiq3dq+vTKUJ Mcn5VocdZQyrtTDtggbuD9OjZmX0LfiM5Yi4U5/Ghok5pl44SPYh21qRHW0LSOXc8F81 1lW+XXEb+ozPYBGHdymT9DTs5E9KSl2ej/nm4oGM7q4BIXjHQn3g13z+5naGocjyDNWi xt9xWiLgJwf2HsPYijoxoygIj+3jkTWhNfIOq1pGiBcj7EyhekV+/CeI3TY1KD1OliTG UD1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771547444; x=1772152244; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=T2PIPxpQNA63NGLvP9npisU2Bb/eGAYAhx+E8CbqwmE=; b=N/95S7cWvRaFWBqXHk2tcCCeHt3+Yn1CzvItuXKL0Gg+lKVLkuDmiLOrrILhrqAWT8 amAuSwPBavJrCiNurTC4mjE3wkll8j92n11smMb3AahzwoLJ2E7xgAsC3jnkKEVMZk7E HUreYND1xMkYFtpTi+e0Z6S3xhzsALmw0mK4Nol9RuU6yAnSLFmNUmlFJkC3FacgMOy2 1B6ZvhB3PMn5ReAH9hxjxoCdWrPTr0+HVECVeLJwZDhBxt3pFgfLpB2DGVh5/t7apgo8 sxj34HBDaM9otf3UazShggFK6P0CTZ4192sR1Jjo31imUx1adrj4WxrVrYMyseq8VO9G ZcGQ== X-Forwarded-Encrypted: i=1; AJvYcCVUfK3X+INC/fwFEwQu7J1nbL4jAAOXTJ7aZtQhvirvTpPKGVZwUtaowBhapLVrimZptIgBvB/zA65yPpE=@vger.kernel.org X-Gm-Message-State: AOJu0Yw6E1yBf5wFWRiBd3GxIIZKBrUyzd6+dKrINyxu0jNLdkIcDc/S P2q3JzeGnIVr7DcvrIu+ggAN40Vf/xPMT4e/DMp/Dk8zoJSXsfTbyVQ= X-Gm-Gg: AZuq6aK7Ae73+eCcrb9d9+bsfupFOsH+stsqaktriQj6Ri5hh/V1zxdqahWFXMqFiJ8 fKDi9pixEnKkqgPqFjiHT2TMxlJfIMsJ+Wy6DY27Y+ifj94kuWlMUmEvR9mvbNMdacjJgEz/nAO HmdIDjoNrZ4MQ6Av5YPRncWSBWHUg1blAKGdR7bESTRVpwfFcPtSsId2R/g8ZkYvne9aXcevzdV x1kQZjU57I+rQC0Zuz9yvYFOcGDmCGCYBTFQJR8aYqQbQGZjkiXXU5Pw+HxuWyFdb1amKxXusmA K75SS34IEu8IIbhLFi788rk1Ex7Rq0BzytWIEMZtOERaURcsslszrR6yTKINDGzesX7w5tG1A0P JOVBa8448FGnOu6Y/U6MsrgWr5wyY9oVh+jNvoEmYw+AHfQUD6IgdoUka8qM2ElTTaMc3tH2gN8 LZt2W2YeEtUSBqj2DbJenmYAXIHTCynmdscYOtB2kDxoyJEZGqmTs4L9m5p6lL1IuCpEckkSuV2 4XNDnCVpK3DYbQbX1F8ybAjQG3s X-Received: by 2002:a05:7022:6626:b0:11b:a3a7:65cd with SMTP id a92af1059eb24-12759a1ee7emr3982672c88.12.1771547443952; Thu, 19 Feb 2026 16:30:43 -0800 (PST) Received: from localhost (c-76-102-12-149.hsd1.ca.comcast.net. [76.102.12.149]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-12742c6dc70sm23197294c88.8.2026.02.19.16.30.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Feb 2026 16:30:43 -0800 (PST) Date: Thu, 19 Feb 2026 16:30:42 -0800 From: Stanislav Fomichev To: Jakub Kicinski Cc: Jiayuan Chen , netdev@vger.kernel.org, Jiayuan Chen , syzbot+2b3391f44313b3983e91@syzkaller.appspotmail.com, "David S. Miller" , Eric Dumazet , Paolo Abeni , Simon Horman , Sabrina Dubroca , Stanislav Fomichev , Kuniyuki Iwashima , Samiullah Khawaja , Ahmed Zaki , Alexander Lobakin , Willem de Bruijn , linux-kernel@vger.kernel.org Subject: Re: [PATCH net v1] net: defer __dev_set_promiscuity() to avoid sleeping in atomic context Message-ID: References: <20260214033859.43857-1-jiayuan.chen@linux.dev> <20260218174025.2fe593d3@kernel.org> <20260219121213.5b5ab0e7@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20260219121213.5b5ab0e7@kernel.org> On 02/19, Jakub Kicinski wrote: > On Thu, 19 Feb 2026 10:59:01 -0800 Stanislav Fomichev wrote: > > On 02/18, Jakub Kicinski wrote: > > > On Tue, 17 Feb 2026 17:10:36 -0800 Stanislav Fomichev wrote: > > > > > Reproducer: > > > > > > > > > > ip link add dummy0 type dummy > > > > > ip link add team0 type team > > > > > ip link set dummy0 master team0 > > > > > ip link set team0 up > > > > > ip link add bridge0 type bridge vlan_filtering 1 > > > > > ip link set bridge0 up > > > > > ip link set team0 master bridge0 > > > > > ip link add macsec0 link bridge0 type macsec > > > > > ip link set macsec0 up # triggers the bug > > > > > > > > Can you add it as a selftest under selftests/drivers/net/team/? > > > > > > Stan, this "fix" may work for the promisc flag but won't we have > > > the same problem with sync'ing the address list? Looks like team > > > will do: > > > - team_set_rx_mode() > > > - dev_uc_sync_multiple() > > > - __dev_set_rx_mode(port->dev) > > > so AFAICT we're calling ndo_set_rx_mode without holding the instance > > > lock? > > > > Not sure I understand your trace without more details about the hierarchy. > > Team on top of a ops-locked netdev > > - team_set_rx_mode() # set_rx_mode on team > - dev_uc_sync_multiple() > - __dev_set_rx_mode(port->dev) # calls ndo_set_rx_mode on ops-locked > # netdev without holding the inst. lock > > IOW this will fire: > > diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c > index 6285fbefe38a..77991f62bffc 100644 > --- a/drivers/net/netdevsim/netdev.c > +++ b/drivers/net/netdevsim/netdev.c > @@ -184,6 +184,7 @@ static netdev_tx_t nsim_start_xmit(struct sk_buff *skb, struct net_device *dev) > > static void nsim_set_rx_mode(struct net_device *dev) > { > + netdev_assert_locked(dev); > } > > static int nsim_change_mtu(struct net_device *dev, int new_mtu) Ah, you're saying in general.. Yeah, agreed, for the instance locked devices not grabbing an instance lock for these paths looks problematic. > > But you have a point, per netdevices.rst ndo_set_rx_mode is synchronized via > > netif_addr_lock and we are breaking that with this patch.. :-( > > (so I don't think we need an instance lock if we keep netif_addr_lock?) > > > > For this particular issue, maybe we can do something similar to net_todo_list? > > Instead of changing the promisc for !FLT under right here right now, move it > > to the rtnl_unlock? Not sure how important the ordering is.. > > Not sure. Another alternative is to implement the long standing idea of > having an async / sleeping version of ndo_set_rx_mode() orchestrated > by the core. Because a lot of drivers need to sleep, anyway, so they > just schedule a work from that callback. > > Then we can say old ndo_set_rx_mode is under netif_addr_lock. > ndo_set_rx_mode_async is under instance lock. That sounds like a better plan going forward, but gonna need a bunch of work to redo the addr lock it seems? We can start with moving promisc into rtnl_unlock to unblock that "bridge vlan_filtering 1" and I can look into adding an instance lock for set_rx_mode.. LMK if you prefer me to focus on the latter and don't waste time on the former.