From: Valdis.Kletnieks@vt.edu (Valdis.Kletnieks at vt.edu)
To: kernelnewbies@lists.kernelnewbies.org
Subject: SIGKILL and a sleeping kernel module
Date: Tue, 19 Feb 2013 05:33:22 -0500 [thread overview]
Message-ID: <36306.1361270002@turing-police.cc.vt.edu> (raw)
In-Reply-To: Your message of "Tue, 19 Feb 2013 10:37:28 +0200." <CAGXs5wVG1N1RcVviPPvhjJ553cvQzGErvjihAtRmdqC7WhtOCw@mail.gmail.com>
On Tue, 19 Feb 2013 10:37:28 +0200, Kevin Wilson said:
> Hi all,
> I am trying to send a SIGKILL to a kernel module which is sleeping.
> I added a printk after the sleep command.
> Sending a SIGLKILL (by kill -9 SIGLKILL pidOfKernelThread) does **not**
> yield the message from printk("calling do_exit\n");
> which is immediately after the msleep() command, as I expected.
Others have mentioned the various types of sleeping in the kernel, but
overlooked a minor detail. If a task is in the kernel in a non-interruptible
state, signals are queued and delivered once that status is cleared (which
often doesn't happen until a syscall is about to return to userspace).
The reason this detail is important for would-be kernel hackers:
If one kernel thread manages to BUG() or oops() or otherwise die
or wedge up while holding a lock, other processes can end up blocking
while waiting for the lock. The problem is that the other processes are
usually in non-interruptible state when they try to take the lock. The
end result is that you end up with processes that are blocked in the
kernel, and you can't kill -9 them - you're basically stuck with them
until you reboot. This is why your system will often limp along and
slowly become more and more wedged up after a BUG().
Also - the fact that /bin/ps shows a D or S does *not* in fact mean the
process is in a sleep state inside the kernel. That's *usually* the case,
but it's quite possible for the code to be actively executing and burning
lots of CPU (often because it's stuck in a loop that's failing to make
forward progress). The result there is that ps shows a D/S but your
CPU starts getting *very* warm....
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 865 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130219/7ecb86c2/attachment.bin
prev parent reply other threads:[~2013-02-19 10:33 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-19 8:37 SIGKILL and a sleeping kernel module Kevin Wilson
2013-02-19 9:11 ` Silviu Popescu
2013-02-19 9:16 ` Srivatsa S. Bhat
2013-02-19 11:32 ` Kevin Wilson
[not found] ` <5123643C.1000907@linux.vnet.ibm.com>
2013-02-19 12:00 ` Kevin Wilson
2013-02-19 18:55 ` Mulyadi Santosa
2013-02-20 6:29 ` Srinivas Ganji
2013-02-20 6:33 ` Srinivas Ganji
2013-02-19 19:54 ` Anatol Pomozov
2013-02-19 10:33 ` Valdis.Kletnieks at vt.edu [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=36306.1361270002@turing-police.cc.vt.edu \
--to=valdis.kletnieks@vt.edu \
--cc=kernelnewbies@lists.kernelnewbies.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).