From: Hubertus Franke <frankeh@watson.ibm.com>
To: Martin Wirth <martin.wirth@dlr.de>
Cc: rusty@rustycorp.com.au, linux-kernel@vger.kernel.org,
lse-tech@lists.sourceforge.net
Subject: Re: [PATCH] Lightweight userspace semaphores...
Date: Sat, 2 Mar 2002 09:08:56 -0500 [thread overview]
Message-ID: <20020302090856.A1332@elinux01.watson.ibm.com> (raw)
In-Reply-To: <3C7C9C41.5080400@dlr.de> <20020227102446.A838@elinux01.watson.ibm.com> <3C7D14B5.1020702@dlr.de> <20020227140441.A1573@elinux01.watson.ibm.com> <3C7FDF76.9040903@dlr.de>
In-Reply-To: <3C7FDF76.9040903@dlr.de>; from martin.wirth@dlr.de on Fri, Mar 01, 2002 at 09:07:18PM +0100
On Fri, Mar 01, 2002 at 09:07:18PM +0100, Martin Wirth wrote:
>
>
> Hubertus Franke Worte:
>
> >
> >So, it works and is correct. Hope that clarifies it, if not let me know.
> >Interestingly enough. This scheme doesn't work for spinning locks.
> >Goto lib/ulocks.c[91-133], I have integrated this dead code here
> >to show how not to do it. A similar analysis as above shows
> >that this approach wouldn't work. You need cmpxchg for these scenarios
> >(more or less).
> >
>
> You are right, I falsely assumed the initial state to be [1,1].
>
> But as mentioned in your README, your approach is currently is not able
> to manage signal handling correctly.
> You have to ignore all non-fatal signals by using ESYSRESTART and a
> SIG_KILL sent to one of the processes
> may corrupt your user-kernel-syncronisation.
>
> I don't think a user space semaphore implementation is acceptable until
> it provides (signal-) interruptability and
> timeouts. But maybe you have some idea how to manage this.
>
> Martin Wirth
>
>
As of the signal handling and ESYSRESTART.
The user code on the slow path can check for return code and
has two choices (a) reenter the kernel and wait or (b) correct the
status word, because its still counted as a waiting process and return
0. I have chosen (a) and I automated it.
I have tried to send signals (e.g. SIGIO) and it
seems to work fine. The signal is handled in user space and returns back
to the kernel section. (b) is feasible but a requires a bit more exception
work in the routine.
As of the corruption case. There is flatout (almost) nothing you can do.
For instance, if a process graps the locks and exits, then another process
tries to acquire it you got a deadlock. At the least on the mailing list
most people feel that you are dead in the water anyway.
I have been thinking about the problem of corruption.
The owner of the lock could register its pid in the lock aread (2nd word).
That still leaves non-atomic windows open and is a half-ass solution.
But more conceptually, if you process dies while holding a lock that protects
some shared data, there is no guarantee that you can make about the data
itself if the updating process dies. In that kind of scenario, why
trying to continue as if nothing happened.
It seems the general consent on the list is that your app is toast at that
point.
-- Hubertus
next prev parent reply other threads:[~2002-03-02 14:08 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Hubertus Franke [this message]
2002-03-03 22:13 ` [Lse-tech] Re: [PATCH] Lightweight userspace semaphores Paul Jackson
2002-03-04 16:07 ` Hubertus Franke
2002-03-04 6:13 ` Rusty Russell
[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
-- strict thread matches above, loose matches on Subject: below --
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
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-03-03 7:07 ` 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
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=20020302090856.A1332@elinux01.watson.ibm.com \
--to=frankeh@watson.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lse-tech@lists.sourceforge.net \
--cc=martin.wirth@dlr.de \
--cc=rusty@rustycorp.com.au \
/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®