Bug 177571

Summary: Rosegarden do not play sw synths
Product: Drivers Reporter: fin4478
Component: Sound(ALSA)Assignee: Jaroslav Kysela (perex)
Status: RESOLVED CODE_FIX    
Severity: blocking CC: tiwai
Priority: P1    
Hardware: x86-64   
OS: Linux   
Kernel Version: 4.8.1 Subsystem:
Regression: No Bisected commit-id:
Attachments: Fix patch

Description fin4478 2016-10-14 11:09:12 UTC
With the kernel 4.7.0 my Debian testing Xfce system works fine. But with kernel 4.8.1 from kernel.org Rosegarden do not play software synth tracks but only audio vocal track can be heard but the song does not go forward. If I press the play button many times, the song is played backwards step by step.

I have Asus A88XM-E motherboard. Audio shows with dmesg as follows:
[    2.603284] snd_hda_codec_realtek hdaudioC0D0: autoconfig for ALC887-VD: line_outs=1 (0x14/0x0/0x0/0x0/0x0) type:line
[    2.603288] snd_hda_codec_realtek hdaudioC0D0:    speaker_outs=0 (0x0/0x0/0x0/0x0/0x0)
[    2.603291] snd_hda_codec_realtek hdaudioC0D0:    hp_outs=1 (0x1b/0x0/0x0/0x0/0x0)
[    2.603293] snd_hda_codec_realtek hdaudioC0D0:    mono: mono_out=0x0
[    2.603294] snd_hda_codec_realtek hdaudioC0D0:    dig-out=0x11/0x0
[    2.603296] snd_hda_codec_realtek hdaudioC0D0:    inputs:
[    2.603298] snd_hda_codec_realtek hdaudioC0D0:      Front Mic=0x19
[    2.603300] snd_hda_codec_realtek hdaudioC0D0:      Rear Mic=0x18
[    2.603301] snd_hda_codec_realtek hdaudioC0D0:      Line=0x1a

The problem might be in also in timer module or somewhere else in the kernel. My sw synths are FluidSynth and ZASF. No debug tracing available because I use non-debug kernels. Jack2 is the latest one, version 1.9.10. I found the same problem in the 4.8.0-rc8 kernel too.
Comment 1 fin4478 2016-10-17 18:30:00 UTC
Tested more kernels from kernel.org. 4.7.8 ok, 4.8.2 same problem
Comment 2 fin4478 2016-10-19 17:09:31 UTC
Same thing happens with external midi synths. Maybe some timer value in the kernel has changed its sign.
Comment 3 fin4478 2016-10-20 01:45:09 UTC
I solved this problem by selecting timer source as PCM-Playback in the Edit->Preferences->Midi dialog. Option Auto does not work and selecting HR timer hangs the pc.
Comment 4 Takashi Iwai 2016-10-21 09:20:51 UTC
There have been indeed a few fixes related to ALSA timer interface.
The relevant commits between 4.7 and 4.8 are:

816f318b2364262a51024096da7ca3b84e78e3b5
    ALSA: rawmidi: Fix possible deadlock with virmidi registration

9f8a7658bcafb2a7853f7a2eae8a94e87e6e695b
    ALSA: timer: Fix zero-division by continue of uninitialized instance

11749e086b2766cccf6217a527ef5c5604ba069c
    ALSA: timer: fix NULL pointer dereference in read()/ioctl() race

8ddc05638ee42b18ba4fe99b5fb647fa3ad20456
    ALSA: timer: fix NULL pointer dereference on memory allocation failure

3915bf2946520ace5bcc8104717a3cb0452d7430
    ALSA: seq_timer: use monotonic times internally

Could you try to revert one by one from the first to the last on top of 4.8.0 kernel?

My rough guess is the second one, but it might be the last one, too.
Comment 5 Takashi Iwai 2016-10-25 14:04:16 UTC
OK, spotted out.  It's the last one.

The fix patch is below.
Comment 6 Takashi Iwai 2016-10-25 14:04:32 UTC
Created attachment 242671 [details]
Fix patch
Comment 7 Takashi Iwai 2016-11-21 16:48:20 UTC
The fix got merged to upstream 4.9.