Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp596029img; Fri, 22 Mar 2019 04:49:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqy53ZD1Ixmrc69mluqGTc97nlmMuGp5rtQPMuR3bnpaiq9f7hZz3pSubJ50uvCQwnhXNATy X-Received: by 2002:a62:59cb:: with SMTP id k72mr8962010pfj.111.1553255395641; Fri, 22 Mar 2019 04:49:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553255395; cv=none; d=google.com; s=arc-20160816; b=cISBuAdh2JGyGts4I+TOKrIurBuNPi94rJb/tTS6bSuFg91suZV3HVOowdW8Rhsv17 AUwW3texUpaoTiXpqjFbX8damRfnk4aetu9NQ5XyF920mpTsfIeYsumIst4WhZi4hC4K GnCBS3Z0uBtbxrDM6BKeWfZnQWj0bA8J2zTuK4jytfF7hJY3r771fg0iy4SHtY3VF6Mw Hb6m/qTnwf7XmjhDwKG7+g0IsH72HTNCSQnnLNqKP6xDlC4Jy7UYyIEEFwr0YTMlOc0X H/Coky8ETi+WavP6id8dE04egl4sLhDrNybOXRLSFUVp+wt1zfh6Uu5Ley30MT/ENtKQ Z9nA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ShrueRAs8DGOW2MKNkh9o+ggfVji342RRuueXT5gvwk=; b=BGTT7v4jQd7QBbMHDfzoQa8KjIc/uJipFCi/RSzrWXAn918jamQl85/jOhht4Hf6o1 H7Kc7qft3HvWeDB+bF+4Ivt32YW/xuxVIkzL2UJ5ORFbtWPMZsjme6CHc2esbhu6wiCy J8EOTE8A/5DGKHCw8UyymVnxGN+BEF/1bs71dz9YpO9xk66/h+lCNvjSRMgk7YzAC0KU 5abEcyRroV8JMGidJsGcjA7gMBlh5ehOo+Y0xoN3AZFsnjCxZHOFNohlChXFk6aso6a6 IZ2ZuMoydnnKJNBGgVfM6HPg5RPhvWlFrWKp0RXnny8+T58uMKeGD5khalkvo03dCdBq mAeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GaupSeUz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z11si6693766pgc.145.2019.03.22.04.49.38; Fri, 22 Mar 2019 04:49:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GaupSeUz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732377AbfCVLs6 (ORCPT + 99 others); Fri, 22 Mar 2019 07:48:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:52396 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731660AbfCVLs4 (ORCPT ); Fri, 22 Mar 2019 07:48:56 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 259752075E; Fri, 22 Mar 2019 11:48:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553255335; bh=IA7wZ7d2N9CCRdbgs0Fil5bdcSPhHWjCvZpkP/QHN+4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GaupSeUzXOy3uBrtvo9Q5+0anA2JD/mO06QjPQHZvvha0dI82d/lRPgdbJ15bo8qw BwnbeW+dq/7pYrTYtU0rQFh3YKAEpA4M8iV28r3LJKYfrU2S9F3/7FDzm54KvwNmgY 7FKzeoMxNhSZ95Ik7IaV5yg4Hgo9mt9A1Cv+QW0Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marc Zyngier , Dietmar Eggemann , Linus Walleij , Russell King , Sasha Levin Subject: [PATCH 4.14 040/183] ARM: 8824/1: fix a migrating irq bug when hotplug cpu Date: Fri, 22 Mar 2019 12:14:28 +0100 Message-Id: <20190322111244.626791208@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190322111241.819468003@linuxfoundation.org> References: <20190322111241.819468003@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ [ 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 Signed-off-by: Dietmar Eggemann Acked-by: Marc Zyngier Reviewed-by: Linus Walleij Signed-off-by: Russell King Signed-off-by: Sasha Levin --- 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 d1346a160760..cf69aab648fb 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1447,6 +1447,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 b6f319606e30..2de321e89b94 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 ece04a457486..5b07c7a31c31 100644 --- a/arch/arm/kernel/irq.c +++ b/arch/arm/kernel/irq.c @@ -31,7 +31,6 @@ #include #include #include -#include #include #include #include @@ -119,64 +118,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 f57333f46242..65f85737c6a2 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