Re: [linux-dvb] [BUG] changeset 9029 (http://linuxtv.org/hg/v4l-dvb/rev/aa3e5cc1d833)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Andreas Oberritter wrote:
> Oliver Endriss wrote:
> > ...
> > @Andreas:
> > Could you please explain in more detail what bad things might happen?
> 
> To quote myself from the changelog: This fixes a deadlock discovered
> by lockdep.

I re-read the commit message, but it still does not ring any bells.
Could you please post the lockdep output?

> The lock is used in process context (e.g. DMX_START) and might also be
> used from interrupt context (e.g. dvb_dmx_swfilter).

Correct:
- dvb_dmx_swfilter uses spin_lock (called from irq, tasklet, whatever)
- DMX_START uses spin_lock_irq (called from process)
-> ok (see below).

> >From http://osdir.com/ml/kernel.janitors/2002-08/msg00022.html:
> 
> "spin_lock_irq disables local interrupts and then takes the spin_lock.
> If you know you're in process context and other users may be in
> interrupt context, this is the correct call to make.
> 
> spin_lock_irqsave saves local interrupt state into the flags variable,
> disables interrupts, then takes the spin_lock.  spin_unlock_irqrestore
> restores the local state saved in the flags.  Use this variant if you
> don't know whether you're in interrupt or process context."
> 
> So, if the assumtions above are correct, then spin_lock_irq must be
> used by all functions called from process context and
> spin_lock_irqsave must be used by all functions called from an unknown
> context.

Correct.

[1] If you want to lock a process against an interrupt handler,
- the process must use spin_lock_irq()
- the interrupt can use spin_lock()

A routine has to use spin_lock_irqsave if (and only if) process and irq
call the routine concurrently. I do not see yet how this might happen.

(Basically, the same happens when locking between tasklet and process
context, except that it is sufficient to use spin_lock_bh instead of
spin_lock_irq.)

Regards
Oliver

-- 
----------------------------------------------------------------
VDR Remote Plugin 0.4.0: http://www.escape-edv.de/endriss/vdr/
----------------------------------------------------------------
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux