From: Russell King <rmk+lkml@arm.linux.org.uk>
To: Arjan van de Ven <arjan@infradead.org>
Cc: Gabriele Brugnoni <news@dveprojects.com>, linux-kernel@vger.kernel.org
Subject: Re: interruptible_sleep_on, interrupts and device drivers
Date: Sat, 15 Oct 2005 11:57:24 +0100 [thread overview]
Message-ID: <20051015105724.GC5724@flint.arm.linux.org.uk> (raw)
In-Reply-To: <1129372589.2908.8.camel@laptopd505.fenrus.org>
On Sat, Oct 15, 2005 at 12:36:29PM +0200, Arjan van de Ven wrote:
> On Sat, 2005-10-15 at 12:29 +0200, Gabriele Brugnoni wrote:
> > save_flags(flags); cli();
>
> this is broken code; cli() cannot and should not be used. (and isn't
> even available on SMP kernels anymore)
>
> > if( !rs.txdone ) {
> > if( arg < 0 ) arg = rs.ttimeout;
> > if( arg > 0 )
> > interruptible_sleep_on_timeout ( &rs.txwait, arg );
> > else
> > interruptible_sleep_on ( &rs.txwait );
> > }
> > restore_flags(flags);
>
> and this is missing a sti()
Err, no, that's wrong. sti() unconditionally enables interrupts - if
an sti() was placed here, it's pointless using save_flags() (which
saves the old interrupt enable state) and restore_flags() (which
restores the interrupt enable state).
Also remember that interruptible_sleep_* is only safe on UP machines
provided it's called with interrupts disabled.
--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 Serial core
next prev parent reply other threads:[~2005-10-15 10:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-15 10:29 interruptible_sleep_on, interrupts and device drivers Gabriele Brugnoni
2005-10-15 10:36 ` Arjan van de Ven
2005-10-15 10:57 ` Russell King [this message]
[not found] <4XQZI-5QC-1@gated-at.bofh.it>
2005-10-15 20:21 ` Robert Hancock
-- strict thread matches above, loose matches on Subject: below --
2005-10-15 10:00 Gabriele Brugnoni
2005-10-15 10:05 ` Arjan van de Ven
2005-10-15 13:01 ` Tushar Adeshara
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=20051015105724.GC5724@flint.arm.linux.org.uk \
--to=rmk+lkml@arm.linux.org.uk \
--cc=arjan@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=news@dveprojects.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