Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Aug 2020 17:26:24 +0000
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)
Message-ID:  <bug-234325-227-7NwnnKfpaS@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-234325-227@https.bugs.freebsd.org/bugzilla/>
References:  <bug-234325-227@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D234325

Leandro Lupori <luporl@FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|Affects Only Me             |Affects Some People

--- Comment #1 from Leandro Lupori <luporl@FreeBSD.org> ---
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.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-234325-227-7NwnnKfpaS>