* [PATCH 0/2] MIPS: BMIPS: Fix interrupt affinity migration
@ 2016-10-31 21:17 Florian Fainelli
2016-10-31 21:17 ` [PATCH 1/2] irqchip/bcm7038-l1: Implement irq_cpu_offline Florian Fainelli
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Florian Fainelli @ 2016-10-31 21:17 UTC (permalink / raw)
To: linux-mips
Cc: ralf, cernekee, jaedon.shin, justinpopo6, tglx, marc.zyngier,
jason, linux-kernel, Florian Fainelli
Hi,
These two patches are against Thomas' irq/core branch as of today:
4cd13c21b207e80ddb1144c576500098f2d5f882 ("softirq: Let ksoftirqd do its job")
Patches can be taken indepdently or together, your call.
Florian Fainelli (2):
irqchip/bcm7038-l1: Implement irq_cpu_offline
MIPS: BMIPS: Migrate interrupts during bmips_cpu_disable
arch/mips/kernel/smp-bmips.c | 2 ++
drivers/irqchip/irq-bcm7038-l1.c | 25 +++++++++++++++++++++++++
2 files changed, 27 insertions(+)
--
2.7.4
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] irqchip/bcm7038-l1: Implement irq_cpu_offline
2016-10-31 21:17 [PATCH 0/2] MIPS: BMIPS: Fix interrupt affinity migration Florian Fainelli
@ 2016-10-31 21:17 ` Florian Fainelli
2016-10-31 21:17 ` [PATCH 2/2] MIPS: BMIPS: Migrate interrupts during bmips_cpu_disable Florian Fainelli
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Florian Fainelli @ 2016-10-31 21:17 UTC (permalink / raw)
To: linux-mips
Cc: ralf, cernekee, jaedon.shin, justinpopo6, tglx, marc.zyngier,
jason, linux-kernel, Florian Fainelli
We did not implement an irq_cpu_offline callback for our irqchip, yet we
support setting a given IRQ's affinity. This resulted in interrupts
whose affinity mask included CPUs being taken offline not to work
correctly once the CPU had been put offline.
Fixes: 5f7f0317ed28 ("IRQCHIP: Add new driver for BCM7038-style level 1 interrupt controllers")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/irqchip/irq-bcm7038-l1.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/drivers/irqchip/irq-bcm7038-l1.c b/drivers/irqchip/irq-bcm7038-l1.c
index 0fea985ef1dc..529968ac38c0 100644
--- a/drivers/irqchip/irq-bcm7038-l1.c
+++ b/drivers/irqchip/irq-bcm7038-l1.c
@@ -216,6 +216,30 @@ static int bcm7038_l1_set_affinity(struct irq_data *d,
return 0;
}
+static void bcm7038_l1_cpu_offline(struct irq_data *d)
+{
+ struct cpumask *mask = irq_data_get_affinity_mask(d);
+ int cpu = smp_processor_id();
+ cpumask_t new_affinity;
+
+ /* This CPU was not on the affinity mask */
+ if (!cpumask_test_cpu(cpu, mask))
+ return;
+
+ if (cpumask_weight(mask) > 1) {
+ /* Multiple CPU affinity, remove this CPU from the affinity
+ * mask
+ */
+ cpumask_copy(&new_affinity, mask);
+ cpumask_clear_cpu(cpu, &new_affinity);
+ } else {
+ /* Only CPU, put on the lowest online CPU */
+ cpumask_clear(&new_affinity);
+ cpumask_set_cpu(cpumask_first(cpu_online_mask), &new_affinity);
+ }
+ irq_set_affinity_locked(d, &new_affinity, false);
+}
+
static int __init bcm7038_l1_init_one(struct device_node *dn,
unsigned int idx,
struct bcm7038_l1_chip *intc)
@@ -267,6 +291,7 @@ static struct irq_chip bcm7038_l1_irq_chip = {
.irq_mask = bcm7038_l1_mask,
.irq_unmask = bcm7038_l1_unmask,
.irq_set_affinity = bcm7038_l1_set_affinity,
+ .irq_cpu_offline = bcm7038_l1_cpu_offline,
};
static int bcm7038_l1_map(struct irq_domain *d, unsigned int virq,
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] MIPS: BMIPS: Migrate interrupts during bmips_cpu_disable
2016-10-31 21:17 [PATCH 0/2] MIPS: BMIPS: Fix interrupt affinity migration Florian Fainelli
2016-10-31 21:17 ` [PATCH 1/2] irqchip/bcm7038-l1: Implement irq_cpu_offline Florian Fainelli
@ 2016-10-31 21:17 ` Florian Fainelli
2016-10-31 21:18 ` [PATCH 0/2] MIPS: BMIPS: Fix interrupt affinity migration Florian Fainelli
2016-11-18 14:09 ` Thomas Gleixner
3 siblings, 0 replies; 6+ messages in thread
From: Florian Fainelli @ 2016-10-31 21:17 UTC (permalink / raw)
To: linux-mips
Cc: ralf, cernekee, jaedon.shin, justinpopo6, tglx, marc.zyngier,
jason, linux-kernel, Florian Fainelli
While we properly disabled the per-CPU timer interrupt, we also need to
make sure that all interrupts that can possibly have this CPU in their
smp_affinity mask also have a chance to see this interrupt migrated to a
CPU not being taken offline.
Fixes: 230b6ff57552 ("MIPS: BMIPS: Mask off timer IRQs when hot-unplugging a CPU")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
arch/mips/kernel/smp-bmips.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/mips/kernel/smp-bmips.c b/arch/mips/kernel/smp-bmips.c
index 6d0f1321e084..37dffda8f16b 100644
--- a/arch/mips/kernel/smp-bmips.c
+++ b/arch/mips/kernel/smp-bmips.c
@@ -365,6 +365,8 @@ static int bmips_cpu_disable(void)
set_cpu_online(cpu, false);
calculate_cpu_foreign_map();
cpumask_clear_cpu(cpu, &cpu_callin_map);
+
+ irq_cpu_offline();
clear_c0_status(IE_IRQ5);
local_flush_tlb_all();
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 0/2] MIPS: BMIPS: Fix interrupt affinity migration
2016-10-31 21:17 [PATCH 0/2] MIPS: BMIPS: Fix interrupt affinity migration Florian Fainelli
2016-10-31 21:17 ` [PATCH 1/2] irqchip/bcm7038-l1: Implement irq_cpu_offline Florian Fainelli
2016-10-31 21:17 ` [PATCH 2/2] MIPS: BMIPS: Migrate interrupts during bmips_cpu_disable Florian Fainelli
@ 2016-10-31 21:18 ` Florian Fainelli
2016-11-18 14:09 ` Thomas Gleixner
3 siblings, 0 replies; 6+ messages in thread
From: Florian Fainelli @ 2016-10-31 21:18 UTC (permalink / raw)
To: linux-mips
Cc: ralf, cernekee, jaedon.shin, justinpopo6, tglx, marc.zyngier,
jason, linux-kernel
On 10/31/2016 02:17 PM, Florian Fainelli wrote:
> Hi,
>
> These two patches are against Thomas' irq/core branch as of today:
>
> 4cd13c21b207e80ddb1144c576500098f2d5f882 ("softirq: Let ksoftirqd do its job")
>
> Patches can be taken indepdently or together, your call.
Resending since I goofed on Thomas' address the first time..
>
> Florian Fainelli (2):
> irqchip/bcm7038-l1: Implement irq_cpu_offline
> MIPS: BMIPS: Migrate interrupts during bmips_cpu_disable
>
> arch/mips/kernel/smp-bmips.c | 2 ++
> drivers/irqchip/irq-bcm7038-l1.c | 25 +++++++++++++++++++++++++
> 2 files changed, 27 insertions(+)
>
--
Florian
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/2] MIPS: BMIPS: Fix interrupt affinity migration
2016-10-31 21:17 [PATCH 0/2] MIPS: BMIPS: Fix interrupt affinity migration Florian Fainelli
` (2 preceding siblings ...)
2016-10-31 21:18 ` [PATCH 0/2] MIPS: BMIPS: Fix interrupt affinity migration Florian Fainelli
@ 2016-11-18 14:09 ` Thomas Gleixner
3 siblings, 0 replies; 6+ messages in thread
From: Thomas Gleixner @ 2016-11-18 14:09 UTC (permalink / raw)
To: Florian Fainelli
Cc: linux-mips, ralf, cernekee, jaedon.shin, justinpopo6,
marc.zyngier, jason, linux-kernel
On Mon, 31 Oct 2016, Florian Fainelli wrote:
> Hi,
>
> These two patches are against Thomas' irq/core branch as of today:
>
> 4cd13c21b207e80ddb1144c576500098f2d5f882 ("softirq: Let ksoftirqd do its job")
>
> Patches can be taken indepdently or together, your call.
>
> Florian Fainelli (2):
> irqchip/bcm7038-l1: Implement irq_cpu_offline
I took that one through tip
> MIPS: BMIPS: Migrate interrupts during bmips_cpu_disable
This one should probably go through MIPS
Thanks,
tglx
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] irqchip/bcm7038-l1: Implement irq_cpu_offline
2016-10-31 21:16 Florian Fainelli
@ 2016-10-31 21:16 ` Florian Fainelli
0 siblings, 0 replies; 6+ messages in thread
From: Florian Fainelli @ 2016-10-31 21:16 UTC (permalink / raw)
To: linux-mips
Cc: ralf, cernekee, jaedon.shin, justinpopo6, tglx, marc.zyngier,
jason, linux-kernel, Florian Fainelli
We did not implement an irq_cpu_offline callback for our irqchip, yet we
support setting a given IRQ's affinity. This resulted in interrupts
whose affinity mask included CPUs being taken offline not to work
correctly once the CPU had been put offline.
Fixes: 5f7f0317ed28 ("IRQCHIP: Add new driver for BCM7038-style level 1 interrupt controllers")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/irqchip/irq-bcm7038-l1.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/drivers/irqchip/irq-bcm7038-l1.c b/drivers/irqchip/irq-bcm7038-l1.c
index 0fea985ef1dc..529968ac38c0 100644
--- a/drivers/irqchip/irq-bcm7038-l1.c
+++ b/drivers/irqchip/irq-bcm7038-l1.c
@@ -216,6 +216,30 @@ static int bcm7038_l1_set_affinity(struct irq_data *d,
return 0;
}
+static void bcm7038_l1_cpu_offline(struct irq_data *d)
+{
+ struct cpumask *mask = irq_data_get_affinity_mask(d);
+ int cpu = smp_processor_id();
+ cpumask_t new_affinity;
+
+ /* This CPU was not on the affinity mask */
+ if (!cpumask_test_cpu(cpu, mask))
+ return;
+
+ if (cpumask_weight(mask) > 1) {
+ /* Multiple CPU affinity, remove this CPU from the affinity
+ * mask
+ */
+ cpumask_copy(&new_affinity, mask);
+ cpumask_clear_cpu(cpu, &new_affinity);
+ } else {
+ /* Only CPU, put on the lowest online CPU */
+ cpumask_clear(&new_affinity);
+ cpumask_set_cpu(cpumask_first(cpu_online_mask), &new_affinity);
+ }
+ irq_set_affinity_locked(d, &new_affinity, false);
+}
+
static int __init bcm7038_l1_init_one(struct device_node *dn,
unsigned int idx,
struct bcm7038_l1_chip *intc)
@@ -267,6 +291,7 @@ static struct irq_chip bcm7038_l1_irq_chip = {
.irq_mask = bcm7038_l1_mask,
.irq_unmask = bcm7038_l1_unmask,
.irq_set_affinity = bcm7038_l1_set_affinity,
+ .irq_cpu_offline = bcm7038_l1_cpu_offline,
};
static int bcm7038_l1_map(struct irq_domain *d, unsigned int virq,
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-11-18 14:12 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-31 21:17 [PATCH 0/2] MIPS: BMIPS: Fix interrupt affinity migration Florian Fainelli
2016-10-31 21:17 ` [PATCH 1/2] irqchip/bcm7038-l1: Implement irq_cpu_offline Florian Fainelli
2016-10-31 21:17 ` [PATCH 2/2] MIPS: BMIPS: Migrate interrupts during bmips_cpu_disable Florian Fainelli
2016-10-31 21:18 ` [PATCH 0/2] MIPS: BMIPS: Fix interrupt affinity migration Florian Fainelli
2016-11-18 14:09 ` Thomas Gleixner
-- strict thread matches above, loose matches on Subject: below --
2016-10-31 21:16 Florian Fainelli
2016-10-31 21:16 ` [PATCH 1/2] irqchip/bcm7038-l1: Implement irq_cpu_offline Florian Fainelli
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).