MusicPlayerDaemon / MPD

Music Player Daemon
https://www.musicpd.org/
GNU General Public License v2.0
2.16k stars 346 forks source link

DSD on ARM 32 still broken. Related to issues #469 #596

Closed starmood closed 5 years ago

starmood commented 5 years ago

Bug report

Describe the bug

Continue with issue #469, after compiling the latest commit, I found there is no any output when playing DoP now on 32bit Raspbian (tried both stretch and buster) mpd process alway shows 100% CPU load, and DAC can't lock the signal. Playing normal PCM file is OK without problem.

Expected Behavior

Actual Behavior

Version

Music Player Daemon 0.22~git (v0.21.10-417-g44aaf5134+) Copyright 2003-2007 Warren Dukes warren.dukes@gmail.com Copyright 2008-2018 Max Kellermann max.kellermann@gmail.com This is free software; see the source for copying conditions. There is NO warranty; not even MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Database plugins: simple proxy upnp

Storage plugins: local curl

Neighbor plugins: upnp

Decoders plugins: [mad] mp3 mp2 [mpg123] mp3 [vorbis] ogg oga [oggflac] ogg oga [flac] flac [opus] opus ogg oga [sndfile] wav aiff aif au snd paf iff svx sf voc w64 pvf xi htk caf sd2 [audiofile] wav au aiff aif [dsdiff] dff [dsf] dsf [hybrid_dsd] m4a [faad] aac [mpcdec] mpc [wavpack] wv [modplug] 669 amf ams dbm dfm dsm far it med mdl mod mtm mt2 okt s3m stm ult umx xm [mikmod] amf dsm far gdm imf it med mod mtm s3m stm stx ult uni xm [sidplay] sid mus str prg P00 [wildmidi] mid [fluidsynth] mid [adplug] amd d00 hsc laa rad raw sa2 [ffmpeg] 16sv 3g2 3gp 4xm 8svx aa3 aac ac3 adx afc aif aifc aiff al alaw amr anim apc ape asf atrac au aud avi avm2 avs bap bfi c93 cak cin cmv cpk daud dct divx dts dv dvd dxa eac3 film flac flc fli fll flx flv g726 gsm gxf iss m1v m2v m2t m2ts m4a m4b m4v mad mj2 mjpeg mjpg mka mkv mlp mm mmf mov mp+ mp1 mp2 mp3 mp4 mpc mpeg mpg mpga mpp mpu mve mvi mxf nc nsv nut nuv oga ogm ogv ogx oma ogg omg opus psp pva qcp qt r3d ra ram rl2 rm rmvb roq rpl rvc shn smk snd sol son spx str swf tak tgi tgq tgv thp ts tsp tta xa xvid uv uv2 vb vid vob voc vp6 vmd wav webm wma wmv wsaud wsvga wv wve [gme] ay gbs gym hes kss nsf nsfe sap spc vgm vgz [pcm]

Filters: libsamplerate soxr

Tag plugins: id3tag

Output plugins: shout null fifo sndio pipe alsa openal httpd recorder

Encoder plugins: null vorbis opus lame twolame wave flac shine

Archive plugins: [bz2] bz2 [zzip] zip [iso] iso

Input plugins: file archive alsa tidal curl ffmpeg mms cdio_paranoia

Playlist plugins: extm3u m3u pls xspf asx rss soundcloud flac cue embcue

Protocols: file:// alsa:// cdda:// ftp:// ftps:// gopher:// http:// https:// mms:// mmsh:// mmst:// mmsu:// rtmp:// rtmps:// rtmpt:// rtmpts:// rtp:// scp:// sftp:// smb:// srtp:// tidal://

Other features: avahi dbus epoll icu inotify systemd tcp un

Log

MaxKellermann commented 5 years ago

Which thread causes 100% CPU? Post a perf report.

starmood commented 5 years ago

perf top result

Overhead Shared Object Symbol 50.99% [kernel] [k] mmioset 23.44% [kernel] [k] copy_from_user_std 4.41% [kernel] [k] arch_cpu_idle 1.63% [snd_pcm] [k] snd_pcm_stream_unlock_mode 0.66% [kernel] [k] ep_scan_ready_list 0.60% [kernel] [k] do_page_fault 0.53% libc-2.28.so [.] strcmp 0.43% [kernel] [k] do_epoll_wait 0.41% [kernel] [k] rcu_idle_exit 0.32% [kernel] [k] vector_swi 0.31% libslang.so.2.3.2 [.] SLsmg_write_chars 0.30% [kernel] [k] _raw_spin_unlock_irqrestore 0.29% [snd_pcm] [k] snd_pcm_ioctl 0.25% [kernel] [k] fget 0.23% libpthread-2.28.so [.] pthread_mutex_lock 0.23% [vdso] [.] vdso_clock_gettime 0.23% libpthread-2.28.so [.] pthread_mutex_unlock_usercnt 0.22% mpd [.] EventLoop::Run 0.19% [kernel] [k] led_trigger_event 0.19% libc-2.28.so [.] __GI___ioctl 0.17% [kernel] [k] do_vfs_ioctl 0.16% libc-2.28.so [.] epoll_wait

top -H result

top - 02:47:33 up 16:29, 2 users, load average: 1.00, 0.75, 0.38 Threads: 6 total, 1 running, 5 sleeping, 0 stopped, 0 zombie %Cpu(s): 1.1 us, 24.2 sy, 0.0 ni, 74.5 id, 0.0 wa, 0.0 hi, 0.2 si, 0.0 st MiB Mem : 926.1 total, 554.1 free, 64.0 used, 307.9 buff/cache MiB Swap: 100.0 total, 100.0 free, 0.0 used. 800.0 avail Mem

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 3186 mpd 20 0 184004 20688 12532 R 99.9 2.2 4:07.40 rtio 3184 mpd 20 0 184004 20688 12532 S 0.0 2.2 0:00.01 mpd 3185 mpd 20 0 184004 20688 12532 S 0.0 2.2 0:00.00 io 3187 mpd 20 0 184004 20688 12532 S 0.0 2.2 0:00.00 player 3188 mpd 20 0 184004 20688 12532 S 0.0 2.2 0:00.10 decoder:dsf 3189 mpd 20 0 184004 20688 12532 S 0.0 2.2 0:00.00 output:ALSA def

MaxKellermann commented 5 years ago

Thanks so far, that was useful, but not enough. While this happens, capture a brief strace (a seconds or so should be enough) of only the "rtio" thread. Use strace -o /tmp/trace -tttT -p 4186 (replace 4186 with the new PID of that thread). Upload the /tmp/trace file for me.

starmood commented 5 years ago

OK, I will try getting that later.

BTW, interesting thing is, I just tried your last release 0.21.11, DoP works fine without problem, and no noise. Like a perfect version. So don't know what's the difference.

starmood commented 5 years ago

The trace file attached

trace.txt

MaxKellermann commented 5 years ago

BTW, interesting thing is, I just tried your last release 0.21.11, DoP works fine without problem, and no noise.

0.21.11 is the latest release of the "stable" branch ("v0.21.x" in git), but this bug report is about the unstable branch ("master" in git), which will eventually become MPD 0.22.

Your trace shows an endless busy loop; this is the important part:

ioctl(15, SNDRV_PCM_IOCTL_WRITEI_FRAMES, 0x6e4f07f8) = -1 EFAULT (Bad address) <0.000181>

This is an obscure error code reported by the kernel, and I'm still not quite sure how and why. I think I need to read some code, maybe then I'll have an idea.