From owner-freebsd-hackers@freebsd.org Sun Oct 21 17:21:56 2018 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3F0B4FFB657 for ; Sun, 21 Oct 2018 17:21:56 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io1-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CBA1E7092B; Sun, 21 Oct 2018 17:21:55 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io1-xd32.google.com with SMTP id a23-v6so89614iod.7; Sun, 21 Oct 2018 10:21:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=FrGLxvY6GXckrJefk0q6QE8KjEILi+Ks0XO3Cq76orU=; b=jDWpfJCXPts9cp/iySiGs+AjJrzCkH2MzLcBi9Mz+6jTrqGwBUSRitl8v80yzUDYSF BDqnSm+KlMQIGglKl/eAOssXCDaw7HGMk5AJTCQn0GRu6yNmgPgOoR++CNNHJPBJi8Gv UGUN8v1ssGjRxAHjCZk7UZ3lqEDGyoXa0Mdu1NFTORnn3BnkNRGvoN4t2RoB49AsJ59h NqEjT3v89FOLPpc7p4VLg82xxD+LbBlgEDuZCLnqBkcp0DUayBc8YWb3E6mZg3PSJ5fv hdNSQSgNPUYeuBgeBlzMHe9EBbV9YWQqw65IAiuxaDvM0ZqvR7pk/JJv9SMREDb+Qco/ VI0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=FrGLxvY6GXckrJefk0q6QE8KjEILi+Ks0XO3Cq76orU=; b=TPRpq0TskMcPeXu3ueKGsqeJXafKSdrB/BU9Bb1AkPWxiXx9GwTRgo1xxk6tM242Fv jEL8vCk4tbviCjFww8Dq8+/6U6NsUrdbem+XEXwoCtPlWYd1sIwx1vA7KWzRGZvoiz4S rtesW4jlVTlyKdYxBbUA47NzNFR8Oe2ch+8HFBJKeF1OmGrvpP1brvOORHIcvYsh6HjK zvr1Q7Y20xi4DAP8JFyp0jOy/x+QS4ZdHOrt7LNlPGd0TYeqEvbR8F6Pqw4x8cqWFuRk w2XwOQLr8KmDBbM0Pwdme0nbWwIfMUky67X3HL71dlotNdBHME67AvD7/DzyDWDKbaIl xlTA== X-Gm-Message-State: AGRZ1gKAd2BAhI6NWAenk+4PiDllGF6xboVL3CcS91KUOsgczdfPwwk6 71SNlwrgJwY6Y5U4bxicHqG4/ho74McH/9wA38dj7g== X-Google-Smtp-Source: AJdET5eqL6pKqx07ET5jiIRDY/jeQXiNHEVhVrHTq1eHyaP5wG8x9QOGO1zqOpm8iT8nVV1XftA4r8dZ9o+aca8XqKE= X-Received: by 2002:a6b:e802:: with SMTP id f2-v6mr7034982ioh.19.1540142514886; Sun, 21 Oct 2018 10:21:54 -0700 (PDT) MIME-Version: 1.0 References: <170994671.20181021201021@serebryakov.spb.ru> In-Reply-To: <170994671.20181021201021@serebryakov.spb.ru> From: Conrad Meyer Date: Sun, 21 Oct 2018 10:21:43 -0700 Message-ID: Subject: Re: What is wrong with dtrace's stack()? To: Lev Serebryakov Cc: "freebsd-hackers@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Oct 2018 17:21:56 -0000 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 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"