Bug 71078

Summary: pulseaudio will continue using high cpu after hibernate
Product: PulseAudio Reporter: TOM_Harrison <l12436>
Component: coreAssignee: pulseaudio-bugs
Status: RESOLVED MOVED QA Contact: pulseaudio-bugs
Severity: normal    
Priority: medium CC: lennart, main.haarp
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: settings
output that generate by pulseaudio -vvv
detail of log
log with pulseaudio, pacmd, aplay

Description TOM_Harrison 2013-10-31 07:59:58 UTC
pulseaudio will using high cpu after wakeup from hibernate.
the only solution is to kill the pulseaudio daemon and restart.

environment
kubuntu 13.10 AMD64
kde 4.11.2
libpulse0:amd64                                   1:4.0-0ubuntu6
pulseaudio with alsa dmix and dsnoop.
Comment 1 Arun Raghavan 2013-10-31 08:27:41 UTC
Please share details about your PA version, and what configuration you have with dmix/dsnoop.

Also, if you have sysprof, fire that up when CPU usage is high, take a snapshot of several seconds' worth, and paste the trace
Comment 2 TOM_Harrison 2013-10-31 08:32:14 UTC
because it the problem that only auto-spawn could happened.
so it could be not easy to trace.
Comment 3 TOM_Harrison 2013-10-31 08:33:11 UTC
Created attachment 88400 [details]
settings
Comment 4 TOM_Harrison 2013-10-31 08:39:52 UTC
this is snapshot with sysprof
[/usr/bin/pulseaudio]                                                  0.00%  82.13%
  In file /lib/x86_64-linux-gnu/libc-2.17.so                          40.41%  40.42%
    - - kernel - -                                                     0.00%   0.00%
      retint_careful                                                   0.00%   0.00%
        _raw_spin_unlock_irq                                           0.00%   0.00%
  No map [/usr/bin/pulseaudio]                                         0.00%  33.59%
    In file [heap]                                                     0.00%  23.29%
      ioctl                                                            0.34%  22.48%
        - - kernel - -                                                 0.00%  22.14%
          system_call_fastpath                                         0.00%  22.14%
            sys_ioctl                                                  0.16%  22.07%
              do_vfs_ioctl                                             0.14%  21.12%
                snd_pcm_playback_ioctl                                 0.02%  20.97%
                  snd_pcm_playback_ioctl1                              0.07%  20.91%
                    snd_pcm_common_ioctl1                              0.08%  20.82%
                      _raw_read_unlock_irq                            20.64%  20.64%
                      snd_pcm_hwsync                                   0.08%   0.09%
                      _raw_read_lock_irq                               0.01%   0.01%
                    snd_pcm_hwsync                                     0.02%   0.02%
                  snd_pcm_common_ioctl1                                0.03%   0.03%
                snd_pcm_playback_ioctl1                                0.01%   0.01%
              fget_light                                               0.47%   0.51%
              fput                                                     0.19%   0.19%
              snd_pcm_playback_ioctl                                   0.04%   0.04%
              __rcu_read_lock                                          0.02%   0.02%
              cap_file_ioctl                                           0.02%   0.02%
              security_file_ioctl                                      0.00%   0.01%
              __rcu_read_unlock                                        0.01%   0.01%
            do_vfs_ioctl                                               0.03%   0.03%
            fput                                                       0.02%   0.02%
            fget_light                                                 0.01%   0.01%
      In file /usr/lib/x86_64-linux-gnu/libasound.so.2.0.0             0.43%   0.44%
      ppoll                                                            0.02%   0.24%
      snd_pcm_state                                                    0.04%   0.04%
      pa_rtpoll_run                                                    0.02%   0.02%
      snd_pcm_hwsync                                                   0.01%   0.01%
      pa_asyncmsgq_read_after_poll                                     0.01%   0.01%
      pa_asyncmsgq_write_before_poll                                   0.01%   0.01%
      In file /lib/x86_64-linux-gnu/libc-2.17.so                       0.01%   0.01%
      pa_fdsem_after_poll                                              0.01%   0.01%
      pa_asyncq_write_after_poll                                       0.01%   0.01%
      gettimeofday                                                     0.00%   0.00%
      pa_asyncmsgq_write_after_poll                                    0.00%   0.00%
      snd_pcm_avail_update                                             0.00%   0.00%
      pa_asyncq_write_before_poll                                      0.00%   0.00%
      pa_asyncq_read_before_poll                                       0.00%   0.00%
    In file /lib/x86_64-linux-gnu/libc-2.17.so                         8.53%   8.53%
    In file /usr/lib/x86_64-linux-gnu/libasound.so.2.0.0               0.31%   0.31%
    pa_once_begin                                                      0.29%   0.29%
    pa_memblock_release                                                0.24%   0.24%
    pa_memblock_acquire                                                0.20%   0.20%
    pa_frame_aligned                                                   0.14%   0.14%
    snd_pcm_mmap_begin                                                 0.12%   0.12%
    pa_object_ref                                                      0.12%   0.12%
    pa_silence_memory                                                  0.11%   0.11%
    pa_silence_memchunk                                                0.07%   0.07%
    clock_gettime                                                      0.00%   0.03%
    pa_run_once                                                        0.03%   0.03%
    snd_pcm_state                                                      0.02%   0.02%
    pa_sink_render_into_full                                           0.02%   0.02%
    pa_frame_size                                                      0.01%   0.01%
    pa_fdsem_before_poll                                               0.01%   0.01%
    pa_sample_spec_valid                                               0.01%   0.01%
    pa_asyncmsgq_get                                                   0.01%   0.01%
    pthread_mutex_unlock                                               0.00%   0.00%
    pa_asyncq_read_before_poll                                         0.00%   0.00%
    pa_ratelimit_test                                                  0.00%   0.00%
    In file /usr/lib/libpulsecore-4.0.so                               0.00%   0.00%
    pa_object_check_type                                               0.00%   0.00%
    pa_asyncq_pop                                                      0.00%   0.00%
  In file [heap]                                                       0.00%   1.95%
  In file /usr/lib/x86_64-linux-gnu/pulseaudio/libpulsecommon-4.0.so   0.98%   0.98%
  In file /usr/lib/pulse-4.0/modules/libalsa-util.so                   0.60%   0.63%
  In file /usr/lib/x86_64-linux-gnu/libasound.so.2.0.0                 0.62%   0.62%
  pa_memblock_unref                                                    0.60%   0.60%
  In file /usr/lib/libpulsecore-4.0.so                                 0.17%   0.54%
  ioctl                                                                0.00%   0.37%
  pa_memblock_new_fixed                                                0.35%   0.35%
  snd_pcm_mmap_commit                                                  0.15%   0.15%
  pa_bytes_to_usec                                                     0.14%   0.14%
  pa_sink_render_into_full                                             0.13%   0.13%
  pa_memblock_unref_fixed                                              0.12%   0.12%
  _dl_update_slotinfo                                                  0.11%   0.11%
  pa_object_unref                                                      0.11%   0.11%
  pa_alsa_safe_avail                                                   0.10%   0.10%
  pa_flist_push                                                        0.10%   0.10%
  update_get_addr                                                      0.10%   0.10%
  pa_memblock_get_length                                               0.09%   0.09%
  pa_once_begin                                                        0.08%   0.08%
  pa_frame_size                                                        0.08%   0.08%
  snd_pcm_format_physical_width                                        0.08%   0.08%
  pa_flist_pop                                                         0.08%   0.08%
  pa_alsa_safe_mmap_begin                                              0.06%   0.06%
  pa_hashmap_iterate                                                   0.06%   0.06%
  pa_sample_spec_valid                                                 0.05%   0.05%
  pa_cvolume_channels_equal_to                                         0.05%   0.05%
  pa_thread_mq_get                                                     0.04%   0.04%
  snd_pcm_mmap_begin                                                   0.04%   0.04%
  pa_sink_render_into                                                  0.04%   0.04%
  __tls_get_addr                                                       0.03%   0.03%
  pa_bytes_to_usec_round_up                                            0.03%   0.03%
  pa_run_once                                                          0.02%   0.02%
  pa_mempool_block_size_max                                            0.02%   0.02%
  pa_bytes_per_second                                                  0.02%   0.02%
  pa_object_check_type                                                 0.02%   0.02%
  pa_sink_check_type                                                   0.01%   0.01%
  pa_smoother_translate                                                0.01%   0.01%
  snd_pcm_poll_descriptors_revents                                     0.01%   0.01%
  ppoll                                                                0.00%   0.01%
  pa_sink_get_requested_latency_within_thread                          0.01%   0.01%
  pa_rtpoll_item_get_pollfd                                            0.01%   0.01%
  pa_rtpoll_run                                                        0.01%   0.01%
  pa_static_mutex_get                                                  0.01%   0.01%
  snd_pcm_avail                                                        0.00%   0.00%
  pa_rtpoll_set_timer_disabled                                         0.00%   0.00%
  pa_sink_process_input_underruns                                      0.00%   0.00%
  pa_alsa_safe_delay                                                   0.00%   0.00%
  pa_asyncq_pop                                                        0.00%   0.00%
  snd_pcm_status                                                       0.00%   0.00%
  pa_msgobject_check_type                                              0.00%   0.00%
  pa_log_ratelimit                                                     0.00%   0.00%
