Skip to contentSkip to conversation

x86/resctrl: Remove lockdep annotation that triggers false positive

PATCH In review James Morse 3 participants 4 messages Feb 21, 2024 – Feb 22, 2024

Subsystems (2)
lore
Share & tools
lore

James Morse

author reviewer
#0 lore raw

PATCH 1/1 x86/resctrl: Remove lockdep annotation that triggers false positive

get_domain_from_cpu() walks a list of domains to find the one that contains the specified CPU. This needs to be protected against races with CPU hotplug when the list is modified. It has recently gained a lockdep annotation to check this.

The lockdep annotation causes false positives when called via IPI as the lock is held, but by another process. Remove it.

Fixes fb700810d30b ("x86/resctrl: Separate arch and fs resctrl locks")
---
 arch/x86/kernel/cpu/resctrl/core.c | 9 ---------
 1 file changed, 9 deletions(-)
arch/x86/kernel/cpu/resctrl/core.c +0 -9
index 9f1aa555a8ea..83e40341583e 100644
@@ -362,15 +362,6 @@ struct rdt_domain *get_domain_from_cpu(int cpu, struct rdt_resource *r)
 {
 	struct rdt_domain *d;
 
-	/*
-	 * Walking r->domains, ensure it can't race with cpuhp.
-	 * Because this is called via IPI by rdt_ctrl_update(), assertions
-	 * about locks this thread holds will lead to false positives. Check
-	 * someone is holding the CPUs lock.
-	 */
-	if (IS_ENABLED(CONFIG_LOCKDEP))
-		lockdep_is_cpus_held();
-
 	list_for_each_entry(d, &r->domains, list) {
 		/* Find the domain that contains this CPU */
 		if (cpumask_test_cpu(cpu, &d->cpu_mask))
Signature · 1 line
2.39.2
maintainer
#1 lore raw

Hi James,

Quoted 26 lines · James Morse

get_domain_from_cpu() walks a list of domains to find the one that contains the specified CPU. This needs to be protected against races with CPU hotplug when the list is modified. It has recently gained a lockdep annotation to check this.

The lockdep annotation causes false positives when called via IPI as the lock is held, but by another process. Remove it.

Fixes fb700810d30b ("x86/resctrl: Separate arch and fs resctrl locks")
---
 arch/x86/kernel/cpu/resctrl/core.c | 9 ---------
 1 file changed, 9 deletions(-)
arch/x86/kernel/cpu/resctrl/core.c +0 -2
index 9f1aa555a8ea..83e40341583e 100644
@@ -362,15 +362,6 @@ struct rdt_domain *get_domain_from_cpu(int cpu, struct rdt_resource *r)
 {
 	struct rdt_domain *d;
 
-	/*
-	 * Walking r->domains, ensure it can't race with cpuhp.

arch/x86/kernel/cpu/resctrl/core.c struct rdt_domain *get_domain_from_cpu(int cpu, struct rdt_resource *r) · line 367

Quoted 10 lines
arch/x86/kernel/cpu/resctrl/core.c +0 -7
-	 * Because this is called via IPI by rdt_ctrl_update(), assertions
-	 * about locks this thread holds will lead to false positives. Check
-	 * someone is holding the CPUs lock.
-	 */
-	if (IS_ENABLED(CONFIG_LOCKDEP))
-		lockdep_is_cpus_held();
-
 	list_for_each_entry(d, &r->domains, list) {
 		/* Find the domain that contains this CPU */
 		if (cpumask_test_cpu(cpu, &d->cpu_mask))

I agree with this change. Could you please base it on x86/cache branch of tip?

Thank you

Reinette

maintainer
#2 lore raw
Quoted 2 lines · Reinette Chatre

I agree with this change. Could you please base it on x86/cache branch of tip?

No need - whacked it into submission.

Thx.

Signature · 4 lines
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
maintainer
#3 lore raw
Quoted 5 lines · Borislav Petkov
Quoted 2 lines · Reinette Chatre

I agree with this change. Could you please base it on x86/cache branch of tip?

No need - whacked it into submission.

Thank you very much Boris.

Reinette