public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arjan van de Ven <arjan@infradead.org>
To: Matti Linnanvuori <mattilinnanvuori@yahoo.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Do not deprecate binary semaphore or do allow mutex in software interrupt contexts
Date: Tue, 11 Sep 2007 15:36:28 +0100	[thread overview]
Message-ID: <20070911153628.26ca02bc@laptopd505.fenrus.org> (raw)
In-Reply-To: <11531.17274.qm@web52008.mail.re2.yahoo.com>

On Tue, 11 Sep 2007 06:20:51 -0700 (PDT)
Matti Linnanvuori <mattilinnanvuori@yahoo.com> wrote:

Hi,

> I thought of a scenario where it seems appropriate to use a binary
> semaphore or a mutex in a software interrupt context. If a device
> cannot interrupt when some important variable changes, it can be
> polled occasionally to update e.g. LEDs to indicate status. Such
> polling can be done most efficiently in timers that are software
> interrupts. Timers are more efficient than works because they do not
> have so much context switching overhead. If the access to the
> variables of the device must be serialized, a binary semaphore or a
> mutex is a natural choice. If user-space writing to the device is
> likely to change the status, it can make sense not to poll the status
> of the device at the same time. The timer could therefore sensibly
> call mutex_trylock.

what do you do if the trylock fails?

> Therefore, it seems wrong to me to deprecate
> binary semaphores and disallow the use of mutexes in software
> interrupt contexts.

to be honest, the scenario describe really smells of broken locking, in
fact it really sounds like it wants to use spinlocks instead 

Greetings,
   Arjan van de Ven

  reply	other threads:[~2007-09-11 13:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-11 13:20 Do not deprecate binary semaphore or do allow mutex in software interrupt contexts Matti Linnanvuori
2007-09-11 14:36 ` Arjan van de Ven [this message]
2007-09-11 13:56   ` Alan Cox
  -- strict thread matches above, loose matches on Subject: below --
2007-09-11 16:20 Matti Linnanvuori
2007-09-11 16:50 ` Peter Zijlstra
2007-09-11 18:22 ` Arjan van de Ven
2007-09-11 17:29 Matti Linnanvuori
2007-09-11 19:22 ` Arjan van de Ven
2007-09-12  5:39 Matti Linnanvuori

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=20070911153628.26ca02bc@laptopd505.fenrus.org \
    --to=arjan@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mattilinnanvuori@yahoo.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