diff mbox

[3.10,005/103] irqchip: Gic: Support forced affinity setting

Message ID 20140604232547.006861681@linuxfoundation.org (mailing list archive)
State New, archived
Headers show

Commit Message

Greg Kroah-Hartman June 4, 2014, 11:24 p.m. UTC
3.10-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Thomas Gleixner <tglx@linutronix.de>

commit ffde1de64012c406dfdda8690918248b472f24e4 upstream.

To support the affinity setting of per cpu timers in the early startup
of a not yet online cpu, implement the force logic, which disables the
cpu online check.

Tagged for stable to allow a simple fix of the affected SoC clock
event drivers.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: Tomasz Figa <t.figa@samsung.com>,
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>,
Cc: Kukjin Kim <kgene.kim@samsung.com>
Cc: linux-arm-kernel@lists.infradead.org,
Link: http://lkml.kernel.org/r/20140416143315.916984416@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/irqchip/irq-gic.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Mark Rutland June 5, 2014, 4:05 p.m. UTC | #1
Hi Greg,

On Thu, Jun 05, 2014 at 12:24:28AM +0100, Greg Kroah-Hartman wrote:
> 3.10-stable review patch.  If anyone has any objections, please let me know.
> 
> ------------------
> 
> From: Thomas Gleixner <tglx@linutronix.de>
> 
> commit ffde1de64012c406dfdda8690918248b472f24e4 upstream.
> 
> To support the affinity setting of per cpu timers in the early startup
> of a not yet online cpu, implement the force logic, which disables the
> cpu online check.
> 
> Tagged for stable to allow a simple fix of the affected SoC clock
> event drivers.

This patch alone has the possiblity of breaking CPU hotplug on arm and
arm64 (specifically it breaks hot unplugging CPU0 where interrupts may
be left targetting the offline CPU).

For arm64 [1] that's fixed by commit 601c942176d8 (arm64: use
cpu_online_mask when using forced irq_set_affinity).

Unfortunately there is not an equivalent fix for arm - Russell objected
to the approach [2,3,4], and that's not yet settled.

Mark.

[1] http://lists.infradead.org/pipermail/linux-arm-kernel/2014-May/254836.html
[2] http://lists.infradead.org/pipermail/linux-arm-kernel/2014-May/254838.html
[3] http://lists.infradead.org/pipermail/linux-arm-kernel/2014-May/259245.html
[4] http://lists.infradead.org/pipermail/linux-arm-kernel/2014-May/259255.html

> 
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> Tested-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> Cc: Kyungmin Park <kyungmin.park@samsung.com>
> Cc: Marek Szyprowski <m.szyprowski@samsung.com>
> Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
> Cc: Tomasz Figa <t.figa@samsung.com>,
> Cc: Daniel Lezcano <daniel.lezcano@linaro.org>,
> Cc: Kukjin Kim <kgene.kim@samsung.com>
> Cc: linux-arm-kernel@lists.infradead.org,
> Link: http://lkml.kernel.org/r/20140416143315.916984416@linutronix.de
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> 
> ---
>  drivers/irqchip/irq-gic.c |    8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> --- a/drivers/irqchip/irq-gic.c
> +++ b/drivers/irqchip/irq-gic.c
> @@ -246,10 +246,14 @@ static int gic_set_affinity(struct irq_d
>  			    bool force)
>  {
>  	void __iomem *reg = gic_dist_base(d) + GIC_DIST_TARGET + (gic_irq(d) & ~3);
> -	unsigned int shift = (gic_irq(d) % 4) * 8;
> -	unsigned int cpu = cpumask_any_and(mask_val, cpu_online_mask);
> +	unsigned int cpu, shift = (gic_irq(d) % 4) * 8;
>  	u32 val, mask, bit;
>  
> +	if (!force)
> +		cpu = cpumask_any_and(mask_val, cpu_online_mask);
> +	else
> +		cpu = cpumask_first(mask_val);
> +
>  	if (cpu >= NR_GIC_CPU_IF || cpu >= nr_cpu_ids)
>  		return -EINVAL;
>  
> 
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
Greg Kroah-Hartman June 5, 2014, 6:05 p.m. UTC | #2
On Thu, Jun 05, 2014 at 05:05:00PM +0100, Mark Rutland wrote:
> Hi Greg,
> 
> On Thu, Jun 05, 2014 at 12:24:28AM +0100, Greg Kroah-Hartman wrote:
> > 3.10-stable review patch.  If anyone has any objections, please let me know.
> > 
> > ------------------
> > 
> > From: Thomas Gleixner <tglx@linutronix.de>
> > 
> > commit ffde1de64012c406dfdda8690918248b472f24e4 upstream.
> > 
> > To support the affinity setting of per cpu timers in the early startup
> > of a not yet online cpu, implement the force logic, which disables the
> > cpu online check.
> > 
> > Tagged for stable to allow a simple fix of the affected SoC clock
> > event drivers.
> 
> This patch alone has the possiblity of breaking CPU hotplug on arm and
> arm64 (specifically it breaks hot unplugging CPU0 where interrupts may
> be left targetting the offline CPU).
> 
> For arm64 [1] that's fixed by commit 601c942176d8 (arm64: use
> cpu_online_mask when using forced irq_set_affinity).

