Article View: linux.kernel.netdev
Article #8478Re: [PATCH wireless v2] wifi: wext: Limit notifier event flushes to the device's netns
From: Johannes Berg
Date: Thu, 29 Oct 2026 07:01
Date: Thu, 29 Oct 2026 07:01
56 lines
11115 bytes
11115 bytes
On Tue, 2026-10-27 at 16:27 -0700, Jakub Kicinski wrote: > On Fri, 23 Oct 2026 11:10:44 +0300 Cosmin Ratiu wrote: > > With mlx5 netdev instance locking enabled, registering an IPoIB netdev > > calls the WEXT notifier while holding the instance mutex. Its call to > > wireless_nlevent_flush() takes net_rwsem to walk every namespace, > > completing the following lockdep dependency cycle: > > > > netdev instance mutex -> net_rwsem (read) -> GID table mutex > > -> event_handler_rwsem (read) -> netdev instance mutex > > > > RoCE GID enumeration takes the GID table mutex under net_rwsem. GID > > updates dispatch events under the table mutex, taking event_handler_rwsem. > > The IPoIB event handler takes the netdev instance mutex in > > ipoib_queue_work() to traverse child interfaces. > > > > The all-namespace walk originated in the single global worker servicing > > per-namespace WEXT queues. The ordering fixes later reused that routine > > in netdevice notifiers to prevent delayed WEXT RTM_NEWLINK messages from > > following RTM_DELLINK or reporting stale interface flags. A notifier only > > needs to drain the affected device's namespace; there is no reason for it > > to walk and flush all namespaces. > > > > Pass dev_net(dev) from both notifier callers and make the flush helper > > operate on that namespace. Keep the all-namespace walk and net_rwsem in > > the existing worker. This removes the instance-mutex -> net_rwsem > > dependency while retaining synchronous flushing from the notifiers. > > > > It may seem strange that the fix for a lock cycle across multiple > > subsystems lies in a completely unrelated part of the code, but this > > seemed the most justified lock cycle edge to break. > > If Johannes thinks this scoping is good for other reasons - SGTM. It seems reasonable, in truth roughly nobody [1] ever really runs WiFi in network namespaces. [1] except security LLM-babysitters trying to prove certain bugs are bad > But my knee jerk fix would be to skip all the wifi processing > for ops-locked devices since no wifi device is ops locked. In wext_netdev_notifier_call()? I suppose these days we could also just skip that for non-wifi devices, somehow. But it's much easier for me now to just take this patch (in fact I already did), rather than try to break it in other ways and have Cosmin go back to test it. Maybe we'll just do both, the latter as an optimisation, we can likely do better than "ops-locked" as a discriminant too. johannes
Technical Details
Message-ID:
<0198c9f52e6a4e3ee63ed6b9ee5c86673ef2e6f4.camel@sipsolutions.net>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-353183-linux-kernel-netdev=dewy.ruReferences:
<20261023081044.728500-1-cratiu@nvidia.com> <20261027162710.34e0e17c@kernel.org>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-353183-linux-kernel-netdev=dewy.ru From: johannes@sipsolutions.net (Johannes Berg) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH wireless v2] wifi: wext: Limit notifier event flushes to the device's netns Date: Thu, 29 Oct 2026 08:01:40 +0100 Organization: Usenet Network Message-ID: <0198c9f52e6a4e3ee63ed6b9ee5c86673ef2e6f4.camel@sipsolutions.net> References: <20261023081044.728500-1-cratiu@nvidia.com> <20261027162710.34e0e17c@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: usenet.network; logging-data="1953939"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:4K15uLDv+LpzV4i0iCnNqlzJhVI= sha256:Mf91EUvoGy8HprYFVhurecRp1BBLvrzRkGlVIX0tryY= sha1:YHmXvVhMdgprg5ksIckjG3mW++U= sha256:0pVZqM2Gl1CeReLJwYxuYK6EuFCoXf9JigxNG4PfY3A= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 790B2125C59; Thu, 29 Oct 2026 10:02:23 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.05 X-Spam-Status: No, score=-3.05 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=sipsolutions.net X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id uACD2UKBWROp; Thu, 29 Oct 2026 10:02:16 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-353183-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=permerror header.from=sipsolutions.net X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4]) by mail.dewy.ru (Postfix) with ESMTPS id 30273125C58; Thu, 29 Oct 2026 10:02:02 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sin.lore.kernel.org (Postfix) with ESMTP id CC86223F20; Thu, 29 Oct 2026 07:01:56 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1793257314; b=IpGOK2DK1qa2mWyxXvgL1J3rra2/kQI2l6oSGUWbxXlBaEtQg+D4KZwNW1gkk5b/eNKq 8PewcYz88WPUNFaDQf95n3VjjAy2SoBOJaLWKJehqobBGlJp40Bk/F9In3F1gKoelZZYQ VrDPajQgRt2brWhgRwNQyvu2y4RjaJV7YLb4ydc6h0wDSfXjLEmMXqfoe1FJ5OK1opCZM sWFb1DscBjOJH40Tugt68J97xTBpwNLmFIuwz3mo6JlmnMVfiBSzL5T+xCL24Ek/WKpNn hPBFlPJuYirf2b/68Kti63i1pPMdou57xi10dUPYaRGIRr8pc27uzKbg0A9GyzPbKrg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793257314; h=X-Original-To:Received:DKIM-Signature:Received:Message-ID:Subject: From:To:Cc:Date:In-Reply-To:References:Content-Type: Content-Transfer-Encoding:User-Agent:X-Mailing-List:List-Id:List-Post: List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence: MIME-Version:X-malware-bazaar; bh=nNh3+dC51ICKXx1gM8EqsdzIHJ7uG3P40rm777hpDF8=; b=s12eFuUME82zOwtmPdQU3+WdKQgn1o6oOsMVuBoqgwKG+eyjzj9m31GL/dCUVGQx+cHA cF+JhZA5FdCpeTKbusJVm8F7LUcsWYv92GvkClCrc2HxHTd2McbZq+ReZCDZzDpebbnpn MO5qEKH9eSfZ8Tu26lh+N/vLIkbBE+MuXJUvfdsZlMZYKm4sW1jZevnReaiAvoujPpvyv SmtPSVfLRVrD2nelPBvEZc+dUHEmBQ6LY5XKahNbsjewSGu6tssRUH6a4Zm7QlblrUJhr bc8kj4Fu8f2kFumn590BmojwVqeqYj562xfiBxjxs/E+U8Bjurcx60kXF0TkANEqr5w== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=sipsolutions.net header.i=@sipsolutions.net header.a=rsa-sha256 header.s=mail header.b=Fzs433BR; dmarc=permerror header.from=sipsolutions.net; spf=pass smtp.mailfrom=sipsolutions.net; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C80C4606A322; Thu, 29 Oct 2026 07:01:53 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=sipsolutions.net header.i=@sipsolutions.net header.a=rsa-sha256 header.s=mail header.b=Fzs433BR X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=168.119.38.16 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793257312; b=cspoVEYo7hJf9dU66m/wBJiR9N/1gF24PYYz6z8Vx8Ewa6W0pl9D8/Czkd4bDAqohTSD 6Mer+w6TRJC5yZOUP2pPMEqat+c6lwM2edCRVxfH6G6nT01SXjkcj+5Tnupn8JZe9YNOm EuMVkFs22vz1BWx+3XapWSBOA3p7hyJMv37bNSMMa0Cej513aXKCJR0ba8fCaypmnDH16 AZl/j8pY96Q02NeXRAR1Ib8P6/gzUXdw57Irq/mR4epUpIfpZi2652t4zb4ah6SoI3Svl c3Iu7H3bZzUFNQM2shalp9wcJlis8T6SiFWYZjYx6WVlDeTHY8i3oDPhLLTGJTYIMmg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793257312; h=DKIM-Signature:Received:Message-ID:Subject:From:To:Cc:Date: In-Reply-To:References:Content-Type:Content-Transfer-Encoding: User-Agent:MIME-Version:X-malware-bazaar; bh=nNh3+dC51ICKXx1gM8EqsdzIHJ7uG3P40rm777hpDF8=; b=p5rDlM4u7mNK7vblbdO/FfM+BpVeZp+z1rPm7CYzNag0C9BfQ+4TqSknbDWoRy6NfhgF m0zhNn6u4xRx9Qe98iJVgcbHfoxO4L4/f2BK8ojn4IFu6h5MhradvxZbArVQlxcImJaHh SYICdKc6TvwH3sLaggQsDduxnNk+WSynNeAm6FsVMoJ7RnfOD0UFlUAhe3/YXHLMTTpqf u2lk3fYDMTwG5oZ97iMieD0DI8Wc1J/HkgRlhCCZaCbUnUBHQymSxerYV4cbU0osSyXU8 pu5gkF0DfeD/vLkKAu8uO0eFSsavSr65fjWOHmcpcGv7H+Phe8hCnJP2sS+xu7LjaJg== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=permerror header.from=sipsolutions.net; spf=pass smtp.mailfrom=sipsolutions.net; dkim=pass header.d=sipsolutions.net header.i=@sipsolutions.net header.a=rsa-sha256 header.s=mail header.b=Fzs433BR; arc=none smtp.remote-ip=168.119.38.16 X-Received: from sipsolutions.net (s3.sipsolutions.net [168.119.38.16]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3D7B4606A31C; Thu, 29 Oct 2026 07:01:50 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dmarc=permerror header.from=sipsolutions.net X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sipsolutions.net X-DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=MIME-Version:Content-Transfer-Encoding: Content-Type:References:In-Reply-To:Date:Cc:To:From:Subject:Message-ID:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To: Resent-Cc:Resent-Message-ID; bh=nNh3+dC51ICKXx1gM8EqsdzIHJ7uG3P40rm777hpDF8=; t=1793257310; x=1794466910; b=Fzs433BR/NyYwt90J3zxwCsXO7P1DBK4Xmy3maspPZKLOwc 762UbDspsHeX71TeG3Azj30cM9shbnEoQj685UjH2bby4mMwrYA3cfmPEjSZpmflzkwSjmB3bJJ3i jWZ0CbpWHtrx0HyJx8sDhn2PO8cZGnE41KUpzYA5IWdK6x7u3ij+6CtWHUoD1vqfReq4DvlN9ouyF xfR9+V9Y6QKkPIjfjqzfmdb6BclVuXc4HZl4KMf9lZuuR3TQBRFX5HPkjUmCWXkA6iE5nqpMqMboN tmL4m14ZKyswNuTW0Xv6/gn6rj1gd7IqM18Kt4/HAlv4ZQ/fzffp6NFlivZkf5Lg==; X-Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__ECDSA_SECP256R1_SHA256__AES_256_GCM:256) (Exim 4.98.2) (envelope-from <johannes@sipsolutions.net>) id 1xMK8s-0000000GTTs-2BMV; Thu, 29 Oct 2026 08:01:42 +0100 X-Cc: linux-wireless@vger.kernel.org, Tariq Toukan <tariqt@nvidia.com>, Carolina Jubran <cjubran@nvidia.com>, Dragos Tatulea <dtatulea@nvidia.com>, netdev@vger.kernel.org X-In-Reply-To: <20261027162710.34e0e17c@kernel.org> X-User-Agent: Evolution 3.60.2 (3.60.2-3.fc44) X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-malware-bazaar: not-scanned