Comment 5 TOM_Harrison 2013-10-31 08:52:15 UTC
if using "sudo pm-suspend" will occur same problem
Comment 6 TOM_Harrison 2013-12-26 01:25:36 UTC
this is the backtrace when the pulseaudio stock.

#0  0x00007f546ac8203f in __GI_ppoll (fds=<optimized out>, nfds=<optimized out>, timeout=<optimized out>, 
    sigmask=sigmask@entry=0x0) at ../sysdeps/unix/sysv/linux/ppoll.c:57
#1  0x00007f546befe8e7 in ppoll (__ss=0x0, __timeout=<optimized out>, __nfds=<optimized out>, __fds=<optimized out>)
    at /usr/include/x86_64-linux-gnu/bits/poll2.h:77
#2  pa_mainloop_poll (m=m@entry=0x98f2d0) at pulse/mainloop.c:858
#3  0x00007f546befeede in pa_mainloop_iterate (m=m@entry=0x98f2d0, block=block@entry=1, retval=retval@entry=0x7ffffc21ff58)
    at pulse/mainloop.c:932
#4  0x00007f546befef90 in pa_mainloop_run (m=0x98f2d0, retval=0x7ffffc21ff58) at pulse/mainloop.c:950
#5  0x0000000000406e82 in main ()
Comment 7 Raymond 2013-12-26 13:51:40 UTC
> pulseaudio with alsa dmix and dsnoop.

