public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [Bug runtime/16920] New: Add aarch64 backtrace support
@ 2014-05-07 18:24 wcohen at redhat dot com
  2014-05-08 15:06 ` [Bug runtime/16920] " wcohen at redhat dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: wcohen at redhat dot com @ 2014-05-07 18:24 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=16920

            Bug ID: 16920
           Summary: Add aarch64 backtrace support
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: runtime
          Assignee: systemtap at sourceware dot org
          Reporter: wcohen at redhat dot com

The runtime does not have support for aarch64 backtraces.  This appears to
require:

-adding runtime/unwind/arm64.h describing aarch64
-include that arm64.h runtime/unwind/unwind.h
-set STP_USE_DWARF_UNWINDER when defined(__arch64__) in runtime/linux/runtime.h

-- 
You are receiving this mail because:
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug runtime/16920] Add aarch64 backtrace support
  2014-05-07 18:24 [Bug runtime/16920] New: Add aarch64 backtrace support wcohen at redhat dot com
@ 2014-05-08 15:06 ` wcohen at redhat dot com
  2014-10-07 19:57 ` wcohen at redhat dot com
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: wcohen at redhat dot com @ 2014-05-08 15:06 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=16920

--- Comment #1 from William Cohen <wcohen at redhat dot com> ---
kprobes is not yet generally available on aarch64 kernels.  With the current
git checkout of systemtap could do something like the following as a test of
functionality of the backtrace support:

stap --all-modules -e 'probe kernel.trace("sched_switch") {print_backtrace();
exit()}'

Should get something like the following:

# ../install/bin/stap --all-modules -e 'probe kernel.trace("sched_switch")
{print_backtrace(); exit()}'
WARNING: no or bad debug frame hdr
WARNING: No binary search table for eh frame, doing slow linear search for
stap_0c4277ebadb5154d1fa1d54d56112285__536
 0xffffffffa0973753 [stap_0c4277ebadb5154d1fa1d54d56112285__536+0x7753/0x0]
 0xffffffffa0974ae2 [stap_0c4277ebadb5154d1fa1d54d56112285__536+0x8ae2/0x0]
 0xffffffffa0975843 [stap_0c4277ebadb5154d1fa1d54d56112285__536+0x9843/0x0]
 0xffffffffa096c00e [stap_0c4277ebadb5154d1fa1d54d56112285__536+0xe/0x0]
 0xffffffff816f2500 : __schedule+0x360/0x740 [kernel]
 0xffffffff816f2909 : schedule+0x29/0x70 [kernel]
 0xffffffff816f200d : schedule_hrtimeout_range_clock+0x14d/0x170 [kernel]
 0xffffffff816f2043 : schedule_hrtimeout_range+0x13/0x20 [kernel]
 0xffffffff811fd689 : poll_schedule_timeout+0x49/0x70 [kernel]
 0xffffffff811fe0ce : do_select+0x5be/0x7a0 [kernel]
 0xffffffff811fe48b : core_sys_select+0x1db/0x300 [kernel]
 0xffffffff811fe7e3 : sys_pselect6+0x123/0x230 [kernel]
 0xffffffff816ff029 : system_call_fastpath+0x16/0x1b [kernel]

-- 
You are receiving this mail because:
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug runtime/16920] Add aarch64 backtrace support
  2014-05-07 18:24 [Bug runtime/16920] New: Add aarch64 backtrace support wcohen at redhat dot com
  2014-05-08 15:06 ` [Bug runtime/16920] " wcohen at redhat dot com
@ 2014-10-07 19:57 ` wcohen at redhat dot com
  2014-10-07 20:23 ` wcohen at redhat dot com
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: wcohen at redhat dot com @ 2014-10-07 19:57 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=16920

William Cohen <wcohen at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mjw at redhat dot com,
                   |                            |wcohen at redhat dot com

-- 
You are receiving this mail because:
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug runtime/16920] Add aarch64 backtrace support
  2014-05-07 18:24 [Bug runtime/16920] New: Add aarch64 backtrace support wcohen at redhat dot com
  2014-05-08 15:06 ` [Bug runtime/16920] " wcohen at redhat dot com
  2014-10-07 19:57 ` wcohen at redhat dot com
