Page MenuHomeFreeBSD

pmc: Provide full path to modules from kernel linker
ClosedPublic

Authored by jrtc27 on May 10 2023, 5:37 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Oct 31, 7:03 PM
Unknown Object (File)
Thu, Oct 31, 11:44 AM
Unknown Object (File)
Oct 4 2024, 8:53 PM
Unknown Object (File)
Oct 4 2024, 5:05 PM
Unknown Object (File)
Oct 1 2024, 9:58 PM
Unknown Object (File)
Oct 1 2024, 9:15 PM
Unknown Object (File)
Sep 30 2024, 5:23 AM
Unknown Object (File)
Sep 29 2024, 2:01 AM
Subscribers

Details

Summary

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.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

The resulting cleanup is excellent.

sys/kern/kern_linker.c
2122

Just looking at the usage of this field, it could become an anonymous union of:

union {
    char *pathname;
    vnode *vp;
};
This revision is now accepted and ready to land.May 11 2023, 6:18 PM

The resulting cleanup is excellent.

Thank @jhb for the suggestion :)

sys/kern/kern_linker.c
2122

Doesn't need to be anonymous, really, but yeah, a union would be nicer than this slightly disgusting kernel-internal interface

jkoshy added inline comments.
usr.sbin/pmcstat/pmcstat.c
625

Consider accepting this option for an additional release cycle, while issuing a warning that it no longer has an effect.

I'm inclined to agree with @jkoshy with emitting a warning for -k for stable/14, but the error from usage for an unknown option might be just as functional in practice.

I'm happy to do that if consensus is that's better, I just felt that it's better to give a hard error for something that's been removed as an option rather than warning that the option that used to do something now doesn't do anything but continuing onwards. I guess it depends whether people are doing weird things with -k; if they're only using it to work around the lack of full paths then ignoring the option will do the right thing, but if they're using it to map onto some other directory that doesn't match the full path then it'll do the wrong thing. Probably we're in the former category though, especially given how little pmcstat actually gets used...

I'm happy to do that if consensus is that's better, I just felt that it's better to give a hard error for something that's been removed as an option rather than warning that the option that used to do something now doesn't do anything but continuing onwards. I guess it depends whether people are doing weird things with -k; if they're only using it to work around the lack of full paths then ignoring the option will do the right thing, but if they're using it to map onto some other directory that doesn't match the full path then it'll do the wrong thing. Probably we're in the former category though, especially given how little pmcstat actually gets used...

For me it's more of a small preference, but not a strong one either way.

  • Warn on -k use in pmcstat
  • Drop -k from pmcstat's own usage output
This revision now requires review to proceed.May 30 2023, 10:42 PM
This revision was not accepted when it landed; it landed in state Needs Review.May 30 2023, 11:38 PM
This revision was automatically updated to reflect the committed changes.