6cb9a8350a
The custom_sched_clock hook is broken. The result from sched_clock needs to be in nanoseconds, not in CPU cycles. The TSC is insufficient for this purpose, because TSC is poorly defined in a virtual environment, and mostly represents real world time instead of scheduled process time (which can be interrupted without notice when a virtual machine is descheduled). To make the scheduler consistent, we must expose a different nature of time, that is scheduled time. So deprecate this custom_sched_clock hack and turn it into a paravirt-op, as it should have been all along. This allows the tsc.c code which converts cycles to nanoseconds to be shared by all paravirt-ops backends. It is unfortunate to add a new paravirt-op, but this is a very distinct abstraction which is clearly different for all virtual machine implementations, and it gets rid of an ugly indirect function which I ashamedly admit I hacked in to try to get this to work earlier, and then even got in the wrong units. Signed-off-by: Zachary Amsden <zach@vmware.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
41 lines
733 B
C
41 lines
733 B
C
#ifndef _ASMi386_TIME_H
|
|
#define _ASMi386_TIME_H
|
|
|
|
#include <linux/efi.h>
|
|
#include "mach_time.h"
|
|
|
|
static inline unsigned long native_get_wallclock(void)
|
|
{
|
|
unsigned long retval;
|
|
|
|
if (efi_enabled)
|
|
retval = efi_get_time();
|
|
else
|
|
retval = mach_get_cmos_time();
|
|
|
|
return retval;
|
|
}
|
|
|
|
static inline int native_set_wallclock(unsigned long nowtime)
|
|
{
|
|
int retval;
|
|
|
|
if (efi_enabled)
|
|
retval = efi_set_rtc_mmss(nowtime);
|
|
else
|
|
retval = mach_set_rtc_mmss(nowtime);
|
|
|
|
return retval;
|
|
}
|
|
|
|
#ifdef CONFIG_PARAVIRT
|
|
#include <asm/paravirt.h>
|
|
#else /* !CONFIG_PARAVIRT */
|
|
|
|
#define get_wallclock() native_get_wallclock()
|
|
#define set_wallclock(x) native_set_wallclock(x)
|
|
#define do_time_init() time_init_hook()
|
|
|
|
#endif /* CONFIG_PARAVIRT */
|
|
|
|
#endif
|