mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] x86/resctrl: Remove lockdep annotation that triggers false positive
@ 2024-02-21 12:23 James Morse
  2024-02-21 16:48 ` Reinette Chatre
  0 siblings, 1 reply; 4+ messages in thread
From: James Morse @ 2024-02-21 12:23 UTC (permalink / raw)
  To: x86, linux-kernel
  Cc: Fenghua Yu, Reinette Chatre, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, H Peter Anvin, Tony Luck, 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.

Reported-by: Tony Luck <tony.luck@intel.com>
Link: https://lore.kernel.org/all/ZdUSwOM9UUNpw84Y@agluck-desk3/
Fixes: fb700810d30b ("x86/resctrl: Separate arch and fs resctrl locks")
Signed-off-by: James Morse <james.morse@arm.com>
---
 arch/x86/kernel/cpu/resctrl/core.c | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c
index 9f1aa555a8ea..83e40341583e 100644
--- a/arch/x86/kernel/cpu/resctrl/core.c
+++ b/arch/x86/kernel/cpu/resctrl/core.c
@@ -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))
-- 
2.39.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] x86/resctrl: Remove lockdep annotation that triggers false positive
  2024-02-21 12:23 [PATCH] x86/resctrl: Remove lockdep annotation that triggers false positive James Morse
@ 2024-02-21 16:48 ` Reinette Chatre
  2024-02-22 15:16   ` Borislav Petkov
  0 siblings, 1 reply; 4+ messages in thread
From: Reinette Chatre @ 2024-02-21 16:48 UTC (permalink / raw)
  To: James Morse, x86, linux-kernel
  Cc: Fenghua Yu, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	H Peter Anvin, Tony Luck

Hi James,

On 2/21/2024 4:23 AM, James Morse wrote:
> 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.
> 
> Reported-by: Tony Luck <tony.luck@intel.com>
> Link: https://lore.kernel.org/all/ZdUSwOM9UUNpw84Y@agluck-desk3/
> Fixes: fb700810d30b ("x86/resctrl: Separate arch and fs resctrl locks")
> Signed-off-by: James Morse <james.morse@arm.com>
> ---
>  arch/x86/kernel/cpu/resctrl/core.c | 9 ---------
>  1 file changed, 9 deletions(-)
> 
> diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c
> index 9f1aa555a8ea..83e40341583e 100644
> --- a/arch/x86/kernel/cpu/resctrl/core.c
> +++ b/arch/x86/kernel/cpu/resctrl/core.c
> @@ -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))

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

Thank you

Reinette

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] x86/resctrl: Remove lockdep annotation that triggers false positive
  2024-02-21 16:48 ` Reinette Chatre
@ 2024-02-22 15:16   ` Borislav Petkov
  2024-02-22 15:57     ` Reinette Chatre
  0 siblings, 1 reply; 4+ messages in thread
From: Borislav Petkov @ 2024-02-22 15:16 UTC (permalink / raw)
  To: Reinette Chatre
  Cc: James Morse, x86, linux-kernel, Fenghua Yu, Thomas Gleixner,
	Ingo Molnar, H Peter Anvin, Tony Luck

On Wed, Feb 21, 2024 at 08:48:24AM -0800, Reinette Chatre wrote:
> I agree with this change. Could you please base it on x86/cache
> branch of tip?

No need - whacked it into submission.

Thx.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] x86/resctrl: Remove lockdep annotation that triggers false positive
  2024-02-22 15:16   ` Borislav Petkov
@ 2024-02-22 15:57     ` Reinette Chatre
  0 siblings, 0 replies; 4+ messages in thread
From: Reinette Chatre @ 2024-02-22 15:57 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: James Morse, x86, linux-kernel, Fenghua Yu, Thomas Gleixner,
	Ingo Molnar, H Peter Anvin, Tony Luck



On 2/22/2024 7:16 AM, Borislav Petkov wrote:
> On Wed, Feb 21, 2024 at 08:48:24AM -0800, Reinette Chatre wrote:
>> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-02-22 15:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-21 12:23 [PATCH] x86/resctrl: Remove lockdep annotation that triggers false positive James Morse
2024-02-21 16:48 ` Reinette Chatre
2024-02-22 15:16   ` Borislav Petkov
2024-02-22 15:57     ` Reinette Chatre

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®