>load-module module-alsa-sink device=dmixer
>load-module module-alsa-source device=dsnooper

why do you use dmix and dsnoop ?


#load-module module-udev-detect tsched=0

do pulseaudio really work when you disable udev-detect ?

you have to provide pulseaudio verbose log
Comment 8 TOM_Harrison 2013-12-26 14:29:13 UTC
my system has install pulseaudio and alsa together, and i could let it work together
dmix and dsnoop just a settings let the pulseaudio could work like a alsa plugin

without udev detect, the pulse audio just do not auto detect the device.
but i could manual setting the pulseaudio to let it work.
i change pulseaudio like a alsa plugin.
to let the alsa and pulse work together.

this settings i have using for a long time.
but the stock problem is recently.
Comment 9 TOM_Harrison 2013-12-26 14:30:21 UTC
there is a problem.
the stock problem is happened when wake up.
i do not know that if i could provide the verbose log
Comment 10 TOM_Harrison 2013-12-26 14:32:05 UTC
the alsa work with pulseaudio i found it on the internet.
so i do not know that it is the original pulseaudio could do or it just a trick
Comment 11 TOM_Harrison 2013-12-27 01:35:33 UTC
Created attachment 91205 [details]
output that generate by pulseaudio -vvv
Comment 12 Raymond 2014-01-07 03:00:10 UTC
it is strange that pulseaudio scheduling delay of 5.247 seconds ?


