<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src/lib/libpmcstat, branch release/14.4.0</title>
<subtitle>FreeBSD source tree</subtitle>
<id>https://cgit-dev.freebsd.org/src/atom?h=release%2F14.4.0</id>
<link rel='self' href='https://cgit-dev.freebsd.org/src/atom?h=release%2F14.4.0'/>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/'/>
<updated>2025-04-26T03:24:17Z</updated>
<entry>
<title>libpmcstat: fix pmcstat -G on older-ish -CURRENT w/ drm-kmod</title>
<updated>2025-04-26T03:24:17Z</updated>
<author>
<name>Kyle Evans</name>
<email>kevans@FreeBSD.org</email>
</author>
<published>2025-04-21T04:00:01Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=e5a4712e6557d1007bfa63b8c83c4e3d8f86564b'/>
<id>urn:sha1:e5a4712e6557d1007bfa63b8c83c4e3d8f86564b</id>
<content type='text'>
The linuxkpi_gplv2.ko module on older-ish -CURRENT had absolutely no
.text contents, but it was still loaded.  Instead of hitting the later
assertion because 0 is not less than 0, we can just skip images like
this as we should not have any samples from them.

Reviewed by:	gallatin

(cherry picked from commit 77721403c91d67dbfd5a2c5c667e7f5d87acb3f6)
</content>
</entry>
<entry>
<title>Remove $FreeBSD$: one-line sh pattern</title>
<updated>2023-08-16T17:55:03Z</updated>
<author>
<name>Warner Losh</name>
<email>imp@FreeBSD.org</email>
</author>
<published>2023-08-16T17:55:03Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=d0b2dbfa0ecf2bbc9709efc5e20baf8e4b44bbbf'/>
<id>urn:sha1:d0b2dbfa0ecf2bbc9709efc5e20baf8e4b44bbbf</id>
<content type='text'>
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
</content>
</entry>
<entry>
<title>Remove $FreeBSD$: one-line .c pattern</title>
<updated>2023-08-16T17:54:42Z</updated>
<author>
<name>Warner Losh</name>
<email>imp@FreeBSD.org</email>
</author>
<published>2023-08-16T17:54:42Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=1d386b48a555f61cb7325543adbbb5c3f3407a66'/>
<id>urn:sha1:1d386b48a555f61cb7325543adbbb5c3f3407a66</id>
<content type='text'>
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
</content>
</entry>
<entry>
<title>Remove $FreeBSD$: two-line .h pattern</title>
<updated>2023-08-16T17:54:16Z</updated>
<author>
<name>Warner Losh</name>
<email>imp@FreeBSD.org</email>
</author>
<published>2023-08-16T17:54:16Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=b3e7694832e81d7a904a10f525f8797b753bf0d3'/>
<id>urn:sha1:b3e7694832e81d7a904a10f525f8797b753bf0d3</id>
<content type='text'>
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
</content>
</entry>
<entry>
<title>pmc: Rework PROCEXEC event to support PIEs</title>
<updated>2023-05-30T23:20:36Z</updated>
<author>
<name>Jessica Clarke</name>
<email>jrtc27@FreeBSD.org</email>
</author>
<published>2023-05-30T23:20:36Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=94426d21bf62f2b36dc9b556ab27c401a412a026'/>
<id>urn:sha1:94426d21bf62f2b36dc9b556ab27c401a412a026</id>
<content type='text'>
Currently the PROCEXEC event only reports a single address, entryaddr,
which is the entry point of the interpreter in the typical dynamic case,
and used solely to calculate the base address of the interpreter. For
PDEs this is fine, since the base address is known from the program
headers, but for PIEs the base address varies at run time based on where
the kernel chooses to load it, and so pmcstat has no way of knowing the
real address ranges for the executable. This was less of an issue in the
past since PIEs were rare, but now they're on by default on 64-bit
architectures it's more of a problem.

To solve this, pass through what was picked for et_dyn_addr by the
kernel, and use that as the offset for the executable's start address
just as is done for everything in the kernel. Since we're changing this
interface, sanitise the way we determine the interpreter's base address
by passing it through directly rather than indirectly via the entry
point and having to subtract off whatever the ELF header's e_entry is
(and anything that wants the entry point in future can still add that
back on as needed; this merely changes the interface to directly provide
the underlying variables involved).

This will be followed up by a bump to the pmc major version.

Reviewed by:	jhb
Differential Revision:	https://reviews.freebsd.org/D39595
</content>
</entry>
<entry>
<title>pmc: Provide full path to modules from kernel linker</title>
<updated>2023-05-30T23:15:34Z</updated>
<author>
<name>Jessica Clarke</name>
<email>jrtc27@FreeBSD.org</email>
</author>
<published>2023-05-30T23:15:34Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=53d0b9e438bc30ef12c24fddec13e97ade852164'/>
<id>urn:sha1:53d0b9e438bc30ef12c24fddec13e97ade852164</id>
<content type='text'>
This unifies the user object and kernel module paths in libpmcstat,
allows modules loaded from non-standard locations (e.g. from a user's
home directory when testing) to be found and, since buffer is what all
the warnings here use (they were never updated when buffer_modules were
added to pick based on where the file was found) has the side-effect of
ensuring the messages are correct.

This includes obsoleting the now-superfluous -k option in pmcstat.

This change breaks the hwpmc ABI and will be followed by a bump to the
pmc major version.

