From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: 2.5.50: sleeping function called from illegal context Date: Tue, 03 Dec 2002 14:56:55 +0100 Sender: alsa-devel-admin@lists.sourceforge.net Message-ID: References: <200212030407.53337.baldrick@wanadoo.fr> <200212030455.16379.baldrick@wanadoo.fr> Mime-Version: 1.0 (generated by SEMI 1.14.4 - "Hosorogi") Content-Type: text/plain; charset=US-ASCII Return-path: In-Reply-To: <200212030455.16379.baldrick@wanadoo.fr> Errors-To: alsa-devel-admin@lists.sourceforge.net List-Help: List-Post: List-Subscribe: , List-Unsubscribe: , List-Archive: To: Duncan Sands Cc: alsa-devel@lists.sourceforge.net List-Id: alsa-devel@alsa-project.org 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: > > > [] __might_sleep+0x52/0x58 > > > [] snd_cs46xx_iec958_put+0x36/0xf8 > > > [] snd_ctl_elem_write+0xe0/0x1a4 > > > [] snd_ctl_ioctl+0x184/0x2c8 > > > [] sys_ioctl+0x1fa/0x244 > > > [] 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