[Mesa-dev] [PATCH 2/2] gallium/util: libunwind support

Rob Clark robdclark at gmail.com
Tue Apr 4 14:06:00 UTC 2017


On Tue, Apr 4, 2017 at 10:00 AM, Rob Clark <robdclark at gmail.com> wrote:
> On Tue, Apr 4, 2017 at 8:45 AM, Thomas Hellstrom <thellstrom at vmware.com> wrote:
>> On 04/04/2017 02:34 PM, Rob Clark wrote:
>>> On Tue, Apr 4, 2017 at 1:49 AM, Thomas Hellstrom <thellstrom at vmware.com> wrote:
>>>> But one more worrying thing is that with these fixes, debug_flush gets
>>>> too slow to be usable. I get about one frame every 5 seconds from Ubuntu
>>>> compiz. The culprit seems to be unw_get_proc_name(). Is there a way we
>>>> can save intermediate information during backtrace capture and call this
>>>> function at printout time?
>>>
>>> btw, is it common to capture many more backtraces than you print?
>>> (Just to check if defering the unw_get_proc_name() would actually help
>>> anything..)
>>
>> Yes. The debug_flush functionality captures the backtrace on each map in
>> case someone would flush when mapped or try a recursive map. Only then
>> they are printed.
>>
>> FWIW in u_debug_symbol.c, José has implemented a hash table for name
>> lookups. Perhaps one solution would to save the IP and insert the
>> function name in the hash table with the IP as key.
>>
>
> fwiw, I added a hash-table:
>
> https://github.com/freedreno/mesa/commits/wip-libunwind
>
> It seems to work, but my hacked up test doesn't collect more
> stacktraces than it prints so haven't really tested it from
> performance standpoint.
>
> Possibly it could re-use debug_symbol_name_cached() instead, or at
> least not duplicate the hashtable..
>

bleh, u_debug_symbol doesn't seem to manage to decode symbol names
quite as well (at least on arm):


aaaa bbbb backtrace follows:
    0: /home/robclark/src/mesa/debug/lib64/gallium/msm_dri.so
(debug_flush_capture_frame+0x38) [0x7f97d5c958]
    1: /home/robclark/src/mesa/debug/lib64/gallium/msm_dri.so
(debug_flush_alert+0xc4) [0x7f97d5cd4c]
    2: /home/robclark/src/mesa/debug/lib64/gallium/msm_dri.so
(fd_gmem_render_tiles+0x74) [0x7f97de65bc]
    3: /home/robclark/src/mesa/debug/lib64/gallium/msm_dri.so
(fd_batch_flush+0x148) [0x7f97de1d50]
    4: /home/robclark/src/mesa/debug/lib64/gallium/msm_dri.so
(fd_flush_resource+0x20) [0x7f97dead28]
    5: /home/robclark/src/mesa/debug/lib64/gallium/msm_dri.so
(dri_flush+0xac) [0x7f97d0005c]
    6: /home/robclark/src/mesa/debug/lib64/libGL.so.1
(loader_dri3_swap_buffers_msc+0x6c) [0x7f9883446c]
    7: glxgears (main+0x3fc) [0x5592ba0fbc]
    8: /lib64/libc.so.6 (__libc_start_main+0xe8) [0x7f9841a668]
    9: ? (__libc_start_main+0xfa786f58) [0x8092ba14d8]


versus this with u_debug_symbol:

aaaa bbbb backtrace follows:
    0: /home/robclark/src/mesa/debug/lib64/gallium/msm_dri.so
(/home/robclark/src/mesa/debug/lib64/gallium/msm_dri.so(+0x411920)
[0x7f8624a920]+0x38) [0x7f8624a958]
    1: /home/robclark/src/mesa/debug/lib64/gallium/msm_dri.so
(/home/robclark/src/mesa/debug/lib64/gallium/msm_dri.so(+0x411c88)
[0x7f8624ac88]+0xc4) [0x7f8624ad4c]
    2: /home/robclark/src/mesa/debug/lib64/gallium/msm_dri.so
(/home/robclark/src/mesa/debug/lib64/gallium/msm_dri.so(+0x49b6b8)
[0x7f862d46b8]+0x74) [0x7f862d472c]
    3: /home/robclark/src/mesa/debug/lib64/gallium/msm_dri.so
(/home/robclark/src/mesa/debug/lib64/gallium/msm_dri.so(+0x496d78)
[0x7f862cfd78]+0x148) [0x7f862cfec0]
    4: /home/robclark/src/mesa/debug/lib64/gallium/msm_dri.so
(/home/robclark/src/mesa/debug/lib64/gallium/msm_dri.so(+0x49fe78)
[0x7f862d8e78]+0x20) [0x7f862d8e98]
    5: /home/robclark/src/mesa/debug/lib64/gallium/msm_dri.so
(/home/robclark/src/mesa/debug/lib64/gallium/msm_dri.so(+0x3b4fb0)
[0x7f861edfb0]+0xac) [0x7f861ee05c]
    6: /home/robclark/src/mesa/debug/lib64/libGL.so.1
(/home/robclark/src/mesa/debug/lib64/libGL.so.1(+0x4d400)
[0x7f86d22400]+0x6c) [0x7f86d2246c]
    7: glxgears (glxgears(main+0) [0x55816a6bc0]+0x3fc) [0x55816a6fbc]
    8: /lib64/libc.so.6 (/lib64/libc.so.6(__libc_start_main+0)
[0x7f86908580]+0xe8) [0x7f86908668]
    9: ? (/lib64/libc.so.6(__libc_start_main+0)
[0x7f86908580]+0xfad9ef58) [0x80816a74d8]


More information about the mesa-dev mailing list