From: Oleg Nesterov <oleg@tv-sign.ru>
To: Dave Airlie <airlied@gmail.com>
Cc: Dave Airlie <airlied@redhat.com>,
Roland McGrath <roland@redhat.com>,
linux-kernel@vger.kernel.org
Subject: Re: What does drm do with signals?
Date: Sat, 25 Aug 2007 15:01:39 +0400 [thread overview]
Message-ID: <20070825110139.GA234@tv-sign.ru> (raw)
In-Reply-To: <21d7e9970708250056g561912fk45b4b943b0a353e3@mail.gmail.com>
On 08/25, Dave Airlie wrote:
>
> On 8/24/07, Oleg Nesterov <oleg@tv-sign.ru> wrote:
> > Could someone please explain why do we need block_all_signals() ?
> >
> > I can't understand what was the intended behaviour, but anyway
> > I suspect it doesn't work as expected.
>
> http://dri.sourceforge.net/doc/drm_low_level.html
>
> Section 4.1 explains the intent...
Thanks a lot Dave, I'll quote this doc:
> 4.1 Delaying Signal Delivery
>
> If the direct-rendering client holds the hardware lock and receives
> a SIGKILL signal, deadlock may result. If the SIGKILL is detected
> and the hardware lock is immediately taken from the client, the
> typical PC-class graphics hardware may be left in an unknown state
> and may lock up (this kind of hardware usually does not deal well
> with intermingling of command streams).
>
> Similarly, if the direct-rendering client holds the hardware lock
> and receives a SIGSTOP, the X server and all other direct-rendering
> clients will block until the process releases the lock.
>
> Ideally, the client should be permitted to complete the rendering
> operation that is currently in progress and have the SIGKILL or SIGSTOP
> signals delivered as soon as the hardware lock is released (or, after
> some reasonable timeout, so that buggy clients can be halted). This
> delay of signal delivery appears to require kernel-level changes
> that cannot be performed by a loadable module using the standard
> module interface.
but drm_lock() doesn't even try to block SIGKILL?
However, I think that block_all_signals() and its usage are broken
in many ways. To name a few,
1. It can't work for multithread programs. dequeue_signal() checks
current->notifier, but this is per thread, not per process.
2. We can't block the "pseudo signals" (freezer).
3. If we want to block SIGKILL, we should also block at least all
sig_kernel_coredump() signals. But this is not easy to do for
multithread programms, all sub-threads except ->group_exit_task
go to sleep in TASK_STOPPED state without doing dequeue_signal()
at all.
4. What about other sig_fatal() signals?
5. drm_lock() blocks SIGSTOP, SIGTSTP, SIGTTIN, SIGTTOU. Suppose
that (say) SIGTSTP is pending. In that case we in fact block
_all_ signals whose numeric value > SIGTSTP. This is somewhat
strange.
Probably something else... Actually, the whole idea looks broken to
me, but yes, it is very easy to blame somebody else's code and I
don't even remotely understand what drm is.
I tried to google for the patch which introduced this interface
but failed. Looks like this is very old thing.
Actually, I can't understand the explanation above. What if the
task which holds the hardware lock doesn't recieve SIGSTOP, but
instead does something like "for (;;) ;" ?
Oleg.
prev parent reply other threads:[~2007-08-25 10:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-23 15:58 Oleg Nesterov
2007-08-25 7:56 ` Dave Airlie
2007-08-25 11:01 ` Oleg Nesterov [this message]
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=20070825110139.GA234@tv-sign.ru \
--to=oleg@tv-sign.ru \
--cc=airlied@gmail.com \
--cc=airlied@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=roland@redhat.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®