ia64/xen-unstable

changeset 14296:4e367aa89895

[IA64] Steal time accounting for PV domain - hypervisor side

Signed-off-by: Atsushi SAKAI <sakaia@jp.fujitsu.com>
author awilliam@xenbuild2.aw
date Wed Mar 07 13:16:07 2007 -0700 (2007-03-07)
parents 9f8e996a678d
children 9fbaf07d3f67
files xen/arch/ia64/linux-xen/entry.S xen/arch/ia64/xen/domain.c xen/include/asm-ia64/hypercall.h
line diff
     1.1 --- a/xen/arch/ia64/linux-xen/entry.S	Wed Mar 07 12:45:08 2007 -0700
     1.2 +++ b/xen/arch/ia64/linux-xen/entry.S	Wed Mar 07 13:16:07 2007 -0700
     1.3 @@ -1509,7 +1509,7 @@ ia64_hypercall_table:
     1.4  	data8 do_ni_hypercall		/* do_vm_assist */
     1.5  	data8 do_ni_hypercall		/* do_update_va_mapping_othe */
     1.6  	data8 do_ni_hypercall		/* (x86 only) */
     1.7 -	data8 do_ni_hypercall		/* do_vcpu_op */
     1.8 +	data8 do_vcpu_op		/* do_vcpu_op */
     1.9  	data8 do_ni_hypercall		/* (x86_64 only) */    /* 25 */
    1.10  	data8 do_ni_hypercall		/* do_mmuext_op */
    1.11  	data8 do_ni_hypercall		/* do_acm_op */
     2.1 --- a/xen/arch/ia64/xen/domain.c	Wed Mar 07 12:45:08 2007 -0700
     2.2 +++ b/xen/arch/ia64/xen/domain.c	Wed Mar 07 13:16:07 2007 -0700
     2.3 @@ -50,6 +50,7 @@
     2.4  #include <xen/guest_access.h>
     2.5  #include <asm/tlb_track.h>
     2.6  #include <asm/perfmon.h>
     2.7 +#include <public/vcpu.h>
     2.8  
     2.9  unsigned long dom0_size = 512*1024*1024;
    2.10  
    2.11 @@ -262,6 +263,9 @@ void context_switch(struct vcpu *prev, s
    2.12                  vcpu_info[current->vcpu_id].evtchn_upcall_mask;
    2.13              __ia64_per_cpu_var(current_psr_ic_addr) =
    2.14                  (int *)(nd->arch.shared_info_va + XSI_PSR_IC_OFS);
    2.15 +            /* steal time accounting */
    2.16 +            if (!guest_handle_is_null(runstate_guest(current)))
    2.17 +                __copy_to_guest(runstate_guest(current), &current->runstate, 1);
    2.18          } else {
    2.19              /* When switching to idle domain, only need to disable vhpt
    2.20               * walker. Then all accesses happen within idle context will
    2.21 @@ -1257,6 +1261,45 @@ void sync_vcpu_execstate(struct vcpu *v)
    2.22  	// FIXME SMP: Anything else needed here for SMP?
    2.23  }
    2.24  
    2.25 +/* This function is taken from xen/arch/x86/domain.c */
    2.26 +long
    2.27 +arch_do_vcpu_op(int cmd, struct vcpu *v, XEN_GUEST_HANDLE(void) arg)
    2.28 +{
    2.29 +	long rc = 0;
    2.30 +
    2.31 +	switch (cmd) {
    2.32 +	case VCPUOP_register_runstate_memory_area:
    2.33 +	{
    2.34 +		struct vcpu_register_runstate_memory_area area;
    2.35 +		struct vcpu_runstate_info runstate;
    2.36 +
    2.37 +		rc = -EFAULT;
    2.38 +		if (copy_from_guest(&area, arg, 1))
    2.39 +			break;
    2.40 +
    2.41 +		if (!guest_handle_okay(area.addr.h, 1))
    2.42 +			break;
    2.43 +
    2.44 +		rc = 0;
    2.45 +		runstate_guest(v) = area.addr.h;
    2.46 +
    2.47 +		if (v == current) {
    2.48 +			__copy_to_guest(runstate_guest(v), &v->runstate, 1);
    2.49 +		} else {
    2.50 +			vcpu_runstate_get(v, &runstate);
    2.51 +			__copy_to_guest(runstate_guest(v), &runstate, 1);
    2.52 +		}
    2.53 +
    2.54 +		break;
    2.55 +	}
    2.56 +	default:
    2.57 +		rc = -ENOSYS;
    2.58 +		break;
    2.59 +	}
    2.60 +
    2.61 +	return rc;
    2.62 +}
    2.63 +
    2.64  static void parse_dom0_mem(char *s)
    2.65  {
    2.66  	dom0_size = parse_size_and_unit(s, NULL);
     3.1 --- a/xen/include/asm-ia64/hypercall.h	Wed Mar 07 12:45:08 2007 -0700
     3.2 +++ b/xen/include/asm-ia64/hypercall.h	Wed Mar 07 13:16:07 2007 -0700
     3.3 @@ -22,6 +22,7 @@ vmx_do_mmu_update(
     3.4      u64 *pdone,
     3.5      u64 foreigndom);
     3.6  
     3.7 -#define arch_do_vcpu_op(cmd, vcpu, arg) (-ENOSYS)
     3.8 +extern long
     3.9 +arch_do_vcpu_op(int cmd, struct vcpu *v, XEN_GUEST_HANDLE(void) arg);
    3.10  
    3.11  #endif /* __ASM_IA64_HYPERCALL_H__ */