lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 22 Jun 2017 09:58:23 -0700
From:   tip-bot for Thomas Gleixner <tipbot@...or.com>
To:     linux-tip-commits@...r.kernel.org
Cc:     hpa@...or.com, marc.zyngier@....com, tglx@...utronix.de,
        linux-kernel@...r.kernel.org, peterz@...radead.org,
        mpe@...erman.id.au, hch@....de, axboe@...nel.dk,
        keith.busch@...el.com, mingo@...nel.org
Subject: [tip:irq/core] x86/irq: Use irq_migrate_all_off_this_cpu()

Commit-ID:  ad7a929fa4bb1143357aa83043a149d5c27c68fd
Gitweb:     http://git.kernel.org/tip/ad7a929fa4bb1143357aa83043a149d5c27c68fd
Author:     Thomas Gleixner <tglx@...utronix.de>
AuthorDate: Tue, 20 Jun 2017 01:37:33 +0200
Committer:  Thomas Gleixner <tglx@...utronix.de>
CommitDate: Thu, 22 Jun 2017 18:21:18 +0200

x86/irq: Use irq_migrate_all_off_this_cpu()

The generic migration code supports all the required features
already. Remove the x86 specific implementation and use the generic one.

Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Cc: Jens Axboe <axboe@...nel.dk>
Cc: Marc Zyngier <marc.zyngier@....com>
Cc: Michael Ellerman <mpe@...erman.id.au>
Cc: Keith Busch <keith.busch@...el.com>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Christoph Hellwig <hch@....de>
Link: http://lkml.kernel.org/r/20170619235445.851311033@linutronix.de

---
 arch/x86/Kconfig      |  1 +
 arch/x86/kernel/irq.c | 89 ++-------------------------------------------------
 2 files changed, 3 insertions(+), 87 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 0efb4c9..fcf1dad 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -87,6 +87,7 @@ config X86
 	select GENERIC_EARLY_IOREMAP
 	select GENERIC_FIND_FIRST_BIT
 	select GENERIC_IOMAP
+	select GENERIC_IRQ_MIGRATION		if SMP
 	select GENERIC_IRQ_PROBE
 	select GENERIC_IRQ_SHOW
 	select GENERIC_PENDING_IRQ		if SMP
diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c
index 78bd2b8..4aa03c5 100644
--- a/arch/x86/kernel/irq.c
+++ b/arch/x86/kernel/irq.c
@@ -432,95 +432,12 @@ int check_irq_vectors_for_cpu_disable(void)
 /* A cpu has been removed from cpu_online_mask.  Reset irq affinities. */
 void fixup_irqs(void)
 {
-	unsigned int irq, vector;
+	unsigned int irr, vector;
 	struct irq_desc *desc;
 	struct irq_data *data;
 	struct irq_chip *chip;
-	int ret;
 
-	for_each_irq_desc(irq, desc) {
-		const struct cpumask *affinity;
-		bool break_affinity = false;
-
-		if (!desc)
-			continue;
-
-		/* interrupt's are disabled at this point */
-		raw_spin_lock(&desc->lock);
-
-		data = irq_desc_get_irq_data(desc);
-		chip = irq_data_get_irq_chip(data);
-		/*
-		 * The interrupt descriptor might have been cleaned up
-		 * already, but it is not yet removed from the radix
-		 * tree. If the chip does not have an affinity setter,
-		 * nothing to do here.
-		 */
-		if (!chip && !chip->irq_set_affinity) {
-			raw_spin_unlock(&desc->lock);
-			continue;
-		}
-
-		affinity = irq_data_get_affinity_mask(data);
-
-		if (!irq_has_action(irq) || irqd_is_per_cpu(data) ||
-		    cpumask_subset(affinity, cpu_online_mask)) {
-			irq_fixup_move_pending(desc, false);
-			raw_spin_unlock(&desc->lock);
-			continue;
-		}
-
-		/*
-		 * Complete an eventually pending irq move cleanup. If this
-		 * interrupt was moved in hard irq context, then the
-		 * vectors need to be cleaned up. It can't wait until this
-		 * interrupt actually happens and this CPU was involved.
-		 */
-		irq_force_complete_move(desc);
-
-		/*
-		 * If there is a setaffinity pending, then try to reuse the
-		 * pending mask, so the last change of the affinity does
-		 * not get lost. If there is no move pending or the pending
-		 * mask does not contain any online CPU, use the current
-		 * affinity mask.
-		 */
-		if (irq_fixup_move_pending(desc, true))
-			affinity = desc->pending_mask;
-
-		/*
-		 * If the mask does not contain an offline CPU, break
-		 * affinity and use cpu_online_mask as fall back.
-		 */
-		if (cpumask_any_and(affinity, cpu_online_mask) >= nr_cpu_ids) {
-			broke_affinity = true;
-			affinity = cpu_online_mask;
-		}
-
-		if (!irqd_can_move_in_process_context(data) && chip->irq_mask)
-			chip->irq_mask(data);
-
-		ret = chip->irq_set_affinity(data, affinity, true);
-		if (ret) {
-			pr_crit("IRQ %u: Force affinity failed (%d)\n",
-				d->irq, ret);
-			broke_affinity = false;
-		}
-
-		/*
-		 * We unmask if the irq was not marked masked by the
-		 * core code. That respects the lazy irq disable
-		 * behaviour.
-		 */
-		if (!irqd_can_move_in_process_context(data) &&
-		    !irqd_irq_masked(data) && chip->irq_unmask)
-			chip->irq_unmask(data);
-
-		raw_spin_unlock(&desc->lock);
-
-		if (broke_affinity)
-			pr_notice("Broke affinity for irq %i\n", irq);
-	}
+	irq_migrate_all_off_this_cpu();
 
 	/*
 	 * We can remove mdelay() and then send spuriuous interrupts to
@@ -539,8 +456,6 @@ void fixup_irqs(void)
 	 * nothing else will touch it.
 	 */
 	for (vector = FIRST_EXTERNAL_VECTOR; vector < NR_VECTORS; vector++) {
-		unsigned int irr;
-
 		if (IS_ERR_OR_NULL(__this_cpu_read(vector_irq[vector])))
 			continue;
 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