Thanks, I'll apply that to the 3.14-stable tree, but, it doesn't seem
relevant at all for 3.10-stable as arch/arm64/kernel/irq.c doesn't do
anything with cpumask or set_affinity.  If it's relevant for 3.10,
please provide a backported version.

> Unfortunately there is not an equivalent fix for arm - Russell objected
> to the approach [2,3,4], and that's not yet settled.

Ok, be sure to cc: stable on the patch when it goes into the tree and
I'll pick it up then.

thanks,

greg k-h
Mark Rutland June 5, 2014, 6:10 p.m. UTC | #3
On Thu, Jun 05, 2014 at 07:05:24PM +0100, Greg Kroah-Hartman wrote:
> On Thu, Jun 05, 2014 at 05:05:00PM +0100, Mark Rutland wrote:
> > Hi Greg,
> > 
> > On Thu, Jun 05, 2014 at 12:24:28AM +0100, Greg Kroah-Hartman wrote:
> > > 3.10-stable review patch.  If anyone has any objections, please let me know.
> > > 
> > > ------------------
> > > 
> > > From: Thomas Gleixner <tglx@linutronix.de>
> > > 
> > > commit ffde1de64012c406dfdda8690918248b472f24e4 upstream.
> > > 
> > > To support the affinity setting of per cpu timers in the early startup
> > > of a not yet online cpu, implement the force logic, which disables the
> > > cpu online check.
> > > 
> > > Tagged for stable to allow a simple fix of the affected SoC clock
> > > event drivers.
> > 
> > This patch alone has the possiblity of breaking CPU hotplug on arm and
> > arm64 (specifically it breaks hot unplugging CPU0 where interrupts may
> > be left targetting the offline CPU).
> > 
> > For arm64 [1] that's fixed by commit 601c942176d8 (arm64: use
> > cpu_online_mask when using forced irq_set_affinity).
> 
> Thanks, I'll apply that to the 3.14-stable tree, but, it doesn't seem
> relevant at all for 3.10-stable as arch/arm64/kernel/irq.c doesn't do
> anything with cpumask or set_affinity.  If it's relevant for 3.10,
> please provide a backported version.

Sorry, my bad. It's not relevant for v3.10, I'd gotten confused over
when I added CPU hotplug.

Thanks,
Mark.

> > Unfortunately there is not an equivalent fix for arm - Russell objected
> > to the approach [2,3,4], and that's not yet settled.
> 
> Ok, be sure to cc: stable on the patch when it goes into the tree and
> I'll pick it up then.
> 
> thanks,
> 
> greg k-h
>
Mark Brown June 23, 2014, 11:17 a.m. UTC | #4
On Thu, Jun 05, 2014 at 11:05:24AM -0700, Greg Kroah-Hartman wrote:
> On Thu, Jun 05, 2014 at 05:05:00PM +0100, Mark Rutland wrote:

> > This patch alone has the possiblity of breaking CPU hotplug on arm and
> > arm64 (specifically it breaks hot unplugging CPU0 where interrupts may
> > be left targetting the offline CPU).

...

> > Unfortunately there is not an equivalent fix for arm - Russell objected
> > to the approach [2,3,4], and that's not yet settled.

> Ok, be sure to cc: stable on the patch when it goes into the tree and
> I'll pick it up then.

Sadly that fix still hasn't materialised so stable remains broken for
ARM.  The discussion was restarted on Friday but Russell is looking to
Thomas for input.
diff mbox

Patch

--- a/drivers/irqchip/irq-gic.c
+++ b/drivers/irqchip/irq-gic.c
@@ -246,10 +246,14 @@  static int gic_set_affinity(struct irq_d
 			    bool force)
 {
 	void __iomem *reg = gic_dist_base(d) + GIC_DIST_TARGET + (gic_irq(d) & ~3);
-	unsigned int shift = (gic_irq(d) % 4) * 8;
-	unsigned int cpu = cpumask_any_and(mask_val, cpu_online_mask);
+	unsigned int cpu, shift = (gic_irq(d) % 4) * 8;
 	u32 val, mask, bit;
 
+	if (!force)
+		cpu = cpumask_any_and(mask_val, cpu_online_mask);
+	else
+		cpu = cpumask_first(mask_val);
+
 	if (cpu >= NR_GIC_CPU_IF || cpu >= nr_cpu_ids)
 		return -EINVAL;