Netdev List
 help / color / mirror / Atom feed
From: Kris Pan <kris.pan@intel.com>
To: tglx@kernel.org, maz@kernel.org
Cc: mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com,
	hpa@zytor.com, x86@kernel.org, peterz@infradead.org,
	frederic@kernel.org, juri.lelli@redhat.com,
	vincent.guittot@linaro.org, longman@redhat.com, tj@kernel.org,
	corbet@lwn.net, linux-doc@vger.kernel.org, davem@davemloft.net,
	edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
	netdev@vger.kernel.org, joro@8bytes.org, will@kernel.org,
	robin.murphy@arm.com, dwmw2@infradead.org,
	baolu.lu@linux.intel.com, vasant.hegde@amd.com,
	suravee.suthikulpanit@amd.com, iommu@lists.linux.dev,
	haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com,
	linux-hyperv@vger.kernel.org, bhelgaas@google.com,
	lpieralisi@kernel.org, linux-pci@vger.kernel.org,
	steve.wahl@hpe.com, bigeasy@linutronix.de, clrkwllms@kernel.org,
	linux-rt-devel@lists.linux.dev, radu@rendec.net,
	linux-kernel@vger.kernel.org, Kris Pan <kris.pan@intel.com>
Subject: [RFC PATCH 01/10] genirq: Add IRQCHIP_AFFINITY_FILTERABLE flag
Date: Mon, 30 Nov 2026 11:36:59 +0800	[thread overview]
Message-ID: <20261130033709.2704805-2-kris.pan@intel.com> (raw)
In-Reply-To: <20261130033709.2704805-1-kris.pan@intel.com>

Runtime IRQ isolation needs to program a mask which differs from
irq_common_data.affinity for unmanaged interrupts: it is either the
request with runtime-isolated CPUs subtracted, or a relocation to
housekeeping CPUs when an automatic placement loses every online
target.  Legacy irqchips which derive mask/unmask or routing state
directly from the requested affinity cannot tolerate that divergence.

Define IRQCHIP_AFFINITY_FILTERABLE for delivery irqchips which can
safely accept a filtered or relocated mask, and
IRQCHIP_AFFINITY_PASSTHROUGH for the forwarding levels above them
which only hand the mask to their parent.  The core requires every
level which implements .irq_set_affinity to be one of the two, so an
unmarked domain keeps filtering off instead of inheriting it from a
parent.  Expose both flags in debugfs.  No irqchip opts in yet.

Signed-off-by: Kris Pan <kris.pan@intel.com>
---
 include/linux/irq.h  | 23 +++++++++++++++++++++++
 kernel/irq/debugfs.c |  2 ++
 2 files changed, 25 insertions(+)

