[PATCH RFC v2 4/4] xen/arm: account for stolen ticks
Stefano Stabellini
stefano.stabellini at eu.citrix.com
Mon May 6 10:51:18 EDT 2013
Register the runstate_memory_area with the hypervisor.
Use pv_time_ops.steal_clock to account for stolen ticks.
Signed-off-by: Stefano Stabellini <stefano.stabellini at eu.citrix.com>
---
arch/arm/xen/enlighten.c | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
index ee86bfa..2a5cc82 100644
--- a/arch/arm/xen/enlighten.c
+++ b/arch/arm/xen/enlighten.c
@@ -14,7 +14,10 @@
#include <xen/xen-ops.h>
#include <asm/xen/hypervisor.h>
#include <asm/xen/hypercall.h>
+#include <asm/arch_timer.h>
#include <asm/system_misc.h>
+#include <asm/paravirt.h>
+#include <linux/jump_label.h>
#include <linux/interrupt.h>
#include <linux/irqreturn.h>
#include <linux/module.h>
@@ -152,6 +155,20 @@ int xen_unmap_domain_mfn_range(struct vm_area_struct *vma,
}
EXPORT_SYMBOL_GPL(xen_unmap_domain_mfn_range);
+unsigned long long xen_stolen_accounting(int cpu)
+{
+ struct vcpu_runstate_info state;
+
+ if (cpu != get_cpu())
+ BUG();
+
+ xen_get_runstate_snapshot(&state);
+
+ WARN_ON(state.state != RUNSTATE_running);
+
+ return state.time[RUNSTATE_runnable] + state.time[RUNSTATE_offline];
+}
+
static void __init xen_percpu_init(void *unused)
{
struct vcpu_register_vcpu_info info;
@@ -170,6 +187,8 @@ static void __init xen_percpu_init(void *unused)
BUG();
per_cpu(xen_vcpu, cpu) = vcpup;
+ xen_setup_runstate_info(cpu);
+
enable_percpu_irq(xen_events_irq, 0);
}
@@ -301,6 +320,10 @@ static int __init xen_init_events(void)
on_each_cpu(xen_percpu_init, NULL, 0);
+ pv_time_ops.steal_clock = xen_stolen_accounting;
+ static_key_slow_inc(¶virt_steal_enabled);
+ static_key_slow_inc(¶virt_steal_rq_enabled);
+
return 0;
}
postcore_initcall(xen_init_events);
--
1.7.2.5
More information about the linux-arm-kernel
mailing list