I: [alsa-sink-ALC272 Analog] alsa-sink.c: Scheduling delay of 5247.71ms > 7.06ms, you might want to investigate this to improve latency...
I: [alsa-source-ALC272 Analog] alsa-source.c: Scheduling delay of 5246.44ms, you might want to investigate this to improve latency...
D: [alsa-sink-ALC272 Analog] alsa-util.c: Got POLLERR from ALSA
D: [alsa-sink-ALC272 Analog] alsa-util.c: Got POLLOUT from ALSA
D: [alsa-sink-ALC272 Analog] alsa-util.c: PCM state is SUSPENDED
I: [alsa-sink-ALC272 Analog] (alsa-lib)pcm_hw.c: SNDRV_PCM_IOCTL_RESUME failed (-38)
D: [alsa-source-ALC272 Analog] alsa-util.c: Got POLLERR from ALSA
D: [alsa-source-ALC272 Analog] alsa-util.c: Got POLLIN from ALSA
D: [alsa-source-ALC272 Analog] alsa-util.c: PCM state is SUSPENDED
I: [alsa-source-ALC272 Analog] (alsa-lib)pcm_hw.c: SNDRV_PCM_IOCTL_RESUME failed (-38)
I: [alsa-sink-ALC272 Analog] alsa-sink.c: Starting playback.
D: [alsa-sink-ALC272 Analog] alsa-sink.c: Cutting sleep time for the initial iterations by half.
I: [alsa-source-ALC272 Analog] alsa-source.c: Starting capture.
I: [alsa-sink-ALC272 Analog] alsa-sink.c: Scheduling delay of 5386.48ms > 7.06ms, you might want to investigate this to improve latency...
D: [alsa-sink-ALC272 Analog] alsa-util.c: Got POLLERR from ALSA
D: [alsa-sink-ALC272 Analog] alsa-util.c: Got POLLOUT from ALSA
D: [alsa-sink-ALC272 Analog] alsa-util.c: PCM state is SUSPENDED
I: [alsa-sink-ALC272 Analog] (alsa-lib)pcm_hw.c: SNDRV_PCM_IOCTL_RESUME failed (-38)
I: [alsa-sink-ALC272 Analog] alsa-sink.c: Starting playback.
Comment 13 Raymond 2014-01-08 09:58:59 UTC
you have to use --log-time


D: [pulseaudio] alsa-util.c:   appl_ptr     : 0
D: [pulseaudio] alsa-util.c:   hw_ptr       : 0
D: [alsa-source-ALC272 Analog] alsa-source.c: Thread starting up
D: [alsa-source-ALC272 Analog] core-util.c: SCHED_RR worked.
I: [alsa-source-ALC272 Analog] core-util.c: Successfully enabled SCHED_RR scheduling for thread, with priority 5.
I: [alsa-source-ALC272 Analog] alsa-source.c: Starting capture.



