direct-io.hg

changeset 15173:88e41a91301c

Correct 32on64 handling of VCPUOP_register_runstate_memory_area. We
were copying too many bytes from the guest so the test for
area.addr.h.c != area.addr.p was failing.

Added a WARN_ON to the kernel to catch this case. It would be a BUG_ON
but this would break the new kernel on older hypervisors and the only
real problem is that stolen time is not updated, which we can live
with.

Signed-off-by: Ian Campbell <ian.campbell@xensource.com>
author Ian Campbell <ian.campbell@xensource.com>
date Fri May 25 15:28:52 2007 +0100 (2007-05-25)
parents f2d2d5f18543
children a00d55b15327
files linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c linux-2.6-xen-sparse/arch/ia64/kernel/time.c xen/arch/x86/x86_64/domain.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c	Fri May 25 13:41:01 2007 +0100
     1.2 +++ b/linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c	Fri May 25 15:28:52 2007 +0100
     1.3 @@ -732,11 +732,13 @@ static void init_missing_ticks_accountin
     1.4  {
     1.5  	struct vcpu_register_runstate_memory_area area;
     1.6  	struct vcpu_runstate_info *runstate = &per_cpu(runstate, cpu);
     1.7 +	int rc;
     1.8  
     1.9  	memset(runstate, 0, sizeof(*runstate));
    1.10  
    1.11  	area.addr.v = runstate;
    1.12 -	HYPERVISOR_vcpu_op(VCPUOP_register_runstate_memory_area, cpu, &area);
    1.13 +	rc = HYPERVISOR_vcpu_op(VCPUOP_register_runstate_memory_area, cpu, &area);
    1.14 +	WARN_ON(rc && rc != -ENOSYS);
    1.15  
    1.16  	per_cpu(processed_blocked_time, cpu) =
    1.17  		runstate->time[RUNSTATE_blocked];
     2.1 --- a/linux-2.6-xen-sparse/arch/ia64/kernel/time.c	Fri May 25 13:41:01 2007 +0100
     2.2 +++ b/linux-2.6-xen-sparse/arch/ia64/kernel/time.c	Fri May 25 15:28:52 2007 +0100
     2.3 @@ -257,11 +257,13 @@ static void init_missing_ticks_accountin
     2.4  {
     2.5  	struct vcpu_register_runstate_memory_area area;
     2.6  	struct vcpu_runstate_info *runstate = &per_cpu(runstate, cpu);
     2.7 +	int rc;
     2.8  
     2.9  	memset(runstate, 0, sizeof(*runstate));
    2.10  
    2.11  	area.addr.v = runstate;
    2.12 -	HYPERVISOR_vcpu_op(VCPUOP_register_runstate_memory_area, cpu, &area);
    2.13 +	rc = HYPERVISOR_vcpu_op(VCPUOP_register_runstate_memory_area, cpu, &area);
    2.14 +	WARN_ON(rc && rc != -ENOSYS);
    2.15  
    2.16  	per_cpu(processed_blocked_time, cpu) = runstate->time[RUNSTATE_blocked];
    2.17  	per_cpu(processed_stolen_time, cpu) = runstate->time[RUNSTATE_runnable]
     3.1 --- a/xen/arch/x86/x86_64/domain.c	Fri May 25 13:41:01 2007 +0100
     3.2 +++ b/xen/arch/x86/x86_64/domain.c	Fri May 25 15:28:52 2007 +0100
     3.3 @@ -22,8 +22,10 @@ arch_compat_vcpu_op(
     3.4          struct compat_vcpu_register_runstate_memory_area area;
     3.5          struct compat_vcpu_runstate_info info;
     3.6  
     3.7 +        area.addr.p = 0;
     3.8 +
     3.9          rc = -EFAULT;
    3.10 -        if ( copy_from_guest(&area, arg, 1) )
    3.11 +        if ( copy_from_guest(&area.addr.h, arg, 1) )
    3.12              break;
    3.13  
    3.14          if ( area.addr.h.c != area.addr.p ||