mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Krzysztof Halasa <khc@pm.waw.pl>
Cc: Jean Delvare <khali@linux-fr.org>,
	David Miller <davem@davemloft.net>,
	linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org
Subject: Re: I2C from interrupt context?
Date: Mon, 10 Nov 2008 23:57:34 -0800	[thread overview]
Message-ID: <20081110235734.f7666725.akpm@linux-foundation.org> (raw)
In-Reply-To: <m3bpwrbjxs.fsf@maximus.localdomain>

On Fri, 07 Nov 2008 17:05:35 +0100 Krzysztof Halasa <khc@pm.waw.pl> wrote:

> Jean Delvare <khali@linux-fr.org> writes:
> 
> > The situation is far from perfect though. For one thing, I seem to
> > recall that Andrew Morton didn't like the approach taken in
> > i2c_transfer(). For another, i2c_smbus_xfer() was not yet modified so
> > at this point only I2C-level transactions can be non-sleeping,
> > SMBus-level transactions can't. But all this could be fixed by anyone
> > who cares about these specific issues.
> 
> Thanks, I'll look at it.

The problem (well: bug) is that in_atomic() returns false inside a
spinlock when CONFIG_PREEMPT=n.  The code as it stands can sleep
inside a spinlock, which is deadlockable if a scheduled-to task
tries to take the same spinlock.

There is no means like this by which a piece of code can determine
whether it can call schedule().  The pattern which we use in many many
places (most especially GFP_KERNEL/GFP_ATOMIC) is to pass a flag down
to callees telling them in some manner which context they were called from.

      reply	other threads:[~2008-11-11  7:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-06 23:44 Krzysztof Halasa
2008-11-06 23:47 ` David Miller
2008-11-07  9:11   ` Jean Delvare
2008-11-07 16:05     ` Krzysztof Halasa
2008-11-11  7:57       ` Andrew Morton [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=20081110235734.f7666725.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=khali@linux-fr.org \
    --cc=khc@pm.waw.pl \
    --cc=linux-i2c@vger.kernel.org \
    --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

all inboxes | Powered by JetHome®