From owner-freebsd-bugs@freebsd.org Wed Aug 19 17:26:33 2020 Return-Path: Delivered-To: freebsd-bugs@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 65D623C538D for ; Wed, 19 Aug 2020 17:26:33 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mailman.nyi.freebsd.org (mailman.nyi.freebsd.org [IPv6:2610:1c1:1:606c::50:13]) by mx1.freebsd.org (Postfix) with ESMTP id 4BWvpF1Wyfz4KGd for ; Wed, 19 Aug 2020 17:26:25 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: by mailman.nyi.freebsd.org (Postfix) id 7CCD23C50C2; Wed, 19 Aug 2020 17:26:25 +0000 (UTC) Delivered-To: bugs@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 78A5A3C5042 for ; Wed, 19 Aug 2020 17:26:25 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BWvp91KL2z4KGT for ; Wed, 19 Aug 2020 17:26:24 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 88E67262DD for ; Wed, 19 Aug 2020 17:26:24 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 07JHQOBM064892 for ; Wed, 19 Aug 2020 17:26:24 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 07JHQOYD064891 for bugs@FreeBSD.org; Wed, 19 Aug 2020 17:26:24 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 234325] pmcstat seems to be broken in sampling mode (at least on amd hardware) Date: Wed, 19 Aug 2020 17:26:24 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: 12.0-RELEASE X-Bugzilla-Keywords: regression X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: luporl@FreeBSD.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_severity Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Aug 2020 17:26:33 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D234325 Leandro Lupori changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|Affects Only Me |Affects Some People --- Comment #1 from Leandro Lupori --- Hello. I'm using FreeBSD 13.0-CURRENT (r364197) on an amd64 VM (qemu with k= vm) and I'm seeing similar issues. Host has a Core i7-6700K CPU. pmcstat -S/-s/-p seems to work fine, but I've noticed several issues with pmcstat -P. I started using sysutils/stress for the tests - that, with --cpu flag, basically calls sqrt(rand()) in a tight loop - but the only way to get it working under pmcstat -P was to build it statically, with debug symbols and modify it so it doesn't fork (I called this modified version mystress). Then the following commands produce correct results: pmcstat -n 500000 -d -P inst_retired.any -O sample.out /tmp/mystress.static pmcstat -R sample.out -G sample.graph CONVERSION STATISTICS: #exec/elf 1 #samples/total 52068 Sample.graph correctly shows hogcpu(), rand() and random_r() as the functio= ns that consumed most of the time. But, when using a static version of stress, with debug symbols, but that fo= rks, pmcstat fails to resolve all userspace callchains: # case 1 pmcstat -n 500000 -d -P inst_retired.any -O sample.out ./stress.static -c 1= -t 3 pmcstat -R sample.out -G sample.graph CONVERSION STATISTICS: #exec/elf 1 #samples/total 49771 #callchain/dubious-frames 49742 >From a brief look at pmcstat code, it seems there is a missing PROCFORK eve= nt, to tell it about the forked child. Another case in which pmcstat -P fails to resolve most symbols is when usin= g a dynamically linked binary (mystress in this case, that doesn't fork): # case 2 pmcstat -n 500000 -d -P inst_retired.any -O sample.out /tmp/mystress pmcstat -R sample.out -G sample.graph CONVERSION STATISTICS: #exec/elf 1 #samples/total 52558 #samples/unknown-function 5973 #callchain/dubious-frames 38383 The main binary symbols are resolved correctly (e.g. hogcpu), but none of t= he shared libraries' ones are (e.g. rand). Yet another case in which pmcstat -P fails to resolve symbols is when using= it with -t to specify the process, instead of starting it on the command line: # case 3 ./mystress.static & sleep 1 pmcstat -n 500000 -d -P inst_retired.any -O sample.out -t mystress pmcstat -R sample.out -G sample.graph CONVERSION STATISTICS: #samples/total 4195 #callchain/dubious-frames 4193 Sometimes no samples are collected at all. All the issues above also occur on a PowerPC64 machine. --=20 You are receiving this mail because: You are the assignee for the bug.=