From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796259854; b=rr1rtsuWRDpZC3rbyQjVSEK3/aE4POmdoT3gKVW0Napd9MRKtbt7CAW2ScRbPsVCx7bt +NxllvGUC3VdpoWuMat5HgQGuAdyRaGpafffjx9bZ1UkG/RzRYqLw2pzDFSUdXk4nOEFO 0SBp8QSt2NHkkYQ4qHk01pQwzPf9tvE/wKQc6SQaU+whYEx5JxV7DtKkQ67vLL1MFl12U 2gOdDOArus6yYP+/5ChHUO18q41u9AM9VC5hqrQPDSxgs8mK9Piyc1bdA9WqiNFl87fjt tym/2oU83IY0UQWfBkNLZ8StnjnX6/i7SUAt7i6oxpsI0V+6IRM766gTG4/TxT9iWJA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796259854; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=30+1M6rYJW4y5xhkVZrEXqppID9NGQm6ceEBKZdPb3E=; b=4q3u3ktlVoW5lQtxxdeDiKRJ5MO1A84gJ01AhpmJNoV6fuAZ+0a+71u1EvUr00XBocXH RSeTqB4GL/DXbAEaO0T/FGL8+nKiCelQ6tEKRnZ0bONOxvJD6TOgPGJdy28KwJAnTlUr/ jfUYfUTAWUAbugB4qG5NRimex5N5RGLpE2q4WlfDU0xOZXEb7c7UVk6pD0aMHKdaY2dtL c0DDnZfBtNO+sG6WoOh0z2uJEVLZFPJY2DiN3M54R/HKVSVEo9dHhCueMHKHlJM5yDCxY /vEBojAIISxh5OzI/6JMtJXoZ2tbITfE46EbsUI+VSaILFZfQcy+hi8bDYKnxol8OUg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="hv1hu/3I"; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5161B606A33E; Thu, 3 Dec 2026 01:04:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=hv1hu/3I Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C9721F00893; Thu, 3 Dec 2026 01:04:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796259853; bh=30+1M6rYJW4y5xhkVZrEXqppID9NGQm6ceEBKZdPb3E=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=hv1hu/3IQ/DJGwwMJgOFWNky97a6c7Zw0ta6biNVEIEyWnH5zWEu7EFZmCjuVaJ0e WdBQkhe9Hrvsaf3vCTK7xF5jIblJWBAjYdUJW9MHfKjwhHL+fd1Mpmkdwi4/vCVOX/ rqM5eaXBe2/4J/MLA4KhLMMLa1B0cJgug00i4wUpxuRH/9TmWZaUQuGdLkPC1wJSY+ /V2hHqFlaxrIyvVuqlrrzjRkbYrhWRTeGx+GgKARQaGxkHBZq4Kd+GKA/V+PCm2CFV v0HXy03MGqPdchmgCf0pWoS3iGrPFQ1jNSmeWYFWjSRcaa6DwgaPYxD3MrupnsjLNf 2824qbuetGjvA== Subject: Re: [PATCH net v7 3/7] igb: fix RTNL assertion when resuming from runtime suspend From: netdev-bot+sashiko@kernel.org To: antonio@mandelbit.com Cc: intel-wired-lan@lists.osuosl.org, anthony.l.nguyen@intel.com, przemyslaw.kitszel@intel.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, janislacis06@gmail.com, ast@kernel.org, daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com, sdf@fomichev.me, sriram.yagnaraman@ericsson.com, kurt@linutronix.de, maciej.fijalkowski@intel.com, hkallweit1@gmail.com, joe@dama.to, rafael@kernel.org, sven.auhagen@voleatech.de, netdev@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, stable@vger.kernel.org Date: Thu, 03 Dec 2026 01:04:11 +0000 Message-ID: <179625985176.3146.14979962176226526203@kernel.org> In-Reply-To: <20261202002317.3140591-4-antonio@mandelbit.com> References: <20261202002317.3140591-4-antonio@mandelbit.com> X-sashiko-severity: Medium Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: bpf@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider. Critical: 0 · High: 0 (2) · Medium: 1 · Low: 0 If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough). - [Medium] The patch does not fully fix the RTNL assertion it targets on runtime resume, but a later patch in the series closes the gap. Pre-existing issues: - [High] This problem wasn't introduced by this patch, but `igb_save_cbs_params()` and `igb_save_txtime_params()` have an off-by-… - [High] This problem wasn't introduced by this patch, but the MSI-X to MSI fallback in `igb_request_irq()` frees Rx/Tx descriptor rings and… -- igb: fix RTNL assertion when resuming from runtime suspend On runtime resume, __igb_open() no longer calls netif_set_real_num_queues() when RTNL isn't held. A new work item takes RTNL and sets the queue counts instead. Until that runs, igb_xmit_frame() drops packets whose queue_mapping is beyond the device's current TX queue count, rather than folding them onto a shared ring. Closes: https://bugzilla.ipfire.org/show_bug.cgi?id=13562 > diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c > index 2fb9615d3bab3..5774a4d3c9810 100644 > --- a/drivers/net/ethernet/intel/igb/igb_main.c > +++ b/drivers/net/ethernet/intel/igb/igb_main.c [ ... ] > @@ -4181,16 +4209,15 @@ static int __igb_open(struct net_device *netdev, bool resuming) > if (err) > goto err_req_irq; > [Severity: High] This isn't a bug introduced by this patch, but the commit message relies on the MSI-X to MSI fallback in igb_request_irq(). Is that fallback safe for the hardware queues that igb_configure() has already enabled? __igb_open() calls igb_configure() before igb_request_irq(). For each of the N queues: - igb_configure_rx_ring() enables RXDCTL and programs the ring base. - igb_alloc_rx_buffers() advances RDT. - igb_setup_rctl() sets E1000_RCTL_EN. - igb_setup_mrqc() spreads RSS over all N queues. If igb_request_msix() fails: drivers/net/ethernet/intel/igb/igb_main.c:igb_request_irq() { ... /* fall back to MSI */ igb_free_all_tx_resources(adapter); igb_free_all_rx_resources(adapter); igb_clear_interrupt_scheme(adapter); err = igb_init_interrupt_scheme(adapter, false); ... igb_configure(adapter); ... } The descriptor rings and Rx pages are freed without any RXDCTL/TXDCTL write. The second igb_configure() only reconfigures the new, smaller set of queues. igb_setup_rctl() only disables queue 0: /* disable queue 0 to prevent tail write w/o re-config */ wr32(E1000_RXDCTL(0), 0); Can queues 1..N-1 stay enabled, with base addresses and posted descriptors that point at freed memory? Packets could still be steered there in two ways: - RSS, until the second igb_setup_mrqc() rewrites RETA. - ntuple/etype filters with an action queue >= 1, permanently. igb_nfc_filter_restore() re-adds them without checking them against the new num_rx_queues. The only check is in igb_add_ethtool_nfc_entry(). Would the NIC then DMA packet data and descriptor write-backs into freed pages? > - /* Notify the stack of the actual queue counts. */ > - err = netif_set_real_num_tx_queues(adapter->netdev, > - adapter->num_tx_queues); > - if (err) > - goto err_set_queues; > - > - err = netif_set_real_num_rx_queues(adapter->netdev, > - adapter->num_rx_queues); > - if (err) > - goto err_set_queues; > + /* Notify the stack of the actual queue counts. This needs RTNL: on > + * runtime resume igb_rtnl_resume_task() does it. > + */ > + if (rtnl_held) { > + err = netif_set_real_num_queues(netdev, adapter->num_tx_queues, > + adapter->num_rx_queues); > + if (err) > + goto err_set_queues; > + } > > /* From here on the code is the same as igb_up() */ > clear_bit(__IGB_DOWN, &adapter->state); [Severity: Medium] Does this fully cover the RTNL assertion on runtime resume? A few lines further down in __igb_open(), the NAPI loop isn't guarded by rtnl_held: for (i = 0; i < adapter->num_q_vectors; i++) { napi = &adapter->q_vector[i]->napi; napi_enable(napi); igb_set_queue_napi(adapter, i, napi); } igb_set_queue_napi() calls netif_queue_set_napi(), which runs netdev_assert_locked_ops_compat_or_invisible(). igb is a registered netdev without the ops lock, so this becomes ASSERT_RTNL(). The runtime resume path is: igb_runtime_resume() __igb_resume(dev, true) __igb_open(netdev, true, false) igb_set_queue_napi() netif_queue_set_napi() Wouldn't this still print "RTNL: assertion failed" and write rxq->napi/txq->napi without RTNL? igb_rtnl_resume_task() only restores the queue counts, not the links between queues and NAPIs. The later patch in this series, "igb: link queues to NAPIs under RTNL after runtime resume", appears to fix this. It guards igb_set_queue_napi() with rtnl_held and calls igb_link_queue_napis() from igb_rtnl_resume_task(). So the gap only exists between these two commits. Since this patch carries the Fixes: and stable tags, should the two be combined? [ ... ] > @@ -6638,6 +6660,17 @@ static netdev_tx_t igb_xmit_frame(struct sk_buff *skb, > if (skb_put_padto(skb, 17)) > return NETDEV_TX_OK; > > + /* After a fallback to fewer queues on runtime resume, the stack can > + * use more queues than the device has until igb_rtnl_resume_task() > + * updates it: drop those packets instead of sharing a ring between > + * queues, which aren't serialized with each other. > + */ > + if (unlikely(skb->queue_mapping >= adapter->num_tx_queues)) { > + dev_kfree_skb_any(skb); > + dev_core_stats_tx_dropped_inc(netdev); > + return NETDEV_TX_OK; > + } [Severity: High] This isn't a bug introduced by this patch, but this check uses >=, while igb_save_cbs_params() and igb_save_txtime_params() use >: drivers/net/ethernet/intel/igb/igb_main.c:igb_save_cbs_params() { ... if (queue < 0 || queue > adapter->num_tx_queues) return -EINVAL; ring = adapter->tx_ring[queue]; ring->cbs_enable = enable; ... } igb_save_txtime_params() has the same check before: ring->launchtime_enable = enable; On i210, igb_offload_cbs() and igb_offload_txtime() accept queue 0 or 1, whatever num_tx_queues is: if (qopt->queue < 0 || qopt->queue > 1) return -EINVAL; num_tx_queues can be 1 in these cases: - a single online CPU - after ethtool -L combined 1 - after the MSI-X to MSI fallback discussed in this commit In that case, can queue 1 pass both checks and dereference a NULL tx_ring[1]? That entry is either never assigned or set to NULL by igb_reset_q_vector(). The netdev has 8 allocated TX queues, and mq_queue_get() only rejects ntx >= dev->num_tx_queues. So these commands reach igb_setup_tc() with queue 1: tc qdisc add dev X root handle 1: mq tc qdisc replace dev X parent 1:2 cbs ... offload 1 An etf qdisc with offload takes the same path. Should both helpers check queue >= adapter->num_tx_queues instead? -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261202002317.3140591-1-antonio%40mandelbit.com