@ 2014-10-07 20:23 ` wcohen at redhat dot com
  2014-10-09  4:04 ` wcohen at redhat dot com
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: wcohen at redhat dot com @ 2014-10-07 20:23 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=16920

--- Comment #2 from William Cohen <wcohen at redhat dot com> ---
Created attachment 7819
  --> https://sourceware.org/bugzilla/attachment.cgi?id=7819&action=edit
Add backtrace support for aarch64

This should be reviewed by someone that know the dwarf unwinder such as Mark
Wielaard.  It shows some signs of life, but needs refinement as seen in the
really simple example below:

# ../install/bin/stap -v -e 'probe vfs.read {print_backtrace(); exit()}'
Pass 1: parsed user script and 104 library script(s) using
143168virt/32320res/4160shr/27904data kb, in 360usr/10sys/373real ms.
Pass 2: analyzed script: 1 probe(s), 2 function(s), 3 embed(s), 0 global(s)
using 250112virt/141632res/5888shr/134848data kb, in 3050usr/290sys/3345real
ms.
Pass 3: using cached
/root/.systemtap/cache/4a/stap_4a42bbbc96d58e126f190a21e7b5d726_1701.c
Pass 4: using cached
/root/.systemtap/cache/4a/stap_4a42bbbc96d58e126f190a21e7b5d726_1701.ko
Pass 5: starting run.
WARNING: no or bad debug frame hdr
WARNING: No binary search table for eh frame, doing slow linear search for
/usr/lib/debug/lib/modules/3.17.0-0.rc7.46.sa2.kprobev2.aarch64/vmlinux
 0xfffffe00001e00b8 : vfs_read+0x0/0x198 [kernel]
 0x0 (inexact)
Pass 5: run completed in 0usr/20sys/556real ms.

-- 
You are receiving this mail because:
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug runtime/16920] Add aarch64 backtrace support
  2014-05-07 18:24 [Bug runtime/16920] New: Add aarch64 backtrace support wcohen at redhat dot com
                   ` (2 preceding siblings ...)
  2014-10-07 20:23 ` wcohen at redhat dot com
@ 2014-10-09  4:04 ` wcohen at redhat dot com
  2014-10-09 14:43 ` wcohen at redhat dot com
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: wcohen at redhat dot com @ 2014-10-09  4:04 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=16920

--- Comment #3 from William Cohen <wcohen at redhat dot com> ---
According to mjw the WARNING are due to missing .debug_frame and/or
.eh_frame_hdr sections.  fche rebuilt the kernel to include .debug_frame. The
new kernel seems to get rid of the  WARNINGs about missing sections.

One of the thing missing from the proposed aarch64 backtrace patch is correct
handling in the case of tracepoints like the x86_64.h and i386.h
arch_unw_init_frame_info(). There seems to be a similar flaw in the arm.h and
ppc64.h

It was suggested to use the -DDEBUG_UNWIND.  The arm64 uses u64 rather than
long in struct pt_regs needed to do some casting in the debug output statements
to make sure that the modules build didn't complain about the differences in
argument size and the print specifier.

Now have something lit the following output:

# ../install/bin/stap -v -e 'probe vfs.read {print_backtrace(); exit()}'
-DDEBUG_UNWIND
Pass 1: parsed user script and 104 library script(s) using
152448virt/37120res/6144shr/28032data kb, in 360usr/10sys/375real ms.
Pass 2: analyzed script: 1 probe(s), 2 function(s), 3 embed(s), 0 global(s)
using 259520virt/146368res/7680shr/135104data kb, in 3080usr/260sys/3339real
ms.
Pass 3: translated to C into
"/tmp/stapo5TaX7/stap_64c46b2957b6cce64f14b860371aafb3_1762_src.c" using
259520virt/146624res/7936shr/135104data kb, in 940usr/130sys/1076real ms.
Pass 4: compiled C into "stap_64c46b2957b6cce64f14b860371aafb3_1762.ko" in
14250usr/250sys/15053real ms.
Pass 5: starting run.
_stp_stack_unwind_one_kernel:265: STARTING kernel unwind
 0xfffffe00001e00b8 : vfs_read+0x0/0x198 [kernel]
