Clear virtual PMCs on each CPU after the hook clears. Drain sample rings before unload.
Sponsored by: AMD
Differential D61370
hwpmc: drain PMCs at unload Authored by afscoelho_gmail.com on Tue, Nov 10, 1:08 AM.
Details
Clear virtual PMCs on each CPU after the hook clears. Drain sample rings before unload. Sponsored by: AMD GENERIC with INVARIANTS on AMD, 160 CPUs.
Diff Detail
Event TimelineComment Actions Tested the unload path with hwpmc as a module on an EPYC 9654 LGTM. Comment Actions How does this relate to your recent addition of pmc_unload()? In particular, should that function attempt to drain samples, or would it not help anything? Comment Actions Thanks for the review! Yes, you are correct in part. With pmc_unload(), D61370 is not needed for kldunload anymore, but it is still needed for shutdown. MOD_SHUTDOWN skips the owner check and calls pmc_cleanup() while PMCs can still be active. I tested this in bhyve with INVARIANTS, without this patch, when the guest shut down, runs panicked with "waiting too long for pmc to be free" from module_shutdown(). With this patch, every shutdown went fine |