The patch titled revert x86_64-mm-i386-pda-init-pda has been removed from the -mm tree. Its filename is revert-x86_64-mm-i386-pda-init-pda.patch This patch was dropped because it is obsolete ------------------------------------------------------ Subject: revert x86_64-mm-i386-pda-init-pda From: Andrew Morton <akpm@xxxxxxxx> Cc: Jeremy Fitzhardinge <jeremy@xxxxxxxx> Cc: Andi Kleen <ak@xxxxxx> Cc: Chuck Ebbert <76306.1226@xxxxxxxxxxxxxx> Cc: Zachary Amsden <zach@xxxxxxxxxx> Cc: Jan Beulich <jbeulich@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- arch/i386/kernel/cpu/common.c | 167 ++++++++------------------------ arch/i386/kernel/head.S | 2 arch/i386/kernel/smpboot.c | 10 - include/asm-i386/processor.h | 1 4 files changed, 46 insertions(+), 134 deletions(-) diff -puN arch/i386/kernel/cpu/common.c~revert-x86_64-mm-i386-pda-init-pda arch/i386/kernel/cpu/common.c --- a/arch/i386/kernel/cpu/common.c~revert-x86_64-mm-i386-pda-init-pda +++ a/arch/i386/kernel/cpu/common.c @@ -18,7 +18,6 @@ #include <asm/apic.h> #include <mach_apic.h> #endif -#include <asm/pda.h> #include "cpu.h" @@ -28,9 +27,6 @@ EXPORT_PER_CPU_SYMBOL(cpu_gdt_descr); DEFINE_PER_CPU(unsigned char, cpu_16bit_stack[CPU_16BIT_STACK_SIZE]); EXPORT_PER_CPU_SYMBOL(cpu_16bit_stack); -struct i386_pda *_cpu_pda[NR_CPUS] __read_mostly; -EXPORT_SYMBOL(_cpu_pda); - static int cachesize_override __cpuinitdata = -1; static int disable_x86_fxsr __cpuinitdata; static int disable_x86_serial_nr __cpuinitdata = 1; @@ -586,124 +582,6 @@ void __init early_cpu_init(void) disable_pse = 1; #endif } - -/* GDT and PDA for boot cpu. - These are always on node 0. If the boot cpu isn't node 0 - it will get a remote GDT/PDA. - If it's a problem we could relocate later, but so far I don't see a real - need for that complexity. -AK */ -union { - struct desc_struct desc; - char pad[PAGE_SIZE]; -} boot_gdt __attribute__((section(".bss.page_aligned"))); -union { - struct i386_pda pda; - char pad[ALIGN(sizeof(struct i386_pda), SMP_CACHE_BYTES)]; -} boot_pda __cacheline_aligned_in_smp; - -__cpuinit int alloc_gdt(int cpu) -{ - struct Xgt_desc_struct *cpu_gdt_descr = &per_cpu(cpu_gdt_descr, cpu); - struct desc_struct *gdt; - struct i386_pda *pda; - static int first_cpu = 1; - - if (first_cpu) { - gdt = &boot_gdt.desc; - pda = &boot_pda.pda; - first_cpu = 0; - } else { - gdt = (struct desc_struct *)cpu_gdt_descr->address; - pda = cpu_pda(cpu); - - /* GDT and PDA might already have been allocated if - this is a CPU hotplug re-insertion. */ - if (gdt == NULL) - gdt = (struct desc_struct *)get_zeroed_page(GFP_KERNEL); - - if (pda == NULL) - pda = kmalloc_node(sizeof(*pda), GFP_KERNEL, cpu_to_node(cpu)); - - if (unlikely(!gdt || !pda)) { - free_pages((unsigned long)gdt, 0); - kfree(pda); - return 0; - } - } - - cpu_gdt_descr->address = (unsigned long)gdt; - cpu_pda(cpu) = pda; - - return 1; -} - -static __cpuinit void pda_init(int cpu, struct task_struct *curr) -{ - struct i386_pda *pda = cpu_pda(cpu); - - memset(pda, 0, sizeof(*pda)); - - pda->cpu_number = cpu; - pda->pcurrent = curr; -} - -/* Initialize the CPU's GDT and PDA */ -static __cpuinit void init_gdt(void) -{ - /* If that's not initialized you'll need to fix it up, James */ - int cpu = smp_processor_id(); - struct task_struct *curr = current; - struct Xgt_desc_struct *cpu_gdt_descr = &per_cpu(cpu_gdt_descr, cpu); - __u32 stk16_off = (__u32)&per_cpu(cpu_16bit_stack, cpu); - struct desc_struct *gdt; - struct i386_pda *pda; - - /* For non-boot CPUs, the GDT and PDA should already have been - allocated. */ - if (!alloc_gdt(cpu)) { - printk(KERN_CRIT "CPU%d failed to allocate GDT or PDA\n", cpu); - for (;;) - local_irq_enable(); - } - - gdt = (struct desc_struct *)cpu_gdt_descr->address; - pda = cpu_pda(cpu); - - BUG_ON(gdt == NULL || pda == NULL); - - /* - * Initialize the per-CPU GDT with the boot GDT, - * and set up the GDT descriptor: - */ - memcpy(gdt, cpu_gdt_table, GDT_SIZE); - cpu_gdt_descr->size = GDT_SIZE - 1; - - /* Set up GDT entry for 16bit stack */ - pack_descriptor((u32 *)&gdt[GDT_ENTRY_ESPFIX_SS].a, - (u32 *)&gdt[GDT_ENTRY_ESPFIX_SS].b, - (unsigned long)stk16_off, CPU_16BIT_STACK_SIZE - 1, - 0x92, 0); - - pack_descriptor((u32 *)&gdt[GDT_ENTRY_PDA].a, - (u32 *)&gdt[GDT_ENTRY_PDA].b, - (unsigned long)pda, sizeof(*pda) - 1, - 0x80 | DESCTYPE_S | 0x2, 0); /* present read-write data segment */ - - load_gdt(cpu_gdt_descr); - - /* Do this once everything GDT-related has been set up. */ - pda_init(cpu, curr); -} - -extern void start_kernel(void); - -void i386_start_kernel(void) -{ - /* Init the GDT and PDA for boot cpu early */ - init_gdt(); - start_kernel(); -} - /* * cpu_init() initializes state that is per-CPU. Some data is already * initialized (naturally) in the bootstrap process, such as the GDT @@ -715,12 +593,14 @@ void __cpuinit cpu_init(void) int cpu = smp_processor_id(); struct tss_struct * t = &per_cpu(init_tss, cpu); struct thread_struct *thread = ¤t->thread; + struct desc_struct *gdt; + __u32 stk16_off = (__u32)&per_cpu(cpu_16bit_stack, cpu); + struct Xgt_desc_struct *cpu_gdt_descr = &per_cpu(cpu_gdt_descr, cpu); if (cpu_test_and_set(cpu, cpu_initialized)) { printk(KERN_WARNING "CPU#%d already initialized!\n", cpu); for (;;) local_irq_enable(); } - printk(KERN_INFO "Initializing CPU#%d\n", cpu); if (cpu_has_vme || cpu_has_tsc || cpu_has_de) @@ -732,6 +612,47 @@ void __cpuinit cpu_init(void) set_in_cr4(X86_CR4_TSD); } + /* The CPU hotplug case */ + if (cpu_gdt_descr->address) { + gdt = (struct desc_struct *)cpu_gdt_descr->address; + memset(gdt, 0, PAGE_SIZE); + goto old_gdt; + } + /* + * This is a horrible hack to allocate the GDT. The problem + * is that cpu_init() is called really early for the boot CPU + * (and hence needs bootmem) but much later for the secondary + * CPUs, when bootmem will have gone away + */ + if (NODE_DATA(0)->bdata->node_bootmem_map) { + gdt = (struct desc_struct *)alloc_bootmem_pages(PAGE_SIZE); + /* alloc_bootmem_pages panics on failure, so no check */ + memset(gdt, 0, PAGE_SIZE); + } else { + gdt = (struct desc_struct *)get_zeroed_page(GFP_KERNEL); + if (unlikely(!gdt)) { + printk(KERN_CRIT "CPU%d failed to allocate GDT\n", cpu); + for (;;) + local_irq_enable(); + } + } +old_gdt: + /* + * Initialize the per-CPU GDT with the boot GDT, + * and set up the GDT descriptor: + */ + memcpy(gdt, cpu_gdt_table, GDT_SIZE); + + /* Set up GDT entry for 16bit stack */ + *(__u64 *)(&gdt[GDT_ENTRY_ESPFIX_SS]) |= + ((((__u64)stk16_off) << 16) & 0x000000ffffff0000ULL) | + ((((__u64)stk16_off) << 32) & 0xff00000000000000ULL) | + (CPU_16BIT_STACK_SIZE - 1); + + cpu_gdt_descr->size = GDT_SIZE - 1; + cpu_gdt_descr->address = (unsigned long)gdt; + + load_gdt(cpu_gdt_descr); load_idt(&idt_descr); /* diff -puN arch/i386/kernel/head.S~revert-x86_64-mm-i386-pda-init-pda arch/i386/kernel/head.S --- a/arch/i386/kernel/head.S~revert-x86_64-mm-i386-pda-init-pda +++ a/arch/i386/kernel/head.S @@ -324,7 +324,7 @@ is386: movl $2,%ecx # set MP cmpb $0,%cl # the first CPU calls start_kernel jne initialize_secondary # all other CPUs call initialize_secondary #endif /* CONFIG_SMP */ - jmp i386_start_kernel + jmp start_kernel /* * We depend on ET to be correct. This checks for 287/387. diff -puN arch/i386/kernel/smpboot.c~revert-x86_64-mm-i386-pda-init-pda arch/i386/kernel/smpboot.c --- a/arch/i386/kernel/smpboot.c~revert-x86_64-mm-i386-pda-init-pda +++ a/arch/i386/kernel/smpboot.c @@ -534,7 +534,7 @@ set_cpu_sibling_map(int cpu) static void __devinit start_secondary(void *unused) { /* - * Don't put *anything* before cpu_init(), SMP + * Dont put anything before smp_callin(), SMP * booting is too fragile that we want to limit the * things done here to the most necessary things. */ @@ -933,14 +933,6 @@ static int __devinit do_boot_cpu(int api unsigned long start_eip; unsigned short nmi_high = 0, nmi_low = 0; - /* Pre-allocate the CPU's GDT and PDA so it doesn't have to do - any memory allocation during the delicate CPU-bringup - phase. */ - if (!alloc_gdt(cpu)) { - printk(KERN_INFO "Couldn't allocate GDT/PDA for CPU %d\n", cpu); - return -1; /* ? */ - } - ++cpucount; alternatives_smp_switch(1); diff -puN include/asm-i386/processor.h~revert-x86_64-mm-i386-pda-init-pda include/asm-i386/processor.h --- a/include/asm-i386/processor.h~revert-x86_64-mm-i386-pda-init-pda +++ a/include/asm-i386/processor.h @@ -732,6 +732,5 @@ extern void select_idle_routine(const st extern unsigned long boot_option_idle_override; extern void enable_sep_cpu(void); extern int sysenter_setup(void); -extern int alloc_gdt(int cpu); #endif /* __ASM_I386_PROCESSOR_H */ _ Patches currently in -mm which might be from akpm@xxxxxxxx are origin.patch convert-i386-numa-kva-space-to-bootmem.patch reduce-max_nr_zones-make-display-of-highmem-counters-conditional-on-config_highmem.patch reduce-max_nr_zones-page-allocator-zone_highmem-cleanup.patch reduce-max_nr_zones-use-enum-to-define-zones-reformat-and-comment.patch reduce-max_nr_zones-remove-display-of-counters-for-unconfigured-zones.patch out-of-memory-notifier.patch mm-swap-write-failure-fixup.patch slab-optimize-kmalloc_node-the-same-way-as-kmalloc.patch slab-fix-lockdep-warnings.patch zone_reclaim-dynamic-slab-reclaim.patch binfmt_elf-consistently-use-loff_t.patch i386-adds-smp_call_function_single-fix.patch swsusp-write-timer.patch swsusp-write-speedup.patch swsusp-read-timer.patch swsusp-read-speedup.patch git-acpi.patch acpi-asus-s3-resume-fix.patch sony_apci-resume.patch kauditd_thread-warning-fix.patch git-block.patch git-block-fixup.patch git-block-hack.patch git-drm.patch git-dvb.patch git-dvb-fixup.patch git-geode-fixup.patch git-gfs2.patch git-ia64.patch git-ieee1394.patch git-input.patch git-intelfb-fixup.patch hdrcheck-permission-fix.patch mmc-driver-for-ti-flashmedia-card-reader-source.patch git-mtd-fixup.patch git-netdev-all.patch drivers-net-ns83820c-add-paramter-to-disable-auto.patch revert-allow-file-systems-to-manually-d_move-inside-of-rename.patch revert-genirq-core-fix-handle_level_irq.patch git-parisc-fixup.patch git-parisc-powerpc-fix.patch git-pcmcia-fixup.patch git-serial.patch git-serial-fixup.patch serial-fix-uart_bug_txen-test.patch pcie-check-and-return-bus_register-errors-fix.patch git-block-vs-git-sas.patch scsi-device_reprobe-can-fail.patch git-scsi-target-fixup.patch git-scsi-target-vs-git-block.patch gregkh-usb-usb-storage-add-rio-karma-eject-support-fix.patch fix-gregkh-usb-usbcore-add-autosuspend-autoresume-infrastructure.patch xpad-dance-pad-support-tidy.patch git-watchdog.patch revert-x86_64-mm-i386-remove-lock-section.patch fix-x86_64-mm-i386-pda-smp-processorid.patch fix-x86_64-mm-spinlock-cleanup.patch revert-x86_64-mm-i386-pda-init-pda.patch xfs-rename-uio_read.patch reduce-max_nr_zones-use-enum-to-define-zones-reformat-and-comment-fix.patch have-x86-use-add_active_range-and-free_area_init_nodes-fix.patch vm-add-per-zone-writeout-counter.patch convert-s390-page-handling-macros-to-functions-fix.patch slab-fix-kmalloc_node-applying-memory-policies-if-nodeid-==-numa_node_id-fix.patch gfp_thisnode-for-the-slab-allocator-v2-fix.patch get-rid-of-zone_table-fix.patch do_no_pfn-tweaks.patch shared-page-table-for-hugetlb-page-v2-tidy.patch radix-tree-rcu-lockless-readside.patch acx1xx-wireless-driver.patch tiacx-pci-build-fix.patch tiacx-ia64-fix.patch tiacx-build-fix.patch nommu-set-bdi-capabilities-for-dev-mem-and-dev-kmem-tidy.patch nommu-move-the-fallback-arch_vma_name-to-a-sensible-place-fix.patch convert-i386-summit-subarch-to-use-srat-info-for-apicid_to_node-calls-tidy.patch deprecate-smbfs-in-favour-of-cifs.patch edac-new-opteron-athlon64-memory-controller-driver-tidy.patch inode_diet-replace-inodeugeneric_ip-with-inodei_private-gfs-fix.patch inode-diet-eliminate-i_blksize-and-use-a-per-superblock-default-fix-fix.patch x86-microcode-microcode-driver-cleanup-tidy.patch x86-microcode-add-sysfs-and-hotplug-support-fix.patch eisa-bus-modalias-attributes-support-1-fix-git-kbuild-fix.patch add-address_space_operationsbatch_write-fix.patch alloc_fdtable-cleanup.patch sysctl-allow-proc-sys-without-sys_sysctl-fix.patch add-probe_kernel_address.patch x86-use-probe_kernel_address-in-handle_bug.patch blockdevc-check-errors.patch let-warn_on-warn_on_once-return-the-condition-fix.patch let-warn_on-warn_on_once-return-the-condition-fix-2.patch omap-add-watchdog-driver-support-tweaks.patch move-valid_dma_direction-from-x86_64-to-generic-code-fix.patch single-bit-flip-detector-tidy.patch fix-unserialized-task-files-changing-fix.patch tty-make-termios_sem-a-mutex-fix.patch solaris-emulation-incorrect-tty-locking-fix.patch solaris-emulation-incorrect-tty-locking-fix-2.patch cpuset-top_cpuset-tracks-hotplug-changes-to-node_online_map-fix.patch remove-sound-oss-copying.patch maximum-latency-tracking-infrastructure-tidy.patch fs-nameic-replace-multiple-current-fs-by-shortcut-variable-tidy.patch call-mm-page-writebackcset_ratelimit-when-new-pages-tidy.patch sys-modules-patch-allow-full-length-section-names.patch expand_fdtable-remove-pointless-unlocklock.patch add-config_headers_check-option-to-automatically-run-make-headers_check-nobble.patch submit-checklist-mention-headers_check.patch ntp-move-all-the-ntp-related-code-to-ntpc-fix.patch reiserfs-on-demand-bitmap-loading.patch streamline-generic_file_-interfaces-and-filemap-gfs-fix.patch add-vector-aio-support-fix.patch csa-basic-accounting-over-taskstats-fix.patch fs-cache-make-kafs-use-fs-cache-fix.patch fs-cache-make-kafs-use-fs-cache-vs-streamline-generic_file_-interfaces-and-filemap.patch nfs-use-local-caching-12-fix.patch stack-overflow-safe-kdump-crash_use_safe_smp_processor_id-fix.patch generic-ioremap_page_range-x86_64-conversion-fix.patch vfs-make-filldir_t-and-struct-kstat-deal-in-64-bit-inode-numbers-alpha-fix.patch some-cleanup-in-the-pipe-code-tidy.patch support-piping-into-commands-in-proc-sys-kernel-core_pattern-fix.patch move-pidmap-to-pspaceh-fix.patch kprobes-handle-symbol-resolution-when-modulesymbol-is-specified-tidy.patch isdn-work-around-excessive-udelay.patch knfsd-add-a-callback-for-when-last-rpc-thread-finishes-tidy.patch knfsd-add-a-callback-for-when-last-rpc-thread-finishes-fix.patch knfsd-separate-out-some-parts-of-nfsd_svc-which-start-nfs-servers-tweaks.patch knfsd-define-new-nfsdfs-file-portlist-contains-list-of-ports-tidy.patch knfsd-define-new-nfsdfs-file-portlist-contains-list-of-ports-fix.patch knfsd-drop-serv-option-to-svc_recv-and-svc_process-nfs-callback-fix-nfs-callback-fix.patch knfsd-move-tempsock-aging-to-a-timer-tidy.patch sched-remove-unnecessary-sched-group-allocations-fix.patch swap_prefetch-vs-zoned-counters.patch ecryptfs-mmap-operations.patch ecryptfs-alpha-build-fix.patch ecryptfs-more-elegant-aes-key-size-manipulation.patch ecryptfs-get_sb_dev-fix.patch make-kmem_cache_destroy-return-void-ecryptfs.patch ecryptfs-versioning-fixes-tidy.patch namespaces-add-nsproxy.patch namespaces-utsname-switch-to-using-uts-namespaces.patch namespaces-utsname-switch-to-using-uts-namespaces-klibc-bit-sparc.patch namespaces-utsname-use-init_utsname-when-appropriate.patch namespaces-utsname-implement-utsname-namespaces.patch namespaces-utsname-sysctl-hack.patch ipc-namespace-core.patch rename-the-provided-execve-functions-to-kernel_execve-headers-fix.patch replace-cad_pid-by-a-struct-pid-fixes.patch readahead-sysctl-parameters-fix.patch make-copy_from_user_inatomic-not-zero-the-tail-on-i386-vs-reiser4.patch make-kmem_cache_destroy-return-void-reiser4.patch reiser4-hardirq-include-fix.patch reiser4-run-truncate_inode_pages-in-reiser4_delete_inode.patch reiser4-get_sb_dev-fix.patch reiser4-vs-zoned-allocator.patch reiser4-rename-generic_sounding_globalspatch-fix.patch hpt3xx-rework-rate-filtering-tidy.patch genirq-convert-the-i386-architecture-to-irq-chips.patch genirq-x86_64-irq-reenable-migrating-irqs-to-other-cpus.patch genirq-msi-simplify-msi-enable-and-disable.patch genirq-ia64-irq-dynamic-irq-support.patch genirq-msi-only-build-msi-apicc-on-ia64-fix.patch genirq-i386-irq-remove-the-msi-assumption-that-irq-==-vector.patch genirq-x86_64-irq-make-vector_irq-per-cpu-fix.patch genirq-x86_64-irq-make-vector_irq-per-cpu-warning-fix.patch add-hypertransport-capability-defines-fix.patch initial-generic-hypertransport-interrupt-support-Kconfig-fix.patch srcu-report-out-of-memory-errors-fixlet.patch isdn-debug-build-fix.patch isdn-more-pr_debug-fixes.patch nr_blockdev_pages-in_interrupt-warning.patch device-suspend-debug.patch slab-leaks3-default-y.patch x86-kmap_atomic-debugging.patch restore-rogue-readahead-printk.patch put_bh-debug.patch acpi_format_exception-debug.patch jmicron-warning-fix.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html