public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* NUMA-Q breakage 5/7 in_interrupt() race
@ 2002-07-12 22:40 William Lee Irwin III
  2002-07-12 22:53 ` William Lee Irwin III
  2002-07-13  8:28 ` William Lee Irwin III
  0 siblings, 2 replies; 4+ messages in thread
From: William Lee Irwin III @ 2002-07-12 22:40 UTC (permalink / raw)
  To: linux-kernel; +Cc: rml

On smaller machines, bootstrapping proceeds far enough to see races
in kmaps near generic_file_read() etc. This is precisely the
in_interrupt() BUG(), but it's quite clear this is happening in
process context. Not even the smaller machines can survive this.
That is, it is impossible to run at all without it (or an equivalent).

Robert, please apply.


Thanks,
Bill


===== include/asm-i386/hardirq.h 1.7 vs edited =====
--- 1.7/include/asm-i386/hardirq.h	Mon May 20 10:51:17 2002
+++ edited/include/asm-i386/hardirq.h	Thu Jul 11 19:51:02 2002
@@ -22,8 +22,24 @@
  * Are we in an interrupt context? Either doing bottom half
  * or hardware interrupt processing?
  */
-#define in_interrupt() ({ int __cpu = smp_processor_id(); \
-	(local_irq_count(__cpu) + local_bh_count(__cpu) != 0); })
+static inline int in_interrupt(void)
+{
+	int total_count, retval, cpu;
+
+	preempt_disable();
+	cpu = smp_processor_id();
+
+	total_count = local_irq_count(cpu) + local_bh_count(cpu);
+
+	if (total_count)
+		retval = 1;
+	else
+		retval = 0;
+
+	preempt_disable();
+
+	return retval;
+}
 
 #define in_irq() (local_irq_count(smp_processor_id()) != 0)
 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: NUMA-Q breakage 5/7 in_interrupt() race
  2002-07-12 22:40 NUMA-Q breakage 5/7 in_interrupt() race William Lee Irwin III
@ 2002-07-12 22:53 ` William Lee Irwin III
  2002-07-12 23:02   ` Thunder from the hill
  2002-07-13  8:28 ` William Lee Irwin III
  1 sibling, 1 reply; 4+ messages in thread
From: William Lee Irwin III @ 2002-07-12 22:53 UTC (permalink / raw)
  To: linux-kernel, rml

On Fri, Jul 12, 2002 at 03:40:03PM -0700, William Lee Irwin III wrote:
> On smaller machines, bootstrapping proceeds far enough to see races
> in kmaps near generic_file_read() etc. This is precisely the
> in_interrupt() BUG(), but it's quite clear this is happening in
> process context. Not even the smaller machines can survive this.
> That is, it is impossible to run at all without it (or an equivalent).
> Robert, please apply.

Argh, I forgot to credit Rusty Russell (and possibly also Paul Mackerras)
with originally discovering & fixing this.


Cheers,
Bill

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: NUMA-Q breakage 5/7 in_interrupt() race
  2002-07-12 22:53 ` William Lee Irwin III
@ 2002-07-12 23:02   ` Thunder from the hill
  0 siblings, 0 replies; 4+ messages in thread
From: Thunder from the hill @ 2002-07-12 23:02 UTC (permalink / raw)
  To: William Lee Irwin III; +Cc: linux-kernel, rml

Hi,

On Fri, 12 Jul 2002, William Lee Irwin III wrote:
> Argh, I forgot to credit Rusty Russell (and possibly also Paul Mackerras)
> with originally discovering & fixing this.

While we're on it, thanks from me, too.

							Regards,
							Thunder
-- 
(Use http://www.ebb.org/ungeek if you can't decode)
------BEGIN GEEK CODE BLOCK------
Version: 3.12
GCS/E/G/S/AT d- s++:-- a? C++$ ULAVHI++++$ P++$ L++++(+++++)$ E W-$
N--- o?  K? w-- O- M V$ PS+ PE- Y- PGP+ t+ 5+ X+ R- !tv b++ DI? !D G
e++++ h* r--- y- 
------END GEEK CODE BLOCK------


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: NUMA-Q breakage 5/7 in_interrupt() race
  2002-07-12 22:40 NUMA-Q breakage 5/7 in_interrupt() race William Lee Irwin III
  2002-07-12 22:53 ` William Lee Irwin III
@ 2002-07-13  8:28 ` William Lee Irwin III
  1 sibling, 0 replies; 4+ messages in thread
From: William Lee Irwin III @ 2002-07-13  8:28 UTC (permalink / raw)
  To: linux-kernel, rml

> ===== include/asm-i386/hardirq.h 1.7 vs edited =====
> +	preempt_disable();
> +
> +	return retval;
> +}

Not sure how it survived running. That should be a preempt_enable() on
the way out. Maybe I should have used the get_cpu()/put_cpu() stuff.

Amended patch follows.


Cheers,
Bill


===== include/asm-i386/hardirq.h 1.7 vs edited =====
--- 1.7/include/asm-i386/hardirq.h	Mon May 20 10:51:17 2002
+++ edited/include/asm-i386/hardirq.h	Thu Jul 11 19:51:02 2002
@@ -22,8 +22,24 @@
  * Are we in an interrupt context? Either doing bottom half
  * or hardware interrupt processing?
  */
-#define in_interrupt() ({ int __cpu = smp_processor_id(); \
-	(local_irq_count(__cpu) + local_bh_count(__cpu) != 0); })
+static inline int in_interrupt(void)
+{
+	int total_count, retval, cpu;
+
+	preempt_disable();
+	cpu = smp_processor_id();
+
+	total_count = local_irq_count(cpu) + local_bh_count(cpu);
+
+	if (total_count)
+		retval = 1;
+	else
+		retval = 0;
+
+	preempt_enable();
+
+	return retval;
+}
 
 #define in_irq() (local_irq_count(smp_processor_id()) != 0)
 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-07-13  8:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-07-12 22:40 NUMA-Q breakage 5/7 in_interrupt() race William Lee Irwin III
2002-07-12 22:53 ` William Lee Irwin III
2002-07-12 23:02   ` Thunder from the hill
2002-07-13  8:28 ` William Lee Irwin III

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox