[alsa-devel] [PATCH] ad1848 ac loop

Trent Piepho xyzzy at speakeasy.org
Fri Sep 21 11:31:14 CEST 2007

On Thu, 20 Sep 2007, Lee Revell wrote:
> On 9/20/07, Trent Piepho <xyzzy at speakeasy.org> wrote:
> > It's also worth noting that only local interrupts are disabled, not global
> > interrupts.  Absent a spin-lock, an SMP system can still have an irq
> > handler run while another thread on another CPU has interupts disabled.
> >
> > > I am not expert on this but following your reasoning any core kernel code
> > > (vm, scheduler) could not be interrupt-safe because most of interrupt handlers
> > > are in drivers and the core has no idea that drivers exist.
> >
> > None of the variables used by drivers' interrupt handlers are modified by
> > the core kernel code.  In this case, chip->playback_substream and
> > chip->record_substream are the relevant variables.  They are used
> > non-atomically from the irq handler, so any code which modifies them must
> > be protected from the irq handler.
> Most ALSA drivers would not enable the device interrupt until trigger
> START, and disable them in trigger STOP.  So your interrupt should
> never be enabled during open()/close().

Multiple substreams per device.  One could call open or close on one
substream while another is active.

Just because one has told the device to stop generating interrupts, doesn't
mean there isn't a pending interrupt already being handled.  That's what
synchronize_irq() is for.

More information about the Alsa-devel mailing list