linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [Alsa-devel] Re: 2.6.10-mm1: ALSA ac97 compile error with CONFIG_PM=n
@ 2005-01-05 14:21 Mark_H_Johnson
  2005-01-05 14:56 ` Alan Cox
  2005-01-05 16:49 ` Takashi Iwai
  0 siblings, 2 replies; 11+ messages in thread
From: Mark_H_Johnson @ 2005-01-05 14:21 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: Andrew Morton, alsa-devel, Adrian Bunk, lkml, perex

> At Tue, 4 Jan 2005 13:25:40 -0600,
> Mark_H_Johnson@raytheon.com wrote:
> > [snip - how to get to the problem]
> > At this point, I get the window asking if I heard the sound (I did
not). If
> > I repeat the test after waiting a short period, it eventually succeeds.
>
> The default blocking behavior of OSS devices was changed recently.
> When the device is in use, open returns -EBUSY immediately in the
> latest version while it was blocked until released in the former
> version.
I suppose there was a "good reason" for changing the user level
interface in this way. Could you [or someone else] explain that and
if you would consider changing it back (to stop breaking old applications)?
Otherwise - is there some way (other than running lsmod and grep) to find
out if the interface is busy and which application is using it?

> > [2] When running latencytest (from
> > http://www.gardena.net/benno/linux/audio/) the sound is not consistent
> > (like it was on 2.4 with OSS) and occasionally I hear "rapid playback"
> > where the repeating audio pattern is much faster than it should be.
>
> It's hard to tell.  The cause could be in the general interrupt
> handling, the difference of HZ, the driver's interrupt setting, or
> whatever.  This must depend on the hardware, anyway.
Well, to a certain extent, I agree but let me repeat the symptoms
I am seeing [repeated below]
> >   a. The time between write() calls to the audio interface varies from
> > roughly 1.16 msec to 2.0 msec. If you add code to dump out the
durations
> > you can see it is a sawtooth pattern, some periods it returns too
quickly
> > and some periods it returns too slowly.
What you describe can certainly explain this first behavior. For example,
if the ALSA code waits for the next clock tick (1 msec resolution)
to return from the write() call, the behavior I see can be explained. I do
not necessarily LIKE this behavior (it makes the analysis of latency and
explanations to other people more difficult) but I understand it and when
this happens - the sound is OK.

> >   b. The time between write() calls is roughly 1.2 msec. I believe this
> > behavior occurs at the same time the audio pattern repeats too quickly.
This behavior on the other hand does not appear reasonable to me. The
latencytest application writes a series of audio fragments, each 1.45 msec
long.
It should never get an extended period (many seconds) where the loop doing
that
gets done at a 1.2 msec rate. What I hear from the speakers (the rapid
playback) does not sound right either. This looks like a bug to me that
needs to be corrected.

I can generally trigger it by running latencytest while reading (or
copying)
a large disk file with the kernels I have been building. Perhaps a long
latency
(> 1 audio fragment - 1.45 msec) is getting the ALSA code into a "hurry up"
mode
which it never leaves. That would explain the symptom but I certainly don't
know the code good enough to tell if that is feasible (or if something else
is causing the symptom).

--Mark H Johnson
  <mailto:Mark_H_Johnson@raytheon.com>


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

* Re: [Alsa-devel] Re: 2.6.10-mm1: ALSA ac97 compile error with CONFIG_PM=n
  2005-01-05 14:21 [Alsa-devel] Re: 2.6.10-mm1: ALSA ac97 compile error with CONFIG_PM=n Mark_H_Johnson
@ 2005-01-05 14:56 ` Alan Cox
  2005-01-05 17:23   ` Lee Revell
  2005-01-05 16:49 ` Takashi Iwai
  1 sibling, 1 reply; 11+ messages in thread
From: Alan Cox @ 2005-01-05 14:56 UTC (permalink / raw)
  To: Mark_H_Johnson
  Cc: Takashi Iwai, Andrew Morton, alsa-devel, Adrian Bunk, lkml, perex

On Mer, 2005-01-05 at 14:21, Mark_H_Johnson@raytheon.com wrote:
> > The default blocking behavior of OSS devices was changed recently.
> > When the device is in use, open returns -EBUSY immediately in the
> > latest version while it was blocked until released in the former
> > version.
> I suppose there was a "good reason" for changing the user level
> interface in this way. Could you [or someone else] explain that and
> if you would consider changing it back (to stop breaking old applications)?
> Otherwise - is there some way (other than running lsmod and grep) to find
> out if the interface is busy and which application is using it?

OSS itself changed behaviour over time (2.2 to 2.4) ALSA has merely
caught up with the newer OSS behaviour and the new behaviour is correct.

If you want to find out if the interface is busy open it. If you want to
do it portably open it with O_NDELAY.


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

* Re: [Alsa-devel] Re: 2.6.10-mm1: ALSA ac97 compile error with CONFIG_PM=n
  2005-01-05 14:21 [Alsa-devel] Re: 2.6.10-mm1: ALSA ac97 compile error with CONFIG_PM=n Mark_H_Johnson
  2005-01-05 14:56 ` Alan Cox
@ 2005-01-05 16:49 ` Takashi Iwai
  2005-01-05 18:04   ` Lee Revell
  1 sibling, 1 reply; 11+ messages in thread
From: Takashi Iwai @ 2005-01-05 16:49 UTC (permalink / raw)
  To: Mark_H_Johnson; +Cc: Andrew Morton, alsa-devel, Adrian Bunk, lkml, perex

At Wed, 5 Jan 2005 08:21:20 -0600,
Mark_H_Johnson@raytheon.com wrote:
> 
> > At Tue, 4 Jan 2005 13:25:40 -0600,
> > Mark_H_Johnson@raytheon.com wrote:
> > > [snip - how to get to the problem]
> > > At this point, I get the window asking if I heard the sound (I did
> not). If
> > > I repeat the test after waiting a short period, it eventually succeeds.
> >
> > The default blocking behavior of OSS devices was changed recently.
> > When the device is in use, open returns -EBUSY immediately in the
> > latest version while it was blocked until released in the former
> > version.
> I suppose there was a "good reason" for changing the user level
> interface in this way. Could you [or someone else] explain that and
> if you would consider changing it back (to stop breaking old applications)?

It was discussed on alsa-devel in November.  Unfortunately, I can't
find ML archive any longer...

The blocking behavior of OSS is a feature which is nowehre defined.
Some OSS drivers open in the blocking mode and some don't.
So, apps shouldn't depend on this feature.

We had implemented OSS emulation in the blocking manner since we
intepreted the POSIX definition in that way.  But Linus pointed out
that it's a misreading.

BTW, you can enable the blocking mode again via module/boot option.
See OSS-Emulation.txt.


> > > [2] When running latencytest (from
> > > http://www.gardena.net/benno/linux/audio/) the sound is not consistent
> > > (like it was on 2.4 with OSS) and occasionally I hear "rapid playback"
> > > where the repeating audio pattern is much faster than it should be.
> >
> > It's hard to tell.  The cause could be in the general interrupt
> > handling, the difference of HZ, the driver's interrupt setting, or
> > whatever.  This must depend on the hardware, anyway.
> Well, to a certain extent, I agree but let me repeat the symptoms
> I am seeing [repeated below]

Please provide the hardware details (I don't see your original post to
lkml).  Otherwise it'll be a vapor discusson...


Takashi

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

* Re: [Alsa-devel] Re: 2.6.10-mm1: ALSA ac97 compile error with CONFIG_PM=n
  2005-01-05 14:56 ` Alan Cox
@ 2005-01-05 17:23   ` Lee Revell
  0 siblings, 0 replies; 11+ messages in thread
From: Lee Revell @ 2005-01-05 17:23 UTC (permalink / raw)
  To: Alan Cox
  Cc: Mark_H_Johnson, Takashi Iwai, Andrew Morton, alsa-devel,
	Adrian Bunk, lkml, perex

On Wed, 2005-01-05 at 14:56 +0000, Alan Cox wrote:
> On Mer, 2005-01-05 at 14:21, Mark_H_Johnson@raytheon.com wrote:
> > > The default blocking behavior of OSS devices was changed recently.
> > > When the device is in use, open returns -EBUSY immediately in the
> > > latest version while it was blocked until released in the former
> > > version.
> > I suppose there was a "good reason" for changing the user level
> > interface in this way. Could you [or someone else] explain that and
> > if you would consider changing it back (to stop breaking old applications)?
> > Otherwise - is there some way (other than running lsmod and grep) to find
> > out if the interface is busy and which application is using it?
> 
> OSS itself changed behaviour over time (2.2 to 2.4) ALSA has merely
> caught up with the newer OSS behaviour and the new behaviour is correct.
> 
> If you want to find out if the interface is busy open it. If you want to
> do it portably open it with O_NDELAY.
> 

And if you want to find out who is using it then try fuser /dev/dsp,
fuser /dev/snd/*, or lsof.

Lee


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

* Re: [Alsa-devel] Re: 2.6.10-mm1: ALSA ac97 compile error with CONFIG_PM=n
  2005-01-05 16:49 ` Takashi Iwai
@ 2005-01-05 18:04   ` Lee Revell
  0 siblings, 0 replies; 11+ messages in thread
From: Lee Revell @ 2005-01-05 18:04 UTC (permalink / raw)
  To: Takashi Iwai
  Cc: Mark_H_Johnson, Andrew Morton, alsa-devel, Adrian Bunk, lkml, perex

On Wed, 2005-01-05 at 17:49 +0100, Takashi Iwai wrote:
> At Wed, 5 Jan 2005 08:21:20 -0600,
> Mark_H_Johnson@raytheon.com wrote:
> > 
> > > At Tue, 4 Jan 2005 13:25:40 -0600,
> > > Mark_H_Johnson@raytheon.com wrote:
> > > > [snip - how to get to the problem]
> > > > At this point, I get the window asking if I heard the sound (I did
> > not). If
> > > > I repeat the test after waiting a short period, it eventually succeeds.
> > >
> > > The default blocking behavior of OSS devices was changed recently.
> > > When the device is in use, open returns -EBUSY immediately in the
> > > latest version while it was blocked until released in the former
> > > version.
> > I suppose there was a "good reason" for changing the user level
> > interface in this way. Could you [or someone else] explain that and
> > if you would consider changing it back (to stop breaking old applications)?
> 
> It was discussed on alsa-devel in November.  Unfortunately, I can't
> find ML archive any longer...
> 

Heh, if you want the excruciating details, here are some pointers.  It's
a long thread, and unfortunately the threading is a little broken.

Here's a link to the technical part:

http://sourceforge.net/mailarchive/message.php?msg_id=10008900

And here's the rant that started it:

http://sourceforge.net/mailarchive/message.php?msg_id=10014826

Lee


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

* Re: [Alsa-devel] Re: 2.6.10-mm1: ALSA ac97 compile error with CONFIG_PM=n
@ 2005-01-07 14:41 Mark_H_Johnson
  0 siblings, 0 replies; 11+ messages in thread
From: Mark_H_Johnson @ 2005-01-07 14:41 UTC (permalink / raw)
  To: Lee Revell
  Cc: Alan Cox, Takashi Iwai, Andrew Morton, alsa-devel, Adrian Bunk,
	lkml, perex

> And if you want to find out who is using it then try fuser /dev/dsp,
> fuser /dev/snd/*, or lsof.

Hmm. I figured out which application is "getting in my way" but am not
quite sure why I have a problem opening the audio / what I should do
about it.

On my system...

# fuser /dev/snd/* /dev/dsp
/dev/snd/pcmC0D0p:    2972  2972m
# ps -fe | grep 2972
u21305    2972  2936  0 10:15 ?        00:00:02 artsd -F 10 -S 4096 -a alsa
-s 60 -m artsmessage -c drkonqi -l 3 -f
root      4915  3407  0 11:08 pts/7    00:00:00 grep 2972
# fuser /dev/snd/* /dev/dsp
[I caused a console beep here using backspace]
# fuser /dev/snd/* /dev/dsp
/dev/snd/pcmC0D0p:    2972  2972m

OK, so artsd wakes up on some trigger and then waits around a while
expecting to get some more audio to process. I see it is a user of
/dev/snd/pcmC0D0p but not a user of /dev/dsp. Yet when I attempt to
open /dev/dsp, I get an error.

When I successfully run latencytest (and open /dev/dsp) I see...

# fuser /dev/snd/* /dev/dsp
/dev/dsp:             9156

which is the pid of latencytest.

Can someone please explain the relationship between these devices
and why access to one of these devices prevents access to another?
This is certainly confusing to me.

Thanks.
  --Mark


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

* Re: [Alsa-devel] Re: 2.6.10-mm1: ALSA ac97 compile error with CONFIG_PM=n
  2005-01-05 21:27   ` Andrew Morton
  2005-01-05 21:43     ` Lee Revell
@ 2005-01-06 16:30     ` Alan Cox
  1 sibling, 0 replies; 11+ messages in thread
From: Alan Cox @ 2005-01-06 16:30 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Takashi Iwai, Mark_H_Johnson, bunk, alsa-devel,
	Linux Kernel Mailing List, perex

On Mer, 2005-01-05 at 21:27, Andrew Morton wrote:
> Takashi Iwai <tiwai@suse.de> wrote:
> >
> > The default blocking behavior of OSS devices was changed recently.
> >  When the device is in use, open returns -EBUSY immediately in the
> >  latest version while it was blocked until released in the former
> >  version.
> > 
> 
> whoa.  That's a significant change in user-visible behaviour.  Why was this
> done?

It now emulates the later OSS PCI and other devices not 2.2 OSS. As such
its the right thing to have done for emulation of OSS IMHO. It also
works with more apps several of which hang on opening /dev/dsp0
expecting OSS -EBUSY responses.


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

* Re: [Alsa-devel] Re: 2.6.10-mm1: ALSA ac97 compile error with CONFIG_PM=n
  2005-01-05 21:27   ` Andrew Morton
@ 2005-01-05 21:43     ` Lee Revell
  2005-01-06 16:30     ` Alan Cox
  1 sibling, 0 replies; 11+ messages in thread
From: Lee Revell @ 2005-01-05 21:43 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Takashi Iwai, Mark_H_Johnson, bunk, alsa-devel, linux-kernel, perex

On Wed, 2005-01-05 at 13:27 -0800, Andrew Morton wrote:
> Takashi Iwai <tiwai@suse.de> wrote:
> >
> > The default blocking behavior of OSS devices was changed recently.
> >  When the device is in use, open returns -EBUSY immediately in the
> >  latest version while it was blocked until released in the former
> >  version.
> > 
> 
> whoa.  That's a significant change in user-visible behaviour.  Why was this
> done?

http://sourceforge.net/mailarchive/message.php?msg_id=10011826

Lee


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

* Re: [Alsa-devel] Re: 2.6.10-mm1: ALSA ac97 compile error with CONFIG_PM=n
  2005-01-05 13:41 ` [Alsa-devel] " Takashi Iwai
@ 2005-01-05 21:27   ` Andrew Morton
  2005-01-05 21:43     ` Lee Revell
  2005-01-06 16:30     ` Alan Cox
  0 siblings, 2 replies; 11+ messages in thread
From: Andrew Morton @ 2005-01-05 21:27 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: Mark_H_Johnson, bunk, alsa-devel, linux-kernel, perex

Takashi Iwai <tiwai@suse.de> wrote:
>
> The default blocking behavior of OSS devices was changed recently.
>  When the device is in use, open returns -EBUSY immediately in the
>  latest version while it was blocked until released in the former
>  version.
> 

whoa.  That's a significant change in user-visible behaviour.  Why was this
done?

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

* Re: [Alsa-devel] Re: 2.6.10-mm1: ALSA ac97 compile error with CONFIG_PM=n
@ 2005-01-05 18:15 Mark_H_Johnson
  0 siblings, 0 replies; 11+ messages in thread
From: Mark_H_Johnson @ 2005-01-05 18:15 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: Andrew Morton, alsa-devel, Adrian Bunk, lkml, perex

> At Wed, 5 Jan 2005 08:21:20 -0600,
> Mark_H_Johnson@raytheon.com wrote:
[snip - back & forth on the blocking behavior]
> > I suppose there was a "good reason" for changing the user level
> > interface in this way. Could you [or someone else] explain that and
> > if you would consider changing it back (to stop breaking old
applications)?
>
> It was discussed on alsa-devel in November.  Unfortunately, I can't
> find ML archive any longer...
>
> The blocking behavior of OSS is a feature which is nowehre defined.
> Some OSS drivers open in the blocking mode and some don't.
> So, apps shouldn't depend on this feature.
>
> We had implemented OSS emulation in the blocking manner since we
> intepreted the POSIX definition in that way.  But Linus pointed out
> that it's a misreading.
>
> BTW, you can enable the blocking mode again via module/boot option.
> See OSS-Emulation.txt.
>
Thanks for the explanation and the suggested work around. Thanks
also to Lee Revell for his other suggestion (using fuser). I should
be able to work around this OK for now.

> > > [snip - rehash of symptoms]
> Please provide the hardware details (I don't see your original post to
> lkml).  Otherwise it'll be a vapor discusson...

Details provided separately. Basically it is a two CPU system (866 Mhz
Pentium III) with an Ensoniq sound card. I use this system primarily
for comparative tests of kernels (for RT latency) before moving a
kernel update to other system for more comprehensive tests.

  --Mark


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

* Re: [Alsa-devel] Re: 2.6.10-mm1: ALSA ac97 compile error with CONFIG_PM=n
  2005-01-04 19:25 Mark_H_Johnson
@ 2005-01-05 13:41 ` Takashi Iwai
  2005-01-05 21:27   ` Andrew Morton
  0 siblings, 1 reply; 11+ messages in thread
From: Takashi Iwai @ 2005-01-05 13:41 UTC (permalink / raw)
  To: Mark_H_Johnson; +Cc: Adrian Bunk, Andrew Morton, alsa-devel, lkml, perex

At Tue, 4 Jan 2005 13:25:40 -0600,
Mark_H_Johnson@raytheon.com wrote:
> 
> A follow up on this patch. This fixed my build / module load problem when
> using CONFIG_PM=N on my system. The audio worked OK (except as noted
> below). Do you want Andrew Morton to pick this up (or will you incorporate
> the fix into another ALSA patch)?

It was already fixed in the recent ALSA tree.
So, just syncing bk-alsa patch would suffice.

> I did have some other minor problems during my testing but I have seen
> these before. Perhaps one of the ALSA developers could comment on the
> correct / incorrect behavior of the audio system. The testing is done on a
> Fedora Core 2 system with the 2.6.10-mm1 kernel (with the patch below). Let
> me know if you need more information on the system configuration, and
> .config.
> 
> [1] After system start up & log in, I do the sequence:
>   su -
>   (password entered)
>   system-config-soundcard
>   Simple mixer control 'PCM',0
>     Capabilities: pvolume pswitch pswitch-joined
>     Playback channels: Front Left - Front Right
>     Limits: Playback 0 - 31
>     Front Left: Playback 23 [74%] [on]
>     Front Right: Playback 23 [74%] [on]
>   sox: Can't open output file '/dev/dsp': Device or resource busy
> 
> At this point, I get the window asking if I heard the sound (I did not). If
> I repeat the test after waiting a short period, it eventually succeeds.

The default blocking behavior of OSS devices was changed recently.
When the device is in use, open returns -EBUSY immediately in the
latest version while it was blocked until released in the former
version.


> [2] When running latencytest (from
> http://www.gardena.net/benno/linux/audio/) the sound is not consistent
> (like it was on 2.4 with OSS) and occasionally I hear "rapid playback"
> where the repeating audio pattern is much faster than it should be.

It's hard to tell.  The cause could be in the general interrupt
handling, the difference of HZ, the driver's interrupt setting, or
whatever.  This must depend on the hardware, anyway.


Takashi

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

end of thread, other threads:[~2005-01-07 14:54 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-05 14:21 [Alsa-devel] Re: 2.6.10-mm1: ALSA ac97 compile error with CONFIG_PM=n Mark_H_Johnson
2005-01-05 14:56 ` Alan Cox
2005-01-05 17:23   ` Lee Revell
2005-01-05 16:49 ` Takashi Iwai
2005-01-05 18:04   ` Lee Revell
  -- strict thread matches above, loose matches on Subject: below --
2005-01-07 14:41 Mark_H_Johnson
2005-01-05 18:15 Mark_H_Johnson
2005-01-04 19:25 Mark_H_Johnson
2005-01-05 13:41 ` [Alsa-devel] " Takashi Iwai
2005-01-05 21:27   ` Andrew Morton
2005-01-05 21:43     ` Lee Revell
2005-01-06 16:30     ` Alan Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).