3 ms·
rdtsc isn't available on all platforms, for what it's worth. It's often disabled as there's a CPU flag to allow its use in user space, and it's well know to not
by junon 1y ago
rdtsc isn't available on all platforms, for what it's worth. It's often disabled as there's a CPU flag to allow its use in user space, and it's well know to not be so accurate.
- loeg 1y agoWhat platforms disable rdtsc for userspace? What accuracy issues do you think it has?
- junon 1y agordtsc instruction access is gated by a permission bit. Sometimes it's allowed from userspace, sometimes it's not. There were issues with it in the past, I forget which off the top of my head. It's also not as accurate as a the High Precision timer (HPET). I'm not sure which platforms gate/expose which these days but it's a grab bag.
- loeg 1y agoPersonally I'm not aware of any platform blocking rdtsc, so I was curious to learn which ones do.
- bonzini 1y ago> It's also not as accurate as a the High Precision timer (HPET) This hasn't been true for about 10 years.
- junon 1y agoYou're right, I was thinking about the interrupt precision over the default APIC timer. My point about it being disabled on some platforms has historically been true, however.
- bonzini 1y agoI think you're confusing this and the kernel's blacklisting of the TSC for timekeeping if it is not synchronized across CPUs; but while there's a knob to block userspace's access to the TSC, I am not sure that has been used anywhere except for debugging reasons (e.g. record/replay).