This will later be used to support KVM clock. I'm not sure if there is a good way to sort out generic upstream Xen headers to include pvclock.h, so at the moment, casts are used to keep the code compiling.
Details
Diff Detail
- Lint
Lint Skipped - Unit
Tests Skipped
Event Timeline
Thanks for doing this, the change looks fine, but could you wait until Friday so I can test it on Xen before committing it?
| sys/x86/include/pvclock.h | ||
|---|---|---|
| 50 | You don't need the __packed here or above, the layout of those structures already make them packed. | |
| sys/x86/x86/pvclock.c | ||
| 130 | I think this change (from the previous code found in the Xen timer) fixes the theoretical issue described here: https://lists.freebsd.org/pipermail/freebsd-virtualization/2014-January/001926.html | |
I've successfully tested this on a Xen PVHVM guest while performing migrations and it works fine, also tested on Dom0 with the same result.
| sys/x86/x86/pvclock.c | ||
|---|---|---|
| 153 | This doesn't need to be a volatile AFAICT. | |
| sys/x86/x86/pvclock.c | ||
|---|---|---|
| 121 | Doesn't this need to happen underneath a critical_enter()? If we switch to a different (virtual) CPU in the loop we could potentially see data for one (physical) CPU but read the TSC from a different CPU. | |
| 130 | I don't see how this code prevents reading from ti->version twice in the condition? | |
| sys/x86/x86/pvclock.c | ||
|---|---|---|
| 121 | scratch that, the caller already does the critical_enter() (and it has to be the one to do it). I think that a CRITICAL_ASSERT(); would be a good idea where to document this important prerequisite. | |