Linux Sound subsystem development
 help / color / mirror / Atom feed
* es1371 driver
@ 2002-02-21 13:40 Wilmer van der Gaast
  2002-02-21 14:30 ` Zwane Mwaikambo
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Wilmer van der Gaast @ 2002-02-21 13:40 UTC (permalink / raw)
  To: linux-sound

(I found two addresses for Thomas, which one is the right one?)

Hello,

My computer has a SB PCI128 card and works perfectly with it. But, one
strange thing with the current Linux driver for it. Here a piece from
es1381_open:

	/* wait for device to become free */
	down(&s->open_sem);
	while (s->open_mode & file->f_mode) {
		if (file->f_flags & O_NONBLOCK) {
			up(&s->open_sem);
			return -EBUSY;
		}
		add_wait_queue(&s->open_wait, &wait);
		__set_current_state(TASK_INTERRUPTIBLE);
		up(&s->open_sem);
		schedule();
		remove_wait_queue(&s->open_wait, &wait);
		set_current_state(TASK_RUNNING);
		if (signal_pending(current))
			return -ERESTARTSYS;
		down(&s->open_sem);
	}

Why does it wait? When I play an MP3 and meanwhile accidentally visit a
website which uses Flash, the whole Mozilla process freezes because it can't
get /dev/dsp. Maybe all programs should be blamed for opening /dev/dsp
without O_NONBLOCK, but for me altering this piece of kernel code worked a
lot better. Now any open() is handled as O_NONBLOCK and I don't get those
crashes anymore.

Anyway, why this crashy behaviour by default? :-/


Greetings,

Wilmer van der Gaast.

-- 
*=-+-______________________
   |lintux-@t-lintux-d0t-cx:      _________________________________
   | http://www.lintux.cx/ |     /        Currently playing        \
   :http://www.algoritme.nl|    /         Oomph:DerNeueGott         \
    ~~~~~~~~~~~~~~~~~~~~~~-+-=-+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+-=*

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: es1371 driver
  2002-02-21 13:40 es1371 driver Wilmer van der Gaast
@ 2002-02-21 14:30 ` Zwane Mwaikambo
  2002-02-21 14:55 ` Jaroslav Kysela
  2002-02-21 18:03 ` Wilmer van der Gaast
  2 siblings, 0 replies; 4+ messages in thread
From: Zwane Mwaikambo @ 2002-02-21 14:30 UTC (permalink / raw)
  To: linux-sound

On Thu, 21 Feb 2002, Wilmer van der Gaast wrote:

> (I found two addresses for Thomas, which one is the right one?)
The one you used.

> Why does it wait? When I play an MP3 and meanwhile accidentally visit a
> website which uses Flash, the whole Mozilla process freezes because it can't
> get /dev/dsp. Maybe all programs should be blamed for opening /dev/dsp
> without O_NONBLOCK, but for me altering this piece of kernel code worked a
> lot better. Now any open() is handled as O_NONBLOCK and I don't get those
> crashes anymore.

Its the userland apps which are broken, they should handle this a bit more 
sanely instead of throwing childish fits and running in the corner ;)

Regards,
	Zwane Mwaikambo



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: es1371 driver
  2002-02-21 13:40 es1371 driver Wilmer van der Gaast
  2002-02-21 14:30 ` Zwane Mwaikambo
@ 2002-02-21 14:55 ` Jaroslav Kysela
  2002-02-21 18:03 ` Wilmer van der Gaast
  2 siblings, 0 replies; 4+ messages in thread
From: Jaroslav Kysela @ 2002-02-21 14:55 UTC (permalink / raw)
  To: linux-sound

On Thu, 21 Feb 2002, Wilmer van der Gaast wrote:

> (I found two addresses for Thomas, which one is the right one?)
>
> Hello,
>
> My computer has a SB PCI128 card and works perfectly with it. But, one
> strange thing with the current Linux driver for it. Here a piece from
> es1381_open:
>
> 	/* wait for device to become free */
> 	down(&s->open_sem);
> 	while (s->open_mode & file->f_mode) {
> 		if (file->f_flags & O_NONBLOCK) {
> 			up(&s->open_sem);
> 			return -EBUSY;
> 		}
> 		add_wait_queue(&s->open_wait, &wait);
> 		__set_current_state(TASK_INTERRUPTIBLE);
> 		up(&s->open_sem);
> 		schedule();
> 		remove_wait_queue(&s->open_wait, &wait);
> 		set_current_state(TASK_RUNNING);
> 		if (signal_pending(current))
> 			return -ERESTARTSYS;
> 		down(&s->open_sem);
> 	}
>
> Why does it wait? When I play an MP3 and meanwhile accidentally visit a
> website which uses Flash, the whole Mozilla process freezes because it can't
> get /dev/dsp. Maybe all programs should be blamed for opening /dev/dsp
> without O_NONBLOCK, but for me altering this piece of kernel code worked a
> lot better. Now any open() is handled as O_NONBLOCK and I don't get those
> crashes anymore.
>
> Anyway, why this crashy behaviour by default? :-/

Applications are ignoring standards. For further defails see:

http://www.unix-systems.org/onlinepubs/7908799/xsh/open.html

Especially this sentence:

If O_NONBLOCK is clear:
	The open() function will block the calling thread until the device
is ready or available before returning.

						Jaroslav

-----
Jaroslav Kysela <perex@suse.cz>
Linux Kernel Sound Maintainer
ALSA Project  http://www.alsa-project.org
SuSE Linux    http://www.suse.com


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: es1371 driver
  2002-02-21 13:40 es1371 driver Wilmer van der Gaast
  2002-02-21 14:30 ` Zwane Mwaikambo
  2002-02-21 14:55 ` Jaroslav Kysela
@ 2002-02-21 18:03 ` Wilmer van der Gaast
  2 siblings, 0 replies; 4+ messages in thread
From: Wilmer van der Gaast @ 2002-02-21 18:03 UTC (permalink / raw)
  To: linux-sound

Jaroslav Kysela (perex@suse.cz) wrote:
> If O_NONBLOCK is clear:
> 	The open() function will block the calling thread until the device
> is ready or available before returning.
> 
Hmm.. Damn, looks like a *lot* of applications don't know about this.

Also, I checked a couple of other drivers (including GUS, the card I
used to have), they all return -EBUSY when the device in use, even when
O_NONBLOCK is clear. Why this inconsistency?


Greetings,

Wilmer van der Gaast.

-- 
+-------- .''`.     - -- ---+  +         - -- --- ---- ----- ------+
| lintux : :'  :  lintux.cx |  | Unix and CGI @   IOI/NIO(Dutch)at |
|   at   `. `~'  debian.org |  | www.lintux.cx/   www.algoritme.nl |
+--- -- -  ` ---------------+  +------ ----- ---- --- -- -         +

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-02-21 18:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-02-21 13:40 es1371 driver Wilmer van der Gaast
2002-02-21 14:30 ` Zwane Mwaikambo
2002-02-21 14:55 ` Jaroslav Kysela
2002-02-21 18:03 ` Wilmer van der Gaast

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox