public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] arm: irq: fix the affinity when migrate a irq
@ 2014-08-15  7:31 Neil Zhang
  2014-08-15  8:45 ` Sudeep Holla
  2014-08-15  8:48 ` Russell King - ARM Linux
  0 siblings, 2 replies; 4+ messages in thread
From: Neil Zhang @ 2014-08-15  7:31 UTC (permalink / raw)
  To: linux-arm-kernel

Commit ffde1de64012 ("irqchip: Gic: Support forced affinity setting")
has enable the forcing cpu affinity of interrupts for gic.

The current code of migrate_one_irq will pass the current affinity mask
to irq_set_affinity with force is true, it may select the cpu being
offlined as the target CPU again, then the interrupt won't be migrated
correctly.

Signed-off-by: Neil Zhang <zhangwm@marvell.com>
---
 arch/arm/kernel/irq.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c
index 2c42576..6f5a878 100644
--- a/arch/arm/kernel/irq.c
+++ b/arch/arm/kernel/irq.c
@@ -167,11 +167,10 @@ static bool migrate_one_irq(struct irq_desc *desc)
 	if (irqd_is_per_cpu(d) || !cpumask_test_cpu(smp_processor_id(), affinity))
 		return false;
 
-	if (cpumask_any_and(affinity, cpu_online_mask) >= nr_cpu_ids) {
-		affinity = cpu_online_mask;
+	if (cpumask_any_and(affinity, cpu_online_mask) >= nr_cpu_ids)
 		ret = true;
-	}
 
+	affinity = cpu_online_mask;
 	c = irq_data_get_irq_chip(d);
 	if (!c->irq_set_affinity)
 		pr_debug("IRQ%u: unable to set affinity\n", d->irq);
-- 
1.7.9.5

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

* [PATCH] arm: irq: fix the affinity when migrate a irq
  2014-08-15  7:31 [PATCH] arm: irq: fix the affinity when migrate a irq Neil Zhang
@ 2014-08-15  8:45 ` Sudeep Holla
  2014-08-15  9:45   ` Neil Zhang
  2014-08-15  8:48 ` Russell King - ARM Linux
  1 sibling, 1 reply; 4+ messages in thread
From: Sudeep Holla @ 2014-08-15  8:45 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Neil,

On 15/08/14 08:31, Neil Zhang wrote:
> Commit ffde1de64012 ("irqchip: Gic: Support forced affinity setting")
> has enable the forcing cpu affinity of interrupts for gic.
>
> The current code of migrate_one_irq will pass the current affinity mask
> to irq_set_affinity with force is true, it may select the cpu being
> offlined as the target CPU again, then the interrupt won't be migrated
> correctly.
>

I had posted similar patch [1] a while ago and the discussion[2] did not 
conclude. We need feedback from Thomas Gleixner.

Regards,
Sudeep

[1] 
http://lists.infradead.org/pipermail/linux-arm-kernel/2014-May/254838.html
[2] 
http://lists.infradead.org/pipermail/linux-arm-kernel/2014-June/265191.html

> Signed-off-by: Neil Zhang <zhangwm@marvell.com>
> ---
>   arch/arm/kernel/irq.c |    5 ++---
>   1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c
> index 2c42576..6f5a878 100644
> --- a/arch/arm/kernel/irq.c
> +++ b/arch/arm/kernel/irq.c
> @@ -167,11 +167,10 @@ static bool migrate_one_irq(struct irq_desc *desc)
>   	if (irqd_is_per_cpu(d) || !cpumask_test_cpu(smp_processor_id(), affinity))
>   		return false;
>
> -	if (cpumask_any_and(affinity, cpu_online_mask) >= nr_cpu_ids) {
> -		affinity = cpu_online_mask;
> +	if (cpumask_any_and(affinity, cpu_online_mask) >= nr_cpu_ids)
>   		ret = true;
> -	}
>
> +	affinity = cpu_online_mask;
>   	c = irq_data_get_irq_chip(d);
>   	if (!c->irq_set_affinity)
>   		pr_debug("IRQ%u: unable to set affinity\n", d->irq);
>

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

* [PATCH] arm: irq: fix the affinity when migrate a irq
  2014-08-15  7:31 [PATCH] arm: irq: fix the affinity when migrate a irq Neil Zhang
  2014-08-15  8:45 ` Sudeep Holla
