[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-4.1-testing] Introduce system_state variable.
# HG changeset patch # User Keir Fraser <keir@xxxxxxx> # Date 1332511265 0 # Node ID d67e4d12723f26bd12a787f998718d535ca07098 # Parent 35e2f18e04b6fc3e6a55e1ad4ba9080044083f6a Introduce system_state variable. Use it to replace x86-specific early_boot boolean variable. Also use it to detect suspend/resume case during cpu offline/online to avoid unnecessarily breaking vcpu and cpupool affinities. Signed-off-by: Keir Fraser <keir@xxxxxxx> Acked-by: Juergen Gross <juergen.gross@xxxxxxxxxxxxxx> xen-unstable changeset: 25079:d5ccb2d1dbd1 xen-unstable date: Thu Mar 22 12:20:13 2012 +0000 Backport requested by Juergen to fix crash on poweroff when using cpupools. --- diff -r 35e2f18e04b6 -r d67e4d12723f xen/arch/x86/acpi/power.c --- a/xen/arch/x86/acpi/power.c Fri Mar 23 13:58:22 2012 +0000 +++ b/xen/arch/x86/acpi/power.c Fri Mar 23 14:01:05 2012 +0000 @@ -135,6 +135,9 @@ if ( !spin_trylock(&pm_lock) ) return -EBUSY; + BUG_ON(system_state != SYS_STATE_active); + system_state = SYS_STATE_suspend; + printk(XENLOG_INFO "Preparing system for ACPI S%d state.\n", state); freeze_domains(); @@ -142,7 +145,10 @@ acpi_dmar_reinstate(); if ( (error = disable_nonboot_cpus()) ) + { + system_state = SYS_STATE_resume; goto enable_cpu; + } cpufreq_del_cpu(0); @@ -159,6 +165,7 @@ if ( (error = device_power_down()) ) { printk(XENLOG_ERR "Some devices failed to power down."); + system_state = SYS_STATE_resume; goto done; } @@ -179,6 +186,8 @@ break; } + system_state = SYS_STATE_resume; + /* Restore CR4 and EFER from cached values. */ cr4 = read_cr4(); write_cr4(cr4 & ~X86_CR4_MCE); @@ -212,6 +221,7 @@ mtrr_aps_sync_end(); acpi_dmar_zap(); thaw_domains(); + system_state = SYS_STATE_active; spin_unlock(&pm_lock); return error; } diff -r 35e2f18e04b6 -r d67e4d12723f xen/arch/x86/mm.c --- a/xen/arch/x86/mm.c Fri Mar 23 13:58:22 2012 +0000 +++ b/xen/arch/x86/mm.c Fri Mar 23 14:01:05 2012 +0000 @@ -5123,7 +5123,7 @@ void free_xen_pagetable(void *v) { - if ( early_boot ) + if ( system_state == SYS_STATE_early_boot ) return; if ( is_xen_heap_page(virt_to_page(v)) ) diff -r 35e2f18e04b6 -r d67e4d12723f xen/arch/x86/setup.c --- a/xen/arch/x86/setup.c Fri Mar 23 13:58:22 2012 +0000 +++ b/xen/arch/x86/setup.c Fri Mar 23 14:01:05 2012 +0000 @@ -87,8 +87,6 @@ s8 __read_mostly xen_cpuidle = -1; boolean_param("cpuidle", xen_cpuidle); -bool_t __read_mostly early_boot = 1; - cpumask_t __read_mostly cpu_present_map; unsigned long __read_mostly xen_phys_start; @@ -275,7 +273,7 @@ void *ret; #ifdef __x86_64__ - if ( !early_boot ) + if ( system_state != SYS_STATE_early_boot ) return mod ? mfn_to_virt(mod->mod_start) : NULL; #endif @@ -1142,7 +1140,7 @@ #endif end_boot_allocator(); - early_boot = 0; + system_state = SYS_STATE_boot; #if defined(CONFIG_X86_64) vesa_init(); @@ -1341,6 +1339,8 @@ /* Hide UART from DOM0 if we're using it */ serial_endboot(); + system_state = SYS_STATE_active; + domain_unpause_by_systemcontroller(dom0); reset_stack_and_jump(init_done); diff -r 35e2f18e04b6 -r d67e4d12723f xen/arch/x86/x86_32/mm.c --- a/xen/arch/x86/x86_32/mm.c Fri Mar 23 13:58:22 2012 +0000 +++ b/xen/arch/x86/x86_32/mm.c Fri Mar 23 14:01:05 2012 +0000 @@ -45,7 +45,7 @@ { unsigned long mfn; - if ( !early_boot ) + if ( system_state != SYS_STATE_early_boot ) { void *v = alloc_xenheap_page(); diff -r 35e2f18e04b6 -r d67e4d12723f xen/arch/x86/x86_64/mm.c --- a/xen/arch/x86/x86_64/mm.c Fri Mar 23 13:58:22 2012 +0000 +++ b/xen/arch/x86/x86_64/mm.c Fri Mar 23 14:01:05 2012 +0000 @@ -81,7 +81,7 @@ { unsigned long mfn; - if ( !early_boot ) + if ( system_state != SYS_STATE_early_boot ) { struct page_info *pg = alloc_domheap_page(NULL, 0); diff -r 35e2f18e04b6 -r d67e4d12723f xen/common/cpupool.c --- a/xen/common/cpupool.c Fri Mar 23 13:58:22 2012 +0000 +++ b/xen/common/cpupool.c Fri Mar 23 14:01:05 2012 +0000 @@ -616,6 +616,10 @@ unsigned int cpu = (unsigned long)hcpu; int rc = 0; + if ( (system_state == SYS_STATE_suspend) || + (system_state == SYS_STATE_resume) ) + goto out; + switch ( action ) { case CPU_DOWN_FAILED: @@ -629,6 +633,7 @@ break; } +out: return !rc ? NOTIFY_DONE : notifier_from_errno(rc); } diff -r 35e2f18e04b6 -r d67e4d12723f xen/common/kernel.c --- a/xen/common/kernel.c Fri Mar 23 13:58:22 2012 +0000 +++ b/xen/common/kernel.c Fri Mar 23 14:01:05 2012 +0000 @@ -22,6 +22,8 @@ #ifndef COMPAT +enum system_state system_state = SYS_STATE_early_boot; + int tainted; xen_commandline_t saved_cmdline; diff -r 35e2f18e04b6 -r d67e4d12723f xen/common/schedule.c --- a/xen/common/schedule.c Fri Mar 23 13:58:22 2012 +0000 +++ b/xen/common/schedule.c Fri Mar 23 14:01:05 2012 +0000 @@ -546,7 +546,7 @@ bool_t affinity_broken; c = per_cpu(cpupool, cpu); - if ( c == NULL ) + if ( (c == NULL) || (system_state == SYS_STATE_suspend) ) return ret; for_each_domain ( d ) diff -r 35e2f18e04b6 -r d67e4d12723f xen/include/asm-x86/setup.h --- a/xen/include/asm-x86/setup.h Fri Mar 23 13:58:22 2012 +0000 +++ b/xen/include/asm-x86/setup.h Fri Mar 23 14:01:05 2012 +0000 @@ -3,7 +3,6 @@ #include <xen/multiboot.h> -extern bool_t early_boot; extern unsigned long xenheap_initial_phys_start; void init_done(void); diff -r 35e2f18e04b6 -r d67e4d12723f xen/include/xen/kernel.h --- a/xen/include/xen/kernel.h Fri Mar 23 13:58:22 2012 +0000 +++ b/xen/include/xen/kernel.h Fri Mar 23 14:01:05 2012 +0000 @@ -81,5 +81,13 @@ (__p >= _sinittext) && (__p <= _einittext); \ }) +extern enum system_state { + SYS_STATE_early_boot, + SYS_STATE_boot, + SYS_STATE_active, + SYS_STATE_suspend, + SYS_STATE_resume +} system_state; + #endif /* _LINUX_KERNEL_H */ _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |