mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] x86: drop false warning of empty cpumask in IPI
@ 2012-02-15  9:30 Gilad Ben-Yossef
  2012-02-17 12:01 ` Ingo Molnar
  0 siblings, 1 reply; 3+ messages in thread
From: Gilad Ben-Yossef @ 2012-02-15  9:30 UTC (permalink / raw)
  To: linux-kernel
  Cc: Gilad Ben-Yossef, Thomas Gleixner, Ingo Molnar, H. Peter Anvin,
	Milton Miller, x86

With current generic SMP infrastructure, it is feasible
for the target CPUs to begin processing an IPI work item
even before we sent them the actual IPI in the case that
an IPI from another CPU woke them first.

This can lead to generating a false warning in a valid
state of trying to send IPI with an empty cpumask when
multiple concurrent IPIs are being sent.

This patch was triggered by the following LKML discussion:
https://lkml.org/lkml/2012/1/13/308

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
CC: Thomas Gleixner <tglx@linutronix.de>
CC: Ingo Molnar <mingo@redhat.com>
CC: "H. Peter Anvin" <hpa@zytor.com>
CC: Milton Miller <miltonm@bga.com>
CC: x86@kernel.org
---
 arch/x86/kernel/apic/ipi.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/apic/ipi.c b/arch/x86/kernel/apic/ipi.c
index cce91bf..00b68a3 100644
--- a/arch/x86/kernel/apic/ipi.c
+++ b/arch/x86/kernel/apic/ipi.c
@@ -106,7 +106,10 @@ void default_send_IPI_mask_logical(const struct cpumask *cpumask, int vector)
 	unsigned long mask = cpumask_bits(cpumask)[0];
 	unsigned long flags;
 
-	if (WARN_ONCE(!mask, "empty IPI mask"))
+	if (!mask)
+		/* The target CPUs must have already processed the
+		 * work items due to a concurrent IPI
+		 */
 		return;
 
 	local_irq_save(flags);
-- 
1.7.0.4


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

* Re: [PATCH] x86: drop false warning of empty cpumask in IPI
  2012-02-15  9:30 [PATCH] x86: drop false warning of empty cpumask in IPI Gilad Ben-Yossef
@ 2012-02-17 12:01 ` Ingo Molnar
  2012-02-19  8:13   ` Gilad Ben-Yossef
  0 siblings, 1 reply; 3+ messages in thread
From: Ingo Molnar @ 2012-02-17 12:01 UTC (permalink / raw)
  To: Gilad Ben-Yossef
  Cc: linux-kernel, Thomas Gleixner, Ingo Molnar, H. Peter Anvin,
	Milton Miller, x86, Peter Zijlstra


* Gilad Ben-Yossef <gilad@benyossef.com> wrote:

> With current generic SMP infrastructure, it is feasible
> for the target CPUs to begin processing an IPI work item
> even before we sent them the actual IPI in the case that
> an IPI from another CPU woke them first.
> 
> This can lead to generating a false warning in a valid
> state of trying to send IPI with an empty cpumask when
> multiple concurrent IPIs are being sent.
> 
> This patch was triggered by the following LKML discussion:
> https://lkml.org/lkml/2012/1/13/308
> 
> Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
> CC: Thomas Gleixner <tglx@linutronix.de>
> CC: Ingo Molnar <mingo@redhat.com>
> CC: "H. Peter Anvin" <hpa@zytor.com>
> CC: Milton Miller <miltonm@bga.com>
> CC: x86@kernel.org
> ---
>  arch/x86/kernel/apic/ipi.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/x86/kernel/apic/ipi.c b/arch/x86/kernel/apic/ipi.c
> index cce91bf..00b68a3 100644
> --- a/arch/x86/kernel/apic/ipi.c
> +++ b/arch/x86/kernel/apic/ipi.c
> @@ -106,7 +106,10 @@ void default_send_IPI_mask_logical(const struct cpumask *cpumask, int vector)
>  	unsigned long mask = cpumask_bits(cpumask)[0];
>  	unsigned long flags;
>  
> -	if (WARN_ONCE(!mask, "empty IPI mask"))
> +	if (!mask)
> +		/* The target CPUs must have already processed the
> +		 * work items due to a concurrent IPI
> +		 */
>  		return;

This could potentially hide real bugs on other callsites.

So why not do the checking at the call site? In almost every 
other scenario it's invalid to send an empty mask.

Thanks,

	Ingo

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

* Re: [PATCH] x86: drop false warning of empty cpumask in IPI
  2012-02-17 12:01 ` Ingo Molnar
