lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87pl8bbgik.ffs@tglx>
Date: Thu, 18 Dec 2025 22:56:51 +0100
From: Thomas Gleixner <tglx@...utronix.de>
To: Luigi Rizzo <lrizzo@...gle.com>, Marc Zyngier <maz@...nel.org>, Luigi
 Rizzo <rizzo.unipi@...il.com>, Paolo Abeni <pabeni@...hat.com>, Andrew
 Morton <akpm@...ux-foundation.org>, Sean Christopherson
 <seanjc@...gle.com>
Cc: linux-kernel@...r.kernel.org, linux-arch@...r.kernel.org, Bjorn Helgaas
 <bhelgaas@...gle.com>, Willem de Bruijn <willemb@...gle.com>, Greg
 Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: Re: [PATCH-v3 3/3] genirq: Configurable default mode for GSIM

On Wed, Dec 17 2025 at 11:21, Luigi Rizzo wrote:
> GSIM (Global Software Interrupt Moderation) can be enabled only after the
> interrupt is created by writing to /proc/irq/NN/soft_moderation. This is
> impractical when devices that are dynamically created or reconfigured.
>
> Add a module parameter irq_moderation.enable_list to specify whether
> moderation should be enabled at interrupt creation time. This is done
> with a comma-separated list of patterns (enable_list) matched against
> interrupt or handler names when the interrupt is created.
>
> This allows very flexible control without having to modify every single
> driver. As an example, one can limit to specific drivers by specifying
> the handler functions (using parentheses) as below
>
>      irq_moderation.enable_list="nvme_irq(),vfio_msihandler()"
>
> ora apply it to certain interrupt names
>
>      irq_moderation.enable_list="eth*,vfio*"

TBH, that's an admittely creative but horrible hack.

That's what uevents are for. Something like the below provides the
information you need to keep track of interrupt requests:

KERNEL[57.529152] change   /kernel/irq/256 (irq)

With that it is very practical to do all this magic in user space, no?

Thanks,

        tglx
---
 kernel/irq/internals.h |    6 ++++++
 kernel/irq/irqdesc.c   |   25 ++++++++++++++++++++-----
 kernel/irq/manage.c    |    1 +
 3 files changed, 27 insertions(+), 5 deletions(-)

--- a/kernel/irq/internals.h
+++ b/kernel/irq/internals.h
@@ -521,3 +521,9 @@ static inline void irq_debugfs_copy_devn
 {
 }
 #endif /* CONFIG_GENERIC_IRQ_DEBUGFS */
+
+#if defined(CONFIG_SPARSE_IRQ) && defined(CONFIG_SYSFS)
+void irqdesc_action_uevent(struct irq_desc *desc);
+#else
+static inline void irqdesc_action_uevent(struct irq_desc *desc) { }
+#endif
--- a/kernel/irq/irqdesc.c
+++ b/kernel/irq/irqdesc.c
@@ -241,7 +241,7 @@ static int init_desc(struct irq_desc *de
 static void irq_kobj_release(struct kobject *kobj);
 
 #ifdef CONFIG_SYSFS
-static struct kobject *irq_kobj_base;
+static struct kset *irq_kobj_base;
 
 #define IRQ_ATTR_RO(_name) \
 static struct kobj_attribute _name##_attr = __ATTR_RO(_name)
@@ -363,10 +363,12 @@ static void irq_sysfs_add(int irq, struc
 		 * crucial and failures in the late irq_sysfs_init()
 		 * cannot be rolled back.
 		 */
-		if (kobject_add(&desc->kobj, irq_kobj_base, "%d", irq))
+		if (kobject_add(&desc->kobj, &irq_kobj_base->kobj, "%d", irq)) {
 			pr_warn("Failed to add kobject for irq %d\n", irq);
-		else
+		} else {
 			desc->istate |= IRQS_SYSFS;
+			desc->kobj.kset = irq_kobj_base;
+		}
 	}
 }
 
@@ -382,6 +384,16 @@ static void irq_sysfs_del(struct irq_des
 		kobject_del(&desc->kobj);
 }
 
+void irqdesc_action_uevent(struct irq_desc *desc)
+{
+	if (!(desc->istate & IRQS_SYSFS))
+		return;
+
+	guard(mutex)(&sparse_irq_lock);
+	if (irq_kobj_base)
+		kobject_uevent(&desc->kobj, KOBJ_CHANGE);
+}
+
 static int __init irq_sysfs_init(void)
 {
 	struct irq_desc *desc;
@@ -389,13 +401,16 @@ static int __init irq_sysfs_init(void)
 
 	/* Prevent concurrent irq alloc/free */
 	guard(mutex)(&sparse_irq_lock);
-	irq_kobj_base = kobject_create_and_add("irq", kernel_kobj);
+	irq_kobj_base = kset_create_and_add("irq", NULL, kernel_kobj);
 	if (!irq_kobj_base)
 		return -ENOMEM;
 
 	/* Add the already allocated interrupts */
-	for_each_irq_desc(irq, desc)
+	for_each_irq_desc(irq, desc) {
 		irq_sysfs_add(irq, desc);
+		if (data_race(desc->action))
+			kobject_uevent(&desc->kobj, KOBJ_CHANGE);
+	}
 	return 0;
 }
 postcore_initcall(irq_sysfs_init);
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -1762,6 +1762,7 @@ static int
 	register_irq_proc(irq, desc);
 	new->dir = NULL;
 	register_handler_proc(irq, new);
+	irqdesc_action_uevent(desc);
 	return 0;
 
 mismatch:

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