mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Satyam Sharma" <satyam.sharma@gmail.com>
To: "Oliver Neukum" <oliver@neukum.org>
Cc: "Arnd Bergmann" <arnd@arndb.de>,
	"Robert P. J. Day" <rpjday@mindspring.com>,
	"Florin Iucha" <florin@iucha.net>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>
Subject: Re: "upping" a semaphore from interrupt context?
Date: Sat, 23 Jun 2007 22:32:55 +0530	[thread overview]
Message-ID: <a781481a0706231002jf4467ebja6c28e3e242ceb76@mail.gmail.com> (raw)
In-Reply-To: <200706231752.08494.oliver@neukum.org>

On 6/23/07, Oliver Neukum <oliver@neukum.org> wrote:
> Am Samstag, 23. Juni 2007 schrieb Satyam Sharma:
> > * 3. set up a timer and schedule another function to service the
> > * interrupt / do what needs to be done then, hopefully the mutex
> > * would be uncontended then => *gargh*
>
> You could use schedule_work(). However then why not use it always.
> This would make sense if what you want to do is outright trivial.

If you use schedule_work() to pass off work from interrupt context
to process context, then you wouldn't be calling down_trylock()
from interrupt context in the first place (which is what is being
discussed here). You would simply pass off the entire code that
uses the shared data (and wraps a *proper* down() or mutex_lock()
around it, not the _trylock() variant) to the workqueue.

Also, that is precisely my point too. What I'm saying is that it is
generally poor design to be wanting to use the _trylock() variant
of semaphore / mutex in interrupt context. Workqueues _are_ the
preferred mechanism to use for (most) such cases where you need
to do something that may require you to sleep.

Satyam

  reply	other threads:[~2007-06-23 17:03 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-22 17:38 Florin Iucha
2007-06-22 17:34 ` Arnd Bergmann
2007-06-23 11:52   ` Robert P. J. Day
2007-06-23 12:02     ` Arnd Bergmann
2007-06-23 12:06       ` Robert P. J. Day
2007-06-23 15:42       ` Satyam Sharma
2007-06-23 15:52         ` Oliver Neukum
2007-06-23 17:02           ` Satyam Sharma [this message]
2007-06-23 16:11         ` Robert P. J. Day
2007-06-23 17:16           ` Satyam Sharma
2007-06-24 15:25             ` Robert P. J. Day
2007-06-24 16:45               ` Satyam Sharma
2007-06-24 16:59                 ` Robert P. J. Day
2007-06-24 18:12                   ` Satyam Sharma
2007-06-22 17:50 ` Satyam Sharma

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=a781481a0706231002jf4467ebja6c28e3e242ceb76@mail.gmail.com \
    --to=satyam.sharma@gmail.com \
    --cc=arnd@arndb.de \
    --cc=florin@iucha.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oliver@neukum.org \
    --cc=rpjday@mindspring.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®