linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Russell King <rmk+kernel@armlinux.org.uk>,
	Sasha Levin <sashal@kernel.org>
Subject: [PATCH AUTOSEL 4.19 05/48] ARM: 8824/1: fix a migrating irq bug when hotplug cpu
Date: Wed, 13 Mar 2019 15:12:07 -0400	[thread overview]
Message-ID: <20190313191250.158955-5-sashal@kernel.org> (raw)
In-Reply-To: <20190313191250.158955-1-sashal@kernel.org>

From: Dietmar Eggemann <dietmar.eggemann@arm.com>

[ Upstream commit 1b5ba350784242eb1f899bcffd95d2c7cff61e84 ]

Arm TC2 fails cpu hotplug stress test.

This issue was tracked down to a missing copy of the new affinity
cpumask for the vexpress-spc interrupt into struct
irq_common_data.affinity when the interrupt is migrated in
migrate_one_irq().

Fix it by replacing the arm specific hotplug cpu migration with the
generic irq code.

This is the counterpart implementation to commit 217d453d473c ("arm64:
fix a migrating irq bug when hotplug cpu").

Tested with cpu hotplug stress test on Arm TC2 (multi_v7_defconfig plus
CONFIG_ARM_BIG_LITTLE_CPUFREQ=y and CONFIG_ARM_VEXPRESS_SPC_CPUFREQ=y).
The vexpress-spc interrupt (irq=22) on this board is affine to CPU0.
Its affinity cpumask now changes correctly e.g. from 0 to 1-4 when
CPU0 is hotplugged out.

Suggested-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/arm/Kconfig           |  1 +
 arch/arm/include/asm/irq.h |  1 -
 arch/arm/kernel/irq.c      | 62 --------------------------------------
 arch/arm/kernel/smp.c      |  2 +-
 4 files changed, 2 insertions(+), 64 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index e8cd55a5b04c..cd4c74daf71e 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1444,6 +1444,7 @@ config NR_CPUS
 config HOTPLUG_CPU
 	bool "Support for hot-pluggable CPUs"
 	depends on SMP
+	select GENERIC_IRQ_MIGRATION
 	help
 	  Say Y here to experiment with turning CPUs off and on.  CPUs
 	  can be controlled through /sys/devices/system/cpu.
diff --git a/arch/arm/include/asm/irq.h b/arch/arm/include/asm/irq.h
index c883fcbe93b6..46d41140df27 100644
--- a/arch/arm/include/asm/irq.h
+++ b/arch/arm/include/asm/irq.h
@@ -25,7 +25,6 @@
 #ifndef __ASSEMBLY__
 struct irqaction;
 struct pt_regs;
-extern void migrate_irqs(void);
 
 extern void asm_do_IRQ(unsigned int, struct pt_regs *);
 void handle_IRQ(unsigned int, struct pt_regs *);
diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c
index 9908dacf9229..844861368cd5 100644
--- a/arch/arm/kernel/irq.c
+++ b/arch/arm/kernel/irq.c
@@ -31,7 +31,6 @@
 #include <linux/smp.h>
 #include <linux/init.h>
 #include <linux/seq_file.h>
-#include <linux/ratelimit.h>
 #include <linux/errno.h>
 #include <linux/list.h>
 #include <linux/kallsyms.h>
@@ -109,64 +108,3 @@ int __init arch_probe_nr_irqs(void)
 	return nr_irqs;
 }
 #endif
-
-#ifdef CONFIG_HOTPLUG_CPU
-static bool migrate_one_irq(struct irq_desc *desc)
-{
-	struct irq_data *d = irq_desc_get_irq_data(desc);
-	const struct cpumask *affinity = irq_data_get_affinity_mask(d);
-	struct irq_chip *c;
-	bool ret = false;
-
-	/*
-	 * If this is a per-CPU interrupt, or the affinity does not
-	 * include this CPU, then we have nothing to do.
-	 */
-	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;
-		ret = true;
-	}
-
-	c = irq_data_get_irq_chip(d);
-	if (!c->irq_set_affinity)
-		pr_debug("IRQ%u: unable to set affinity\n", d->irq);
-	else if (c->irq_set_affinity(d, affinity, false) == IRQ_SET_MASK_OK && ret)
-		cpumask_copy(irq_data_get_affinity_mask(d), affinity);
-
-	return ret;
-}
-
-/*
- * The current CPU has been marked offline.  Migrate IRQs off this CPU.
- * If the affinity settings do not allow other CPUs, force them onto any
- * available CPU.
- *
- * Note: we must iterate over all IRQs, whether they have an attached
- * action structure or not, as we need to get chained interrupts too.
- */
-void migrate_irqs(void)
-{
-	unsigned int i;
-	struct irq_desc *desc;
-	unsigned long flags;
-
-	local_irq_save(flags);
-
-	for_each_irq_desc(i, desc) {
-		bool affinity_broken;
-
-		raw_spin_lock(&desc->lock);
-		affinity_broken = migrate_one_irq(desc);
-		raw_spin_unlock(&desc->lock);
-
-		if (affinity_broken)
-			pr_warn_ratelimited("IRQ%u no longer affine to CPU%u\n",
-				i, smp_processor_id());
-	}
-
-	local_irq_restore(flags);
-}
-#endif /* CONFIG_HOTPLUG_CPU */
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index 3bf82232b1be..1d6f5ea522f4 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -254,7 +254,7 @@ int __cpu_disable(void)
 	/*
 	 * OK - migrate IRQs away from this CPU
 	 */
