From e3abb4d49a33a9438f7a3afbd28e67c9239a8409 Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Sun, 24 May 2009 22:15:25 +0300 Subject: [PATCH] --- yaml --- r: 145246 b: refs/heads/master c: a8cd0244e9cebcf9b358d24c7e7410062f3665cb h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/Documentation/kernel-parameters.txt | 4 ---- trunk/arch/x86/boot/memory.c | 29 +++++++++++++---------- trunk/arch/x86/kernel/cpu/common.c | 7 ------ trunk/arch/x86/kernel/reboot.c | 8 ------- trunk/arch/x86/kernel/setup_percpu.c | 4 +--- trunk/arch/x86/kvm/mmu.c | 3 +-- trunk/arch/x86/mm/pageattr.c | 12 +++------- trunk/drivers/base/power/main.c | 4 ---- trunk/init/main.c | 3 ++- trunk/kernel/async.c | 20 +++++++--------- trunk/kernel/kexec.c | 2 ++ trunk/kernel/power/disk.c | 21 +++++++++++++--- trunk/kernel/power/main.c | 7 +++++- 14 files changed, 58 insertions(+), 68 deletions(-) diff --git a/[refs] b/[refs] index 97ee560128c1..204d6fb36526 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: a0c1af135a93ee25b07cbc61762fb957fd2f3733 +refs/heads/master: a8cd0244e9cebcf9b358d24c7e7410062f3665cb diff --git a/trunk/Documentation/kernel-parameters.txt b/trunk/Documentation/kernel-parameters.txt index fd5cac013037..e87bdbfbcc75 100644 --- a/trunk/Documentation/kernel-parameters.txt +++ b/trunk/Documentation/kernel-parameters.txt @@ -1535,10 +1535,6 @@ and is between 256 and 4096 characters. It is defined in the file register save and restore. The kernel will only save legacy floating-point registers on task switch. - noxsave [BUGS=X86] Disables x86 extended register state save - and restore using xsave. The kernel will fallback to - enabling legacy floating-point and sse state. - nohlt [BUGS=ARM,SH] Tells the kernel that the sleep(SH) or wfi(ARM) instruction doesn't work correctly and not to use it. This is also useful when using JTAG debugger. diff --git a/trunk/arch/x86/boot/memory.c b/trunk/arch/x86/boot/memory.c index 74b3d2ba84e9..5054c2ddd1a0 100644 --- a/trunk/arch/x86/boot/memory.c +++ b/trunk/arch/x86/boot/memory.c @@ -17,6 +17,11 @@ #define SMAP 0x534d4150 /* ASCII "SMAP" */ +struct e820_ext_entry { + struct e820entry std; + u32 ext_flags; +} __attribute__((packed)); + static int detect_memory_e820(void) { int count = 0; @@ -24,21 +29,13 @@ static int detect_memory_e820(void) u32 size, id, edi; u8 err; struct e820entry *desc = boot_params.e820_map; - static struct e820entry buf; /* static so it is zeroed */ + static struct e820_ext_entry buf; /* static so it is zeroed */ /* - * Note: at least one BIOS is known which assumes that the - * buffer pointed to by one e820 call is the same one as - * the previous call, and only changes modified fields. Therefore, - * we use a temporary buffer and copy the results entry by entry. - * - * This routine deliberately does not try to account for - * ACPI 3+ extended attributes. This is because there are - * BIOSes in the field which report zero for the valid bit for - * all ranges, and we don't currently make any use of the - * other attribute bits. Revisit this if we see the extended - * attribute bits deployed in a meaningful way in the future. + * Set this here so that if the BIOS doesn't change this field + * but still doesn't change %ecx, we're still okay... */ + buf.ext_flags = 1; do { size = sizeof buf; @@ -69,7 +66,13 @@ static int detect_memory_e820(void) break; } - *desc++ = buf; + /* ACPI 3.0 added the extended flags support. If bit 0 + in the extended flags is zero, we're supposed to simply + ignore the entry -- a backwards incompatible change! */ + if (size > 20 && !(buf.ext_flags & 1)) + continue; + + *desc++ = buf.std; count++; } while (next && count < ARRAY_SIZE(boot_params.e820_map)); diff --git a/trunk/arch/x86/kernel/cpu/common.c b/trunk/arch/x86/kernel/cpu/common.c index 77848d9fca68..c1caefc82e62 100644 --- a/trunk/arch/x86/kernel/cpu/common.c +++ b/trunk/arch/x86/kernel/cpu/common.c @@ -114,13 +114,6 @@ DEFINE_PER_CPU_PAGE_ALIGNED(struct gdt_page, gdt_page) = { .gdt = { } }; EXPORT_PER_CPU_SYMBOL_GPL(gdt_page); -static int __init x86_xsave_setup(char *s) -{ - setup_clear_cpu_cap(X86_FEATURE_XSAVE); - return 1; -} -__setup("noxsave", x86_xsave_setup); - #ifdef CONFIG_X86_32 static int cachesize_override __cpuinitdata = -1; static int disable_x86_serial_nr __cpuinitdata = 1; diff --git a/trunk/arch/x86/kernel/reboot.c b/trunk/arch/x86/kernel/reboot.c index 667188e0b5a0..1340dad417f4 100644 --- a/trunk/arch/x86/kernel/reboot.c +++ b/trunk/arch/x86/kernel/reboot.c @@ -232,14 +232,6 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "Dell DXP061"), }, }, - { /* Handle problems with rebooting on Sony VGN-Z540N */ - .callback = set_bios_reboot, - .ident = "Sony VGN-Z540N", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), - DMI_MATCH(DMI_PRODUCT_NAME, "VGN-Z540N"), - }, - }, { } }; diff --git a/trunk/arch/x86/kernel/setup_percpu.c b/trunk/arch/x86/kernel/setup_percpu.c index 8f0e13be36b3..3a97a4cf1872 100644 --- a/trunk/arch/x86/kernel/setup_percpu.c +++ b/trunk/arch/x86/kernel/setup_percpu.c @@ -160,10 +160,8 @@ static ssize_t __init setup_pcpu_remap(size_t static_size) /* * If large page isn't supported, there's no benefit in doing * this. Also, on non-NUMA, embedding is better. - * - * NOTE: disabled for now. */ - if (true || !cpu_has_pse || !pcpu_need_numa()) + if (!cpu_has_pse || !pcpu_need_numa()) return -EINVAL; /* diff --git a/trunk/arch/x86/kvm/mmu.c b/trunk/arch/x86/kvm/mmu.c index b6caf1329b1b..32cf11e5728a 100644 --- a/trunk/arch/x86/kvm/mmu.c +++ b/trunk/arch/x86/kvm/mmu.c @@ -2897,8 +2897,7 @@ static int kvm_pv_mmu_write(struct kvm_vcpu *vcpu, static int kvm_pv_mmu_flush_tlb(struct kvm_vcpu *vcpu) { - kvm_x86_ops->tlb_flush(vcpu); - set_bit(KVM_REQ_MMU_SYNC, &vcpu->requests); + kvm_set_cr3(vcpu, vcpu->arch.cr3); return 1; } diff --git a/trunk/arch/x86/mm/pageattr.c b/trunk/arch/x86/mm/pageattr.c index 0f9052bcec4b..797f9f107cb6 100644 --- a/trunk/arch/x86/mm/pageattr.c +++ b/trunk/arch/x86/mm/pageattr.c @@ -153,7 +153,7 @@ static void __cpa_flush_all(void *arg) */ __flush_tlb_all(); - if (cache && boot_cpu_data.x86 >= 4) + if (cache && boot_cpu_data.x86_model >= 4) wbinvd(); } @@ -204,11 +204,6 @@ static void cpa_flush_range(unsigned long start, int numpages, int cache) } } -static void wbinvd_local(void *unused) -{ - wbinvd(); -} - static void cpa_flush_array(unsigned long *start, int numpages, int cache, int in_flags, struct page **pages) { @@ -223,9 +218,8 @@ static void cpa_flush_array(unsigned long *start, int numpages, int cache, /* 4M threshold */ if (numpages >= 1024) { - if (boot_cpu_data.x86 >= 4) - on_each_cpu(wbinvd_local, NULL, 1); - + if (boot_cpu_data.x86_model >= 4) + wbinvd(); return; } /* diff --git a/trunk/drivers/base/power/main.c b/trunk/drivers/base/power/main.c index 3e4bc699bc0f..69b4ddb7de3b 100644 --- a/trunk/drivers/base/power/main.c +++ b/trunk/drivers/base/power/main.c @@ -357,7 +357,6 @@ static void dpm_power_up(pm_message_t state) { struct device *dev; - mutex_lock(&dpm_list_mtx); list_for_each_entry(dev, &dpm_list, power.entry) if (dev->power.status > DPM_OFF) { int error; @@ -367,7 +366,6 @@ static void dpm_power_up(pm_message_t state) if (error) pm_dev_err(dev, state, " early", error); } - mutex_unlock(&dpm_list_mtx); } /** @@ -616,7 +614,6 @@ int device_power_down(pm_message_t state) int error = 0; suspend_device_irqs(); - mutex_lock(&dpm_list_mtx); list_for_each_entry_reverse(dev, &dpm_list, power.entry) { error = suspend_device_noirq(dev, state); if (error) { @@ -625,7 +622,6 @@ int device_power_down(pm_message_t state) } dev->power.status = DPM_OFF_IRQ; } - mutex_unlock(&dpm_list_mtx); if (error) device_power_up(resume_event(state)); return error; diff --git a/trunk/init/main.c b/trunk/init/main.c index d721dad05dd7..3bbf93be744c 100644 --- a/trunk/init/main.c +++ b/trunk/init/main.c @@ -566,7 +566,8 @@ asmlinkage void __init start_kernel(void) tick_init(); boot_cpu_init(); page_address_init(); - printk(KERN_NOTICE "%s", linux_banner); + printk(KERN_NOTICE); + printk(linux_banner); setup_arch(&command_line); mm_init_owner(&init_mm, &init_task); setup_command_line(command_line); diff --git a/trunk/kernel/async.c b/trunk/kernel/async.c index 50540301ed0f..968ef9457d4e 100644 --- a/trunk/kernel/async.c +++ b/trunk/kernel/async.c @@ -92,23 +92,19 @@ extern int initcall_debug; static async_cookie_t __lowest_in_progress(struct list_head *running) { struct async_entry *entry; - async_cookie_t ret = next_cookie; /* begin with "infinity" value */ - if (!list_empty(running)) { entry = list_first_entry(running, struct async_entry, list); - ret = entry->cookie; - } - - if (!list_empty(&async_pending)) { - list_for_each_entry(entry, &async_pending, list) - if (entry->running == running) { - ret = entry->cookie; - break; - } + return entry->cookie; + } else if (!list_empty(&async_pending)) { + entry = list_first_entry(&async_pending, + struct async_entry, list); + return entry->cookie; + } else { + /* nothing in progress... next_cookie is "infinity" */ + return next_cookie; } - return ret; } static async_cookie_t lowest_in_progress(struct list_head *running) diff --git a/trunk/kernel/kexec.c b/trunk/kernel/kexec.c index e4983770913b..5a758c6e4950 100644 --- a/trunk/kernel/kexec.c +++ b/trunk/kernel/kexec.c @@ -1451,6 +1451,7 @@ int kernel_kexec(void) error = device_suspend(PMSG_FREEZE); if (error) goto Resume_console; + device_pm_lock(); /* At this point, device_suspend() has been called, * but *not* device_power_down(). We *must* * device_power_down() now. Otherwise, drivers for @@ -1488,6 +1489,7 @@ int kernel_kexec(void) enable_nonboot_cpus(); device_power_up(PMSG_RESTORE); Resume_devices: + device_pm_unlock(); device_resume(PMSG_RESTORE); Resume_console: resume_console(); diff --git a/trunk/kernel/power/disk.c b/trunk/kernel/power/disk.c index 5cb080e7eebd..b0dc9e7a0d17 100644 --- a/trunk/kernel/power/disk.c +++ b/trunk/kernel/power/disk.c @@ -215,6 +215,8 @@ static int create_image(int platform_mode) if (error) return error; + device_pm_lock(); + /* At this point, device_suspend() has been called, but *not* * device_power_down(). We *must* call device_power_down() now. * Otherwise, drivers for some devices (e.g. interrupt controllers) @@ -225,7 +227,7 @@ static int create_image(int platform_mode) if (error) { printk(KERN_ERR "PM: Some devices failed to power down, " "aborting hibernation\n"); - return error; + goto Unlock; } error = platform_pre_snapshot(platform_mode); @@ -278,6 +280,9 @@ static int create_image(int platform_mode) device_power_up(in_suspend ? (error ? PMSG_RECOVER : PMSG_THAW) : PMSG_RESTORE); + Unlock: + device_pm_unlock(); + return error; } @@ -339,11 +344,13 @@ static int resume_target_kernel(bool platform_mode) { int error; + device_pm_lock(); + error = device_power_down(PMSG_QUIESCE); if (error) { printk(KERN_ERR "PM: Some devices failed to power down, " "aborting resume\n"); - return error; + goto Unlock; } error = platform_pre_restore(platform_mode); @@ -396,6 +403,9 @@ static int resume_target_kernel(bool platform_mode) device_power_up(PMSG_RECOVER); + Unlock: + device_pm_unlock(); + return error; } @@ -454,9 +464,11 @@ int hibernation_platform_enter(void) goto Resume_devices; } + device_pm_lock(); + error = device_power_down(PMSG_HIBERNATE); if (error) - goto Resume_devices; + goto Unlock; error = hibernation_ops->prepare(); if (error) @@ -481,6 +493,9 @@ int hibernation_platform_enter(void) device_power_up(PMSG_RESTORE); + Unlock: + device_pm_unlock(); + Resume_devices: entering_platform_hibernation = false; device_resume(PMSG_RESTORE); diff --git a/trunk/kernel/power/main.c b/trunk/kernel/power/main.c index 868028280d13..f99ed6a75eac 100644 --- a/trunk/kernel/power/main.c +++ b/trunk/kernel/power/main.c @@ -289,10 +289,12 @@ static int suspend_enter(suspend_state_t state) { int error; + device_pm_lock(); + if (suspend_ops->prepare) { error = suspend_ops->prepare(); if (error) - return error; + goto Done; } error = device_power_down(PMSG_SUSPEND); @@ -341,6 +343,9 @@ static int suspend_enter(suspend_state_t state) if (suspend_ops->finish) suspend_ops->finish(); + Done: + device_pm_unlock(); + return error; }