public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] 4th try: i386 rw_semaphores fix
@ 2001-04-12 21:18 D.W.Howells
  0 siblings, 0 replies; 51+ messages in thread
From: D.W.Howells @ 2001-04-12 21:18 UTC (permalink / raw)
  To: andrewm; +Cc: linux-kernel, dhowells




Andrew Morton wrote:
> It still doesn't compile with gcc-2.91.66 because of the "#define
> rwsemdebug(FMT, ...)" thing. What can we do about this? 

Hmmm... It probably needs to be made conditional on the version of the 
compiler by means of the macros that hold the version numbers.

> I cooked up a few more tests, generally beat the thing 
> up. This code works. Good stuff. I'll do some more testing 
> later this week - put some delays inside the semaphore code 
> itself to stretch the timing windows, but I don't see how 
> it can break it. 

Excellent. I tried to keep it as simple as possible to make it easier to test 
and follow.

> Manfred says the rep;nop should come *before* the memory 
> operation, but I don't know if he's been heard... 

Probably... It's copied directly out of the spinlock stuff. I noticed it at 
the time, but it didn't stick in my memory.

> The spin_lock_irqsave() in up_read/up_write shouldn't be 
> necessary plus it puts the readers onto the 
> waitqueue with add_wait_queue_exclusive, so an up_write 
> will only release one reader.

Not so... have you looked at the new __wait_ctx_common() function? It 
actually ignores the exclusive flag since it uses other criteria as to whom 
to wake. All the add_wait_queue_exclusive() function does is put the process 
on the _back_ of the queue as far as rwsems are concerned.

> Other architectures need work. 
> If they can live with a spinlock in the fastpath, then 
> the code at http://www.uow.edu.au/~andrewm/linux/rw_semaphore.tar.gz 
> is bog-simple and works.

Sorry to pre-empt you, but have you seen my "advanced" patch? I sent it to 
the list in an email with the subject:

	[PATCH] i386 rw_semaphores, general abstraction patch

I added a general fallback implementation with the inline implementation 
functions written wholly in C and using spinlocks.

> Now I think we should specify the API a bit: 

Agreed... I'll think more in it on Tuesday, though... after Easter.

Your points, however, look fairly reasonable.

> Perhaps the writer-wakes-multiple 
> readers stuff isn't happening

It does. Using my test program & module, try:

	driver -5 & sleep 1; driver 100 &

Keep doing "ps", and you'll see all the reader processes jump into the S 
state at the same time, once all the writers have finished. You may need to 
increase the delay between the ups and downs in the module to see it clearly.

David Howells

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

end of thread, other threads:[~2001-04-16 17:32 UTC | newest]

Thread overview: 51+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <3AD0FD0F.9B0C47FD@uow.edu.au>
2001-04-09  3:08 ` rw_semaphores Linus Torvalds
2001-04-09  4:18   ` rw_semaphores Linus Torvalds
2001-04-09 13:55     ` rw_semaphores Ben LaHaise
2001-04-10  2:41   ` rw_semaphores Tachino Nobuhiro
2001-04-10  5:43     ` rw_semaphores Linus Torvalds
2001-04-10  6:33       ` rw_semaphores Tachino Nobuhiro
2001-04-10  7:47       ` rw_semaphores David Howells
2001-04-10 18:02         ` [PATCH] i386 rw_semaphores fix David Howells
2001-04-10 19:42           ` Linus Torvalds
2001-04-10 19:56             ` x86 cpu configuration (was: Re: [PATCH] i386 rw_semaphores fix) Jeff Garzik
2001-04-10 21:58               ` Alan Cox
2001-04-10 20:05             ` [PATCH] i386 rw_semaphores fix Andi Kleen
2001-04-10 20:16               ` Linus Torvalds
2001-04-10 22:00               ` Alan Cox
2001-04-11  0:00                 ` Andi Kleen
2001-04-11  0:13                   ` David Weinehall
2001-04-11  0:20                     ` Andi Kleen
2001-04-11  0:56                       ` David Weinehall
2001-04-11  1:04                         ` Andi Kleen
2001-04-11 12:32                       ` Alan Cox
2001-04-11  0:55                     ` Linus Torvalds
2001-04-11  1:07                       ` Andi Kleen
2001-04-11  1:12                         ` Linus Torvalds
2001-04-11  1:23                           ` Andi Kleen
2001-04-11 12:36                             ` Alan Cox
2001-04-11 18:05                       ` H. Peter Anvin
2001-04-11 12:28                   ` Alan Cox
2001-04-11 18:06                     ` H. Peter Anvin
2001-04-11 22:06                       ` Alan Cox
2001-04-11 22:42                         ` H. Peter Anvin
2001-04-11 22:55                           ` Alan Cox
2001-04-10 21:57             ` Alan Cox
2001-04-11  0:40               ` Tim Wright
2001-04-11  7:38             ` David Howells
2001-04-11 12:24               ` Maciej W. Rozycki
2001-04-11 12:57             ` [PATCH] 2nd try: " David Howells
2001-04-11 16:37               ` [PATCH] 3rd " David Howells
2001-04-11 21:41                 ` [PATCH] 4th " David Howells
2001-04-12 18:16                   ` Andrew Morton
2001-04-11 23:00                 ` [PATCH] 3rd " Anton Blanchard
2001-04-12 15:06                   ` [PATCH] i386 rw_semaphores, general abstraction patch David Howells
2001-04-11 16:56           ` [PATCH] i386 rw_semaphores fix Andrew Morton
2001-04-11 17:36             ` David Howells
2001-04-11 18:41               ` Linus Torvalds
2001-04-11 21:27             ` David Howells
2001-04-16 14:39         ` rw_semaphores yodaiken
2001-04-16 14:56           ` rw_semaphores Alan Cox
2001-04-16 17:05           ` rw_semaphores Linus Torvalds
2001-04-16 17:34             ` rw_semaphores yodaiken
2001-04-16 17:26           ` rw_semaphores Andrew Morton
2001-04-12 21:18 [PATCH] 4th try: i386 rw_semaphores fix D.W.Howells

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