public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: William Lee Irwin III <wli@holomorphy.com>
To: Rusty Russell <rusty@rustcorp.com.au>,
	"David S. Miller" <davem@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] cpumask_t
Date: Sun, 19 Jan 2003 14:43:29 -0800	[thread overview]
Message-ID: <20030119224329.GI780@holomorphy.com> (raw)
In-Reply-To: <20030119221852.GC789@holomorphy.com>

On Sun, Jan 19, 2003 at 02:18:52PM -0800, William Lee Irwin III wrote:
> This is just broken anyway. And fixing it isn't as obvious as just


Fix up several obvious stupidities. Atop the prior patch:

 arch/i386/kernel/irq.c  |    2 +-
 arch/i386/kernel/smp.c  |    7 +++++--
 include/linux/cpumask.h |    6 +++---
 3 files changed, 9 insertions(+), 6 deletions(-)


diff -urpN cpu-2.5.59-1/arch/i386/kernel/irq.c cpu-2.5.59-2/arch/i386/kernel/irq.c
--- cpu-2.5.59-1/arch/i386/kernel/irq.c	2003-01-19 13:27:24.000000000 -0800
+++ cpu-2.5.59-2/arch/i386/kernel/irq.c	2003-01-19 14:30:24.000000000 -0800
@@ -873,7 +873,7 @@ static int irq_affinity_write_proc (stru
 	 * one online CPU still has to be targeted.
 	 */
 	cpus_and(tmp, new_value, cpu_online_map);
-	if (!any_online_cpu(tmp))
+	if (!any_online_cpu(tmp) >= NR_CPUS)
 		return -EINVAL;
 
 	irq_affinity[irq] = new_value;
diff -urpN cpu-2.5.59-1/arch/i386/kernel/smp.c cpu-2.5.59-2/arch/i386/kernel/smp.c
--- cpu-2.5.59-1/arch/i386/kernel/smp.c	2003-01-19 12:23:52.000000000 -0800
+++ cpu-2.5.59-2/arch/i386/kernel/smp.c	2003-01-19 14:34:40.000000000 -0800
@@ -331,8 +331,9 @@ asmlinkage void smp_invalidate_interrupt
 			leave_mm(cpu);
 	}
 	ack_APIC_irq();
+	smp_mb__before_clear_bit();
 	cpu_clear(cpu, flush_cpumask);
-
+	smp_mb__after_clear_bit();
 out:
 	put_cpu_no_resched();
 }
@@ -370,6 +371,7 @@ static void flush_tlb_others(cpumask_t c
 	 * atomic_set_mask(cpumask, &flush_cpumask);
 	 */
 	flush_cpumask = cpumask;
+	mb();
 	/*
 	 * We have to send the IPI only to
 	 * CPUs affected.
@@ -377,7 +379,8 @@ static void flush_tlb_others(cpumask_t c
 	send_IPI_mask(cpumask, INVALIDATE_TLB_VECTOR);
 
 	while (any_online_cpu(flush_cpumask) < NR_CPUS)
-		/* nothing. lockup detection does not belong here */;
+		/* nothing. lockup detection does not belong here */
+		mb();
 
 	flush_mm = NULL;
 	flush_va = 0;
diff -urpN cpu-2.5.59-1/include/linux/cpumask.h cpu-2.5.59-2/include/linux/cpumask.h
--- cpu-2.5.59-1/include/linux/cpumask.h	2003-01-19 11:53:27.000000000 -0800
+++ cpu-2.5.59-2/include/linux/cpumask.h	2003-01-19 14:40:49.000000000 -0800
@@ -16,7 +16,7 @@ extern cpumask_t cpu_online_map;
 
 #define cpu_online(cpu)		test_bit(cpu, cpu_online_map.mask)
 #define num_online_cpus()	bitmap_weight(cpu_online_map.mask, NR_CPUS)
-#define any_online_cpu(map)	find_first_zero_bit((map).mask, NR_CPUS)
+#define any_online_cpu(map)	find_first_bit((map).mask, NR_CPUS)
 
 #define cpu_set(cpu, map)		set_bit(cpu, (map).mask)
 #define cpu_clear(cpu, map)		clear_bit(cpu, (map).mask)
@@ -26,8 +26,8 @@ extern cpumask_t cpu_online_map;
 #define cpus_and(dst,src1,src2)	bitmap_and((dst).mask,(src1).mask, (src2).mask, NR_CPUS)
 #define cpus_or(dst,src1,src2)	bitmap_or((dst).mask, (src1).mask, (src2).mask, NR_CPUS)
 #define cpus_equal(map1, map2)	bitmap_equal((map1).mask, (map2).mask, NR_CPUS)
-#define first_cpu(map)		find_first_zero_bit((map).mask, NR_CPUS)
-#define next_cpu(cpu, map)	find_next_zero_bit((map).mask, NR_CPUS, cpu)
+#define first_cpu(map)		find_first_bit((map).mask, NR_CPUS)
+#define next_cpu(cpu, map)	find_next_bit((map).mask, NR_CPUS, cpu)
 
 static inline int next_online_cpu(int cpu, cpumask_t map)
 {

  reply	other threads:[~2003-01-19 22:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-08  7:39 [PATCH] cpumask_t Rusty Russell
2002-08-08 14:36 ` David S. Miller
2002-08-09  6:04   ` Rusty Russell
2002-08-09 10:10     ` Brad Heilbrun
2003-01-19 21:35     ` William Lee Irwin III
2003-01-19 22:18       ` William Lee Irwin III
2003-01-19 22:43         ` William Lee Irwin III [this message]
2003-01-19 22:54           ` William Lee Irwin III
2003-02-10  7:06             ` William Lee Irwin III
2003-01-20  6:10       ` David S. Miller
2003-01-20  6:32         ` William Lee Irwin III
2003-01-20  6:24           ` David S. Miller

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=20030119224329.GI780@holomorphy.com \
    --to=wli@holomorphy.com \
    --cc=davem@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    /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