Le 18/06/2018 à 14:29, m...@netbsd.org a écrit :
joerg called it stupid and said we should use monitor, he's probably right. new arm also has a similar thing.
The thing is, there are several SPINLOCK_BACKOFF()s that we just can't replace by monitor. For example because we want to measure the delay under LOCKDEBUG.
(Perhaps a tunable read-mostly SPINLOCK_BACKOFF_* would be worthwhile?)
You mean, like, a configurable SPINLOCK_BACKOFF_MIN? Yes, that seems doable. I guess we should do both; use "monitor" when possible, and in the places that are still required to use "pause", use a lower BACKOFF_MIN (set at boot time, depending on the cpu model) to compensate for the increased CPU latency. There will still be a loss in this case, because the cycle ratio is 14 (10c -> 140c), but BACKOFF_MIN equals 4. By the way I'm wondering if KabyLake and later generations have the same increased latency, if they do we definitely need to fix that. I guess you have a Skylake, is there any seeable effect?
Also on the same topic: SPINLOCK_RUN_HOOK seems to be unused?
Yes, please remove.