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=1796096514; b=KiLPkKpqWpQO50qmFVCjv1rEPS7jJtBeMHWlCC6CN/2zHvWLvlGp8yIh5eyLMxciNQbJ +saYMtLEeNpOLPE53AS3fiDql1tMw+GSwk0xPb9bPZUjPO6n4KdJzrkp4OPt3CY3kyD40 H308SQvJjprvMfIWXxhIenf6yGn+YKGj1gH3Ndeqf7XhZPA+byIUAaArbZcTUxhi+IAco rIHz/tKF74Lf7DLuEtAIPdRve/jrn6mo/3wJbE+0vDwOQkI5LusltOFSmCMWx2zBNcO+Q 4NDEvislfYet5zR9vl2zATQRPc5zQ1x8u0LQeWE9Bc8A1yhoo/EdPKZSnoGzZTwGDxQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796096514; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=VehVvi/VfJ5AwYb0sHFWFLA0m0Gumb0JbSEORNmM/hY=; b=z98HdYMOXrOAWnueRI6yetut7U/3uyCMv9Ep6gN5Ok37Ttebo6wmu+fSS3gHGiaayNhp tfxmCKaxAoUtXxZF7Y4rVdGQQxoHQ+1smXdh6uEijQ6LHXf2TbKLfIFDBqQ7VdOL8eZ7j MIqbEQCSLccaxzClzEESJg17AUTOPHujK85xshG1Ah6RlpLqAuaRp3VIoymlJFbY45o1V xxS5QKwR7V+aAVa1CAvA4yISd5evRjNaZQgfN/wKY0s43ltN5jIvYwF4pyPLjKyiHCjNe 0T/CRh671jPyx0M45SpHcgtw+lVwVEztNwWJXqzi+yYRQe438xqfIldwF6a3/XHQSjg== 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=NmIWEz4j; 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 1F4FA606A327; Tue, 1 Dec 2026 03:41:54 +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=NmIWEz4j Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC22F1F00924; Tue, 1 Dec 2026 03:41:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796096514; bh=VehVvi/VfJ5AwYb0sHFWFLA0m0Gumb0JbSEORNmM/hY=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=NmIWEz4jPKAk8sd1Z5rcOzE1T7KRb0mIuABjN4VgkFrN4OZmGrtfvwDdbunjb0pyO +hF3J3ahJH/nRdY0ypRMMCdY+BWkLJkgo9wlzYvsoq+Y6dbuAeUd/seYe5CFurT9nK /gjzKf6g61LcUWtVsj5zcZxl5V3Sel5/lQTVoIKlpTl0cE1azLuWQaFBgeBzGCmHZ3 gOI/6ZNxS5DyWQeH6WxaECMt4BhpdvsKrkdSuE6/HCEBmdo/BYUtslqwPcRgIgCIjA KbIPD0mXABhhuHAvwAyn5HEY7qZrdZapj9B7zpLpgg+Utnw948rv+o1Wrjcirz/4NK DWXnGZ0TZQkcQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [RFC PATCH 10/10] net: Keep core-managed IRQ affinity automatic Reply-To: sashiko-reviews@lists.linux.dev To: "Kris Pan" Cc: linux-hyperv@vger.kernel.org, linux-pci@vger.kernel.org, linux-rt-devel@lists.linux.dev, linux-kernel@vger.kernel.org In-Reply-To: <20261130033709.2704805-11-kris.pan@intel.com> References: <20261130033709.2704805-1-kris.pan@intel.com> <20261130033709.2704805-11-kris.pan@intel.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Tue, 01 Dec 2026 03:41:53 +0000 X-Mailing-List: linux-hyperv@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [Medium] net: napi_restore_config() clobbers explicit user IRQ affinity provenance - [Medium] net: iavf_napi_poll() aborts polling on queues relocated by irq_set_affinity_auto() -- commit 0f2dab218632e320a8692e002bb91de0e36ea073 Author: Kris Pan net: Keep core-managed IRQ affinity automatic This commit switches napi_restore_config() to irq_set_affinity_auto() so core-managed NAPI IRQs retain automatic placement provenance across NAPI enable cycles, and updates CPU reverse maps in irq_cpu_rmap_notify() and netif_napi_irq_notify() from irq_copy_programmed_affinity() when runtime IRQ isolation is active. > diff --git a/net/core/dev.c b/net/core/dev.c > index 88abf8ced9c5f..93a772d09d8b4 100644 > --- a/net/core/dev.c > +++ b/net/core/dev.c [ ... ] > @@ -7637,6 +7638,9 @@ netif_napi_irq_notify(struct irq_affinity_notify *n= otify, > container_of(notify, struct napi_struct, notify); > #ifdef CONFIG_RFS_ACCEL > struct cpu_rmap *rmap =3D napi->dev->rx_cpu_rmap; > + const struct cpumask *prog; > + cpumask_var_t prog_mask; > + bool allocated; > int err; > #endif > =20 > @@ -7645,7 +7649,23 @@ netif_napi_irq_notify(struct irq_affinity_notify *= notify, > =20 > #ifdef CONFIG_RFS_ACCEL > if (napi->dev->rx_cpu_rmap_auto) { > - err =3D cpu_rmap_update(rmap, napi->napi_rmap_idx, mask); > + /* > + * The notifier reports the requested mask; the reverse map > + * has to describe the CPUs the chip is asked to use, which > + * runtime IRQ isolation may have filtered or relocated. > + */ > + prog =3D mask; > + allocated =3D false; > + /* See irq_cpu_rmap_notify(). */ > + if (irq_isolation_active()) { > + allocated =3D alloc_cpumask_var(&prog_mask, GFP_KERNEL); > + if (allocated && > + irq_copy_programmed_affinity(napi->irq, prog_mask)) > + prog =3D prog_mask; > + } > + err =3D cpu_rmap_update(rmap, napi->napi_rmap_idx, prog); > + if (allocated) > + free_cpumask_var(prog_mask); > if (err) > netdev_warn(napi->dev, "RMAP update failed (%d)\n", > err); [Severity: Medium] When runtime IRQ isolation relocates an automatic NAPI IRQ to a housekeeping CPU, does leaving napi->config->affinity_mask set to the unfiltered requested mask break iavf_napi_poll()? iavf opts into core-managed affinity via netif_set_affinity_auto() and checks napi->config->affinity_mask in its poll loop to stop polling when an IRQ moves to another CPU: drivers/net/ethernet/intel/iavf/iavf_txrx.c:iavf_napi_poll() { ... if (!clean_complete) { int cpu_id =3D smp_processor_id(); /* It is possible that the interrupt affinity has changed but, * if the cpu is pegged at 100%, polling will never exit while * traffic continues and the interrupt will be stuck on this * cpu. We check to make sure affinity is correct before we * continue to poll, otherwise we must stop polling so the * interrupt can move to the correct cpu. */ if (!cpumask_test_cpu(cpu_id, &q_vector->napi.config->affinity_mask)) { /* Tell napi that we are done polling */ napi_complete_done(napi, work_done); /* Force an interrupt */ iavf_force_wb(vsi, q_vector); /* Return budget-1 so that polling stops */ return budget - 1; } ... } Because netif_napi_irq_notify() copies the unfiltered mask into napi->config->affinity_mask and only uses irq_copy_programmed_affinity() for cpu_rmap_update(), a queue relocated by irq_set_affinity_auto() from an isolated CPU to a housekeeping CPU will never find smp_processor_id() in napi->config->affinity_mask. Under sustained load (!clean_complete), every poll cycle on the housekeeping CPU aborts after a single budget and triggers an immediate hardware interrupt via iavf_force_wb(). > @@ -7796,7 +7816,7 @@ static void napi_restore_config(struct napi_struct = *n) > =20 > if (n->dev->irq_affinity_auto && > test_bit(NAPI_STATE_HAS_NOTIFIER, &n->state)) > - irq_set_affinity(n->irq, &n->config->affinity_mask); > + irq_set_affinity_auto(n->irq, &n->config->affinity_mask); [Severity: Medium] Does calling irq_set_affinity_auto() unconditionally in napi_restore_config() overwrite explicit user IRQ pinning across NAPI enable cycles? When an administrator pins a queue IRQ via /proc/irq/N/smp_affinity, write_irq_affinity() calls irq_set_affinity(), which clears IRQS_AFFINITY_AUTO on desc->istate and notifies netif_napi_irq_notify(). netif_napi_irq_notify() saves the user mask into napi->config->affinity_mask, which is meant to preserve user-configured affinity across device resets, without recording that the mask came from an explicit user request rather than the initial automatic spread. On the next napi_enable_locked() (such as link down/up, MTU change, or ethtool channel change), napi_restore_config() calls irq_set_affinity_auto() with that user mask, which passes IRQ_AFFINITY_SET_AUTO to __irq_set_affinity() and re-sets IRQS_AFFINITY_AUTO. Runtime IRQ isolation then treats the explicitly pinned IRQ as automatically placed and relocates it to housekeeping CPUs. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261130033709.2704= 805-1-kris.pan@intel.com?part=3D10