The patch titled revert x86_64-mm-i386-pda-use-gs has been removed from the -mm tree. Its filename is revert-x86_64-mm-i386-pda-use-gs.patch This patch was dropped because it was merged into mainline or a subsystem tree ------------------------------------------------------ Subject: revert x86_64-mm-i386-pda-use-gs From: Andrew Morton <akpm@xxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- arch/i386/kernel/asm-offsets.c | 9 ---- arch/i386/kernel/cpu/common.c | 21 +--------- arch/i386/kernel/entry.S | 61 +++++++++++-------------------- arch/i386/kernel/head.S | 31 ++------------- arch/i386/kernel/process.c | 27 +++++++------ arch/i386/kernel/signal.c | 6 ++- include/asm-i386/mmu_context.h | 4 +- include/asm-i386/processor.h | 4 -- include/asm-i386/ptrace.h | 2 - kernel/fork.c | 2 - 10 files changed, 50 insertions(+), 117 deletions(-) diff -puN arch/i386/kernel/asm-offsets.c~revert-x86_64-mm-i386-pda-use-gs arch/i386/kernel/asm-offsets.c --- a/arch/i386/kernel/asm-offsets.c~revert-x86_64-mm-i386-pda-use-gs +++ a/arch/i386/kernel/asm-offsets.c @@ -80,15 +80,6 @@ void foo(void) OFFSET(RT_SIGFRAME_sigcontext, rt_sigframe, uc.uc_mcontext); BLANK(); - OFFSET(PT_EAX, pt_regs, eax); - OFFSET(PT_DS, pt_regs, xds); - OFFSET(PT_ES, pt_regs, xes); - OFFSET(PT_GS, pt_regs, xgs); - OFFSET(PT_ORIG_EAX, pt_regs, orig_eax); - OFFSET(PT_EIP, pt_regs, eip); - OFFSET(PT_CS, pt_regs, xcs); - BLANK(); - OFFSET(pbe_address, pbe, address); OFFSET(pbe_orig_address, pbe, orig_address); OFFSET(pbe_next, pbe, next); diff -puN arch/i386/kernel/cpu/common.c~revert-x86_64-mm-i386-pda-use-gs arch/i386/kernel/cpu/common.c --- a/arch/i386/kernel/cpu/common.c~revert-x86_64-mm-i386-pda-use-gs +++ a/arch/i386/kernel/cpu/common.c @@ -587,14 +587,6 @@ void __init early_cpu_init(void) #endif } -/* Make sure %gs is initialized properly in idle threads */ -struct pt_regs * __devinit idle_regs(struct pt_regs *regs) -{ - memset(regs, 0, sizeof(struct pt_regs)); - regs->xgs = __KERNEL_PDA; - return regs; -} - __cpuinit int alloc_gdt(int cpu) { struct Xgt_desc_struct *cpu_gdt_descr = &per_cpu(cpu_gdt_descr, cpu); @@ -648,14 +640,6 @@ struct i386_pda boot_pda = { .pcurrent = &init_task, }; -static inline void set_kernel_gs(void) -{ - /* Set %gs for this CPU's PDA. Memory clobber is to create a - barrier with respect to any PDA operations, so the compiler - doesn't move any before here. */ - asm volatile ("mov %0, %%gs" : : "r" (__KERNEL_PDA) : "memory"); -} - /* Initialize the CPU's GDT and PDA. The boot CPU does this for itself, but secondaries find this done for them. */ __cpuinit int init_gdt(int cpu, struct task_struct *idle) @@ -714,7 +698,6 @@ static void __cpuinit _cpu_init(int cpu, the boot CPU, this will transition from the boot gdt+pda to the real ones). */ load_gdt(cpu_gdt_descr); - set_kernel_gs(); if (cpu_test_and_set(cpu, cpu_initialized)) { printk(KERN_WARNING "CPU#%d already initialized!\n", cpu); @@ -753,8 +736,8 @@ static void __cpuinit _cpu_init(int cpu, __set_tss_desc(cpu, GDT_ENTRY_DOUBLEFAULT_TSS, &doublefault_tss); #endif - /* Clear %fs. */ - asm volatile ("mov %0, %%fs" : : "r" (0)); + /* Clear %fs and %gs. */ + asm volatile ("movl %0, %%fs; movl %0, %%gs" : : "r" (0)); /* Clear all 6 debug registers: */ set_debugreg(0, 0); diff -puN arch/i386/kernel/entry.S~revert-x86_64-mm-i386-pda-use-gs arch/i386/kernel/entry.S --- a/arch/i386/kernel/entry.S~revert-x86_64-mm-i386-pda-use-gs +++ a/arch/i386/kernel/entry.S @@ -30,13 +30,12 @@ * 18(%esp) - %eax * 1C(%esp) - %ds * 20(%esp) - %es - * 24(%esp) - %gs - * 28(%esp) - orig_eax - * 2C(%esp) - %eip - * 30(%esp) - %cs - * 34(%esp) - %eflags - * 38(%esp) - %oldesp - * 3C(%esp) - %oldss + * 24(%esp) - orig_eax + * 28(%esp) - %eip + * 2C(%esp) - %cs + * 30(%esp) - %eflags + * 34(%esp) - %oldesp + * 38(%esp) - %oldss * * "current" is in register %ebx during any slow entries. */ @@ -92,9 +91,6 @@ VM_MASK = 0x00020000 #define SAVE_ALL \ cld; \ - pushl %gs; \ - CFI_ADJUST_CFA_OFFSET 4;\ - /*CFI_REL_OFFSET gs, 0;*/\ pushl %es; \ CFI_ADJUST_CFA_OFFSET 4;\ /*CFI_REL_OFFSET es, 0;*/\ @@ -124,9 +120,7 @@ VM_MASK = 0x00020000 CFI_REL_OFFSET ebx, 0;\ movl $(__USER_DS), %edx; \ movl %edx, %ds; \ - movl %edx, %es; \ - movl $(__KERNEL_PDA), %edx; \ - movl %edx, %gs + movl %edx, %es; #define RESTORE_INT_REGS \ popl %ebx; \ @@ -159,22 +153,17 @@ VM_MASK = 0x00020000 2: popl %es; \ CFI_ADJUST_CFA_OFFSET -4;\ /*CFI_RESTORE es;*/\ -3: popl %gs; \ - CFI_ADJUST_CFA_OFFSET -4;\ - /*CFI_RESTORE gs;*/\ -.pushsection .fixup,"ax"; \ -4: movl $0,(%esp); \ +.section .fixup,"ax"; \ +3: movl $0,(%esp); \ jmp 1b; \ -5: movl $0,(%esp); \ +4: movl $0,(%esp); \ jmp 2b; \ -6: movl $0,(%esp); \ - jmp 3b; \ +.previous; \ .section __ex_table,"a";\ .align 4; \ - .long 1b,4b; \ - .long 2b,5b; \ - .long 3b,6b; \ -.popsection + .long 1b,3b; \ + .long 2b,4b; \ +.previous #define RING0_INT_FRAME \ CFI_STARTPROC simple;\ @@ -336,17 +325,10 @@ sysenter_past_esp: movl PT_EIP(%esp), %edx movl PT_OLDESP(%esp), %ecx xorl %ebp,%ebp -1: mov PT_GS(%esp), %gs TRACE_IRQS_ON ENABLE_INTERRUPTS_SYSEXIT CFI_ENDPROC -.pushsection .fixup,"ax" -2: movl $0,PT_GS(%esp) - jmp 1b -.section __ex_table,"a" - .align 4 - .long 1b,2b -.popsection + # system call handler stub ENTRY(system_call) @@ -392,7 +374,7 @@ restore_nocheck: TRACE_IRQS_IRET restore_nocheck_notrace: RESTORE_REGS - addl $4, %esp # skip orig_eax/error_code + addl $4, %esp CFI_ADJUST_CFA_OFFSET -4 1: INTERRUPT_RETURN .section .fixup,"ax" @@ -534,12 +516,14 @@ syscall_badsys: /* put ESP to the proper location */ \ movl %eax, %esp; #define UNWIND_ESPFIX_STACK \ + pushl %eax; \ CFI_ADJUST_CFA_OFFSET 4; \ movl %ss, %eax; \ /* see if on 16bit stack */ \ - cmp $__ESPFIX_SS, %eax; \ + cmpw $__ESPFIX_SS, %ax; \ je 28f; \ -27: CFI_ADJUST_CFA_OFFSET -4; \ +27: popl %eax; \ + CFI_ADJUST_CFA_OFFSET -4; \ .section .fixup,"ax"; \ 28: movl $__KERNEL_DS, %eax; \ movl %eax, %ds; \ @@ -608,15 +592,13 @@ KPROBE_ENTRY(page_fault) CFI_ADJUST_CFA_OFFSET 4 ALIGN error_code: - /* the function address is in %gs's slot on the stack */ - pushl %es - CFI_ADJUST_CFA_OFFSET 4 pushl %ds CFI_ADJUST_CFA_OFFSET 4 /*CFI_REL_OFFSET ds, 0*/ pushl %eax CFI_ADJUST_CFA_OFFSET 4 CFI_REL_OFFSET eax, 0 + xorl %eax, %eax pushl %ebp CFI_ADJUST_CFA_OFFSET 4 CFI_REL_OFFSET ebp, 0 @@ -629,6 +611,7 @@ error_code: pushl %edx CFI_ADJUST_CFA_OFFSET 4 CFI_REL_OFFSET edx, 0 + decl %eax # eax = -1 pushl %ecx CFI_ADJUST_CFA_OFFSET 4 CFI_REL_OFFSET ecx, 0 diff -puN arch/i386/kernel/head.S~revert-x86_64-mm-i386-pda-use-gs arch/i386/kernel/head.S --- a/arch/i386/kernel/head.S~revert-x86_64-mm-i386-pda-use-gs +++ a/arch/i386/kernel/head.S @@ -302,7 +302,6 @@ is386: movl $2,%ecx # set MP movl %eax,%cr0 call check_x87 - call setup_pda lgdt cpu_gdt_descr lidt idt_descr ljmp $(__KERNEL_CS),$1f @@ -313,13 +312,10 @@ is386: movl $2,%ecx # set MP movl %eax,%ds movl %eax,%es - xorl %eax,%eax # Clear FS and LDT + xorl %eax,%eax # Clear FS/GS and LDT movl %eax,%fs + movl %eax,%gs lldt %ax - - movl $(__KERNEL_PDA),%eax - mov %eax,%gs - cld # gcc2 wants the direction flag cleared at all times pushl %eax # fake return address #ifdef CONFIG_SMP @@ -350,23 +346,6 @@ check_x87: ret /* - * Point the GDT at this CPU's PDA. On boot this will be - * cpu_gdt_table and boot_pda; for secondary CPUs, these will be - * that CPU's GDT and PDA. - */ -setup_pda: - /* get the PDA pointer */ - movl start_pda, %eax - - /* slot the PDA address into the GDT */ - mov cpu_gdt_descr+2, %ecx - mov %ax, (__KERNEL_PDA+0+2)(%ecx) /* base & 0x0000ffff */ - shr $16, %eax - mov %al, (__KERNEL_PDA+4+0)(%ecx) /* base & 0x00ff0000 */ - mov %ah, (__KERNEL_PDA+4+3)(%ecx) /* base & 0xff000000 */ - ret - -/* * setup_idt * * sets up a idt with 256 entries pointing to @@ -505,8 +484,6 @@ ENTRY(empty_zero_page) * This starts the data section. */ .data -ENTRY(start_pda) - .long boot_pda ENTRY(stack_start) .long init_thread_union+THREAD_SIZE @@ -548,7 +525,7 @@ idt_descr: # boot GDT descriptor (later on used by CPU#0): .word 0 # 32 bit align gdt_desc.address -ENTRY(cpu_gdt_descr) +cpu_gdt_descr: .word GDT_ENTRIES*8-1 .long cpu_gdt_table @@ -608,7 +585,7 @@ ENTRY(cpu_gdt_table) .quad 0x004092000000ffff /* 0xc8 APM DS data */ .quad 0x0000920000000000 /* 0xd0 - ESPFIX 16-bit SS */ - .quad 0x00cf92000000ffff /* 0xd8 - PDA */ + .quad 0x0000000000000000 /* 0xd8 - PDA */ .quad 0x0000000000000000 /* 0xe0 - unused */ .quad 0x0000000000000000 /* 0xe8 - unused */ .quad 0x0000000000000000 /* 0xf0 - unused */ diff -puN arch/i386/kernel/process.c~revert-x86_64-mm-i386-pda-use-gs arch/i386/kernel/process.c --- a/arch/i386/kernel/process.c~revert-x86_64-mm-i386-pda-use-gs +++ a/arch/i386/kernel/process.c @@ -56,7 +56,6 @@ #include <asm/tlbflush.h> #include <asm/cpu.h> -#include <asm/pda.h> asmlinkage void ret_from_fork(void) __asm__("ret_from_fork"); @@ -345,7 +344,6 @@ int kernel_thread(int (*fn)(void *), voi regs.xds = __USER_DS; regs.xes = __USER_DS; - regs.xgs = __KERNEL_PDA; regs.orig_eax = -1; regs.eip = (unsigned long) kernel_thread_helper; regs.xcs = __KERNEL_CS | get_kernel_rpl(); @@ -431,6 +429,7 @@ int copy_thread(int nr, unsigned long cl p->thread.eip = (unsigned long) ret_from_fork; savesegment(fs,p->thread.fs); + savesegment(gs,p->thread.gs); tsk = current; if (unlikely(test_tsk_thread_flag(tsk, TIF_IO_BITMAP))) { @@ -653,16 +652,16 @@ struct task_struct fastcall * __switch_t load_esp0(tss, next); /* - * Save away %fs. No need to save %gs, as it was saved on the - * stack on entry. No need to save %es and %ds, as those are - * always kernel segments while inside the kernel. Doing this - * before setting the new TLS descriptors avoids the situation - * where we temporarily have non-reloadable segments in %fs - * and %gs. This could be an issue if the NMI handler ever - * used %fs or %gs (it does not today), or if the kernel is - * running inside of a hypervisor layer. + * Save away %fs and %gs. No need to save %es and %ds, as + * those are always kernel segments while inside the kernel. + * Doing this before setting the new TLS descriptors avoids + * the situation where we temporarily have non-reloadable + * segments in %fs and %gs. This could be an issue if the + * NMI handler ever used %fs or %gs (it does not today), or + * if the kernel is running inside of a hypervisor layer. */ savesegment(fs, prev->fs); + savesegment(gs, prev->gs); /* * Load the per-thread Thread-Local Storage descriptor. @@ -670,14 +669,16 @@ struct task_struct fastcall * __switch_t load_TLS(next, cpu); /* - * Restore %fs if needed. + * Restore %fs and %gs if needed. * - * Glibc normally makes %fs be zero. + * Glibc normally makes %fs be zero, and %gs is one of + * the TLS segments. */ if (unlikely(prev->fs | next->fs)) loadsegment(fs, next->fs); - write_pda(pcurrent, next_p); + if (prev->gs | next->gs) + loadsegment(gs, next->gs); /* * Restore IOPL if needed. diff -puN arch/i386/kernel/signal.c~revert-x86_64-mm-i386-pda-use-gs arch/i386/kernel/signal.c --- a/arch/i386/kernel/signal.c~revert-x86_64-mm-i386-pda-use-gs +++ a/arch/i386/kernel/signal.c @@ -128,7 +128,7 @@ restore_sigcontext(struct pt_regs *regs, X86_EFLAGS_TF | X86_EFLAGS_SF | X86_EFLAGS_ZF | \ X86_EFLAGS_AF | X86_EFLAGS_PF | X86_EFLAGS_CF) - COPY_SEG(gs); + GET_SEG(gs); GET_SEG(fs); COPY_SEG(es); COPY_SEG(ds); @@ -244,7 +244,9 @@ setup_sigcontext(struct sigcontext __use { int tmp, err = 0; - err |= __put_user(regs->xgs, (unsigned int __user *)&sc->gs); + tmp = 0; + savesegment(gs, tmp); + err |= __put_user(tmp, (unsigned int __user *)&sc->gs); savesegment(fs, tmp); err |= __put_user(tmp, (unsigned int __user *)&sc->fs); diff -puN include/asm-i386/mmu_context.h~revert-x86_64-mm-i386-pda-use-gs include/asm-i386/mmu_context.h --- a/include/asm-i386/mmu_context.h~revert-x86_64-mm-i386-pda-use-gs +++ a/include/asm-i386/mmu_context.h @@ -62,8 +62,8 @@ static inline void switch_mm(struct mm_s #endif } -#define deactivate_mm(tsk, mm) \ - asm("movl %0,%%fs": :"r" (0)); +#define deactivate_mm(tsk, mm) \ + asm("movl %0,%%fs ; movl %0,%%gs": :"r" (0)) #define activate_mm(prev, next) \ switch_mm((prev),(next),NULL) diff -puN include/asm-i386/processor.h~revert-x86_64-mm-i386-pda-use-gs include/asm-i386/processor.h --- a/include/asm-i386/processor.h~revert-x86_64-mm-i386-pda-use-gs +++ a/include/asm-i386/processor.h @@ -473,7 +473,6 @@ struct thread_struct { .vm86_info = NULL, \ .sysenter_cs = __KERNEL_CS, \ .io_bitmap_ptr = NULL, \ - .gs = __KERNEL_PDA, \ } /* @@ -501,8 +500,7 @@ static inline void load_esp0(struct tss_ } #define start_thread(regs, new_eip, new_esp) do { \ - __asm__("movl %0,%%fs": :"r" (0)); \ - regs->xgs = 0; \ + __asm__("movl %0,%%fs ; movl %0,%%gs": :"r" (0)); \ set_fs(USER_DS); \ regs->xds = __USER_DS; \ regs->xes = __USER_DS; \ diff -puN include/asm-i386/ptrace.h~revert-x86_64-mm-i386-pda-use-gs include/asm-i386/ptrace.h --- a/include/asm-i386/ptrace.h~revert-x86_64-mm-i386-pda-use-gs +++ a/include/asm-i386/ptrace.h @@ -16,8 +16,6 @@ struct pt_regs { long eax; int xds; int xes; - /* int xfs; */ - int xgs; long orig_eax; long eip; int xcs; diff -puN kernel/fork.c~revert-x86_64-mm-i386-pda-use-gs kernel/fork.c --- a/kernel/fork.c~revert-x86_64-mm-i386-pda-use-gs +++ a/kernel/fork.c @@ -1303,7 +1303,7 @@ fork_out: return ERR_PTR(retval); } -noinline struct pt_regs * __devinit __attribute__((weak)) idle_regs(struct pt_regs *regs) +struct pt_regs * __devinit __attribute__((weak)) idle_regs(struct pt_regs *regs) { memset(regs, 0, sizeof(struct pt_regs)); return regs; _ Patches currently in -mm which might be from akpm@xxxxxxxx are origin.patch pidh-cleanup.patch git-acpi.patch acpi-preserve-correct-battery-state-through-suspend-resume-cycles-tidy.patch acpi-asus-s3-resume-fix.patch sony_apci-resume.patch kauditd_thread-warning-fix.patch git-cifs-fixup.patch git-geode-fixup.patch git-gfs2.patch git-ia64.patch hdrcheck-permission-fix.patch git-libata-all.patch libata-return-sense-data-in-hdio_drive_cmd-ioctl-tidy.patch mmc-driver-for-ti-flashmedia-card-reader-source.patch forcedeth-power-management-support-tidy.patch drivers-net-ns83820c-add-paramter-to-disable-auto.patch git-parisc.patch git-parisc-powerpc-fix.patch git-pcmcia-fixup.patch git-serial.patch git-serial-fixup.patch serial-fix-uart_bug_txen-test.patch revert-gregkh-pci-altix-rom-shadowing.patch revert-gregkh-pci-altix-sn-acpi-hotplug-support.patch revert-gregkh-pci-altix-add-initial-acpi-io-support.patch pci-optionally-sort-device-lists-breadth-first-tweaks.patch pci-optionally-sort-device-lists-breadth-first-force-on.patch git-scsi-misc.patch git-scsi-target-fixup.patch git-scsi-target-vs-git-block.patch xpad-dance-pad-support-tidy.patch git-watchdog.patch git-watchdog-fixup.patch revert-insert-ioapics-and-local-apic-into-resource-map.patch x86_64-dump_trace-atomicity-fix.patch spinlock-debug-all-cpu-backtrace.patch spinlock-debug-all-cpu-backtrace-fix.patch spinlock-debug-all-cpu-backtrace-fix-2.patch spinlock-debug-all-cpu-backtrace-fix-3.patch xfs-rename-uio_read.patch get-rid-of-zone_table-fix.patch kmemdup-introduce-vs-slab-clean-up-leak-tracking-ifdefs-a-little-bit.patch slab-reduce-numa-text-size-tidy.patch swap-token-new-scheme-to-preempt-token-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 swsusp-add-resume_offset-command-line-parameter-rev-2-fix.patch deprecate-smbfs-in-favour-of-cifs.patch edac-new-opteron-athlon64-memory-controller-driver.patch edac-new-opteron-athlon64-memory-controller-driver-tidy.patch add-address_space_operationsbatch_write-fix.patch add-config_headers_check-option-to-automatically-run-make-headers_check-nobble.patch generic-bug-handling.patch use-generic-bug-for-i386.patch use-generic-bug-for-x86-64.patch use-generic-bug-for-powerpc.patch use-generic-bug-for-powerpc-fix-2.patch use-generic-bug-for-powerpc-fix-infinite-loop-on-bug.patch bug-test-1.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 vfs-make-filldir_t-and-struct-kstat-deal-in-64-bit-inode-numbers-alpha-fix.patch knfsd-nfsd4-fslocations-data-structures-fix.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 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 squash-ipc-warnings.patch squash-transmeta-warnings.patch squash-tcp-warnings.patch squash-udf-warnings.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