Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 Oct 2018 10:21:43 -0700
From:      Conrad Meyer <cse.cem@gmail.com>
To:        Lev Serebryakov <lev@freebsd.org>
Cc:        "freebsd-hackers@freebsd.org" <freebsd-hackers@freebsd.org>
Subject:   Re: What is wrong with dtrace's stack()?
Message-ID:  <CAG6CVpVCe-8OVU%2BKEyAh8swFSAjRshNcNLN0tjAS3W8bZxyrTA@mail.gmail.com>
In-Reply-To: <170994671.20181021201021@serebryakov.spb.ru>
References:  <170994671.20181021201021@serebryakov.spb.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
Your assembler dump offsets are in decimal.  Look for offset 0x33 =
+51, not +33.

Conrad
On Sun, Oct 21, 2018 at 10:12 AM Lev Serebryakov <lev@freebsd.org> wrote:
>
> Hello Freebsd-hackers,
>
>  I'm trying to profile strange if_gif and if_gre performance on hardware
> without pmc. So, I'm sampling kernel stacks with simple dtrace script.
>
>  And I have a lot of stacks which show something like this:
>
>   kernel`ipsec_hdrsiz_inpcb+0xa1
>   kernel`soo_write+0x33
>   kernel`dofilewrite+0x79
>   kernel`sys_write+0xc3
>   kernel`amd64_syscall+0x332
>   kernel`0xffffffff8086c87d
>
>  Functions after soo_write could be different, but address is always the
> same: soo_write+0x33.
>
>  But soo_write doesn't call all these functions, in first place! soo_write
> looks like:
>
> Dump of assembler code for function soo_write:
>    0xffffffff8060f930 <+0>:     push   %rbp
>    0xffffffff8060f931 <+1>:     mov    %rsp,%rbp
>    0xffffffff8060f934 <+4>:     push   %r15
>    0xffffffff8060f936 <+6>:     push   %r14
>    0xffffffff8060f938 <+8>:     push   %r12
>    0xffffffff8060f93a <+10>:    push   %rbx
>    0xffffffff8060f93b <+11>:    sub    $0x10,%rsp
>    0xffffffff8060f93f <+15>:    mov    %rsi,%r12
>    0xffffffff8060f942 <+18>:    mov    (%rdi),%rbx
>    0xffffffff8060f945 <+21>:    mov    0x28(%r12),%rax
>    0xffffffff8060f94a <+26>:    mov    %rax,(%rsp)
>    0xffffffff8060f94e <+30>:    xor    %esi,%esi
>    0xffffffff8060f950 <+32>:    xor    %ecx,%ecx
>    0xffffffff8060f952 <+34>:    xor    %r8d,%r8d
> ....
>
>  Now I can not trust all these collected stacks. What do I do wrong?!
>
> I have in my kernel config:
>
> makeoptions     DEBUG=-g
> makeoptions     WITH_CTF=1              # Run ctfconvert(1) for DTrace support
> options         KDTRACE_FRAME           # Ensure frames are compiled in
> options         KDTRACE_HOOKS           # Kernel DTrace hooks
>
> --
> Best regards,
>  Lev                          mailto:lev@FreeBSD.org
>
> _______________________________________________
> freebsd-hackers@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAG6CVpVCe-8OVU%2BKEyAh8swFSAjRshNcNLN0tjAS3W8bZxyrTA>