direct-io.hg

changeset 15090:204046d99562

[IA64] Fix time_resume()

Add missing exclusion in time_resume() and steal time accounting
reinitialization after resume.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author Alex Williamson <alex.williamson@hp.com>
date Thu May 03 14:21:39 2007 -0600 (2007-05-03)
parents a141484a91d0
children 367d9ab41d80
files linux-2.6-xen-sparse/arch/ia64/kernel/time.c linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/ia64/kernel/time.c	Thu May 03 14:14:41 2007 -0600
     1.2 +++ b/linux-2.6-xen-sparse/arch/ia64/kernel/time.c	Thu May 03 14:21:39 2007 -0600
     1.3 @@ -267,6 +267,62 @@ static void init_missing_ticks_accountin
     1.4  	per_cpu(processed_stolen_time, cpu) = runstate->time[RUNSTATE_runnable]
     1.5  					    + runstate->time[RUNSTATE_offline];
     1.6  }
     1.7 +
     1.8 +static int xen_ia64_settimefoday_after_resume;
     1.9 +
    1.10 +static int __init __xen_ia64_settimeofday_after_resume(char *str)
    1.11 +{
    1.12 +	xen_ia64_settimefoday_after_resume = 1;
    1.13 +	return 1;
    1.14 +}
    1.15 +
    1.16 +__setup("xen_ia64_settimefoday_after_resume",
    1.17 +	 __xen_ia64_settimeofday_after_resume);
    1.18 +
    1.19 +/* Called after suspend, to resume time.  */
    1.20 +void
    1.21 +time_resume(void)
    1.22 +{
    1.23 +	unsigned int cpu;
    1.24 +	
    1.25 +	/* Just trigger a tick.  */
    1.26 +	ia64_cpu_local_tick();
    1.27 +
    1.28 +	if (xen_ia64_settimefoday_after_resume) {
    1.29 +		/* do_settimeofday() resets timer interplator */
    1.30 +		struct timespec xen_time;
    1.31 +		int ret;
    1.32 +		efi_gettimeofday(&xen_time);
    1.33 +
    1.34 +		ret = do_settimeofday(&xen_time);
    1.35 +		WARN_ON(ret);
    1.36 +	} else {
    1.37 +#if 0
    1.38 +		/* adjust EFI time */
    1.39 +		struct timespec my_time = CURRENT_TIME;
    1.40 +		struct timespec xen_time;
    1.41 +		static timespec diff;
    1.42 +		struct xen_domctl domctl;
    1.43 +		int ret;
    1.44 +
    1.45 +		efi_gettimeofday(&xen_time);
    1.46 +		diff = timespec_sub(&xen_time, &my_time);
    1.47 +		domctl.cmd = XEN_DOMCTL_settimeoffset;
    1.48 +		domctl.domain = DOMID_SELF;
    1.49 +		domctl.u.settimeoffset.timeoffset_seconds = diff.tv_sec;
    1.50 +		ret = HYPERVISOR_domctl_op(&domctl);
    1.51 +		WARN_ON(ret);
    1.52 +#endif
    1.53 +		/* Time interpolator remembers the last timer status.
    1.54 +		   Forget it */
    1.55 +		write_seqlock_irq(&xtime_lock);
    1.56 +		time_interpolator_reset();
    1.57 +		write_sequnlock_irq(&xtime_lock);
    1.58 +	}
    1.59 +
    1.60 +	for_each_online_cpu(cpu)
    1.61 +		init_missing_ticks_accounting(cpu);
    1.62 +}
    1.63  #else
    1.64  #define init_missing_ticks_accounting(cpu) do {} while (0)
    1.65  #endif
     2.1 --- a/linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c	Thu May 03 14:14:41 2007 -0600
     2.2 +++ b/linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c	Thu May 03 14:21:39 2007 -0600
     2.3 @@ -863,19 +863,6 @@ direct_remap_pfn_range(struct vm_area_st
     2.4  }
     2.5  
     2.6  
     2.7 -/* Called after suspend, to resume time.  */
     2.8 -void
     2.9 -time_resume(void)
    2.10 -{
    2.11 -	extern void ia64_cpu_local_tick(void);
    2.12 -
    2.13 -	/* Just trigger a tick.  */
    2.14 -	ia64_cpu_local_tick();
    2.15 -
    2.16 -	/* Time interpolator remembers the last timer status.  Forget it */
    2.17 -	time_interpolator_reset();
    2.18 -}
    2.19 -
    2.20  ///////////////////////////////////////////////////////////////////////////
    2.21  // expose p2m table
    2.22  #ifdef CONFIG_XEN_IA64_EXPOSE_P2M