On 5/27/20 7:42 AM, Naveen Krishna Ch wrote: > Hi Alexander > > On Wed, 27 May 2020 at 19:38, Alexander Monakov <amonakov@xxxxxxxxx> wrote: >> >> On Wed, 27 May 2020, Guenter Roeck wrote: >> >>>>> I understand that. If you anticipate that the module may be inserted after a >>>>> wraparound, the driver should populate 'prev_value' with actual counter >>>>> values instead of zeros. That way the driver will properly accumulate >>>>> energy over time it's been inserted. As implemented, the driver counts >>>>> energy since boot time, minus unknown amount lost to wraparounds if the >>>>> driver was loaded too late. >>>> No problem if this module is built into the kernel. >>>> If this module is inserted at later point, unless the user keeps the >>>> counters since >>>> the boot and provide it as an input during the module insert (we can >>>> implement this). >>> >>> I won't accept such a parameter. If you may recall, I did bring this up as >>> reason why I abandoned the matching change for the coretemp driver, predicting >>> that people would complain about it. Now they do. Not surprising. We (and you) >>> will have to live with it. > Yes agree, letting user provide initial values is not appropriate. My bad. > >> >> I'm not exactly complaining, I'm proposing a solution: at probe time, populate >> prev_value members with MSR values instead of zeros. That way, the module will >> correctly count energy over the time it's been loaded. It can be unloaded and >> reloaded freely, and doing so would allow to easily measure energy across large >> spans of time, which sounds like an improvement. > > In the current driver, the accumulation thread starts during the probe and the > prev_value of sockets and the core0 is updated with the current MSR value. > It takes (nr_cpus - 1) iterations of the thread to populate the prev_value for > the other cores. > > By populating prev_value of all the cores during probe, we can > certainly save some > information (values with in one wrap-around at the best). If this > information is > useful, i can submit a patch to do so. Guenter, could you suggest us on this. > As long as you don't ignore counter values from before loading the driver, sure, go ahead. Guenter >> >> I can try to cook a corresponding patch if that sounds alright. >> >> Cheers. >> Alexander > > >