Huge Audio Stuttering Even at Desktop

OS is Fedora 28.

Video plays fine, but audio is practically unrecognizable.

My only clues in dmesg are:

# dmesg |grep sound
[   14.199599] input: HDA NVidia HDMI/DP,pcm=3 as /devices/pci0000:00/0000:00:02.7/0000:09:00.0/sound/card0/input8
[   14.199856] input: HDA NVidia HDMI/DP,pcm=7 as /devices/pci0000:00/0000:00:02.7/0000:09:00.0/sound/card0/input9
[   14.199977] input: HDA NVidia HDMI/DP,pcm=8 as /devices/pci0000:00/0000:00:02.7/0000:09:00.0/sound/card0/input10
[   14.200156] input: HDA NVidia HDMI/DP,pcm=9 as /devices/pci0000:00/0000:00:02.7/0000:09:00.0/sound/card0/input11
# dmesg |grep snd
[   13.474921] snd_hda_intel 0000:09:00.0: Disabling MSI
[   19.408048] snd_hda_intel 0000:09:00.0: azx_get_response timeout, switching to polling mode: last cmd=0x005f2e08
# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: NVidia [HDA NVidia], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: NVidia [HDA NVidia], device 8: HDMI 2 [HDMI 2]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: NVidia [HDA NVidia], device 9: HDMI 3 [HDMI 3]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
# aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)
hdmi:CARD=NVidia,DEV=0
    HDA NVidia, HDMI 0
    HDMI Audio Output
hdmi:CARD=NVidia,DEV=1
    HDA NVidia, HDMI 1
    HDMI Audio Output
hdmi:CARD=NVidia,DEV=2
    HDA NVidia, HDMI 2
    HDMI Audio Output
hdmi:CARD=NVidia,DEV=3
    HDA NVidia, HDMI 3
    HDMI Audio Output

And I have to set the OS (PulseAudio) to HDMI2 for some reason. HDMI is dead, and these are the only two choices.

I gather that this may be a problem of different sampling rates, but between what? I PCI passthrough the nVidia video and sound card to the KVM guest, and video/audio is played in guest and passed out the nVidia HDMI port. It’s never converted to analog so how can it be a sampling problem? By HDMI, it goes into a Yamaha audio receiver, which strips off the audio and passes video along to the HDMI port out (to the projector). I am quite sure the problem is in the KVM guest.

I don’t understand why the kernel wants the snd_hda_intel driver for this nVidia sound card, but when I blacklist it no other driver takes its place.

I’ve tried installing the latest proprietary nVidia driver in the RPM Fusion repos, but it fails claiming it does not support the GTX 1060. Same story with manually installing the proprietary driver with the .run file. Doesn’t make sense. But the nouveau driver works fine for video.

snd_hda_intel is the right driver for the nvidia audio device.
So the issue happens in a guest under kvm? Did you try running it on bare metal?
Otherwise, regarding the dead slot maybe playing with probe_mask might help:
https://www.kernel.org/doc/html/v4.16/sound/hd-audio/notes.html#hd-audio-controller
i.e. create a file like 99-sound.conf containing

options snd_hda_intel probe_mask=6

It just doesn’t work.

In /etc/modprobe.d/pci-vm.conf I’ve tried all of the following, each time after running:

grub2-mkconfig -o /boot/efi/EFI/fedora/grub/cfg

dracut -f

reboot

options snd_hd_intel probe_mask= every permutation from 1 - 7, each at a time.

options snd_hd_intel bdl_pos_adj=32

options snd_hd_intel position_fix= 1 and 2

options snd_hd_intel model=auto,enable_msi=0

None of these changed the symptom at all in the guest OS.

# cat /proc/asound/card0/codec#0 
Codec: Nvidia GPU 84 HDMI/DP
Address: 0
AFG Function Id: 0x1 (unsol 0)
Vendor Id: 0x10de0084
Subsystem Id: 0x104385b9
Revision Id: 0x100100
No Modem Function Group found
Default PCM:
    rates [0x0]:
    bits [0x0]:
    formats [0x0]:
