Re: [PATCH] 2nd try: i386 rw_semaphores fix

2001-04-12 Thread Jamie Lokier
Linus Torvalds wrote: > > > On Wed, 11 Apr 2001, Bernd Schmidt wrote: > See? Do you see why a "memory" clobber is _not_ comparable to a "ax" > clobber? And why that non-comparability makes a memory clobber equivalent > to a read-modify-write cycle? I had to think about this, so I'll explain it

Re: [PATCH] 2nd try: i386 rw_semaphores fix

2001-04-12 Thread Jamie Lokier
Linus Torvalds wrote: On Wed, 11 Apr 2001, Bernd Schmidt wrote: See? Do you see why a "memory" clobber is _not_ comparable to a "ax" clobber? And why that non-comparability makes a memory clobber equivalent to a read-modify-write cycle? I had to think about this, so I'll explain it a

Re: [PATCH] 2nd try: i386 rw_semaphores fix

2001-04-11 Thread Linus Torvalds
On Wed, 11 Apr 2001, Bernd Schmidt wrote: > > > > The example in there compiles out-of-the box and is much easier to > > experiment on than the whole kernel :-) > > That example seems to fail because a "memory" clobber only tells the compiler > that memory is written, not that it is read. The

Re: [PATCH] 2nd try: i386 rw_semaphores fix

2001-04-11 Thread Bernd Schmidt
On Wed, 11 Apr 2001, Andreas Franck wrote: > Hello David, > > > I've been discussing it with some other kernel and GCC people, and they > > think > > that only "memory" is required. > > Hmm.. I just looked at my GCC problem report from December, perhaps you're > interested, too: > >

Re: [PATCH] 2nd try: i386 rw_semaphores fix

2001-04-11 Thread Andreas Franck
Hello David, > I've been discussing it with some other kernel and GCC people, and they > think > that only "memory" is required. Hmm.. I just looked at my GCC problem report from December, perhaps you're interested, too: http://gcc.gnu.org/ml/gcc-bugs/2000-12/msg00554.html The example in

Re: [PATCH] 2nd try: i386 rw_semaphores fix

2001-04-11 Thread David Howells
I've been discussing it with some other kernel and GCC people, and they think that only "memory" is required. > What are the reasons against mentioning sem->count directly as a "=m" > reference? This makes the whole thing less fragile and no more dependent > on the memory layout of the

Re: [PATCH] 2nd try: i386 rw_semaphores fix

2001-04-11 Thread Andreas Franck
Hello David and people, > I've just consulted with one of the gcc people we have here, and he says > that > the '"memory"' constraint should do the trick. > > Do I take it that that is actually insufficient? I don't remember exactly, it's been a while, but I think it was not sufficient when I

Re: [PATCH] 2nd try: i386 rw_semaphores fix

2001-04-11 Thread David Howells
> I'd like you to look over it. It seems newer GCC's (snapshots and the > upcoming 3.0) will be more strict when modifying some values through > assembler-passed pointers - in this case, the passed semaphore structure got > freed too early, causing massive stack corruption on early bootup. > >

[PATCH] 2nd try: i386 rw_semaphores fix

2001-04-11 Thread David Howells
Here's the RW semaphore patch again (rwsem2.diff) with a fallback to spinlocks if XADD/CMPXCHG aren't available. I've put the two implementations in separate headers as suggested. David diff -uNr linux-2.4.3/arch/i386/config.in linux/arch/i386/config.in --- linux-2.4.3/arch/i386/config.in

[PATCH] 2nd try: i386 rw_semaphores fix

2001-04-11 Thread David Howells
Here's the RW semaphore patch again (rwsem2.diff) with a fallback to spinlocks if XADD/CMPXCHG aren't available. I've put the two implementations in separate headers as suggested. David diff -uNr linux-2.4.3/arch/i386/config.in linux/arch/i386/config.in --- linux-2.4.3/arch/i386/config.in

Re: [PATCH] 2nd try: i386 rw_semaphores fix

2001-04-11 Thread David Howells
I'd like you to look over it. It seems newer GCC's (snapshots and the upcoming 3.0) will be more strict when modifying some values through assembler-passed pointers - in this case, the passed semaphore structure got freed too early, causing massive stack corruption on early bootup. The

Re: [PATCH] 2nd try: i386 rw_semaphores fix

2001-04-11 Thread Andreas Franck
Hello David and people, I've just consulted with one of the gcc people we have here, and he says that the '"memory"' constraint should do the trick. Do I take it that that is actually insufficient? I don't remember exactly, it's been a while, but I think it was not sufficient when I came

Re: [PATCH] 2nd try: i386 rw_semaphores fix

2001-04-11 Thread David Howells
I've been discussing it with some other kernel and GCC people, and they think that only "memory" is required. What are the reasons against mentioning sem-count directly as a "=m" reference? This makes the whole thing less fragile and no more dependent on the memory layout of the structure.

Re: [PATCH] 2nd try: i386 rw_semaphores fix

2001-04-11 Thread Andreas Franck
Hello David, I've been discussing it with some other kernel and GCC people, and they think that only "memory" is required. Hmm.. I just looked at my GCC problem report from December, perhaps you're interested, too: http://gcc.gnu.org/ml/gcc-bugs/2000-12/msg00554.html The example in there

Re: [PATCH] 2nd try: i386 rw_semaphores fix

2001-04-11 Thread Bernd Schmidt
On Wed, 11 Apr 2001, Andreas Franck wrote: Hello David, I've been discussing it with some other kernel and GCC people, and they think that only "memory" is required. Hmm.. I just looked at my GCC problem report from December, perhaps you're interested, too:

Re: [PATCH] 2nd try: i386 rw_semaphores fix

2001-04-11 Thread Linus Torvalds
On Wed, 11 Apr 2001, Bernd Schmidt wrote: The example in there compiles out-of-the box and is much easier to experiment on than the whole kernel :-) That example seems to fail because a "memory" clobber only tells the compiler that memory is written, not that it is read. The above