Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 Apr 2003 17:38:08 -0700 (PDT)
From:      Archie Cobbs <archie@dellroad.org>
To:        Peter Dufault <dufault@hda.com>
Cc:        freebsd-arch@freebsd.org
Subject:   Re: lots of malloc(M_WAITOK)'s in interrupt context from camisr
Message-ID:  <200304300038.h3U0c8Hj073288@arch20m.dellroad.org>
In-Reply-To: <5AC4B3BA-7AA0-11D7-BD29-000393B2C586@hda.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Peter Dufault wrote:
> The issue is promoting not thinking about what context you're working in.
> It makes sense to have a clean API for kicking off a worker thread, but 
> "automagic" threads that kick in due to lack of thinking out how things
> work aren't ready for prime time.
> 
> To do what you're recommending, use a "Permit me to be naive" flag.
> That puts the complexity in one place recognizing that it might not be 
> the best place.

I agree with that... I'm really trying to make out a more abstract
point which is that while in practice interrupt events are "different"
from other events that a driver sees because they're more time
critical, in the more general view they are just events, just like
any other event such as "transmit this packet" or "change media
mode" or whatever.

The fact that the device originates some event instead of the system/user
means that an interrupt is the only mechanism available to deliver
the event to the device driver (which can be thought of as a FSM).
That doesn't necessarily imply that the event itself is somehow
fundamentally different from system- or user-originated events.

But the fact that "interrupt handlers can't sleep" means that the
device driver writer has to treat them differently. This is of
course standard practice and I'm not really arguing we should change
it, I'm just pointing out that it's one of those "it's always been
that way" things that perhaps causes more pain than necessary, and
if looked at from first principles might ultimately not be seen as
the most elegant way to do things.

It evolved the way it is today not because of elegance, but because
device driver writers must follow the kernel device API and kernel
writers found it easier prohibit sleeping during interrupts :-)

-Archie

__________________________________________________________________________
Archie Cobbs     *     Precision I/O      *     http://www.precisionio.com



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200304300038.h3U0c8Hj073288>