@ 2014-08-15  8:48 ` Russell King - ARM Linux
  1 sibling, 0 replies; 4+ messages in thread
From: Russell King - ARM Linux @ 2014-08-15  8:48 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Aug 15, 2014 at 03:31:57PM +0800, Neil Zhang wrote:
> Commit ffde1de64012 ("irqchip: Gic: Support forced affinity setting")
> has enable the forcing cpu affinity of interrupts for gic.
> 
> The current code of migrate_one_irq will pass the current affinity mask
> to irq_set_affinity with force is true, it may select the cpu being
> offlined as the target CPU again, then the interrupt won't be migrated
> correctly.

NAK.

-- 
FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up
according to speedtest.net.

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

* [PATCH] arm: irq: fix the affinity when migrate a irq
  2014-08-15  8:45 ` Sudeep Holla
@ 2014-08-15  9:45   ` Neil Zhang
  0 siblings, 0 replies; 4+ messages in thread
From: Neil Zhang @ 2014-08-15  9:45 UTC (permalink / raw)
  To: linux-arm-kernel



> -----Original Message-----
> From: Sudeep Holla [mailto:sudeep.holla at arm.com]
> Sent: 2014?8?15? 16:45
> To: Neil Zhang; linux at arm.linux.org.uk
> Cc: Sudeep Holla; linux-kernel at vger.kernel.org;
> linux-arm-kernel at lists.infradead.org
> Subject: Re: [PATCH] arm: irq: fix the affinity when migrate a irq
> 
> Hi Neil,
> 
> On 15/08/14 08:31, Neil Zhang wrote:
> > Commit ffde1de64012 ("irqchip: Gic: Support forced affinity setting")
> > has enable the forcing cpu affinity of interrupts for gic.
> >
> > The current code of migrate_one_irq will pass the current affinity
> > mask to irq_set_affinity with force is true, it may select the cpu
> > being offlined as the target CPU again, then the interrupt won't be
> > migrated correctly.
> >
> 
> I had posted similar patch [1] a while ago and the discussion[2] did not
> conclude. We need feedback from Thomas Gleixner.
> 
> Regards,
> Sudeep
> 
> [1]
> http://lists.infradead.org/pipermail/linux-arm-kernel/2014-May/254838.html
> [2]
> http://lists.infradead.org/pipermail/linux-arm-kernel/2014-June/265191.html

I see, thanks.

> 
> > Signed-off-by: Neil Zhang <zhangwm@marvell.com>
> > ---
> >   arch/arm/kernel/irq.c |    5 ++---
> >   1 file changed, 2 insertions(+), 3 deletions(-)
> >
> > diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c index
> > 2c42576..6f5a878 100644
> > --- a/arch/arm/kernel/irq.c
> > +++ b/arch/arm/kernel/irq.c
> > @@ -167,11 +167,10 @@ static bool migrate_one_irq(struct irq_desc *desc)
> >   	if (irqd_is_per_cpu(d) || !cpumask_test_cpu(smp_processor_id(), affinity))
> >   		return false;
> >
> > -	if (cpumask_any_and(affinity, cpu_online_mask) >= nr_cpu_ids) {
> > -		affinity = cpu_online_mask;
> > +	if (cpumask_any_and(affinity, cpu_online_mask) >= nr_cpu_ids)
> >   		ret = true;
> > -	}
> >
> > +	affinity = cpu_online_mask;
> >   	c = irq_data_get_irq_chip(d);
> >   	if (!c->irq_set_affinity)
> >   		pr_debug("IRQ%u: unable to set affinity\n", d->irq);
> >

Best Regards,
Neil Zhang

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

end of thread, other threads:[~2014-08-15  9:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-15  7:31 [PATCH] arm: irq: fix the affinity when migrate a irq Neil Zhang
2014-08-15  8:45 ` Sudeep Holla
2014-08-15  9:45   ` Neil Zhang
2014-08-15  8:48 ` Russell King - ARM Linux

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