This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Regarding systemtap support for AArch64


On 10/28/2013 10:02 AM, William Cohen wrote:

> Hi Sandeepa,
> 
> I got the v2 versions of the kprobe patches and built and booted the new kernel. It functions and gives the same same results as the earlier version of the kprobe patches.  I was looking around to see why the $return doesn't work and came across the a similar thread for the arm from a couple years ago:
> 
> http://comments.gmane.org/gmane.linux.systemtap/17986
> 
> elfutils still need to have some additional aarch64 support included so that systemtap can find the location of the return value.
> 
> -Will
> 

Hi Sandeepa,

With the helpful tips from Mark and Frank, I have a built systemtap on
aarch64 using the elfutils with aarch64 support from the elfutils git
repo.  Systemtap scripts using the $return compiles but the $return
value looks wrong.  For example below $return shouldn't be some huge
negative number:

$ sudo ../install/bin/stap -m return -k -v -e 'probe vfs.read.return {printf("read performed 0x%x\n", $return); exit()}'
Pass 1: parsed user script and 92 library script(s) using 140728virt/25036res/2784shr/22952data kb, in 4750usr/150sys/10805real ms.
Pass 2: analyzed script: 2 probe(s), 7 function(s), 6 embed(s), 0 global(s) using 323588virt/103604res/3676shr/100440data kb, in 40150usr/7910sys/105966real ms.
Pass 3: translated to C into "/tmp/stapmZsmxy/return_src.c" using 323588virt/105924res/5996shr/100440data kb, in 150usr/10sys/357real ms.
Pass 4: compiled C into "return.ko" in 41820usr/2890sys/100357real ms.
Pass 5: starting run.
[358010.304872] return: systemtap: 2.4/0.157, base: ffffffbffc0e8000, memory: 15data/21text/0ctx/2058net/11alloc kb, probes: 2
read performed 0xffffffc077a9a100
Pass 5: run completed in 40usr/150sys/3714real ms.
Keeping temporary directory "/tmp/stapmZsmxy"

The aarch64 call abi is described in:

http://infocenter.arm.com/help/topic/com.arm.doc.ihi0055b/IHI0055B_aapcs64.pdf

According to the call abi the simple integer value should be in
register "x0".  It looks in the generated c code for the module that
it is trying to access the return value with:

    { int64_t value = fetch_register (0); STAP_RETVALUE = value; }


As a sanity check I ran a "make -s check" on the locally built aarch64
elfutils to see if there were any issues with it.

FAIL: run-elflint-self.sh

Probably should implement the print_regs() to make debugging this easier.

-Will


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]