diff --git a/include/linux/irq.h b/include/linux/irq.h
index f485369b1b4f7..d47ebe8ec3708 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -569,6 +569,27 @@ struct irq_chip {
  * IRQCHIP_AFFINITY_PRE_STARTUP:      Default affinity update before startup
  * IRQCHIP_IMMUTABLE:		      Don't ever change anything in this chip
  * IRQCHIP_MOVE_DEFERRED:	      Move the interrupt in actual interrupt context
+ * IRQCHIP_AFFINITY_FILTERABLE:       Delivery chip accepts a filtered or
+ *                                    relocated affinity mask instead of the
+ *                                    requested one.  Set it on the level
+ *                                    which programs the delivery target; the
+ *                                    core walks the parent chain and requires
+ *                                    every level which implements
+ *                                    .irq_set_affinity to be FILTERABLE or
+ *                                    PASSTHROUGH.  A chip which derives
+ *                                    routing from irq_common_data.affinity
+ *                                    must not opt in.  The opt-in also covers
+ *                                    the initial placement: the activation
+ *                                    path must respect the runtime isolation
+ *                                    filter before the first affinity request
+ *                                    runs.
+ * IRQCHIP_AFFINITY_PASSTHROUGH:      Forwarding level above a filterable
+ *                                    delivery chip.  The chip only hands the
+ *                                    mask to its parent and derives no state
+ *                                    from it, so it accepts a filtered mask.
+ *                                    An unmarked level which implements
+ *                                    .irq_set_affinity disables filtering for
+ *                                    the whole chain.
  */
 enum {
 	IRQCHIP_SET_TYPE_MASKED			= (1 <<  0),
@@ -584,6 +605,8 @@ enum {
 	IRQCHIP_AFFINITY_PRE_STARTUP		= (1 << 10),
 	IRQCHIP_IMMUTABLE			= (1 << 11),
 	IRQCHIP_MOVE_DEFERRED			= (1 << 12),
+	IRQCHIP_AFFINITY_FILTERABLE		= (1 << 13),
+	IRQCHIP_AFFINITY_PASSTHROUGH		= (1 << 14),
 };
 
 #include <linux/irqdesc.h>
diff --git a/kernel/irq/debugfs.c b/kernel/irq/debugfs.c
index 5c5ebaee35f2c..3bdc5a388ea5f 100644
--- a/kernel/irq/debugfs.c
+++ b/kernel/irq/debugfs.c
@@ -54,6 +54,8 @@ static const struct irq_bit_descr irqchip_flags[] = {
 	BIT_MASK_DESCR(IRQCHIP_ENABLE_WAKEUP_ON_SUSPEND),
 	BIT_MASK_DESCR(IRQCHIP_IMMUTABLE),
 	BIT_MASK_DESCR(IRQCHIP_MOVE_DEFERRED),
+	BIT_MASK_DESCR(IRQCHIP_AFFINITY_FILTERABLE),
+	BIT_MASK_DESCR(IRQCHIP_AFFINITY_PASSTHROUGH),
 };
 
 static void
-- 
2.43.0


  reply	other threads:[~2026-11-30  3:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30  3:36 [RFC PATCH 00/10] genirq/cpuset: Evict unmanaged IRQs from runtime-isolated CPUs Kris Pan
2026-11-30  3:36 ` Kris Pan [this message]
2026-11-30  3:37 ` [RFC PATCH 02/10] sched/isolation: Add runtime isolation helpers Kris Pan
2026-11-30  3:37 ` [RFC PATCH 03/10] genirq: Track automatic vs. explicit affinity provenance Kris Pan
2026-11-30  3:37 ` [RFC PATCH 04/10] genirq: Filter unmanaged IRQ affinity against runtime isolation Kris Pan
2026-11-30  3:37 ` [RFC PATCH 05/10] genirq: Reapply unmanaged IRQ affinity on isolation changes Kris Pan
2026-11-30  3:37 ` [RFC PATCH 06/10] genirq: Align affinity notifiers and IRQ threads with isolation Kris Pan
2026-11-30  3:37 ` [RFC PATCH 07/10] genirq: Handle runtime isolation across hotplug and suspend Kris Pan
2026-11-30  3:37 ` [RFC PATCH 08/10] x86/apic: Support runtime IRQ isolation Kris Pan
2026-11-30  3:37 ` [RFC PATCH 09/10] sched/isolation: Publish runtime isolation to genirq Kris Pan
2026-11-30  3:37 ` [RFC PATCH 10/10] net: Keep core-managed IRQ affinity automatic Kris Pan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261130033709.2704805-2-kris.pan@intel.com \
    --to=kris.pan@intel.com \
    --cc=baolu.lu@linux.intel.com \
    --cc=bhelgaas@google.com \
    --cc=bigeasy@linutronix.de \
    --cc=bp@alien8.de \
    --cc=clrkwllms@kernel.org \
    --cc=corbet@lwn.net \
    --cc=dave.hansen@linux.intel.com \
    --cc=davem@davemloft.net \
    --cc=decui@microsoft.com \
    --cc=dwmw2@infradead.org \
    --cc=edumazet@kernel.org \
    --cc=frederic@kernel.org \
    --cc=haiyangz@microsoft.com \
    --cc=hpa@zytor.com \
    --cc=iommu@lists.linux.dev \
    --cc=joro@8bytes.org \
    --cc=juri.lelli@redhat.com \
    --cc=kuba@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-rt-devel@lists.linux.dev \
    --cc=longman@redhat.com \
    --cc=lpieralisi@kernel.org \
    --cc=maz@kernel.org \
    --cc=mingo@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=peterz@infradead.org \
    --cc=radu@rendec.net \
    --cc=robin.murphy@arm.com \
    --cc=steve.wahl@hpe.com \
    --cc=suravee.suthikulpanit@amd.com \
    --cc=tglx@kernel.org \
    --cc=tj@kernel.org \
    --cc=vasant.hegde@amd.com \
    --cc=vincent.guittot@linaro.org \
    --cc=wei.liu@kernel.org \
    --cc=will@kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox