mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hubertus Franke <frankeh@watson.ibm.com>
To: Benjamin LaHaise <bcrl@redhat.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>,
	Linus Torvalds <torvalds@transmeta.com>,
	Rusty Russell <rusty@rustcorp.com.au>,
	mingo@elte.hu, Matthew Kirkwood <matthew@hairy.beasts.org>,
	David Axmark <david@mysql.com>,
	William Lee Irwin III <wli@holomorphy.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Lightweight userspace semaphores...
Date: Mon, 25 Feb 2002 13:23:35 -0500	[thread overview]
Message-ID: <20020225132335.C1163@elinux01.watson.ibm.com> (raw)
In-Reply-To: <Pine.LNX.4.33.0202250808150.3268-100000@home.transmeta.com> <E16fOAO-0005Ml-00@the-village.bc.nu> <20020225113239.A11675@redhat.com>
In-Reply-To: <20020225113239.A11675@redhat.com>; from bcrl@redhat.com on Mon, Feb 25, 2002 at 11:32:40AM -0500

On Mon, Feb 25, 2002 at 11:32:40AM -0500, Benjamin LaHaise wrote:
> On Mon, Feb 25, 2002 at 04:39:56PM +0000, Alan Cox wrote:
> > _alloca
> > mmap
> > 
> > Still fits on the stack 8)
> 
> Are we sure that forcing semaphore overhead to the size of a page is a 
> good idea?  I'd much rather see a sleep/wakeup mechanism akin to wait 
> queues be exported by the kernel so that userspace can implement a rich 
> set of locking functions on top of that in whatever shared memory is 
> being used.
> 
> 		-ben
> -

Amen, I agree Ben. As I indicated in my previous note, one can
implement various versions of spinning, starvation, non-starvation locks
based on the appropriateness for a given app and scenario.
For instance the multiple reader/single writer requires 2 queues.
If as Ben stated something similar to the SysV implementation is desired
where a single lock holds multiple waiting queues, that should be straight
forward to implement. Waiting queues could be allocated on demand as well.

I'd like to see an implementation that facilitate that.
My implementation separates the state to the user level and the 
waiting to the kernel level. There are race conditions that need to 
be resolved with respect to wakeup. They can be all encoded into
the atomic word maintained in shared memory in user space.

For more complex locks I'd like to have compare_and_swap instructions.
As I stated, I have implemented some of the more complicated locks
(spinning, convoy avoidance, etc.) and they have all passed some rigorous
stress test.

As for allocation on the stack. If indeed there are kernel objects
associated with the address, they need to be cleared upon exit from
the issueing subroutine (at least in my implementation).


At this point, could be go through and delineate some of the requirements
first.
E.g.  (a) filedescriptors vs. vaddr
      (b) explicit vs. implicite allocation  
      (c) system call interface vs. device driver
      (d) state management in user space only or in kernel as well
	        i.e. how many are waiting, how many are woken up.
      (e) semaphores only or multiple queues
      (f) protection through an exported handle with some MAGIC or
          through virtual memory access rights
      (g) persistence on mmap or not 

Here is my point of view:
(a) vaddr 
(b) implicite
(c) syscall
(d) user only
(e) multiple queues
(f) virtual memory access rights.
(g) persistent  (if you don't want persistence you remove the underlying object)
	
I requested some input on my original message a couple of weeks regarding 
these points (but only got one on (b)).

Could everybody respond to (a)-(f) for a show of hands.
Could we also consolidate some pointers of the various implementations
that are out there and then see what the pluses and minuses of the various
implementations are  and how they score against (a)-(f).

-- Hubertus Franke


  parent reply	other threads:[~2002-02-25 18:23 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-23  3:47 Rusty Russell
2002-02-23 15:03 ` Ingo Molnar
2002-02-23 18:20   ` Linus Torvalds
2002-02-23 18:28     ` Larry McVoy
2002-02-23 20:31       ` Ingo Molnar
2002-02-23 21:22       ` Alan Cox
2002-02-26 16:09     ` Hubertus Franke
2002-02-24 23:29   ` Rusty Russell
2002-02-24 23:48     ` Linus Torvalds
2002-02-25  1:10       ` Rusty Russell
2002-02-25  1:23         ` Linus Torvalds
2002-02-25 13:14           ` Alan Cox
2002-02-25 16:11             ` Linus Torvalds
2002-02-25 16:39               ` Alan Cox
2002-02-25 16:32                 ` Benjamin LaHaise
2002-02-25 17:42                   ` Alan Cox
2002-02-25 18:23                   ` Hubertus Franke [this message]
2002-02-25 20:57                     ` Hubertus Franke
2002-02-25 17:06                 ` Linus Torvalds
2002-02-25 17:31                   ` Alan Cox
2002-02-25 17:20                     ` Linus Torvalds
2002-02-25 17:50                       ` Alan Cox
2002-02-25 17:44                         ` Linus Torvalds
2002-02-25 18:06                           ` Alan Cox
2002-02-25 19:31                             ` Linus Torvalds
2002-02-24  4:57                               ` Daniel Phillips
2002-02-25 19:51                             ` Hubertus Franke
2002-02-26 12:15                       ` [PATCH] 2.5.5 IDE clean 14 Martin Dalecki
2002-02-26 21:49                         ` Keith Owens
2002-02-27 10:08                           ` Martin Dalecki
2002-03-03  7:07                 ` [PATCH] Lightweight userspace semaphores Rusty Russell
2002-03-01  4:56           ` Eric W. Biederman
2002-03-02 14:54       ` Pavel Machek
2002-02-25 15:00 ` Hubertus Franke
2002-03-01  4:44   ` Eric W. Biederman
2002-02-27  0:24 ` Rusty Russell
2002-02-27 15:53   ` Hubertus Franke
2002-03-01  0:24     ` Richard Henderson
2002-03-01  2:00       ` Hubertus Franke
2002-02-27 16:29   ` Hubertus Franke
2002-03-02 14:50   ` Hubertus Franke
2002-03-03 13:30   ` Rusty Russell
2002-03-04 16:51     ` Hubertus Franke
2002-03-05  4:41     ` Rusty Russell
2002-02-27  8:43 [PATCH] Lightweight userspace semphores Martin Wirth
2002-02-27 15:24 ` Hubertus Franke
2002-02-27 17:17   ` Martin Wirth
2002-02-27 19:04     ` Hubertus Franke
     [not found]       ` <3C7FDF76.9040903@dlr.de>
2002-03-02 14:08         ` [PATCH] Lightweight userspace semaphores Hubertus Franke
     [not found] <20020227163834.GF322@reload.nmd.msu.ru>
2002-02-27 16:58 ` Hubertus Franke
     [not found]   ` <20020227173307.GH322@reload.nmd.msu.ru>
2002-02-27 22:09     ` Hubertus Franke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020225132335.C1163@elinux01.watson.ibm.com \
    --to=frankeh@watson.ibm.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=bcrl@redhat.com \
    --cc=david@mysql.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthew@hairy.beasts.org \
    --cc=mingo@elte.hu \
    --cc=rusty@rustcorp.com.au \
    --cc=torvalds@transmeta.com \
    --cc=wli@holomorphy.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®