All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oliver Endriss <o.endriss@gmx.de>
To: linux-dvb@linuxtv.org, linux-media@vger.kernel.org
Cc: Trent Piepho <xyzzy@speakeasy.org>
Subject: Re: [linux-dvb] [BUG] changeset 9029 (http://linuxtv.org/hg/v4l-dvb/rev/aa3e5cc1d833)
Date: Wed, 18 Feb 2009 03:04:27 +0100	[thread overview]
Message-ID: <200902180304.28615@orion.escape-edv.de> (raw)
In-Reply-To: <499A36CD.4070209@linuxtv.org>

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/
----------------------------------------------------------------

  reply	other threads:[~2009-02-18  2:05 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-02  1:46 [BUG] changeset 9029 (http://linuxtv.org/hg/v4l-dvb/rev/aa3e5cc1d833) e9hack
2009-02-02  3:38 ` Andy Walls
2009-02-15 12:36 ` Oliver Endriss
2009-02-15 14:07   ` [linux-dvb] " Andy Walls
2009-02-15 20:25   ` Andy Walls
2009-02-16 16:19   ` Trent Piepho
2009-02-16 16:33     ` [linux-dvb] " VDR User
2009-02-16 18:31     ` Mauro Carvalho Chehab
2009-02-16 19:13       ` [linux-dvb] " Steven Toth
2009-02-16 19:15         ` Steven Toth
2009-02-16 23:11           ` Andy Walls
2009-02-17  0:22         ` Trent Piepho
2009-02-17 15:16           ` Steven Toth
2009-02-17 16:47             ` Andreas Oberritter
2009-02-18  2:32             ` Trent Piepho
2009-02-18 15:07               ` Steven Toth
2009-02-18 20:45                 ` Trent Piepho
2009-02-17  0:40     ` Oliver Endriss
2009-02-17  4:02       ` Andreas Oberritter
2009-02-18  2:04         ` Oliver Endriss [this message]
2009-02-18  3:22           ` [linux-dvb] " Trent Piepho
2009-02-18 16:47             ` Oliver Endriss
2009-02-18 12:51           ` Andreas Oberritter
2009-02-18  9:15         ` Trent Piepho

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=200902180304.28615@orion.escape-edv.de \
    --to=o.endriss@gmx.de \
    --cc=linux-dvb@linuxtv.org \
    --cc=linux-media@vger.kernel.org \
    --cc=xyzzy@speakeasy.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.