mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
xen: add steal_clock support on x86
The pv_time_ops structure contains a function pointer for the "steal_clock" functionality used only by KVM and Xen on ARM. Xen on x86 uses its own mechanism to account for the "stolen" time a thread wasn't able to run due to hypervisor scheduling. Add support in Xen arch independent time handling for this feature by moving it out of the arm arch into drivers/xen and remove the x86 Xen hack. Signed-off-by: Juergen Gross <[email protected]> Reviewed-by: Boris Ostrovsky <[email protected]> Reviewed-by: Stefano Stabellini <[email protected]> Signed-off-by: David Vrabel <[email protected]>
This commit is contained in:
parent
c7ebf9d9c6
commit
ecb23dc6f2
6 changed files with 25 additions and 69 deletions
|
|
@ -6,6 +6,7 @@
|
|||
#include <linux/math64.h>
|
||||
#include <linux/gfp.h>
|
||||
|
||||
#include <asm/paravirt.h>
|
||||
#include <asm/xen/hypervisor.h>
|
||||
#include <asm/xen/hypercall.h>
|
||||
|
||||
|
|
@ -75,6 +76,15 @@ bool xen_vcpu_stolen(int vcpu)
|
|||
return per_cpu(xen_runstate, vcpu).state == RUNSTATE_runnable;
|
||||
}
|
||||
|
||||
static u64 xen_steal_clock(int cpu)
|
||||
{
|
||||
struct vcpu_runstate_info state;
|
||||
|
||||
BUG_ON(cpu != smp_processor_id());
|
||||
xen_get_runstate_snapshot(&state);
|
||||
return state.time[RUNSTATE_runnable] + state.time[RUNSTATE_offline];
|
||||
}
|
||||
|
||||
void xen_setup_runstate_info(int cpu)
|
||||
{
|
||||
struct vcpu_register_runstate_memory_area area;
|
||||
|
|
@ -86,3 +96,13 @@ void xen_setup_runstate_info(int cpu)
|
|||
BUG();
|
||||
}
|
||||
|
||||
void __init xen_time_setup_guest(void)
|
||||
{
|
||||
pv_time_ops.steal_clock = xen_steal_clock;
|
||||
|
||||
static_key_slow_inc(¶virt_steal_enabled);
|
||||
/*
|
||||
* We can't set paravirt_steal_rq_enabled as this would require the
|
||||
* capability to read another cpu's runstate info.
|
||||
*/
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue