Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1261695

[PATCH v10 5/5] xen/arm: account for stolen ticks

From Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Newsgroups linux.kernel
Subject [PATCH v10 5/5] xen/arm: account for stolen ticks
Date 2015-11-03 17:30 +0100
Message-ID <qqMD9-5cu-25@gated-at.bofh.it> (permalink)
References <qqMts-57V-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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>

---

Changes in v4:
- don't use paravirt_steal_rq_enabled: we do not support retrieving
stolen ticks for vcpus other than one we are running on.

Changes in v3:
- use BUG_ON and smp_processor_id.
---
 arch/arm/xen/enlighten.c |   21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
index eeeab07..7dd2cc0 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>
@@ -79,6 +82,19 @@ int xen_unmap_domain_gfn_range(struct vm_area_struct *vma,
 }
 EXPORT_SYMBOL_GPL(xen_unmap_domain_gfn_range);
 
+static unsigned long long xen_stolen_accounting(int cpu)
+{
+	struct vcpu_runstate_info state;
+
+	BUG_ON(cpu != smp_processor_id());
+
+	xen_get_runstate_snapshot(&state);
+
+	WARN_ON(state.state != RUNSTATE_running);
+
+	return state.time[RUNSTATE_runnable] + state.time[RUNSTATE_offline];
+}
+
 static void xen_percpu_init(void)
 {
 	struct vcpu_register_vcpu_info info;
@@ -96,6 +112,8 @@ static void xen_percpu_init(void)
 	BUG_ON(err);
 	per_cpu(xen_vcpu, cpu) = vcpup;
 
+	xen_setup_runstate_info(cpu);
+
 	enable_percpu_irq(xen_events_irq, 0);
 	put_cpu();
 }
@@ -259,6 +277,9 @@ static int __init xen_guest_init(void)
 
 	register_cpu_notifier(&xen_cpu_notifier);
 
+	pv_time_ops.steal_clock = xen_stolen_accounting;
+	static_key_slow_inc(&paravirt_steal_enabled);
+
 	return 0;
 }
 early_initcall(xen_guest_init);
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v10 0/5] xen/arm/arm64: CONFIG_PARAVIRT and stolen ticks  accounting Stefano Stabellini <stefano.stabellini@eu.citrix.com> - 2015-11-03 17:20 +0100
  [PATCH v10 4/5] arm64: introduce CONFIG_PARAVIRT, PARAVIRT_TIME_ACCOUNTING and pv_time_ops Stefano Stabellini <stefano.stabellini@eu.citrix.com> - 2015-11-03 17:30 +0100
  [PATCH v10 2/5] missing include in cputime.c, remove #ifdef CONFIG_PARAVIRT from sched/core.c Stefano Stabellini <stefano.stabellini@eu.citrix.com> - 2015-11-03 17:30 +0100
    Re: [PATCH v10 2/5] missing include in cputime.c, remove #ifdef  CONFIG_PARAVIRT from sched/core.c kbuild test robot <lkp@intel.com> - 2015-11-03 18:20 +0100
      Re: [PATCH v10 2/5] missing include in cputime.c, remove #ifdef  CONFIG_PARAVIRT from sched/core.c Stefano Stabellini <stefano.stabellini@eu.citrix.com> - 2015-11-03 19:00 +0100
    Re: [PATCH v10 2/5] missing include in cputime.c, remove #ifdef  CONFIG_PARAVIRT from sched/core.c kbuild test robot <lkp@intel.com> - 2015-11-03 19:30 +0100
  [PATCH v10 5/5] xen/arm: account for stolen ticks Stefano Stabellini <stefano.stabellini@eu.citrix.com> - 2015-11-03 17:30 +0100
  [PATCH v10 3/5] arm: introduce CONFIG_PARAVIRT, PARAVIRT_TIME_ACCOUNTING and pv_time_ops Stefano Stabellini <stefano.stabellini@eu.citrix.com> - 2015-11-03 17:30 +0100
  [PATCH v10 1/5] xen: move xen_setup_runstate_info and get_runstate_snapshot to drivers/xen/time.c Stefano Stabellini <stefano.stabellini@eu.citrix.com> - 2015-11-03 17:30 +0100

csiph-web