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>] [day] [month] [year] [list]
Date:	Sun, 31 Jul 2011 11:04:18 +0800
From:	Hillf Danton <dhillf@...il.com>
To:	Ralf Baechle <ralf@...ux-mips.org>,
	LKML <linux-kernel@...r.kernel.org>
Subject: [RFC PATCH] MIPS/octeon: select online CPU for irq

The tiny probability of dead loop is removed if all bound CPUs of given irq go
offline, and selected CPU is always checked to be online.

Signed-off-by: Hillf Danton <dhillf@...il.com>
---
 arch/mips/cavium-octeon/octeon-irq.c |   32 +++++++++++---------------------
 1 files changed, 11 insertions(+), 21 deletions(-)

diff --git a/arch/mips/cavium-octeon/octeon-irq.c
b/arch/mips/cavium-octeon/octeon-irq.c
index ffd4ae6..7b678e3 100644
--- a/arch/mips/cavium-octeon/octeon-irq.c
+++ b/arch/mips/cavium-octeon/octeon-irq.c
@@ -198,28 +198,18 @@ static void __init octeon_irq_init_core(void)

 static int next_cpu_for_irq(struct irq_data *data)
 {
-
 #ifdef CONFIG_SMP
-	int cpu;
-	int weight = cpumask_weight(data->affinity);
-
-	if (weight > 1) {
-		cpu = smp_processor_id();
-		for (;;) {
-			cpu = cpumask_next(cpu, data->affinity);
-			if (cpu >= nr_cpu_ids) {
-				cpu = -1;
-				continue;
-			} else if (cpumask_test_cpu(cpu, cpu_online_mask)) {
-				break;
-			}
-		}
-	} else if (weight == 1) {
-		cpu = cpumask_first(data->affinity);
-	} else {
-		cpu = smp_processor_id();
-	}
-	return cpu;
+	int cpu = smp_processor_id();
+
+	cpu = cpumask_next_and(cpu, data->affinity, cpu_online_mask);
+	if (cpu < nr_cpu_ids)
+		return cpu;
+
+	cpu = cpumask_first_and(data->affinity, cpu_online_mask);
+	if (cpu < nr_cpu_ids)
+		return cpu;
+
+	return smp_processor_id();
 #else
 	return smp_processor_id();
 #endif
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