-	migrate_irqs();
+	irq_migrate_all_off_this_cpu();
 
 	/*
 	 * Flush user cache and TLB mappings, and then remove this CPU
-- 
2.19.1


  parent reply	other threads:[~2019-03-13 19:13 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-13 19:12 [PATCH AUTOSEL 4.19 01/48] clk: sunxi-ng: v3s: Fix TCON reset de-assert bit Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 02/48] kallsyms: Handle too long symbols in kallsyms.c Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 03/48] clk: sunxi: A31: Fix wrong AHB gate number Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 04/48] esp: Skip TX bytes accounting when sending from a request socket Sasha Levin
2019-03-13 19:12 ` Sasha Levin [this message]
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 06/48] bpf: only adjust gso_size on bytestream protocols Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 07/48] bpf: fix lockdep false positive in stackmap Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 08/48] af_key: unconditionally clone on broadcast Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 09/48] ARM: 8835/1: dma-mapping: Clear DMA ops on teardown Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 10/48] assoc_array: Fix shortcut creation Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 11/48] keys: Fix dependency loop between construction record and auth key Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 12/48] scsi: libiscsi: Fix race between iscsi_xmit_task and iscsi_complete_task Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 13/48] net: systemport: Fix reception of BPDUs Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 14/48] net: dsa: bcm_sf2: Do not assume DSA master supports WoL Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 15/48] pinctrl: meson: meson8b: fix the sdxc_a data 1..3 pins Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 16/48] qmi_wwan: apply SET_DTR quirk to Sierra WP7607 Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 17/48] net: mv643xx_eth: disable clk on error path in mv643xx_eth_shared_probe() Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 18/48] xfrm: Fix inbound traffic via XFRM interfaces across network namespaces Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 19/48] mailbox: bcm-flexrm-mailbox: Fix FlexRM ring flush timeout issue Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 20/48] ASoC: topology: free created components in tplg load error Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 21/48] qed: Fix iWARP buffer size provided for syn packet processing Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 22/48] qed: Fix iWARP syn packet mac address validation Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 23/48] ARM: dts: armada-xp: fix Armada XP boards NAND description Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 24/48] arm64: Relax GIC version check during early boot Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 25/48] ARM: tegra: Restore DT ABI on Tegra124 Chromebooks Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 26/48] net: marvell: mvneta: fix DMA debug warning Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 27/48] kasan, slub: move kasan_poison_slab hook before page_address Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 28/48] mm: handle lru_add_drain_all for UP properly Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 29/48] tmpfs: fix link accounting when a tmpfile is linked in Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 30/48] kasan, slab: fix conflicts with CONFIG_HARDENED_USERCOPY Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 31/48] kasan, slab: make freelist stored without tags Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 32/48] ixgbe: fix older devices that do not support IXGBE_MRQC_L3L4TXSWEN Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 33/48] ARCv2: lib: memcpy: fix doing prefetchw outside of buffer Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 34/48] ARC: uacces: remove lp_start, lp_end from clobber list Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 35/48] ARCv2: support manual regfile save on interrupts Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 36/48] ARCv2: don't assume core 0x54 has dual issue Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 37/48] phonet: fix building with clang Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 38/48] mac80211_hwsim: propagate genlmsg_reply return code Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 39/48] bpf, lpm: fix lookup bug in map_delete_elem Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 40/48] net: thunderx: make CFG_DONE message to run through generic send-ack sequence Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 41/48] net: thunderx: add nicvf_send_msg_to_pf result check for set_rx_mode_task Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 42/48] nfp: bpf: fix code-gen bug on BPF_ALU | BPF_XOR | BPF_K Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 43/48] nfp: bpf: fix ALU32 high bits clearance bug Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 44/48] bnxt_en: Fix typo in firmware message timeout logic Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 45/48] bnxt_en: Wait longer for the firmware message response to complete Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 46/48] mdio_bus: Fix use-after-free on device_register fails Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 47/48] net: set static variable an initial value in atl2_probe() Sasha Levin
2019-03-13 19:12 ` [PATCH AUTOSEL 4.19 48/48] selftests: fib_tests: sleep after changing carrier. again Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190313191250.158955-5-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=dietmar.eggemann@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rmk+kernel@armlinux.org.uk \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).