|
|
|
|
|
|
|
|
|
|
xen-ia64-devel
[Xen-ia64-devel] [PATCH 10/15] ia64/pv_ops/xen/pv_time_ops: implement sc
paravirtualize sched_clock.
Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
---
arch/ia64/xen/time.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 48 insertions(+), 0 deletions(-)
diff --git a/arch/ia64/xen/time.c b/arch/ia64/xen/time.c
index 68d6204..fb83326 100644
--- a/arch/ia64/xen/time.c
+++ b/arch/ia64/xen/time.c
@@ -175,10 +175,58 @@ static void xen_itc_jitter_data_reset(void)
} while (unlikely(ret != lcycle));
}
+/* based on xen_sched_clock() in arch/x86/xen/time.c. */
+/*
+ * This relies on HAVE_UNSTABLE_SCHED_CLOCK. If it can't be defined,
+ * something similar logic should be implemented here.
+ */
+/*
+ * Xen sched_clock implementation. Returns the number of unstolen
+ * nanoseconds, which is nanoseconds the VCPU spent in RUNNING+BLOCKED
+ * states.
+ */
+static unsigned long long xen_sched_clock(void)
+{
+ struct vcpu_runstate_info runstate;
+
+ unsigned long long now;
+ unsigned long long offset;
+ unsigned long long ret;
+
+ /*
+ * Ideally sched_clock should be called on a per-cpu basis
+ * anyway, so preempt should already be disabled, but that's
+ * not current practice at the moment.
+ */
+ preempt_disable();
+
+ /*
+ * both ia64_native_sched_clock() and xen's runstate are
+ * based on mAR.ITC. So difference of them makes sense.
+ */
+ now = ia64_native_sched_clock();
+
+ get_runstate_snapshot(&runstate);
+
+ WARN_ON(runstate.state != RUNSTATE_running);
+
+ offset = 0;
+ if (now > runstate.state_entry_time)
+ offset = now - runstate.state_entry_time;
+ ret = runstate.time[RUNSTATE_blocked] +
+ runstate.time[RUNSTATE_running] +
+ offset;
+
+ preempt_enable();
+
+ return ret;
+}
+
struct pv_time_ops xen_time_ops __initdata = {
.init_missing_ticks_accounting = xen_init_missing_ticks_accounting,
.do_steal_accounting = xen_do_steal_accounting,
.clocksource_resume = xen_itc_jitter_data_reset,
+ .sched_clock = xen_sched_clock,
};
/* Called after suspend, to resume time. */
--
1.6.0.2
_______________________________________________
Xen-ia64-devel mailing list
Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ia64-devel
|
<Prev in Thread] |
Current Thread |
[Next in Thread>
|
- [Xen-ia64-devel] [PATCH 00/15] ia64/pv_ops, xen: more paravirtualization. TAKE 5, Isaku Yamahata
- [Xen-ia64-devel] [PATCH 06/15] ia64/pv_ops/pvchecker: support mov = ar.itc paravirtualization, Isaku Yamahata
- [Xen-ia64-devel] [PATCH 14/15] ia64/pv_ops: paravirtualize gate.S., Isaku Yamahata
- [Xen-ia64-devel] [PATCH 07/15] ia64/pv_ops: paravirtualize mov = ar.itc., Isaku Yamahata
- [Xen-ia64-devel] [PATCH 13/15] ia64/pv_ops: move down __kernel_syscall_via_epc., Isaku Yamahata
- [Xen-ia64-devel] [PATCH 15/15] ia64/pv_ops/xen/gate.S: xen gate page paravirtualization, Isaku Yamahata
- [Xen-ia64-devel] [PATCH 01/15] ia64/pv_ops/xen: use __initconst instead of __initdata for const data, Isaku Yamahata
- [Xen-ia64-devel] [PATCH 08/15] ia64/pv_ops/xen: paravirtualize read/write ar.itc and ar.itm, Isaku Yamahata
- [Xen-ia64-devel] [PATCH 02/15] ia64/xen: short-circuit tests for dom0, Isaku Yamahata
- [Xen-ia64-devel] [PATCH 04/15] ia64/pv_ops/xen: preliminary to paravirtualizing fsys.S for xen., Isaku Yamahata
- [Xen-ia64-devel] [PATCH 10/15] ia64/pv_ops/xen/pv_time_ops: implement sched_clock.,
Isaku Yamahata <=
- [Xen-ia64-devel] [PATCH 09/15] ia64/pv_ops/pv_time_ops: add sched_clock hook., Isaku Yamahata
- [Xen-ia64-devel] [PATCH 05/15] ia64/pv_ops: paravirtualize fsys.S., Isaku Yamahata
- [Xen-ia64-devel] [PATCH 03/15] ia64/pv_ops: add hooks to paravirtualize fsyscall implementation., Isaku Yamahata
- [Xen-ia64-devel] [PATCH 12/15] ia64/pv_ops/xen: define xen specific gate page., Isaku Yamahata
- [Xen-ia64-devel] [PATCH 11/15] ia64/pv_ops: gate page paravirtualization., Isaku Yamahata
|
|
|
|
|