From: Andrew Morton <akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
To: Krzysztof Halasa <khc-9GfyWEdoJtJmR6Xm/wNWPw@public.gmane.org>
Cc: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>,
David Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.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-fiqtE+24Nu0B9AHHLWeGtNQXobZC6xk2@public.gmane.org>
On Fri, 07 Nov 2008 17:05:35 +0100 Krzysztof Halasa <khc-9GfyWEdoJtJmR6Xm/wNWPw@public.gmane.org> wrote:
> Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.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.
prev parent reply other threads:[~2008-11-11 7:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <m3bpws8ln3.fsf@maximus.localdomain>
[not found] ` <m3bpws8ln3.fsf-fiqtE+24Nu0B9AHHLWeGtNQXobZC6xk2@public.gmane.org>
2008-11-06 23:47 ` I2C from interrupt context? David Miller
[not found] ` <20081106.154754.02648408.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2008-11-07 9:11 ` Jean Delvare
[not found] ` <20081107101118.286f3713-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-11-07 16:05 ` Krzysztof Halasa
[not found] ` <m3bpwrbjxs.fsf-fiqtE+24Nu0B9AHHLWeGtNQXobZC6xk2@public.gmane.org>
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-de/tnxtf+jlsfhdxvbkv3wd2fqjk+8+b@public.gmane.org \
--cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
--cc=khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org \
--cc=khc-9GfyWEdoJtJmR6Xm/wNWPw@public.gmane.org \
--cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.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