Re: SMP and gcc 2.7.2.3 break arch/i386/kernel/time.c (more clues

David Dyck (dcd@tc.fluke.com)
Tue, 7 Dec 1999 23:26:43 -0800 (PST)


I've learned a bit more, and I thought I'd follow up
on myself:

On Tue, 7 Dec 1999, David Dyck wrote:

> using gcc version 2.7.2.3
> and enabled SMP triggers the error

> time.c: In function `do_gettimeofday':
> time.c:262: fixed or forbidden register was spilled.
> This may be due to a compiler bug or to impossible asm
> statements or clauses.

Mike Galbraith <mikeg@weiden.de> posted an earlier patch
which we would agree should not be applied, but it also
points at the problem in

> the macro __build_read_lock_ptr() in include/asm-i386/rwlock.h
>
> #define __build_read_lock_ptr(rw, helper) \
> asm volatile(LOCK "subl $1,(%0)\n\t" \
> "js 2f\n" \
> "1:\n" \
> ".section .text.lock,\"ax\"\n" \
> "2:\tcall " helper "\n\t" \
> "jmp 1b\n" \
> ".previous" \
> ::"a" (rw) : "memory")
>

Since the helper function requires it's argument to
be in ax we can't change the constraint on rw to be "r",
but Mike suggested later that maybe the more of the
helper function could be inlined

In this case when looking at ./arch/i386/kernel/semaphore.c
for the helper function __read_lock_failed
It does appear 'short' enough to inline.

What do you think?

.align 4
.globl __read_lock_failed
__read_lock_failed:
lock ; incl (%eax)
1: cmpl $1,(%eax)
js 1b

lock ; decl (%eax)
js __read_lock_failed
ret

I've really appreciate all the email and comments I've
received about this, hope I'm not bugging anyone too much.

David

PS
I'm still trying to find documentation for .previous
as info "as" (that comes with binutils GNU ld version 2.9.5
(with BFD 2.9.5.0.16) doesn't mention .previous)

Does anyone know where this is (or should be) documented
(Yes, I've seen it mentioned in the assembler sources, but
shouldn't this be documented in info as?)

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/