_stp_stack_unwind_one_kernel:300: CONTINUING kernel unwind to depth 1
unwind:1622: pc=fffffe00001e00b8, fffffe00001e00b8
unwind:1662: trying debug_frame
_stp_search_unwind_hdr:922: binary search for fffffe00001e00b8
_stp_search_unwind_hdr:987: fde off=5d198
_stp_search_unwind_hdr:997: returning fde=fffffdfffd325458
startLoc=fffffe00001e00b8
unwind_frame:1338:
/usr/lib/debug/lib/modules/3.17.0-0.rc7.46.sa2.kprobev2.unwind.aarch64/vmlinux:
fde=fffffdfffd325458
unwind_frame:1343:
/usr/lib/debug/lib/modules/3.17.0-0.rc7.46.sa2.kprobev2.unwind.aarch64/vmlinux:
cie=fffffdfffd325118
parse_fde_cie:305: map retAddrReg value 30 to reg_info idx 30
unwind_frame:1358: startLoc: fffffe00001e00b8, endLoc: fffffe00001e0250
unwind_frame:1407: cie=fffffdfffd325118 fde=fffffdfffd325458
startLoc=fffffe00001e00b8 endLoc=fffffe00001e0250, pc=fffffe00001e00b8
unwind_frame:1427: processCFI for CIE
processCFI:462: targetLoc=0 state->loc=fffffe00001e00b8
processCFI:667: map DW_CFA_def_cfa value 31 to reg_info idx 9999
processCFI:669: DW_CFA_def_cfa reg=31
processCFI:678: DW_CFA_def_cfa_offset offs=0
processCFI:796: targetLoc=0 state->loc=fffffe00001e00b8
processCFI:797: result: 1
unwind_frame:1435: processCFI for FDE
processCFI:462: targetLoc=fffffe00001e00b8 state->loc=fffffe00001e00b8
advance_loc:390: state->loc=fffffe00001e00bc
processCFI:765: DW_CFA_advance_loc
processCFI:796: targetLoc=fffffe00001e00b8 state->loc=fffffe00001e00bc
processCFI:797: result: 1
unwind_frame:1454: cfa reg=31, off=0
unwind_frame:1459: cfa=fffffe00001e0910 startLoc=fffffe00001e0910,
endLoc=fffffe03dd15be80
unwind_frame:1464: cfa startLoc=fffffe00001e0000, endLoc=fffffe00001e0910
unwind_frame:1466: cie=fffffdfffd325118 fde=fffffdfffd325458
unwind_frame:1590: returning 0 (fffffe03d8dc5203)
_stp_stack_unwind_one_kernel:318: ret=0 PC=fffffe03d8dc5203 SP=fffffe00001e0910
 0xfffffe03d8dc5203
_stp_stack_unwind_one_kernel:300: CONTINUING kernel unwind to depth 2
unwind:1622: pc=fffffe03d8dc5202, fffffe03d8dc5203
unwind:1658: No module found for pc=fffffe03d8dc5202
_stp_stack_unwind_one_kernel:318: ret=-22 PC=fffffe03d8dc5203
SP=fffffe00001e0910
 0x0 (inexact)
Pass 5: run completed in 0usr/20sys/561real ms.

-- 
You are receiving this mail because:
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug runtime/16920] Add aarch64 backtrace support
  2014-05-07 18:24 [Bug runtime/16920] New: Add aarch64 backtrace support wcohen at redhat dot com
                   ` (3 preceding siblings ...)
  2014-10-09  4:04 ` wcohen at redhat dot com
