Re: NetBSD-current on thinkpad T495, sound issue (was "audio issue on -current")

2023-12-03 Thread Vitaly Shevtsov
Ok. please ignore. It happened again after 4 hours of playing music.

On Sun, Dec 3, 2023 at 10:01 PM Vitaly Shevtsov  wrote:
>
> I jumped to conclusions :) It works fine when I have "options
> HDAUDIO_DEBUG and options HDAFG_DEBUG" in the kernel config. I had
> been playing sound for 2 hours with no issue. As soon as I disabled
> these options, the problem occurred again. Then I enabled them again,
> and now I have been playing sound for 2 hours again. Strange
>
>
> On Sun, Dec 3, 2023 at 8:20 PM Vitaly Shevtsov  wrote:
> >
> > Hello.
> >
> > Today I built a kernel from the latest source tree and it seems the
> > problem is fixed now. But I don't understand how, I see neither
> > dev/hdaudio nor dev/audio was updated. I suspect interrupt handling
> > was fixed. Anyway, thank you.
> >
> > On Mon, Nov 27, 2023 at 8:09 PM Vitaly Shevtsov  
> > wrote:
> > >
> > > Hello!
> > >
> > > I see, I suspected something like that.
> > >
> > > On Mon, Nov 27, 2023 at 12:34 AM Michael van Elst  
> > > wrote:
> > > >
> > > > shev.vt1...@gmail.com (Vitaly Shevtsov) writes:
> > > >
> > > > >When I'm listening to music I get this error after some time:
> > > > >audio1(hdafg1): audio_write: device timeout, seq=16987,
> > > > >usrbuf=60224/H60224, outbuf=8192/8192
> > > >
> > > > You get timeouts when the backend driver (hdafg1) doesn't
> > > > finish playing buffers. So that's probably a bug there or
> > > > maybe a bug in interrupt routing.
> > > >
> > > > Here, audio1/hdafg1 is a digital output (HDMI) which also has
> > > > problems but with different symptoms. But the analog output
> > > > audio0/hdafg0 works fine.
> > > >


Re: NetBSD-current on thinkpad T495, sound issue (was "audio issue on -current")

2023-12-03 Thread Vitaly Shevtsov
I jumped to conclusions :) It works fine when I have "options
HDAUDIO_DEBUG and options HDAFG_DEBUG" in the kernel config. I had
been playing sound for 2 hours with no issue. As soon as I disabled
these options, the problem occurred again. Then I enabled them again,
and now I have been playing sound for 2 hours again. Strange


On Sun, Dec 3, 2023 at 8:20 PM Vitaly Shevtsov  wrote:
>
> Hello.
>
> Today I built a kernel from the latest source tree and it seems the
> problem is fixed now. But I don't understand how, I see neither
> dev/hdaudio nor dev/audio was updated. I suspect interrupt handling
> was fixed. Anyway, thank you.
>
> On Mon, Nov 27, 2023 at 8:09 PM Vitaly Shevtsov  wrote:
> >
> > Hello!
> >
> > I see, I suspected something like that.
> >
> > On Mon, Nov 27, 2023 at 12:34 AM Michael van Elst  
> > wrote:
> > >
> > > shev.vt1...@gmail.com (Vitaly Shevtsov) writes:
> > >
> > > >When I'm listening to music I get this error after some time:
> > > >audio1(hdafg1): audio_write: device timeout, seq=16987,
> > > >usrbuf=60224/H60224, outbuf=8192/8192
> > >
> > > You get timeouts when the backend driver (hdafg1) doesn't
> > > finish playing buffers. So that's probably a bug there or
> > > maybe a bug in interrupt routing.
> > >
> > > Here, audio1/hdafg1 is a digital output (HDMI) which also has
> > > problems but with different symptoms. But the analog output
> > > audio0/hdafg0 works fine.
> > >


Re: NetBSD-current on thinkpad T495, sound issue (was "audio issue on -current")

2023-12-03 Thread Vitaly Shevtsov
Hello.

Today I built a kernel from the latest source tree and it seems the
problem is fixed now. But I don't understand how, I see neither
dev/hdaudio nor dev/audio was updated. I suspect interrupt handling
was fixed. Anyway, thank you.

On Mon, Nov 27, 2023 at 8:09 PM Vitaly Shevtsov  wrote:
>
> Hello!
>
> I see, I suspected something like that.
>
> On Mon, Nov 27, 2023 at 12:34 AM Michael van Elst  wrote:
> >
> > shev.vt1...@gmail.com (Vitaly Shevtsov) writes:
> >
> > >When I'm listening to music I get this error after some time:
> > >audio1(hdafg1): audio_write: device timeout, seq=16987,
> > >usrbuf=60224/H60224, outbuf=8192/8192
> >
> > You get timeouts when the backend driver (hdafg1) doesn't
> > finish playing buffers. So that's probably a bug there or
> > maybe a bug in interrupt routing.
> >
> > Here, audio1/hdafg1 is a digital output (HDMI) which also has
> > problems but with different symptoms. But the analog output
> > audio0/hdafg0 works fine.
> >


