2003-02-26 05:57:53

by Dave Airlie

[permalink] [raw]
Subject: holding kernel semaphores while in userspace ...


I've two processes that both read/write a shared resource (read via mmap,
write via write) that my device driver controls...

Now I know I could use SYSV semaphores and a shared mem region to
implement read/write semaphores but this seems to me to be a bit
heavyweight - I know I probably want futexes also (but this is 2.4 and I
probably wouldn't get that patch past the people here..)

So I was wondering if I added a couple of ioctls to my driver to wrap
access to a rwsem in the kernel, so four ioctls doing read/write up/down
combinations (are there interruptible versions for rwsems??), or is what
I'm doing stupid and evil .. and should I just be happy with my SYSV
semaphores or just use futexes (do these work acroess processes??)

Dave.

--
David Airlie, Software Engineer
http://www.skynet.ie/~airlied / [email protected]
pam_smb / Linux DecStation / Linux VAX / ILUG person



2003-02-26 20:22:19

by Perez-Gonzalez, Inaky

[permalink] [raw]
Subject: RE: holding kernel semaphores while in userspace ...


> I'm doing stupid and evil .. and should I just be happy with my SYSV
> semaphores or just use futexes (do these work acroess processes??)

They do - I also think RH is porting the futex stuff for NPTL to 2.4 for
their betas, so you might want to check it out (disclaimer: I read this
somewhere in the NPTL mailing list ... go figure :)

I?aky P?rez-Gonz?lez -- Not speaking for Intel -- all opinions are my own
(and my fault)