Re: Misbehaving Alder Lake-N PCH USB 3.2 xHCI Host Controller

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 21.8.2024 16.02, Michał Pecio wrote:
The reason I suggested aplay is only because it terminates after a
finite time, reducing the amount of output produced.

Today I found that I have similar issues if I plug my audio dongle into
one particular Asmedia USB 3.1 controller. I quickly confirmed your
finding that aplay has different symptoms - audio is slowed down and
distorted, but no errors in dmesg. Same for Jack in playback only mode.
I need to use Jack in full duplex to reproduce your symptoms.

I automatically stop Jack with timeout to control dmesg pollution:
timeout -s KILL 0.1 jackd -d alsa -d hw:3 -p 48 -n 2


The root cause appears to be that there are those "missed service" and
"underrun" errors in the first place. One means that the controller
failed to execute a transfer in its scheduled (micro)frame for internal
reasons or that the transfer was queued too late by software, the other
means that the controller ran out of queued data to send.

My best guess is that these are caused by a full xhci event ring.

If event ring is full it would stop transfer rings, and we would see
missed service events. This matches the logs.

The events get handled and cleared in the interrupt handler, but
not every event generates an interrupt. for isoc transfers we intentionally
block a lot of event triggered interrupts.

The event ring size has doubled since 6.6.45 kernel, using a newer kernel
could help. This changed in 6.7 kernel:
28084d3fcc3c ("xhci: Use more than one Event Ring segment")

I also now see that there is a driver issue in handling "missed service" events

If we get a "missed service" event for the last TD in a URB, then that URB won't
be returned to audio driver until we get a _successful_ event that generates
interrupts at some point later in the future. This could explain the underrun/overrun
events.

If possible I'd like to see xhci traces of this issue.

steps:
mount -t debugfs none /sys/kernel/debug
echo 81920 > /sys/kernel/debug/tracing/buffer_size_kb
echo 1 > /sys/kernel/debug/tracing/events/xhci-hcd/enable
echo 1 > /sys/kernel/debug/tracing/tracing_on
< Reproduce issue >
Send content of /sys/kernel/debug/tracing/trace

Trace grows fast, so please copy the /sys/kernel/debug/tracing/trace file
somewhere as soon as issue is seen.

Thanks
Mathias




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux