linux icon indicating copy to clipboard operation
linux copied to clipboard

CRITICAL: sof-hda-dsp: PCM: The kernel I/O operations took long time, causing recovery malfuction for pipewire

Open perexg opened this issue 3 months ago • 31 comments

Hardware: Meteor Lake platform, Ultra 7 165H processor Kernel: 6.17-rc7 (but observed weird pipewire behaviour from ~6.15)

Reproduction:

Use any ALSA application like aplay or pipewire and look to strace -ttt times for:

  1. open syscall (~1.6 seconds)
  2. SNDRV_PCM_IOCTL_START (~6 ms)
  3. SNDRV_PCM_IOCTL_HWSYNC (~4 ms)
1758698755.914439 openat(AT_FDCWD, "/dev/snd/pcmC0D0p", O_RDWR|O_NONBLOCK|O_CLOEXEC) = 4
1758698757.508081 close(3)              = 0

1758699185.654109 ioctl(90, SNDRV_PCM_IOCTL_START, 0x560c952e71b0) = 0
1758699185.660952 epoll_wait(9, [{events=EPOLLIN, data=0x560c94eef800}], 32, -1) = 1

# recovery times (10ms total)

1758699769.137824 ioctl(148, SNDRV_PCM_IOCTL_HWSYNC, 0x560c95d13df0) = -1 EPIPE (Broken pipe)
1758699769.141410 ioctl(148, SNDRV_PCM_IOCTL_STATUS_EXT, 0x7f0d27ffe9e0) = 0
1758699769.141443 ioctl(148, SNDRV_PCM_IOCTL_DROP, 0) = 0
1758699769.141472 ioctl(148, SNDRV_PCM_IOCTL_PREPARE, 0) = 0
1758699769.144541 ioctl(148, SNDRV_PCM_IOCTL_START, 0x560c95d13df0) = 0
1758699769.147493 ioctl(148, SNDRV_PCM_IOCTL_HWSYNC, 0x560c95d13df0) = 0
1758699769.147556 write(98, "\1\0\0\0\0\0\0\0", 8) = 8

Corner case:

Use one (or two+) USB soundcards connected to machine. Run a playback application and run e.g. pavucontrol to monitor all sound devices. The system sound is unusable. Pipewire tries to recover quickly, but because big I/O times for the SOF driver (multiply by opened devices), the recovery code does not do the right job, thus the audio data are not delivered in time.

ADDED: Workaround (use legacy HDA driver - no digital /build-in/ microphone):

echo "options snd-intel-dspcfg dsp_driver=1" > /etc/modprobe.d/alsa.conf
# and reboot

perexg avatar Sep 24 '25 07:09 perexg