Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Duncan Sands <baldrick@wanadoo.fr>
Cc: alsa-devel@lists.sourceforge.net
Subject: Re: 2.5.50: sleeping function called from illegal context
Date: Tue, 03 Dec 2002 14:56:55 +0100	[thread overview]
Message-ID: <s5hisyb9peg.wl@alsa2.suse.de> (raw)
In-Reply-To: <200212030455.16379.baldrick@wanadoo.fr>

At Tue, 3 Dec 2002 04:55:15 +0100,
Duncan Sands wrote:
> 
> On Tuesday 03 December 2002 13:01, Takashi Iwai wrote:
> > At Tue, 3 Dec 2002 04:07:52 +0100,
> >
> > Duncan Sands wrote:
> > > Got this with today 2.5 BK tree:
> > >
> > > Debug: sleeping function called from illegal context at
> > > include/asm/semaphore.h:119 Call Trace:
> > >  [<c0113f1a>] __might_sleep+0x52/0x58
> > >  [<c024291a>] snd_cs46xx_iec958_put+0x36/0xf8
> > >  [<c0217f28>] snd_ctl_elem_write+0xe0/0x1a4
> > >  [<c0218360>] snd_ctl_ioctl+0x184/0x2c8
> > >  [<c01462e6>] sys_ioctl+0x1fa/0x244
> > >  [<c01088f7>] syscall_call+0x7/0xb
> >
> > ouch, we are using rwlock in the control ioctls.
> >
> > mutex is necessary for many controls, so we cannot suppress the use of
> > mutex in control callbacks.
> > but temporary unlocking looks ad-hoc, too...
> 
> If I understand right, the problem is that snd_ctl_elem_write
> acquires control_rwlock, which is a rw spinlock.  It then calls
> snd_cs46xx_iec958_put which acquires chip->spos_mutex,
> which is a semaphore.  Thus the message.  Now I deduce
> from the fact that  you don't use read_lock_irqsave that the
> data structure is not read from interrupt context.  That means
> you are only protecting against other CPUs.  So why not use
> a semaphore instead of a spinlock?

hmm, there are some places calling with irq lock.
for example, snd_ctl_notify() can be called from the interrupt handler
for some interrupts like h/w volume change.

however, it seems that a single rwlock is used for the management of
two different lists.  and snd_ctl_elem_write() uses card->controls
only, whereas snd_ctl_notify() uses card->ctl_files only.
hence, we can merge two locks, rwsem for card->controls and rwlock for
card->ctl_files.  i'll give a try.


ciao,

Takashi


-------------------------------------------------------
This SF.net email is sponsored by: Get the new Palm Tungsten T 
handheld. Power & Color in a compact size! 
http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0002en

  reply	other threads:[~2002-12-03 13:56 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-03  3:07 2.5.50: sleeping function called from illegal context Duncan Sands
2002-12-03 12:01 ` Takashi Iwai
2002-12-03  3:55   ` Duncan Sands
2002-12-03 13:56     ` Takashi Iwai [this message]
2002-12-03  5:57       ` Duncan Sands
2002-12-03 14:56         ` Takashi Iwai
2002-12-03  6:39           ` Duncan Sands
2002-12-06 13:13           ` Duncan Sands
2002-12-03 18:34         ` Paul Davis
     [not found] <3DE3F32200B4A5E8@mel-rti20.wanadoo.fr>
2002-12-03 12:21 ` Duncan Sands
2002-12-04 15:41   ` Takashi Iwai

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=s5hisyb9peg.wl@alsa2.suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@lists.sourceforge.net \
    --cc=baldrick@wanadoo.fr \
    /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