On Oct 15 12:45, Richard Henderson wrote: > On 10/10/18 1:37 PM, Aaron Lindsay wrote: > > +static void cpu_post_save(void *opaque) > > +{ > > + ARMCPU *cpu = opaque; > > + pmccntr_sync(&cpu->env); > > +} > > I'm confused about the need for this. > Can you explain the sequence of events that requires it?
It sounds like you're more okay with this now based on your comments on my later patch, but for others... The PMU implementation is event-driven - the counters and other associated PMU/sysreg state are only updated when needed to ensure the architectural state observed by the system is correct (i.e. on system register reads). Otherwise, the counters are stored as differences from the underlying counts rather than the raw counter values themselves. Upon migration, we want to convert the counters and other state to their architectural versions, but then want to swap it all back to the differential versions again when we're done saving/loading. -Aaron