variorum icon indicating copy to clipboard operation
variorum copied to clipboard

MSR_RAPL_POWER_UNIT may be used uninitialized

Open slabasan opened this issue 2 years ago • 2 comments

Print package power limits internally reads the MSR_RAPL_POWER_UNIT and stores the conversion units for future use. Other printing of power limits, such as printing the DRAM power limits, does not have this internal call. As such, if any other print power API has been called before print package power limits, the conversion units are used uninitialized.

Ideas:

  • Extract "fundamental" MSRs, i.e., those that are needed by other MSRs into a different struct that is always accessible by functions. Right now, we are passing in each MSR that is needed into each function, which is tedious. The MSR struct can also be large, so probably does not make sense to make the entire struct available to each function.
  • Extract common functionality to reduce code duplication

slabasan avatar Jun 02 '22 05:06 slabasan

Nice catch!

rountree avatar Jun 02 '22 18:06 rountree

Yes indeed, this was tricky: we ran into this when I was porting the JSON query API to Intel systems and ran into a weird issue where a similar call to get_rapl_pkg_power_info resulted in different outputs. Thanks @slabasan for the debugging help and the temporary fix to ensure correctness -- we can put in a better solution to address this later (after the current release milestone).

tpatki avatar Jun 02 '22 18:06 tpatki