@ 2012-02-19  8:13   ` Gilad Ben-Yossef
  0 siblings, 0 replies; 3+ messages in thread
From: Gilad Ben-Yossef @ 2012-02-19  8:13 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Thomas Gleixner, Ingo Molnar, H. Peter Anvin,
	Milton Miller, x86, Peter Zijlstra

On Fri, Feb 17, 2012 at 2:01 PM, Ingo Molnar <mingo@elte.hu> wrote:
>
> * Gilad Ben-Yossef <gilad@benyossef.com> wrote:
>
>> With current generic SMP infrastructure, it is feasible
>> for the target CPUs to begin processing an IPI work item
>> even before we sent them the actual IPI in the case that
>> an IPI from another CPU woke them first.
>>
>> This can lead to generating a false warning in a valid
>> state of trying to send IPI with an empty cpumask when
>> multiple concurrent IPIs are being sent.
>>
>> This patch was triggered by the following LKML discussion:
>> https://lkml.org/lkml/2012/1/13/308
>>
>> Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
>> CC: Thomas Gleixner <tglx@linutronix.de>
>> CC: Ingo Molnar <mingo@redhat.com>
>> CC: "H. Peter Anvin" <hpa@zytor.com>
>> CC: Milton Miller <miltonm@bga.com>
>> CC: x86@kernel.org
>> ---
>>  arch/x86/kernel/apic/ipi.c |    5 ++++-
>>  1 files changed, 4 insertions(+), 1 deletions(-)
>>
>> diff --git a/arch/x86/kernel/apic/ipi.c b/arch/x86/kernel/apic/ipi.c
>> index cce91bf..00b68a3 100644
>> --- a/arch/x86/kernel/apic/ipi.c
>> +++ b/arch/x86/kernel/apic/ipi.c
>> @@ -106,7 +106,10 @@ void default_send_IPI_mask_logical(const struct cpumask *cpumask, int vector)
>>       unsigned long mask = cpumask_bits(cpumask)[0];
>>       unsigned long flags;
>>
>> -     if (WARN_ONCE(!mask, "empty IPI mask"))
>> +     if (!mask)
>> +             /* The target CPUs must have already processed the
>> +              * work items due to a concurrent IPI
>> +              */
>>               return;
>
> This could potentially hide real bugs on other callsites.
>
> So why not do the checking at the call site? In almost every
> other scenario it's invalid to send an empty mask.

hmm... isn't that racy? Also, none of the other send_IPI_maks
implementations do the check.

I can obviously add a warning at the "zero not OK" call sites, though.

Actually, the code is racy right now as well. I think we're
trying to program the APIC with a zero dest field from time to
time. How bad is that? :-)

Thanks,
Gilad




-- 
Gilad Ben-Yossef
Chief Coffee Drinker
gilad@benyossef.com
Israel Cell: +972-52-8260388
US Cell: +1-973-8260388
http://benyossef.com

"If you take a class in large-scale robotics, can you end up in a
situation where the homework eats your dog?"
 -- Jean-Baptiste Queru

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

end of thread, other threads:[~2012-02-19  8:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-15  9:30 [PATCH] x86: drop false warning of empty cpumask in IPI Gilad Ben-Yossef
2012-02-17 12:01 ` Ingo Molnar
2012-02-19  8:13   ` Gilad Ben-Yossef

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®