Reviewed by:	jhb, jkoshy, mhorne
Differential Revision:	https://reviews.freebsd.org/D40048
</content>
</entry>
<entry>
<title>libpmcstat: Fix a few ARM-specific issues with function symbols.</title>
<updated>2022-03-10T23:39:53Z</updated>
<author>
<name>John Baldwin</name>
<email>jhb@FreeBSD.org</email>
</author>
<published>2022-03-10T23:39:53Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=a6db407f15ab7d0dbfd83a48173343654106510e'/>
<id>urn:sha1:a6db407f15ab7d0dbfd83a48173343654106510e</id>
<content type='text'>
- Refine the checks for ARM mapping symbols and apply them on arm64 as
  well as 32-bit arm.  In particular, mapping symbols can have
  additional characters and are not strictly limited to just "$a" but
  can append additional characters (e.g. "$a.1").  Add "$x" to the
  list of mapping symbol prefixes.

- Clear the LSB of function symbol addresses.  Thumb function
  addresses set the LSB to enable Thumb mode.  However, the actual
  function starts at the aligned address with LSB clear.  Not clearing
  the LSB can cause pmcannotate to pass misaligned addresses to
  objdump when extracting disassembly.

Reviewed by:	andrew
Obtained from:	CheriBSD
Sponsored by:	University of Cambridge, Google, Inc.
Differential Revision:	https://reviews.freebsd.org/D34416
</content>
</entry>
<entry>
<title>Make hwpmc work for userspace binaries again</title>
<updated>2021-12-15T13:38:36Z</updated>
<author>
<name>Andrew Gallatin</name>
<email>gallatin@FreeBSD.org</email>
</author>
<published>2021-12-15T13:38:36Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=517a7adb1160850746227e4cc30d4bcc3ff04d7d'/>
<id>urn:sha1:517a7adb1160850746227e4cc30d4bcc3ff04d7d</id>
<content type='text'>
hwpmc has been utterly broken for userspace binaries, and has been
labeling all samples from userspace binaries as dubious frames. The
issues are that:

-The check for ph.p_offset &amp; (-ph.p_align) == 0 was mostly bogus. The
 intent was to ignore all executable segments other than the first,
 which when using BFD appeared in the first page, but with current LLD
 a read-only data segment appears before the executable segment,
 pushing the latter into the second page or later. This meant no
 executable segment was ever found, and thus pi_vaddr remained
 0. Instead of relying on BFD's layout, track whether we've seen an
 executable segment explicitly with a local bool.

-Shared libraries were not parsing the segments to calculate pi_vaddr,
 resulting in it always being 0. Again, when using BFD, the executable
 segment started at the first page, and so pi_vaddr was genuinely
 meant to be 0, but not with LLD's current layout. This meant that
 pmcstat_image_link's offset calculation gave the base address of the
 segment in memory, rather than the base address of the whole library
 in memory, and so when adding that to pi_start/pi_end to get the
 range of the executable sections in memory it double-counted the
 offset of the first executable segment within the library. Thus we
 need to do the exact same parsing for ET_DYN as we do for ET_EXEC,
 which is simpler to write as special-casing ET_REL to not look for
 segments. Note that, whilst PT_INTERP isn't needed for shared
 libraries, it will be for PIEs, which pmcstat still fails to handle
 due to not knowing the base address of the PIE; we get the base
 address for libraries by MAP_IN events, and for rtld by virtue of the
 process's entry address being rtld's, but have no equivalent for the
 executable.

Fixes courtesy of jrtc27@.

Reviewed by: jrtc27, jhb (earlier version)
Differential Revision: https://reviews.freebsd.org/D33055
Sponsored by: Netflix
</content>
</entry>
<entry>
<title>pmcstat: fix PPC kernel symbol resolution</title>
<updated>2020-11-05T16:47:23Z</updated>
<author>
<name>Leandro Lupori</name>
<email>luporl@FreeBSD.org</email>
</author>
<published>2020-11-05T16:47:23Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=926da0492a672c3175d81f24bfa1b4ad461b884b'/>
<id>urn:sha1:926da0492a672c3175d81f24bfa1b4ad461b884b</id>
<content type='text'>
PowerPC kernel is of DYN type and it has a base address where it is
initially loaded, before being relocated. As the start address passed to
pmcstat_image_link() is where the kernel was relocated to, but the symbols
always use the original base address, we need to subtract it to get the
correct offset.

Reviewed by:	jhibbits
Sponsored by:	Eldorado Research Institute (eldorado.org.br)
Differential Revision:	https://reviews.freebsd.org/D26114
</content>
</entry>
<entry>
<title>pmcstat: implement showing offsets into symbols in top mode</title>
<updated>2020-08-05T19:05:49Z</updated>
<author>
<name>Mateusz Guzik</name>
<email>mjg@FreeBSD.org</email>
</author>
<published>2020-08-05T19:05:49Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=94e9ef85c594951f9d9d0e4cd7595e9cd2f792da'/>
<id>urn:sha1:94e9ef85c594951f9d9d0e4cd7595e9cd2f792da</id>
<content type='text'>
The -I option (and hotkey) is reused for this. Skipping symbol resolution is
moved to the new -A option (and hotkey).

While arguably this violates POLA I think it's a change for the better.
ALso note the -I option was added in head.

Differential Revision:	https://reviews.freebsd.org/D21658
</content>
</entry>
</feed>