Default Amp-In caps: N/A
Default Amp-Out caps: N/A
State of AFG node 0x01:
  Power states:  D0 D1 D2 D3 CLKSTOP EPSS
  Power: setting=D0, actual=D0
GPIO: io=0, o=0, i=0, unsolicited=0, wake=0
Node 0x04 [Pin Complex] wcaps 0x407381: 8-Channels Digital CP
  Control: name="IEC958 Playback Con Mask", index=0, device=0
  Control: name="IEC958 Playback Pro Mask", index=0, device=0
  Control: name="IEC958 Playback Default", index=0, device=0
  Control: name="IEC958 Playback Switch", index=0, device=0
  Pincap 0x09000094: OUT Detect HBR HDMI DP
  Pin Default 0x185600f0: [Jack] Digital Out at Int HDMI
    Conn = Digital, Color = Unknown
    DefAssociation = 0xf, Sequence = 0x0
  Pin-ctls: 0x00:
  Unsolicited: tag=01, enabled=1
  Connection: 4
     0x0a* 0x0b 0x0c 0x0d
Node 0x05 [Pin Complex] wcaps 0x407381: 8-Channels Digital CP
  Control: name="IEC958 Playback Con Mask", index=1, device=0
  Control: name="IEC958 Playback Pro Mask", index=1, device=0
  Control: name="IEC958 Playback Default", index=1, device=0
  Control: name="IEC958 Playback Switch", index=1, device=0
  Pincap 0x09000094: OUT Detect HBR HDMI DP
  Pin Default 0x185600f0: [Jack] Digital Out at Int HDMI
    Conn = Digital, Color = Unknown
    DefAssociation = 0xf, Sequence = 0x0
  Pin-ctls: 0x00:
  Unsolicited: tag=02, enabled=1
  Connection: 4
     0x0a* 0x0b 0x0c 0x0d
Node 0x06 [Pin Complex] wcaps 0x407381: 8-Channels Digital CP
  Control: name="IEC958 Playback Con Mask", index=2, device=0
  Control: name="IEC958 Playback Pro Mask", index=2, device=0
  Control: name="IEC958 Playback Default", index=2, device=0
  Control: name="IEC958 Playback Switch", index=2, device=0
  Pincap 0x09000094: OUT Detect HBR HDMI DP
  Pin Default 0x185600f0: [Jack] Digital Out at Int HDMI
    Conn = Digital, Color = Unknown
    DefAssociation = 0xf, Sequence = 0x0
  Pin-ctls: 0x00:
  Unsolicited: tag=03, enabled=1
  Connection: 4
     0x0a* 0x0b 0x0c 0x0d
Node 0x07 [Pin Complex] wcaps 0x407381: 8-Channels Digital CP
  Control: name="IEC958 Playback Con Mask", index=3, device=0
  Control: name="IEC958 Playback Pro Mask", index=3, device=0
  Control: name="IEC958 Playback Default", index=3, device=0
  Control: name="IEC958 Playback Switch", index=3, device=0
  Pincap 0x09000094: OUT Detect HBR HDMI DP
  Pin Default 0x185600f0: [Jack] Digital Out at Int HDMI
    Conn = Digital, Color = Unknown
    DefAssociation = 0xf, Sequence = 0x0
  Pin-ctls: 0x00:
  Unsolicited: tag=04, enabled=1
  Connection: 4
     0x0a* 0x0b 0x0c 0x0d
Node 0x08 [Pin Complex] wcaps 0x407381: 8-Channels Digital CP
  Pincap 0x09000094: OUT Detect HBR HDMI DP
  Pin Default 0x585600f0: [N/A] Digital Out at Int HDMI
    Conn = Digital, Color = Unknown
    DefAssociation = 0xf, Sequence = 0x0
  Pin-ctls: 0x00:
  Unsolicited: tag=00, enabled=0
  Connection: 4
     0x0a* 0x0b 0x0c 0x0d
