From: Daniel Jacobowitz <dan@debian.org>
To: george anzinger <george@mvista.com>
Cc: Linus Torvalds <torvalds@transmeta.com>,
Jim Houston <jim.houston@ccur.com>,
Stephen Rothwell <sfr@canb.auug.org.au>,
LKML <linux-kernel@vger.kernel.org>,
anton@samba.org, "David S. Miller" <davem@redhat.com>,
ak@muc.de, davidm@hpl.hp.com, schwidefsky@de.ibm.com,
ralf@gnu.org, willy@debian.org
Subject: Re: [PATCH] compatibility syscall layer (lets try again)
Date: Wed, 11 Dec 2002 02:10:41 -0500 [thread overview]
Message-ID: <20021211071041.GA8988@nevyn.them.org> (raw)
In-Reply-To: <3DF673B9.4E273E83@mvista.com>
On Tue, Dec 10, 2002 at 03:07:37PM -0800, george anzinger wrote:
> Daniel Jacobowitz wrote:
> >
> > On Fri, Dec 06, 2002 at 09:57:08AM -0800, Linus Torvalds wrote:
> > >
> > > I just pushed my version of the system call restart code to the BK trees.
> > > It's losely based on Georges code, but subtly different. Also, I didn't
> > > actually update any actual system calls to use it, I just did the
> > > infrastructure.
> > >
> > > Non-x86 architectures need to be updated to work with this: they need to
> > > update their thread structures, the additional do_signal() support in
> > > their signal.c, and add the actual system call itself somewhere. For x86,
> > > this was about 15 lines of changes.
> > >
> > > The basic premise is very simple: if you want to restart a system call,
> > > you can do
> > >
> > > restart = ¤t_thread()->restart_block;
> > > restart->fn = my_continuation_function;
> > > restart->arg0 = my_arg0_for_continuation;
> > > restart->arg1 = my_arg1_for_continuation;
> > > ..
> > > return -ERESTARTSYS_RESTARTBLOCK;
> > >
> > > which will cause the system call to either return -EINTR (if a signal
> > > handler was actually invoced) or for "benign" signals (SIGSTOP etc) it
> > > will end up restarting the system call at the continuation function (with
> > > the "restart" block as the argument).
> > >
> > > We could extend this to allow restarting even over signal handlers, but
> > > that would have some re-entrancy issues (ie what happens if a signal
> > > handler itself wants to use a system call that may want restarting), so at
> > > least for now restarting is only done when no handler is invoced (*).
> > >
> > > Linus
> > >
> > > (*) The nesting case is by no means impossible to handle gracefully
> > > (adding a "restart even if handler is called" error number and returning
> > > -EINTR if nesting, for example), but I don't know of any system calls that
> > > would really want to try to restart anyway, so..
> >
> > Well, here's something to consider. This isn't entirely hypothetical;
> > there are test cases in GDB's regression suite that cover nearly this.
> >
> > Suppose a process is sleeping for an hour. The user wants to see what
> > another thread is doing, so he hits Control-C; the thread which happens
> > to be reported as 'current' is the one that was in nanosleep(). It
> > used to be that when he said continue, the nanosleep would return; now
> > hopefully it'll continue. Great! But this damnable user isn't done
> > yet. He wants to look at one of his data structures. He calls a
> > debugging print_foo() function from GDB. He realizes he left a
> > sleep-for-a-minute nanosleep call in it and C-c's again. Now we have
> > two interrupted nanosleep calls and the application will never see a
> > signal to interrupt either of them; he says "continue" twice and
> > expects to get back to his hour-long sleep.
> >
> > Note that I'm not saying we _need_ to support this, mind :) It's a
> > little pathological.
>
> I seem to recall working on a debugger in the distant past
> and put a lock in it that did not allow it to run a debuggee
> function while the debugee was in a system call. It seems
> to me that is is begging for problems and is not that hard
> for gdb/etc to prevent.
>
> Daniel, what to you think?
I really don't see the point. I like being able to call functions
while stopped in read() or poll(); you can hit C-c and go off to
examine your application. That's as much "in a syscall" as this is.
Besides, implementing this is more of a pain than it's worth.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
next prev parent reply other threads:[~2002-12-11 7:03 UTC|newest]
Thread overview: 78+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-12-04 7:02 [PATCH] compatibility syscall layer (lets try again) Stephen Rothwell
2002-12-04 7:07 ` [PATCH] compatibility syscall layer - PPC64 Stephen Rothwell
2002-12-06 23:03 ` Anton Blanchard
2002-12-04 7:16 ` [PATCH] compatibility syscall layer - SPARC64 Stephen Rothwell
2002-12-04 7:18 ` [PATCH] compatibility syscall layer - X86_64 Stephen Rothwell
2002-12-04 11:29 ` Andi Kleen
2002-12-04 7:26 ` [PATCH] compatibility syscall layer - IA64 Stephen Rothwell
2002-12-04 7:37 ` David Mosberger
2002-12-04 7:28 ` [PATCH] compatibility syscall layer (lets try again) Stephen Rothwell
2002-12-04 7:29 ` [PATCH] compatibility syscall layer - PARISC Stephen Rothwell
2002-12-04 7:30 ` [PATCH] compatibility syscall layer (lets try again) Stephen Rothwell
2002-12-04 7:33 ` Stephen Rothwell
2002-12-04 11:57 ` Pavel Machek
2002-12-04 16:54 ` Linus Torvalds
2002-12-04 16:54 ` David S. Miller
2002-12-04 17:05 ` Linus Torvalds
2002-12-04 19:56 ` george anzinger
2002-12-04 20:07 ` Linus Torvalds
2002-12-04 20:56 ` Daniel Jacobowitz
2002-12-04 22:09 ` David S. Miller
2002-12-04 22:31 ` george anzinger
2002-12-04 22:39 ` David S. Miller
2002-12-04 22:42 ` Linus Torvalds
2002-12-04 23:42 ` Jim Houston
2002-12-05 0:18 ` Linus Torvalds
2002-12-05 2:01 ` george anzinger
2002-12-05 2:51 ` Linus Torvalds
2002-12-05 3:10 ` Andi Kleen
2002-12-05 3:46 ` george anzinger
2002-12-05 4:11 ` Linus Torvalds
2002-12-05 7:10 ` george anzinger
2002-12-05 9:48 ` george anzinger
2002-12-05 15:24 ` Jim Houston
2002-12-05 16:35 ` george anzinger
2002-12-06 0:03 ` Richard Henderson
2002-12-05 17:03 ` Linus Torvalds
2002-12-06 9:17 ` george anzinger
2002-12-06 17:57 ` Linus Torvalds
2002-12-06 19:20 ` Linus Torvalds
2002-12-06 20:09 ` [PATCH] compatibility syscall layer (let's " Jim Houston
2002-12-06 20:33 ` george anzinger
2002-12-06 20:18 ` [PATCH] compatibility syscall layer (lets " george anzinger
2002-12-06 21:12 ` Linus Torvalds
2002-12-06 21:56 ` Jim Houston
2002-12-06 22:58 ` Linus Torvalds
2002-12-07 2:25 ` george anzinger
2002-12-06 23:08 ` george anzinger
2002-12-08 20:41 ` David S. Miller
2002-12-09 6:18 ` Stephen Rothwell
2002-12-09 15:41 ` Daniel Jacobowitz
2002-12-09 16:48 ` Linus Torvalds
2002-12-09 17:27 ` David Mosberger
2002-12-09 20:22 ` David S. Miller
2002-12-09 17:49 ` Jim Houston
2002-12-09 17:57 ` Linus Torvalds
2002-12-09 23:30 ` Paul Mackerras
2002-12-10 23:07 ` george anzinger
2002-12-11 7:10 ` Daniel Jacobowitz [this message]
2002-12-11 8:11 ` george anzinger
2002-12-11 8:26 ` Daniel Jacobowitz
2002-12-10 11:08 ` Jamie Lokier
2002-12-05 2:27 ` Jim Houston
-- strict thread matches above, loose matches on Subject: below --
2002-12-09 16:58 Mikael Starvik
2002-12-09 17:35 ` Linus Torvalds
2002-12-09 18:46 ` David Mosberger
2002-12-10 0:13 ` Paul Mackerras
2002-12-10 23:11 ` george anzinger
2002-12-09 17:16 Martin Schwidefsky
2002-12-09 17:33 ` Linus Torvalds
2002-12-09 20:18 ` David S. Miller
2002-12-09 17:56 Martin Schwidefsky
2002-12-09 18:20 ` Linus Torvalds
2002-12-10 14:40 ` Keith Owens
2002-12-09 18:41 Martin Schwidefsky
2002-12-09 18:52 ` Linus Torvalds
2002-12-10 8:20 ` george anzinger
2002-12-10 8:42 Martin Schwidefsky
2002-12-10 17:17 Martin Schwidefsky
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=20021211071041.GA8988@nevyn.them.org \
--to=dan@debian.org \
--cc=ak@muc.de \
--cc=anton@samba.org \
--cc=davem@redhat.com \
--cc=davidm@hpl.hp.com \
--cc=george@mvista.com \
--cc=jim.houston@ccur.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ralf@gnu.org \
--cc=schwidefsky@de.ibm.com \
--cc=sfr@canb.auug.org.au \
--cc=torvalds@transmeta.com \
--cc=willy@debian.org \
/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;
as well as URLs for NNTP newsgroup(s).