public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nick Piggin <nickpiggin@yahoo.com.au>
To: Bhuvan Kumar MITTAL <bhuvan.mittal@st.com>
Cc: "'Alan Cox'" <alan@lxorguk.ukuu.org.uk>,
	linux-kernel@vger.kernel.org,
	"'Daniel J Blueman'" <daniel.blueman@gmail.com>
Subject: Re: How to make mmap'ed kernel buffer non-cacheable
Date: Wed, 02 May 2007 18:45:34 +1000	[thread overview]
Message-ID: <46384FAE.8030606@yahoo.com.au> (raw)
In-Reply-To: <04b101c78c93$1e234ea0$142ec70a@dlh.st.com>

You can do down_interruptible to make the down interruptible.

Bhuvan Kumar MITTAL wrote:
> I'll rephrase the problem as follow:
> 
> I have a userthread which makes ioctl calls to the kernel and once it reaches inside the kernel it waits on a semaphore. It then does some work inside the kernel and continuously keeps looping between the kernel and user space in an endless while loop. 
> 
> I want to kill that thread from another user thread while the former is waiting on a semaphore in kernel (which it will never get) coz I want a clean exit of my driver. Please suggest me a way. I did try the use of pthread_cancel, but that is possible only if the target thread is executing in user space and making use of a pthread_testcancel call (with cancelability enabled ofcourse). 
> 
> Kindly suggest something. 
> 
> 
>>In continuation to this, I have another query:
>>As mentioned above, If there is a kernel task waiting on a semaphore (maybe even in hung state) and I wish to kill the kernel task from user space by making an ioctl call into the kernel, then how is it possible? Is it feasible at all?
> 
> 
> If the kernel task is hung because of some bug in your code, then it isn't
> really possible in general. You could always just "up" the semaphore and hope,
> but things might be corrupted.
> 
> If you just want to tell the kernel task to quit, I guess you'd just introduce
> some quit ioctl message, and have the kernel thread respond to that.
> 
> 
> 


-- 
SUSE Labs, Novell Inc.

  reply	other threads:[~2007-05-02  8:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-20 13:00 How to make mmap'ed kernel buffer non-cacheable Bhuvan Kumar MITTAL
2007-04-20 13:43 ` Alan Cox
2007-04-23  4:11   ` Bhuvan Kumar MITTAL
2007-04-23  4:25     ` Nick Piggin
2007-05-01  3:58       ` Bhuvan Kumar MITTAL
2007-05-01 12:09         ` Nick Piggin
2007-05-02  8:23           ` Bhuvan Kumar MITTAL
2007-05-02  8:45             ` Nick Piggin [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-04-20 13:32 Daniel J Blueman

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=46384FAE.8030606@yahoo.com.au \
    --to=nickpiggin@yahoo.com.au \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=bhuvan.mittal@st.com \
    --cc=daniel.blueman@gmail.com \
    --cc=linux-kernel@vger.kernel.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