@ 2014-10-09 14:43 ` wcohen at redhat dot com
  2014-10-09 18:11 ` wcohen at redhat dot com
  2014-10-09 19:12 ` wcohen at redhat dot com
  6 siblings, 0 replies; 8+ messages in thread
From: wcohen at redhat dot com @ 2014-10-09 14:43 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=16920

William Cohen <wcohen at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #7819|0                           |1
        is obsolete|                            |

--- Comment #4 from William Cohen <wcohen at redhat dot com> ---
Created attachment 7820
  --> https://sourceware.org/bugzilla/attachment.cgi?id=7820&action=edit
Updated version of the patch

-- 
You are receiving this mail because:
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug runtime/16920] Add aarch64 backtrace support
  2014-05-07 18:24 [Bug runtime/16920] New: Add aarch64 backtrace support wcohen at redhat dot com
                   ` (4 preceding siblings ...)
  2014-10-09 14:43 ` wcohen at redhat dot com
@ 2014-10-09 18:11 ` wcohen at redhat dot com
  2014-10-09 19:12 ` wcohen at redhat dot com
  6 siblings, 0 replies; 8+ messages in thread
From: wcohen at redhat dot com @ 2014-10-09 18:11 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=16920

William Cohen <wcohen at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #5 from William Cohen <wcohen at redhat dot com> ---
commit 0f2e612e72749b8fc51ed72b3fa6743f953c09a7 provides stack backtraces for
arm64.  This provides the information for probe points that provide struct
pt_regs, but doesn't provide the information for kernel.trace points.

# ../install/bin/stap --all-modules -v -e 'probe vfs.read {print_backtrace();
exit()}' 
Pass 1: parsed user script and 104 library script(s) using
152448virt/36992res/6080shr/28032data kb, in 350usr/30sys/376real ms.
Pass 2: analyzed script: 1 probe(s), 2 function(s), 3 embed(s), 0 global(s)
using 259520virt/146176res/7616shr/135104data kb, in 3050usr/290sys/3341real
ms.
Pass 3: using cached
/root/.systemtap/cache/f0/stap_f0004365d79839ae85f343ee225db584_2071.c
Pass 4: using cached
/root/.systemtap/cache/f0/stap_f0004365d79839ae85f343ee225db584_2071.ko
Pass 5: starting run.
 0xfffffe00001e00b8 : vfs_read+0x0/0x198 [kernel]
 0xfffffe00001e0910 : sys_read+0x50/0xb0 [kernel]
 0xfffffe00000931b0 : __sys_trace_return+0x0/0x10 [kernel]
 0x0 (inexact)
Pass 5: run completed in 0usr/20sys/546real ms.

-- 
You are receiving this mail because:
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug runtime/16920] Add aarch64 backtrace support
  2014-05-07 18:24 [Bug runtime/16920] New: Add aarch64 backtrace support wcohen at redhat dot com
                   ` (5 preceding siblings ...)
  2014-10-09 18:11 ` wcohen at redhat dot com
@ 2014-10-09 19:12 ` wcohen at redhat dot com
  6 siblings, 0 replies; 8+ messages in thread
From: wcohen at redhat dot com @ 2014-10-09 19:12 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=16920

--- Comment #6 from William Cohen <wcohen at redhat dot com> ---
Note that this test run required a kernel built with the following patch to
provide the needed sections in the kernel:

--- ./arch/arm64/Makefile.orig    2014-10-08 12:06:39.413204335 -0400
+++ ./arch/arm64/Makefile    2014-10-08 12:04:57.972189568 -0400
@@ -20,6 +20,7 @@
 KBUILD_DEFCONFIG := defconfig

 KBUILD_CFLAGS    += -mgeneral-regs-only
+KBUILD_CFLAGS    += -fno-asynchronous-unwind-tables
 ifeq ($(CONFIG_CPU_BIG_ENDIAN), y)
 KBUILD_CPPFLAGS    += -mbig-endian
 AS        += -EB

-- 
You are receiving this mail because:
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-10-09 19:12 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-07 18:24 [Bug runtime/16920] New: Add aarch64 backtrace support wcohen at redhat dot com
2014-05-08 15:06 ` [Bug runtime/16920] " wcohen at redhat dot com
2014-10-07 19:57 ` wcohen at redhat dot com
2014-10-07 20:23 ` wcohen at redhat dot com
2014-10-09  4:04 ` wcohen at redhat dot com
2014-10-09 14:43 ` wcohen at redhat dot com
2014-10-09 18:11 ` wcohen at redhat dot com
2014-10-09 19:12 ` wcohen at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).