Is there a way to reliably check if a speculative roll back has occured in the CPU ?
Normally we consider that an overflow has occured if the number of events in a PMC reaches the overflow mark (0x80000000). With speculative rollback, we assume that the overflow has occured if the number of events is short of the overflow mark by 256 or less. pmc_overflow() and check_compute_delta() use this assumption. The problem with this assumption is that it is not always valid which is why perf_event_interrupt() uses two different checks for overflow. In the first pass it uses '(int)val < 0' and in the second pass the pmc_overflow() helper. The reason for falling back to 'val < 0' check is that the sampling period could be very low and the number of events could truly be less than 256 even if no speculative roll back had occured. But the problem with the 'val < 0' check is that if speculative rollback did occur, we would not detect the rollback. We simply go ahead and reset the counters and THROW AWAY all the events that occured until that point. Over time and possibly with larger sampling periods, the number of events thrown away can lead to very inaccurate results. So, is there a better way to detect if a speculative rollback has occured when we get a perf_event_interrupt() ? Sukadev _______________________________________________ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev