Re: [PATCH] i386 rw_semaphores fix

From: David Howells (dhowells@cambridge.redhat.com)
Date: Wed Apr 11 2001 - 12:36:23 EST


Andrew Morton wrote:
> I think that's a very good approach. Sure, it's suboptimal when there
> are three or more waiters (and they're the right type and order). But
> that never happens. Nice design idea.

Cheers.

> These numbers are infinity :)

I know, but I think Linus may be happy with the resolution for the moment. It
can be extended later by siphoning off excess quantities of waiters into a
separate counter (as is done now) and by making the access count use a larger
part of the variable.

Unfortunately, managing the count and siphoned-off count together is tricky.

> You need sterner testing stuff :) I hit the BUG at the end of rwsem_wake()
> in about a second running rwsem-4. Removed the BUG and everything stops
> in D state.
>
> Grab rwsem-4 from
> ...

Will do.

> It's very simple. But running fully in-kernel shortens the
> code paths enormously and allows you to find those little
> timing windows.

I thought I'd got them all by using an activity counter incremented by both
read and write lockers.

> - rwsemdebug(FMT, ...) doesn't compile with egcs-1.1.2. Need
> to remove the comma.

This is tricky... you get all sorts of horrible warnings with gcc-2.96 if you
remove the comma. What I've done is now ANSI-C99 compliant, but egcs is not.

> - The comments in down_write and down_read() are inaccurate.
> RWSEM_ACTIVE_WRITE_BIAS is 0xffff0001, not 0x00010001

Done.

> - It won't compile when WAITQUEUE_DEBUG is turned on. I
> guess you knew that.

Currently putting in separate debugging stuff for rwsems.

> - The comments above the functions in semaphore.h need
> updating.

Done. (BTW in the latest patch, they're actually split out into separate
header files as per Linus's suggestion).

> - What on earth does __xg() do? (And why do people write
> code like that without explaining why? Don't answer this
> one).

Stolen from the xchg() macro/function, but I'm not sure what it does. Plus I
don't use it now.

> - Somewhat offtopic: the `asm' statements in semaphore.c
> are really dangerous.

Now all got .text in.

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



This archive was generated by hypermail 2b29 : Sun Apr 15 2001 - 21:00:16 EST