Skip to contentSkip to conversation

irqdomain debufs fixes for 4.20

PATCH New Marc Zyngier 2 participants 5 messages Oct 1, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover irqdomain debufs fixes for 4.20

Here's a couple of fixes for the irqdomain debugfs feature that I wrote while working on some unrelated irqchip over the weekend.

If nobody screams, I'll queue them for 4.20.

Thanks,

	M.

Marc Zyngier (2):
genirq/debugfs: Reset domain debugfs_file on removal of the debugfs
file
genirq/debugfs: Reinstate full OF path for domain name

 kernel/irq/irqdomain.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Signature · 1 line
2.19.0
#1 lore raw

PATCH 1/2 genirq/debugfs: Reset domain debugfs_file on removal of the debugfs file

When removing a debugfs file for a given irq domain, we fail to clear the corresponding field, meaning that the corresponding domain won't be created again if we need to do so.

It turns out that this is exactly what irq_domain_update_bus_token does (delete old file, update domain name, recreate file).

This doesn't have any impact other than making debug more difficult, but we do value ease of debugging... So let's clear the debugfs_file field.

---
 kernel/irq/irqdomain.c | 1 +
 1 file changed, 1 insertion(+)
kernel/irq/irqdomain.c +1 -0
index 5d9fc01b60a6..95a0acbdd4e6 100644
@@ -1741,6 +1741,7 @@ static void debugfs_add_domain_dir(struct irq_domain *d)
 static void debugfs_remove_domain_dir(struct irq_domain *d)
 {
 	debugfs_remove(d->debugfs_file);
+	d->debugfs_file = NULL;
 }
 
 void __init irq_domain_debugfs_init(struct dentry *root)
Signature · 1 line
2.19.0
#2 lore raw

[tip:irq/core] genirq/debugfs: Reset domain debugfs_file on removal of the debugfs file

genirq/debugfs: Reset domain debugfs_file on removal of the debugfs file
Commit-ID:  513145ea66af95f1a5c744d7b5a4f4a97625e669
Gitweb:     https://git.kernel.org/tip/513145ea66af95f1a5c744d7b5a4f4a97625e669
Author:     Marc Zyngier <[email protected]>
AuthorDate: Mon, 1 Oct 2018 11:05:21 +0100
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Mon, 1 Oct 2018 12:24:53 +0200

genirq/debugfs: Reset domain debugfs_file on removal of the debugfs file

When removing a debugfs file for a given irq domain, we fail to clear the corresponding field, meaning that the corresponding domain won't be created again if we need to do so.

It turns out that this is exactly what irq_domain_update_bus_token does (delete old file, update domain name, recreate file).

This doesn't have any impact other than making debug more difficult, but we do value ease of debugging... So clear the debugfs_file field.

---
 kernel/irq/irqdomain.c | 1 +
 1 file changed, 1 insertion(+)
kernel/irq/irqdomain.c +1 -0
index 5d9fc01b60a6..95a0acbdd4e6 100644
@@ -1741,6 +1741,7 @@ static void debugfs_add_domain_dir(struct irq_domain *d)
 static void debugfs_remove_domain_dir(struct irq_domain *d)
 {
 	debugfs_remove(d->debugfs_file);
+	d->debugfs_file = NULL;
 }
 
 void __init irq_domain_debugfs_init(struct dentry *root)
#3 lore raw

PATCH 2/2 genirq/debugfs: Reinstate full OF path for domain name

In reply to Marc Zyngier

On a DT based system, we use the of_node full name to name the corresponding irq domain. We expect that name to be unique, so so that domains with the same base name won't clash (this happens on multi-node topologies, for example).

Since a7e4cfb0a7ca ("of/fdt: only store the device node basename in full_name"), of_node_full_name() lies and only returns the basename. This breaks the above requirement, and we end-up with only a subset of the domains in /sys/kernel/debug/irq/domains.

Let's reinstate the feature by using the fancy new %pOF format specifier, which happens to do the right thing.

Fixes a7e4cfb0a7ca ("of/fdt: only store the device node basename in full_name")
---
 kernel/irq/irqdomain.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/irq/irqdomain.c +1 -1
index 95a0acbdd4e6..3b30a4aeb0db 100644
@@ -183,7 +183,7 @@ struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, int size,
 		 * unhappy about. Replace them with ':', which does
 		 * the trick and is not as offensive as '\'...
 		 */
-		name = kstrdup(of_node_full_name(of_node), GFP_KERNEL);
+		name = kasprintf(GFP_KERNEL, "%pOF", of_node);
 		if (!name) {
 			kfree(domain);
 			return NULL;
Signature · 1 line
2.19.0
#4 lore raw

[tip:irq/core] genirq/debugfs: Reinstate full OF path for domain name

genirq/debugfs: Reinstate full OF path for domain name
Commit-ID:  94967b55ebf3b603f2fe750ecedd896042585a1c
Gitweb:     https://git.kernel.org/tip/94967b55ebf3b603f2fe750ecedd896042585a1c
Author:     Marc Zyngier <[email protected]>
AuthorDate: Mon, 1 Oct 2018 11:05:22 +0100
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Mon, 1 Oct 2018 12:24:53 +0200

genirq/debugfs: Reinstate full OF path for domain name

On a DT based system, we use the of_node full name to name the corresponding irq domain. We expect that name to be unique, so so that domains with the same base name won't clash (this happens on multi-node topologies, for example).

Since a7e4cfb0a7ca ("of/fdt: only store the device node basename in full_name"), of_node_full_name() lies and only returns the basename. This breaks the above requirement, and we end-up with only a subset of the domains in /sys/kernel/debug/irq/domains.

Let's reinstate the feature by using the fancy new %pOF format specifier, which happens to do the right thing.

Fixes a7e4cfb0a7ca ("of/fdt: only store the device node basename in full_name")
---
 kernel/irq/irqdomain.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/irq/irqdomain.c +1 -1
index 95a0acbdd4e6..3b30a4aeb0db 100644
@@ -183,7 +183,7 @@ struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, int size,
 		 * unhappy about. Replace them with ':', which does
 		 * the trick and is not as offensive as '\'...
 		 */
-		name = kstrdup(of_node_full_name(of_node), GFP_KERNEL);
+		name = kasprintf(GFP_KERNEL, "%pOF", of_node);
 		if (!name) {
 			kfree(domain);
 			return NULL;