Lower the sample rate when PMC interrupt time exceeds the CPU budget. The default budget is 25%.
Sponsored by: AMD
Differential D61372
hwpmc: limit PMC interrupt time Authored by afscoelho_gmail.com on Tue, Nov 10, 1:08 AM. Project Tags None Referenced Files
Subscribers
Details
Lower the sample rate when PMC interrupt time exceeds the CPU budget. The default budget is 25%. Sponsored by: AMD GENERIC with INVARIANTS on AMD, 160 CPUs.
Diff Detail
Event TimelineComment Actions Tested on an EPYC 9654: time_limited passes, and with a 1% budget the pmc_intr_took() can run on several CPUs at once. Two CPUs can read Comment Actions This is a bit annoying for analysis. I think we need to re-generate an event registration in pmclog with the new rate to signal to the analysis software that the rate changed. I need the rate to normalize the data and if it changes we should correct for that. Comment Actions That's is a good catch, thanks! The log really needs to show the rate change. I think to add PMCLOG_TYPE_RATECHANGE rather than repeat PMCALLOCATE including the timestamp of the change, the new rate cap, and the per tick sample limit in each affected log. What do you think? How about the time each PMC spends stopped? Comment Actions Add PMCLOG_TYPE_RATECHANGE. Use atomic_cmpset_int() loops for the limits in pmc_intr_took(). Comment Actions Thank you. I added PMCLOG_TYPE_RATECHANGE in this diff. When the rate limit changes, hwpmc writes this record to each log before the next sample. It has the TSC time, the new rate and per-tick limits, the cause (interrupt time or sysctl), and the interrupt time in ns. libpmc and pmcstat -R read it, and the test checks it. also added the atomic_cmpset_int() fix from @ojanerif_amd.com. D61373 logs the dropped sample counts for each PMC and CPU. Do you also want the time that the driver stops each PMC? Comment Actions Hi @ali_mashtizadeh.com, I tried this with a RATECHANGE record at the start of each log, with a new flag PMCLOG_RATE_START. It works, but I am not sure about it. An old libpmc stops at an unknown record type. Thus almost every sampling log from a new kernel breaks an old pmcstat, and not only logs with a change in them. What do you think? Is a record at the start of each log OK with you? |