Re: NetBSD-current on thinkpad T495, sound issue (was "audio issue on -current")

2023-11-27 Thread Vitaly Shevtsov
Hello!

I see, I suspected something like that.

On Mon, Nov 27, 2023 at 12:34 AM Michael van Elst  wrote:
>
> shev.vt1...@gmail.com (Vitaly Shevtsov) writes:
>
> >When I'm listening to music I get this error after some time:
> >audio1(hdafg1): audio_write: device timeout, seq=16987,
> >usrbuf=60224/H60224, outbuf=8192/8192
>
> You get timeouts when the backend driver (hdafg1) doesn't
> finish playing buffers. So that's probably a bug there or
> maybe a bug in interrupt routing.
>
> Here, audio1/hdafg1 is a digital output (HDMI) which also has
> problems but with different symptoms. But the analog output
> audio0/hdafg0 works fine.
>


Re: NetBSD-current on thinkpad T495, sound issue (was "audio issue on -current")

2023-11-26 Thread Michael van Elst
shev.vt1...@gmail.com (Vitaly Shevtsov) writes:

>When I'm listening to music I get this error after some time:
>audio1(hdafg1): audio_write: device timeout, seq=16987,
>usrbuf=60224/H60224, outbuf=8192/8192

You get timeouts when the backend driver (hdafg1) doesn't
finish playing buffers. So that's probably a bug there or
maybe a bug in interrupt routing.

Here, audio1/hdafg1 is a digital output (HDMI) which also has
problems but with different symptoms. But the analog output
audio0/hdafg0 works fine.



NetBSD-current on thinkpad T495, sound issue (was "audio issue on -current")

2023-11-26 Thread Vitaly Shevtsov
Hello!

For some reason I don't see the messages I posted before, so I'm sorry
for possibly duplicating them.

When I'm listening to music I get this error after some time:
audio1(hdafg1): audio_write: device timeout, seq=16987,
usrbuf=60224/H60224, outbuf=8192/8192
audio1(hdafg1): audio_drain: device timeout, seq=16987,
usrbuf=60224/H60224, outbuf=8192/8192

I tried different values for hw.audio1.blk_ms with no luck. I also
tried to increase AUDIO_TIMEOUT from 3000 to 9000 in
/usr/src/sys/dev/audio/audio.c and it didn't work.

I've made some research and found this:
- The sound stops working because cv_timedwait_sig() returns
EWOULDBLOCK in audio.c:1705
- Then the MD driver receives the hw interrupt (hdaudio_intr) that the
RIRB (response input ring buffer) is empty:
   [   650.951986] audio_pmixer_process@1 done mixseq=63728 hwbuf=0/960/1440
   [   650.951986] audio_softintr_wr@1 called
   [   650.951986] audio_softintr_wr@1 #2 broadcast; trkseq=63729
out=960/1440/1920
   [   650.951986] audio_track_waitio@1 #2 wakeup
   [   650.951986] audio_track_play@1 #2 start pstate=1
   [   650.951986] audio_track_play@1 #2 end out=960/1920/1920
f=0/0/441 usr=28224/63504/H65268
   [   650.951986] audio_write@1 #2 while resid=3312 usrbuf=28224/63504/H65268
   [   650.951986] audio_write@1 #2 uiomove(len=1764) usrbuf=28224/65268/C65268
   [   650.951986] audio_write@1 #2 while resid=1548 usrbuf=28224/65268/H65268
   [   650.951986] audio_write@1 #2 sleep usrbuf=65268/H65268
   [   650.961986] hdaudio1: cmd  : request 0F09  (21)
   [   650.961986] hdaudio1: cmd  : response  
   [   650.961986] hdaudio1: hdaudio_intr: 997   /* this a line number
in hdaudio.c */
   [   650.961986] hdaudio1: unsol: rirb empty
   [   650.961986] hdaudio1: hdaudio_intr: 999   /* this a line number
in hdaudio.c */
   [   650.961986] hdaudio1: cmd  : request 0707 0040 (14)
   [   650.961986] hdaudio1: cmd  : response  
   [   650.961986] hdaudio1: cmd  : request 0707 0080 (21)
   [   650.961986] hdaudio1: cmd  : response  
   [   653.951941] audio_track_waitio@1 #2 cv_timedwait_sig failed 35
   [   653.951941] audio1(hdafg1): audio_write: device timeout,
seq=63729, usrbuf=65268/H65268, outbuf=1920/1920
   [   653.951941] audio_write@1 #2 done error=35
   [   653.951941] audio_write@1 #2 begin resid=1548 pid=1083.1078 ioflag=0x1
   [   653.951941] audio_write@1 #2 while resid=1548 usrbuf=28224/65268/H65268
   [   653.951941] audio_write@1 #2 sleep usrbuf=65268/H65268
- If I start a player on a just rebooted system right after login, it
happens nearly within the same time, 650-700 seconds in dmesg output
- It seems sc->sc_lock is locked by some other thread

Regards,


-- 
Vitaly