From 3848f1b9faaa08ee7a08f8df94abe45c4177bd6e Mon Sep 17 00:00:00 2001 From: Hideo Saito Date: Sun, 24 May 2009 15:33:34 +0000 Subject: [PATCH] --- yaml --- r: 145257 b: refs/heads/master c: 8e35961b57da14cb64cb0e4e1b7e3aabda6396fe h: refs/heads/master i: 145255: 9c042ff2345c3afbfae3da2b42b79b4e2bb35e99 v: v3 --- [refs] | 2 +- trunk/Documentation/kernel-parameters.txt | 4 --- trunk/arch/powerpc/mm/mmu_context_nohash.c | 6 ++--- 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/kvm/x86.c | 6 +---- trunk/arch/x86/mm/pageattr.c | 12 +++------ trunk/drivers/base/power/main.c | 4 --- trunk/drivers/md/bitmap.c | 13 +++++---- trunk/drivers/md/md.c | 31 +++++++--------------- trunk/drivers/md/raid5.c | 6 ++--- 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 ++++- 19 files changed, 82 insertions(+), 106 deletions(-) diff --git a/[refs] b/[refs] index 788cf47706fe..926a1a239101 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: e25e0920b5f0f2d46d16f14f7f51ccbfd0773671 +refs/heads/master: 8e35961b57da14cb64cb0e4e1b7e3aabda6396fe 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/powerpc/mm/mmu_context_nohash.c b/trunk/arch/powerpc/mm/mmu_context_nohash.c index a70e311bd457..030d0005b4d2 100644 --- a/trunk/arch/powerpc/mm/mmu_context_nohash.c +++ b/trunk/arch/powerpc/mm/mmu_context_nohash.c @@ -127,12 +127,12 @@ static unsigned int steal_context_up(unsigned int id) pr_debug("[%d] steal context %d from mm @%p\n", cpu, id, mm); - /* Mark this mm has having no context anymore */ - mm->context.id = MMU_NO_CONTEXT; - /* Flush the TLB for that context */ local_flush_tlb_mm(mm); + /* Mark this mm has having no context anymore */ + mm->context.id = MMU_NO_CONTEXT; + /* XXX This clear should ultimately be part of local_flush_tlb_mm */ __clear_bit(id, stale_map[cpu]); 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 32cf11e5728a..b6caf1329b1b 100644 --- a/trunk/arch/x86/kvm/mmu.c +++ b/trunk/arch/x86/kvm/mmu.c @@ -2897,7 +2897,8 @@ static int kvm_pv_mmu_write(struct kvm_vcpu *vcpu, static int kvm_pv_mmu_flush_tlb(struct kvm_vcpu *vcpu) { - kvm_set_cr3(vcpu, vcpu->arch.cr3); + kvm_x86_ops->tlb_flush(vcpu); + set_bit(KVM_REQ_MMU_SYNC, &vcpu->requests); return 1; } diff --git a/trunk/arch/x86/kvm/x86.c b/trunk/arch/x86/kvm/x86.c index 3944e917e794..49079a46687b 100644 --- a/trunk/arch/x86/kvm/x86.c +++ b/trunk/arch/x86/kvm/x86.c @@ -338,9 +338,6 @@ EXPORT_SYMBOL_GPL(kvm_lmsw); void kvm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) { - unsigned long old_cr4 = vcpu->arch.cr4; - unsigned long pdptr_bits = X86_CR4_PGE | X86_CR4_PSE | X86_CR4_PAE; - if (cr4 & CR4_RESERVED_BITS) { printk(KERN_DEBUG "set_cr4: #GP, reserved bits\n"); kvm_inject_gp(vcpu, 0); @@ -354,8 +351,7 @@ void kvm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) kvm_inject_gp(vcpu, 0); return; } - } else if (is_paging(vcpu) && (cr4 & X86_CR4_PAE) - && ((cr4 ^ old_cr4) & pdptr_bits) + } else if (is_paging(vcpu) && !is_pae(vcpu) && (cr4 & X86_CR4_PAE) && !load_pdptrs(vcpu, vcpu->arch.cr3)) { printk(KERN_DEBUG "set_cr4: #GP, pdptrs reserved bits\n"); kvm_inject_gp(vcpu, 0); 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/drivers/md/bitmap.c b/trunk/drivers/md/bitmap.c index 56df1cee8fb3..47c68bc75a17 100644 --- a/trunk/drivers/md/bitmap.c +++ b/trunk/drivers/md/bitmap.c @@ -1097,12 +1097,14 @@ void bitmap_daemon_work(struct bitmap *bitmap) } bitmap->allclean = 1; - spin_lock_irqsave(&bitmap->lock, flags); for (j = 0; j < bitmap->chunks; j++) { bitmap_counter_t *bmc; - if (!bitmap->filemap) + spin_lock_irqsave(&bitmap->lock, flags); + if (!bitmap->filemap) { /* error or shutdown */ + spin_unlock_irqrestore(&bitmap->lock, flags); break; + } page = filemap_get_page(bitmap, j); @@ -1119,8 +1121,6 @@ void bitmap_daemon_work(struct bitmap *bitmap) write_page(bitmap, page, 0); bitmap->allclean = 0; } - spin_lock_irqsave(&bitmap->lock, flags); - j |= (PAGE_BITS - 1); continue; } @@ -1181,10 +1181,9 @@ void bitmap_daemon_work(struct bitmap *bitmap) ext2_clear_bit(file_page_offset(j), paddr); kunmap_atomic(paddr, KM_USER0); } - } else - j |= PAGE_COUNTER_MASK; + } + spin_unlock_irqrestore(&bitmap->lock, flags); } - spin_unlock_irqrestore(&bitmap->lock, flags); /* now sync the final page */ if (lastpage != NULL) { diff --git a/trunk/drivers/md/md.c b/trunk/drivers/md/md.c index 641b211fe3fe..fccc8343a250 100644 --- a/trunk/drivers/md/md.c +++ b/trunk/drivers/md/md.c @@ -1375,9 +1375,6 @@ static void super_1_sync(mddev_t *mddev, mdk_rdev_t *rdev) sb->raid_disks = cpu_to_le32(mddev->raid_disks); sb->size = cpu_to_le64(mddev->dev_sectors); - sb->chunksize = cpu_to_le32(mddev->chunk_size >> 9); - sb->level = cpu_to_le32(mddev->level); - sb->layout = cpu_to_le32(mddev->layout); if (mddev->bitmap && mddev->bitmap_file == NULL) { sb->bitmap_offset = cpu_to_le32((__u32)mddev->bitmap_offset); @@ -3306,9 +3303,7 @@ static ssize_t action_show(mddev_t *mddev, char *page) { char *type = "idle"; - if (test_bit(MD_RECOVERY_FROZEN, &mddev->recovery)) - type = "frozen"; - else if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery) || + if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery) || (!mddev->ro && test_bit(MD_RECOVERY_NEEDED, &mddev->recovery))) { if (test_bit(MD_RECOVERY_RESHAPE, &mddev->recovery)) type = "reshape"; @@ -3331,12 +3326,7 @@ action_store(mddev_t *mddev, const char *page, size_t len) if (!mddev->pers || !mddev->pers->sync_request) return -EINVAL; - if (cmd_match(page, "frozen")) - set_bit(MD_RECOVERY_FROZEN, &mddev->recovery); - else - clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); - - if (cmd_match(page, "idle") || cmd_match(page, "frozen")) { + if (cmd_match(page, "idle")) { if (mddev->sync_thread) { set_bit(MD_RECOVERY_INTR, &mddev->recovery); md_unregister_thread(mddev->sync_thread); @@ -3690,7 +3680,7 @@ array_size_store(mddev_t *mddev, const char *buf, size_t len) if (strict_blocks_to_sectors(buf, §ors) < 0) return -EINVAL; if (mddev->pers && mddev->pers->size(mddev, 0, 0) < sectors) - return -E2BIG; + return -EINVAL; mddev->external_size = 1; } @@ -5567,7 +5557,7 @@ static struct block_device_operations md_fops = .owner = THIS_MODULE, .open = md_open, .release = md_release, - .ioctl = md_ioctl, + .locked_ioctl = md_ioctl, .getgeo = md_getgeo, .media_changed = md_media_changed, .revalidate_disk= md_revalidate, @@ -6362,13 +6352,12 @@ void md_do_sync(mddev_t *mddev) skipped = 0; - if (!test_bit(MD_RECOVERY_RESHAPE, &mddev->recovery) && - ((mddev->curr_resync > mddev->curr_resync_completed && - (mddev->curr_resync - mddev->curr_resync_completed) - > (max_sectors >> 4)) || - (j - mddev->curr_resync_completed)*2 - >= mddev->resync_max - mddev->curr_resync_completed - )) { + if ((mddev->curr_resync > mddev->curr_resync_completed && + (mddev->curr_resync - mddev->curr_resync_completed) + > (max_sectors >> 4)) || + (j - mddev->curr_resync_completed)*2 + >= mddev->resync_max - mddev->curr_resync_completed + ) { /* time to update curr_resync_completed */ blk_unplug(mddev->queue); wait_event(mddev->recovery_wait, diff --git a/trunk/drivers/md/raid5.c b/trunk/drivers/md/raid5.c index 3c3626d2a1f9..4616bc3a6e71 100644 --- a/trunk/drivers/md/raid5.c +++ b/trunk/drivers/md/raid5.c @@ -3811,13 +3811,13 @@ static sector_t reshape_request(mddev_t *mddev, sector_t sector_nr, int *skipped safepos = conf->reshape_safe; sector_div(safepos, data_disks); if (mddev->delta_disks < 0) { - writepos -= min(reshape_sectors, writepos); + writepos -= reshape_sectors; readpos += reshape_sectors; safepos += reshape_sectors; } else { writepos += reshape_sectors; - readpos -= min(reshape_sectors, readpos); - safepos -= min(reshape_sectors, safepos); + readpos -= reshape_sectors; + safepos -= reshape_sectors; } /* 'writepos' is the most advanced device address we might write. 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; }