Node 0x09 [Pin Complex] wcaps 0x407381: 8-Channels Digital CP
  Pincap 0x09000094: OUT Detect HBR HDMI DP
  Pin Default 0x585600f0: [N/A] Digital Out at Int HDMI
    Conn = Digital, Color = Unknown
    DefAssociation = 0xf, Sequence = 0x0
  Pin-ctls: 0x00:
  Unsolicited: tag=00, enabled=0
  Connection: 4
     0x0a* 0x0b 0x0c 0x0d
Node 0x0a [Audio Output] wcaps 0x62b1: 8-Channels Digital Stripe
  Converter: stream=0, channel=0
  Digital: Enabled GenLevel
  Digital category: 0x2
  IEC Coding Type: 0x0
  PCM:
    rates [0x7f0]: 32000 44100 48000 88200 96000 176400 192000
    bits [0xe]: 16 20 24
    formats [0x5]: PCM AC3
  Unsolicited: tag=00, enabled=0
Node 0x0b [Audio Output] wcaps 0x62b1: 8-Channels Digital Stripe
  Converter: stream=0, channel=0
  Digital:
  Digital category: 0x0
  IEC Coding Type: 0x0
  PCM:
    rates [0x7f0]: 32000 44100 48000 88200 96000 176400 192000
    bits [0xe]: 16 20 24
    formats [0x5]: PCM AC3
  Unsolicited: tag=00, enabled=0
Node 0x0c [Audio Output] wcaps 0x62b1: 8-Channels Digital Stripe
  Converter: stream=0, channel=0
  Digital:
  Digital category: 0x0
  IEC Coding Type: 0x0
  PCM:
    rates [0x7f0]: 32000 44100 48000 88200 96000 176400 192000
    bits [0xe]: 16 20 24
    formats [0x5]: PCM AC3
  Unsolicited: tag=00, enabled=0
Node 0x0d [Audio Output] wcaps 0x62b1: 8-Channels Digital Stripe
  Converter: stream=0, channel=0
  Digital:
  Digital category: 0x0
  IEC Coding Type: 0x0
  PCM:
    rates [0x7f0]: 32000 44100 48000 88200 96000 176400 192000
    bits [0xe]: 16 20 24
    formats [0x5]: PCM AC3
  Unsolicited: tag=00, enabled=0

So in the host (CentOS 7.5) I turned off PCI passthrough for both nVidia devices (sound and video), and set the Intel CPU sound to pass through to the guest with this systemd file:

[Unit]
Description=Deactivate nVidia sound card in host
After=systemd-libvirt-guests.service,libvirtd.service
Requires=systemd-libvirt-guests.service,libvirtd.service

[Service]
Type=oneshot
RemainAfterExit=yes
#ExecStart=/usr/bin/sh -c "virsh nodedev-dettach pci_0000_01_00_0"
#ExecStart=/usr/bin/sh -c "virsh nodedev-dettach pci_0000_01_00_1"
# Intel
ExecStart=/usr/bin/sh -c "virsh nodedev-dettach pci_0000_00_1f_3"

[Install]
WantedBy=multi-user.target

Unfortunately the service file can’t find libvirt.sock on boot so fails. And thus the Intel sound takes over and sound works in the host. When I manually:

virsh nodedev-dettach pci_0000_00_1f_3

… all sound stops. In KDE systemsettings I set the nVidia sound card to be the default, but the system remains mute, even as this setting survives boot.

Looks like I’ve made a mistake buying this card. In 22 years of running Linux exclusively I have never, never had this kind of stupid problem with sound. I have been without TV for 3 weeks now because of this and I am about to ditch this worthless card. Is this all because nVidia does not cooperate with Linux developers?

The nvidia audio device is a standard intel hda device, nothing proprietary.
I suspect you’re just hitting the standard audio-in-guest problem:
https://wiki.archlinux.org/index.php/PCI_passthrough_via_OVMF#Slowed_down_audio_pumped_through_HDMI_on_the_video_card

generix, you are the man!

In /etc/modprobe.d/pci-vm.conf
options snd-hda-intel enable_msi=1

I tried setting it to 0 all day long as others have said to do, but turning it on I now have full audio. Thank goodness.