2007-05-03 19:13:49

by Tim Bird

[permalink] [raw]
Subject: Re: v2.6.21-rt1 - bug in asm-mips/atomic.h

Ingo Molnar wrote:
> i have released the v2.6.20-rt1 kernel...
Ingo,

There appears to be a bug in the patch for include/asm-mips/atomic.h
In the hunk for line 554, it has 2 #endifs.
I think it should only have one.

A portion of the patch reads:

Index: new-linux/include/asm-mips/atomic.h
===================================================================
--- new-linux.orig/include/asm-mips/atomic.h 2007-04-25 20:08:32.000000000 -0700
+++ new-linux/include/asm-mips/atomic.h 2007-04-26 16:15:14.000000000 -0700
@@ -545,7 +554,9 @@
: "=&r" (result), "=&r" (temp), "=m" (v->counter)
: "Ir" (i), "m" (v->counter)
: "memory");
- } else {
+ }
+#if !defined(CONFIG_NO_SPINLOCK) && !defined(CONFIG_PREEMPT_RT)
+ else {
unsigned long flags;

raw_local_irq_save(flags);
@@ -554,6 +565,8 @@
v->counter = result;
raw_local_irq_restore(flags);
}
+#endif
+#endif

smp_mb();


When I applied the patch to 2.6.21 and tried to compile for MIPS I got:
CHK include/linux/utsrelease.h
CC arch/mips/kernel/asm-offsets.s
In file included from /home/tbird/work/alp-3.0/alp-linux/include/linux/rt_lock.h:14,
from /home/tbird/work/alp-3.0/alp-linux/include/linux/spinlock.h:116,
from /home/tbird/work/alp-3.0/alp-linux/include/linux/capability.h:45,
from /home/tbird/work/alp-3.0/alp-linux/include/linux/sched.h:47,
from /home/tbird/work/alp-3.0/alp-linux/arch/mips/kernel/asm-offsets.c:14:
include2/asm/atomic.h:571: error: expected '(' before 'volatile'
include2/asm/atomic.h:573: error: expected identifier or '(' before 'return'
include2/asm/atomic.h:574: error: expected identifier or '(' before '}' token
include2/asm/atomic.h:576: error: expected declaration specifiers or '...' before 'atomic64_t'
include2/asm/atomic.h: In function 'atomic64_sub_return':
include2/asm/atomic.h:593: error: 'v' undeclared (first use in this function)
include2/asm/atomic.h:593: error: (Each undeclared identifier is reported only once
include2/asm/atomic.h:593: error: for each function it appears in.)
include2/asm/atomic.h:585: error: invalid lvalue in asm output 2
include2/asm/atomic.h:585: error: memory input 4 is not directly addressable
include2/asm/atomic.h:599: error: invalid lvalue in asm output 2
include2/asm/atomic.h:599: error: memory input 4 is not directly addressable
include2/asm/atomic.h: At top level:
include2/asm/atomic.h:638: error: expected declaration specifiers or '...' before 'atomic64_t'
include2/asm/atomic.h: In function 'atomic64_sub_if_positive':
include2/asm/atomic.h:659: error: 'v' undeclared (first use in this function)
include2/asm/atomic.h:647: error: invalid lvalue in asm output 2
include2/asm/atomic.h:647: error: memory input 4 is not directly addressable
include2/asm/atomic.h:665: error: invalid lvalue in asm output 2
include2/asm/atomic.h:665: error: memory input 4 is not directly addressable
In file included from /home/tbird/work/alp-3.0/alp-linux/include/linux/rt_lock.h:14,
from /home/tbird/work/alp-3.0/alp-linux/include/linux/spinlock.h:116,
from /home/tbird/work/alp-3.0/alp-linux/include/linux/capability.h:45,
from /home/tbird/work/alp-3.0/alp-linux/include/linux/sched.h:47,
from /home/tbird/work/alp-3.0/alp-linux/arch/mips/kernel/asm-offsets.c:14:
include2/asm/atomic.h:779:2: error: #endif without #if

After removing the second #endif in the second hunk above, things compiled better.
-- Tim

=============================
Tim Bird
Architecture Group Chair, CE Linux Forum
Senior Staff Engineer, Sony Electronics
=============================


2007-05-03 19:33:01

by Tim Bird

[permalink] [raw]
Subject: Re: v2.6.21-rt1 - mips compile bugs

Ingo Molnar wrote:
> i have released the v2.6.20-rt1 kernel...

There was also a problem with the patch for arch/mips/kernel/entry.S
Some kind of cruft was in the patch.

Below is a patch which fixes both issues. It at least allows compilation.
I haven't turned anything on, or looked at runtime yet.

Index: alp-linux/arch/mips/kernel/entry.S
===================================================================
--- alp-linux.orig/arch/mips/kernel/entry.S 2007-05-03 12:28:38.000000000 -0700
+++ alp-linux/arch/mips/kernel/entry.S 2007-05-03 12:21:47.000000000 -0700
@@ -21,8 +21,6 @@
#endif

#ifndef CONFIG_PREEMPT
-<<<<<<< delete local_irq_disable
- raw_local_irq_disable
#define resume_kernel restore_all
#else
#define __ret_from_irq ret_from_exception
@@ -32,7 +30,7 @@
.align 5
#ifndef CONFIG_PREEMPT
FEXPORT(ret_from_exception)
- local_irq_disable # preempt stop
+ raw_local_irq_disable # preempt stop
b __ret_from_irq
#endif
FEXPORT(ret_from_irq)
Index: alp-linux/include/asm-mips/atomic.h
===================================================================
--- alp-linux.orig/include/asm-mips/atomic.h 2007-05-03 12:28:38.000000000 -0700
+++ alp-linux/include/asm-mips/atomic.h 2007-05-03 11:56:58.000000000 -0700
@@ -566,7 +566,6 @@
raw_local_irq_restore(flags);
}
#endif
-#endif

smp_mb();


=============================
Tim Bird
Architecture Group Chair, CE Linux Forum
Senior Staff Engineer, Sony Electronics
=============================