On Tue, 25 Oct 2016 00:33:00 +0200, Yves Guillemot wrote: > > Hello, > > Some Rosegarden users recently reported a problem when moving from kernel > 4.7.5 or previous to 4.8.3 or 4.8.4: the cursor showing the advance of the > MIDI sequencer sticks to its starting position and sound is no more produced. > > Debugging the code, it appears that the time repeatedly read from ALSA with > snd_seq_get_queue_status() has a changing nanoseconds part, but an always 0 > seconds part. > > This can be easily shown with the attached timetest.c program: > > $ uname -rsp > Linux 4.4.26-desktop-1.mga5 x86_64 > $ ./timetest > 1.111185000 s > 2.222389000 s > 3.333583000 s > 4.444769000 s > 5.555969000 s > 6.667168000 s > 7.778362000 s > 8.889583000 s > 10.000850000 s > 11.112045000 s > $ > > $ uname -rsp > Linux 4.8.4 x86_64 > $ ./timetest > 0.000189483 s > 0.000410668 s > 0.000611312 s > 0.000804993 s > 0.000996216 s > 0.000191040 s > 0.000383909 s > 0.000576614 s > 0.000771814 s > 0.000965598 s > $ > > Is some change to the way we are using the ALSA API needed with this new > kernels? > Should we use some workaround? Indeed it's a clear regression, and it must be a bug reported recently in https://bugzilla.kernel.org/show_bug.cgi?id=177571 I could see the issue and spotted the bad commit 3915bf294652 "ALSA: seq_timer: use monotonic times internally". The fix patch is below. I'm going to queue it. thanks, Takashi -- 8< -- Subject: [PATCH] ALSA: seq: Fix time account regression The recent rewrite of the sequencer time accounting using timespec64 in the commit [3915bf294652: ALSA: seq_timer: use monotonic times internally] introduced a bad regression. Namely, the time reported back doesn't increase but goes back and forth. The culprit was obvious: the delta is stored to the result (cur_time = delta), instead of adding the delta (cur_time += delta)! Let's fix it. Fixes: 3915bf294652 ('ALSA: seq_timer: use monotonic times internally') Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=177571 Reported-by: Yves Guillemot <yc.guillemot@xxxxxxxxxx> Cc: <stable@xxxxxxxxxxxxxxx> # v4.8+ Signed-off-by: Takashi Iwai <tiwai@xxxxxxx> --- sound/core/seq/seq_timer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/core/seq/seq_timer.c b/sound/core/seq/seq_timer.c index dcc102813aef..37d9cfbc29f9 100644 --- a/sound/core/seq/seq_timer.c +++ b/sound/core/seq/seq_timer.c @@ -448,8 +448,8 @@ snd_seq_real_time_t snd_seq_timer_get_cur_time(struct snd_seq_timer *tmr) ktime_get_ts64(&tm); tm = timespec64_sub(tm, tmr->last_update); - cur_time.tv_nsec = tm.tv_nsec; - cur_time.tv_sec = tm.tv_sec; + cur_time.tv_nsec += tm.tv_nsec; + cur_time.tv_sec += tm.tv_sec; snd_seq_sanity_real_time(&cur_time); } spin_unlock_irqrestore(&tmr->lock, flags); -- 2.10.1 ------------------------------------------------------------------------------ The Command Line: Reinvented for Modern Developers Did the resurgence of CLI tooling catch you by surprise? Reconnect with the command line and become more productive. Learn the new .NET and ASP.NET CLI. Get your free copy! http://sdm.link/telerik _______________________________________________ Alsa-user mailing list Alsa-user@xxxxxxxxxxxxxxxxxxxxx https://lists.sourceforge.net/lists/listinfo/alsa-user