diff options
author | Stefano Stabellini <stefano.stabellini@eu.citrix.com> | 2015-11-23 05:35:12 -0500 |
---|---|---|
committer | David Vrabel <david.vrabel@citrix.com> | 2015-12-21 09:40:55 -0500 |
commit | 34e38523d586ae1e838241d44c8a2e9a1c9e0b43 (patch) | |
tree | d9245bb2404b0ef0c4d4e901d7416ce7ab2633c1 /arch/arm/xen/enlighten.c | |
parent | dfd57bc3a5664b98eb7b477e8d7bb2591a5198cf (diff) |
xen/arm: account for stolen ticks
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@eu.citrix.com>
Diffstat (limited to 'arch/arm/xen/enlighten.c')
-rw-r--r-- | arch/arm/xen/enlighten.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c index fc7ea529f462..ebbfa64e4add 100644 --- a/arch/arm/xen/enlighten.c +++ b/arch/arm/xen/enlighten.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <xen/page.h> | 12 | #include <xen/page.h> |
13 | #include <xen/interface/sched.h> | 13 | #include <xen/interface/sched.h> |
14 | #include <xen/xen-ops.h> | 14 | #include <xen/xen-ops.h> |
15 | #include <asm/paravirt.h> | ||
15 | #include <asm/xen/hypervisor.h> | 16 | #include <asm/xen/hypervisor.h> |
16 | #include <asm/xen/hypercall.h> | 17 | #include <asm/xen/hypercall.h> |
17 | #include <asm/system_misc.h> | 18 | #include <asm/system_misc.h> |
@@ -79,6 +80,19 @@ int xen_unmap_domain_gfn_range(struct vm_area_struct *vma, | |||
79 | } | 80 | } |
80 | EXPORT_SYMBOL_GPL(xen_unmap_domain_gfn_range); | 81 | EXPORT_SYMBOL_GPL(xen_unmap_domain_gfn_range); |
81 | 82 | ||
83 | static unsigned long long xen_stolen_accounting(int cpu) | ||
84 | { | ||
85 | struct vcpu_runstate_info state; | ||
86 | |||
87 | BUG_ON(cpu != smp_processor_id()); | ||
88 | |||
89 | xen_get_runstate_snapshot(&state); | ||
90 | |||
91 | WARN_ON(state.state != RUNSTATE_running); | ||
92 | |||
93 | return state.time[RUNSTATE_runnable] + state.time[RUNSTATE_offline]; | ||
94 | } | ||
95 | |||
82 | static void xen_percpu_init(void) | 96 | static void xen_percpu_init(void) |
83 | { | 97 | { |
84 | struct vcpu_register_vcpu_info info; | 98 | struct vcpu_register_vcpu_info info; |
@@ -104,6 +118,8 @@ static void xen_percpu_init(void) | |||
104 | BUG_ON(err); | 118 | BUG_ON(err); |
105 | per_cpu(xen_vcpu, cpu) = vcpup; | 119 | per_cpu(xen_vcpu, cpu) = vcpup; |
106 | 120 | ||
121 | xen_setup_runstate_info(cpu); | ||
122 | |||
107 | after_register_vcpu_info: | 123 | after_register_vcpu_info: |
108 | enable_percpu_irq(xen_events_irq, 0); | 124 | enable_percpu_irq(xen_events_irq, 0); |
109 | put_cpu(); | 125 | put_cpu(); |
@@ -271,6 +287,9 @@ static int __init xen_guest_init(void) | |||
271 | 287 | ||
272 | register_cpu_notifier(&xen_cpu_notifier); | 288 | register_cpu_notifier(&xen_cpu_notifier); |
273 | 289 | ||
290 | pv_time_ops.steal_clock = xen_stolen_accounting; | ||
291 | static_key_slow_inc(¶virt_steal_enabled); | ||
292 | |||
274 | return 0; | 293 | return 0; |
275 | } | 294 | } |
276 | early_initcall(xen_guest_init); | 295 | early_initcall(xen_guest_init); |