D: [pulseaudio] main.c: Got org.PulseAudio1!
D: [pulseaudio] main.c: Got org.pulseaudio.Server!
I: [pulseaudio] main.c: 幕後程å¼å•Ÿå‹•å®Œæˆã€‚
D: [pulseaudio] bluetooth-util.c: dbus: interface=org.freedesktop.DBus, path=/org/freedesktop/DBus, member=NameAcquired
E: [alsa-source-ALC272 Analog] alsa-util.c: snd_pcm_avail_delay() returned strange values: delay 0 is less than avail 8.
E: [alsa-source-ALC272 Analog] alsa-util.c: Most likely this is a bug in the ALSA driver 'snd_hda_intel'. Please report this issue to the ALSA developers.
E: [alsa-source-ALC272 Analog] alsa-util.c: snd_pcm_dump():
E: [alsa-source-ALC272 Analog] alsa-util.c: Direct Snoop PCM
E: [alsa-source-ALC272 Analog] alsa-util.c: Its setup is:
E: [alsa-source-ALC272 Analog] alsa-util.c:   stream       : CAPTURE
E: [alsa-source-ALC272 Analog] alsa-util.c:   access       : MMAP_INTERLEAVED
E: [alsa-source-ALC272 Analog] alsa-util.c:   format       : S32_LE
E: [alsa-source-ALC272 Analog] alsa-util.c:   subformat    : STD
E: [alsa-source-ALC272 Analog] alsa-util.c:   channels     : 2
E: [alsa-source-ALC272 Analog] alsa-util.c:   rate         : 48000
E: [alsa-source-ALC272 Analog] alsa-util.c:   exact rate   : 48000 (48000/1)
E: [alsa-source-ALC272 Analog] alsa-util.c:   msbits       : 32
E: [alsa-source-ALC272 Analog] alsa-util.c:   buffer_size  : 8192
E: [alsa-source-ALC272 Analog] alsa-util.c:   period_size  : 1024
E: [alsa-source-ALC272 Analog] alsa-util.c:   period_time  : 21333
E: [alsa-source-ALC272 Analog] alsa-util.c:   tstamp_mode  : ENABLE
E: [alsa-source-ALC272 Analog] alsa-util.c:   period_step  : 1
E: [alsa-source-ALC272 Analog] alsa-util.c:   avail_min    : 7310
E: [alsa-source-ALC272 Analog] alsa-util.c:   period_event : 0
E: [alsa-source-ALC272 Analog] alsa-util.c:   start_threshold  : -1
E: [alsa-source-ALC272 Analog] alsa-util.c:   stop_threshold   : 4611686018427387904
E: [alsa-source-ALC272 Analog] alsa-util.c:   silence_threshold: 0
E: [alsa-source-ALC272 Analog] alsa-util.c:   silence_size : 0
E: [alsa-source-ALC272 Analog] alsa-util.c:   boundary     : 4611686018427387904
E: [alsa-source-ALC272 Analog] alsa-util.c: Hardware PCM card 0 'HDA Intel MID' device 0 subdevice 0
E: [alsa-source-ALC272 Analog] alsa-util.c: Its setup is:
E: [alsa-source-ALC272 Analog] alsa-util.c:   stream       : CAPTURE
E: [alsa-source-ALC272 Analog] alsa-util.c:   access       : MMAP_INTERLEAVED
E: [alsa-source-ALC272 Analog] alsa-util.c:   format       : S32_LE
E: [alsa-source-ALC272 Analog] alsa-util.c:   subformat    : STD
E: [alsa-source-ALC272 Analog] alsa-util.c:   channels     : 2
E: [alsa-source-ALC272 Analog] alsa-util.c:   rate         : 48000
E: [alsa-source-ALC272 Analog] alsa-util.c:   exact rate   : 48000 (48000/1)
E: [alsa-source-ALC272 Analog] alsa-util.c:   msbits       : 32
E: [alsa-source-ALC272 Analog] alsa-util.c:   buffer_size  : 8192
E: [alsa-source-ALC272 Analog] alsa-util.c:   period_size  : 1024
E: [alsa-source-ALC272 Analog] alsa-util.c:   period_time  : 21333
E: [alsa-source-ALC272 Analog] alsa-util.c:   tstamp_mode  : ENABLE
E: [alsa-source-ALC272 Analog] alsa-util.c:   period_step  : 1
E: [alsa-source-ALC272 Analog] alsa-util.c:   avail_min    : 1024
E: [alsa-source-ALC272 Analog] alsa-util.c:   period_event : 0
E: [alsa-source-ALC272 Analog] alsa-util.c:   start_threshold  : 1
E: [alsa-source-ALC272 Analog] alsa-util.c:   stop_threshold   : 4611686018427387904
E: [alsa-source-ALC272 Analog] alsa-util.c:   silence_threshold: 0
E: [alsa-source-ALC272 Analog] alsa-util.c:   silence_size : 0
E: [alsa-source-ALC272 Analog] alsa-util.c:   boundary     : 4611686018427387904
E: [alsa-source-ALC272 Analog] alsa-util.c:   appl_ptr     : 0
E: [alsa-source-ALC272 Analog] alsa-util.c:   hw_ptr       : 16424

the sound card alreay capture (hw_ptr is at 16424) but pulseaudio still not read anything (appl_ptr = 0 )


I: [alsa-sink-ALC272 Analog] alsa-sink.c: Scheduling delay of 5247.71ms > 7.06ms, you might want to investigate this to improve latency...
I: [alsa-source-ALC272 Analog] alsa-source.c: Scheduling delay of 5246.44ms, you might want to investigate this to improve latency...
Comment 14 TOM_Harrison 2014-01-08 13:26:43 UTC
Created attachment 91668 [details]
detail of log
Comment 15 Raymond 2014-01-09 06:54:40 UTC
do supsend and resume work as expected when you 

aplay -Dplughw:0,0 any.wav

aplay -Dplug:dmix:0 any.wav
Comment 16 TOM_Harrison 2014-01-09 07:38:21 UTC
Created attachment 91736 [details]
log with pulseaudio, pacmd, aplay
Comment 17 GitLab Migration User 2018-07-30 10:18:16 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/330.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.