1. 03 2月, 2009 1 次提交
    • Y
      x86, percpu: fix kexec with vmlinux · ef3892bd
      Yinghai Lu 提交于
      Impact: fix regression with kexec with vmlinux
      
      Split data.init into data.init, percpu, data.init2 sections
      instead of let data.init wrap percpu secion.
      
      Thus kexec loading will be happy, because sections will not
      overlap.
      
      Before the patch we have:
      
      Elf file type is EXEC (Executable file)
      Entry point 0x200000
      There are 6 program headers, starting at offset 64
      
      Program Headers:
        Type           Offset             VirtAddr           PhysAddr
                       FileSiz            MemSiz              Flags  Align
        LOAD           0x0000000000200000 0xffffffff80200000 0x0000000000200000
                       0x0000000000ca6000 0x0000000000ca6000  R E    200000
        LOAD           0x0000000000ea6000 0xffffffff80ea6000 0x0000000000ea6000
                       0x000000000014dfe0 0x000000000014dfe0  RWE    200000
        LOAD           0x0000000001000000 0xffffffffff600000 0x0000000000ff4000
                       0x0000000000000888 0x0000000000000888  RWE    200000
        LOAD           0x00000000011f6000 0xffffffff80ff6000 0x0000000000ff6000
                       0x0000000000073086 0x0000000000a2d938  RWE    200000
        LOAD           0x0000000001400000 0x0000000000000000 0x000000000106a000
                       0x00000000001d2ce0 0x00000000001d2ce0  RWE    200000
        NOTE           0x00000000009e2c1c 0xffffffff809e2c1c 0x00000000009e2c1c
                       0x0000000000000024 0x0000000000000024         4
      
       Section to Segment mapping:
        Segment Sections...
         00     .text .notes __ex_table .rodata __bug_table .pci_fixup .builtin_fw __ksymtab __ksymtab_gpl __ksymtab_strings __init_rodata __param
         01     .data .init.rodata .data.cacheline_aligned .data.read_mostly
         02     .vsyscall_0 .vsyscall_fn .vsyscall_gtod_data .vsyscall_1 .vsyscall_2 .vgetcpu_mode .jiffies
         03     .data.init_task .smp_locks .init.text .init.data .init.setup .initcall.init .con_initcall.init .x86_cpu_dev.init .altinstructions .altinstr_replacement .exit.text .init.ramfs .bss
         04     .data.percpu
         05     .notes
      
      After patch we've got:
      
      Elf file type is EXEC (Executable file)
      Entry point 0x200000
      There are 7 program headers, starting at offset 64
      
      Program Headers:
        Type           Offset             VirtAddr           PhysAddr
                       FileSiz            MemSiz              Flags  Align
        LOAD           0x0000000000200000 0xffffffff80200000 0x0000000000200000
                       0x0000000000ca6000 0x0000000000ca6000  R E    200000
        LOAD           0x0000000000ea6000 0xffffffff80ea6000 0x0000000000ea6000
                       0x000000000014dfe0 0x000000000014dfe0  RWE    200000
        LOAD           0x0000000001000000 0xffffffffff600000 0x0000000000ff4000
                       0x0000000000000888 0x0000000000000888  RWE    200000
        LOAD           0x00000000011f6000 0xffffffff80ff6000 0x0000000000ff6000
                       0x0000000000073086 0x0000000000073086  RWE    200000
        LOAD           0x0000000001400000 0x0000000000000000 0x000000000106a000
                       0x00000000001d2ce0 0x00000000001d2ce0  RWE    200000
        LOAD           0x000000000163d000 0xffffffff8123d000 0x000000000123d000
                       0x0000000000000000 0x00000000007e6938  RWE    200000
        NOTE           0x00000000009e2c1c 0xffffffff809e2c1c 0x00000000009e2c1c
                       0x0000000000000024 0x0000000000000024         4
      
       Section to Segment mapping:
        Segment Sections...
         00     .text .notes __ex_table .rodata __bug_table .pci_fixup .builtin_fw __ksymtab __ksymtab_gpl __ksymtab_strings __init_rodata __param
         01     .data .init.rodata .data.cacheline_aligned .data.read_mostly
         02     .vsyscall_0 .vsyscall_fn .vsyscall_gtod_data .vsyscall_1 .vsyscall_2 .vgetcpu_mode .jiffies
         03     .data.init_task .smp_locks .init.text .init.data .init.setup .initcall.init .con_initcall.init .x86_cpu_dev.init .altinstructions .altinstr_replacement .exit.text .init.ramfs
         04     .data.percpu
         05     .bss
         06     .notes
      Signed-off-by: NYinghai Lu <yinghai@kernel.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      ef3892bd
  2. 20 1月, 2009 1 次提交
    • B
      x86: move stack_canary into irq_stack · 947e76cd
      Brian Gerst 提交于
      Impact: x86_64 percpu area layout change, irq_stack now at the beginning
      
      Now that the PDA is empty except for the stack canary, it can be removed.
      The irqstack is moved to the start of the per-cpu section.  If the stack
      protector is enabled, the canary overlaps the bottom 48 bytes of the irqstack.
      
      tj: * updated subject
          * dropped asm relocation of irq_stack_ptr
          * updated comments a bit
          * rebased on top of stack canary changes
      Signed-off-by: NBrian Gerst <brgerst@gmail.com>
      Signed-off-by: NTejun Heo <tj@kernel.org>
      947e76cd
  3. 16 1月, 2009 4 次提交
    • T
      x86: convert pda ops to wrappers around x86 percpu accessors · 49357d19
      Tejun Heo 提交于
      pda is now a percpu variable and there's no reason it can't use plain
      x86 percpu accessors.  Add x86_test_and_clear_bit_percpu() and replace
      pda op implementations with wrappers around x86 percpu accessors.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      49357d19
    • T
      x86: make pda a percpu variable · b12d8db8
      Tejun Heo 提交于
      [ Based on original patch from Christoph Lameter and Mike Travis. ]
      
      As pda is now allocated in percpu area, it can easily be made a proper
      percpu variable.  Make it so by defining per cpu symbol from linker
      script and declaring it in C code for SMP and simply defining it for
      UP.  This change cleans up code and brings SMP and UP closer a bit.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      b12d8db8
    • T
      x86: fold pda into percpu area on SMP · 1a51e3a0
      Tejun Heo 提交于
      [ Based on original patch from Christoph Lameter and Mike Travis. ]
      
      Currently pdas and percpu areas are allocated separately.  %gs points
      to local pda and percpu area can be reached using pda->data_offset.
      This patch folds pda into percpu area.
      
      Due to strange gcc requirement, pda needs to be at the beginning of
      the percpu area so that pda->stack_canary is at %gs:40.  To achieve
      this, a new percpu output section macro - PERCPU_VADDR_PREALLOC() - is
      added and used to reserve pda sized chunk at the start of the percpu
      area.
      
      After this change, for boot cpu, %gs first points to pda in the
      data.init area and later during setup_per_cpu_areas() gets updated to
      point to the actual pda.  This means that setup_per_cpu_areas() need
      to reload %gs for CPU0 while clearing pda area for other cpus as cpu0
      already has modified it when control reaches setup_per_cpu_areas().
      
      This patch also removes now unnecessary get_local_pda() and its call
      sites.
      
      A lot of this patch is taken from Mike Travis' "x86_64: Fold pda into
      per cpu area" patch.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      1a51e3a0
    • T
      x86: make percpu symbols zerobased on SMP · 3e5d8f97
      Tejun Heo 提交于
      [ Based on original patch from Christoph Lameter and Mike Travis. ]
      
      This patch makes percpu symbols zerobased on x86_64 SMP by adding
      PERCPU_VADDR() to vmlinux.lds.h which helps setting explicit vaddr on
      the percpu output section and using it in vmlinux_64.lds.S.  A new
      PHDR is added as existing ones cannot contain sections near address
      zero.  PERCPU_VADDR() also adds a new symbol __per_cpu_load which
      always points to the vaddr of the loaded percpu data.init region.
      
      The following adjustments have been made to accomodate the address
      change.
      
      * code to locate percpu gdt_page in head_64.S is updated to add the
        load address to the gdt_page offset.
      
      * __per_cpu_load is used in places where access to the init data area
        is necessary.
      
      * pda->data_offset is initialized soon after C code is entered as zero
        value doesn't work anymore.
      
      This patch is mostly taken from Mike Travis' "x86_64: Base percpu
      variables at zero" patch.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      3e5d8f97
  4. 12 12月, 2008 1 次提交
  5. 16 10月, 2008 3 次提交
  6. 12 10月, 2008 1 次提交
  7. 05 9月, 2008 1 次提交
  8. 08 7月, 2008 1 次提交
  9. 25 5月, 2008 2 次提交
  10. 29 4月, 2008 1 次提交
    • R
      x86_64 vDSO: use initdata · d9dedc13
      Roland McGrath 提交于
      The 64-bit vDSO image is in a special ".vdso" section for no reason
      I can determine.  Furthermore, the location of the vdso_end symbol
      includes some wrongly-calculated padding space in the image, which
      is then (correctly) rounded to page size, resulting in an extra page
      of zeros in the image mapped in to user processes.
      
      This changes it to put the vdso.so image into normal initdata as we
      have always done for the 32-bit vDSO images.  The extra padding is
      gone, so the user VMA is one page instead of two.  The image that
      was already copied around at boot time is now in initdata, so we
      recover that wasted space after boot.
      Signed-off-by: NRoland McGrath <roland@redhat.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      d9dedc13
  11. 17 4月, 2008 2 次提交
    • T
      x86: use ELF section to list CPU vendor specific code · 03ae5768
      Thomas Petazzoni 提交于
      Replace the hardcoded list of initialization functions for each CPU
      vendor by a list in an ELF section, which is read at initialization in
      arch/x86/kernel/cpu/cpu.c to fill the cpu_devs[] array. The ELF
      section, named .x86cpuvendor.init, is reclaimed after boot, and
      contains entries of type "struct cpu_vendor_dev" which associates a
      vendor number with a pointer to a "struct cpu_dev" structure.
      
      This first modification allows to remove all the VENDOR_init_cpu()
      functions.
      
      This patch also removes the hardcoded calls to early_init_amd() and
      early_init_intel(). Instead, we add a "c_early_init" member to the
      cpu_dev structure, which is then called if not NULL by the generic CPU
      initialization code. Unfortunately, in early_cpu_detect(), this_cpu is
      not yet set, so we have to use the cpu_devs[] array directly.
      
      This patch is part of the Linux Tiny project, and is needed for
      further patch that will allow to disable compilation of unused CPU
      support code.
      Signed-off-by: NThomas Petazzoni <thomas.petazzoni@free-electrons.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      03ae5768
    • I
      x86: check vmlinux limits, 64-bit · b4e0409a
      Ingo Molnar 提交于
      these build-time and link-time checks would have prevented the
      vmlinux size regression.
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      b4e0409a
  12. 19 2月, 2008 2 次提交
  13. 30 1月, 2008 2 次提交
  14. 29 1月, 2008 1 次提交
  15. 11 10月, 2007 2 次提交
  16. 23 7月, 2007 1 次提交
  17. 22 7月, 2007 3 次提交
  18. 20 7月, 2007 2 次提交
    • R
      x86_64: Put allocated ELF notes in read-only data segment · 2e1d5b8f
      Roland McGrath 提交于
      This changes the x86_64 linker script to use the asm-generic NOTES macro so
      that ELF note sections with SHF_ALLOC set are linked into the kernel image
      along with other read-only data.  The PT_NOTE also points to their location.
      
      This paves the way for putting useful build-time information into ELF notes
      that can be found easily later in a kernel memory dump.
      Signed-off-by: NRoland McGrath <roland@redhat.com>
      Cc: Andi Kleen <ak@suse.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      2e1d5b8f
    • F
      define new percpu interface for shared data · 5fb7dc37
      Fenghua Yu 提交于
      per cpu data section contains two types of data.  One set which is
      exclusively accessed by the local cpu and the other set which is per cpu,
      but also shared by remote cpus.  In the current kernel, these two sets are
      not clearely separated out.  This can potentially cause the same data
      cacheline shared between the two sets of data, which will result in
      unnecessary bouncing of the cacheline between cpus.
      
      One way to fix the problem is to cacheline align the remotely accessed per
      cpu data, both at the beginning and at the end.  Because of the padding at
      both ends, this will likely cause some memory wastage and also the
      interface to achieve this is not clean.
      
      This patch:
      
      Moves the remotely accessed per cpu data (which is currently marked
      as ____cacheline_aligned_in_smp) into a different section, where all the data
      elements are cacheline aligned. And as such, this differentiates the local
      only data and remotely accessed data cleanly.
      Signed-off-by: NFenghua Yu <fenghua.yu@intel.com>
      Acked-by: NSuresh Siddha <suresh.b.siddha@intel.com>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Cc: Christoph Lameter <clameter@sgi.com>
      Cc: <linux-arch@vger.kernel.org>
      Cc: "Luck, Tony" <tony.luck@intel.com>
      Cc: Andi Kleen <ak@suse.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      5fb7dc37
  19. 19 5月, 2007 2 次提交
  20. 03 5月, 2007 4 次提交
    • A
      [PATCH] x86-64: Remove CONFIG_REORDER · 2136220d
      Andi Kleen 提交于
      The option never worked well and functionlist wasn't well maintained.
      Also it made the build very slow on many binutils version.
      
      So just remove it.
      
      Cc: arjan@linux.intel.com
      Signed-off-by: NAndi Kleen <ak@suse.de>
      2136220d
    • E
      [PATCH] x86-64: move __vgetcpu_mode & __jiffies to the vsyscall_2 zone · 141a892f
      Eric Dumazet 提交于
      We apparently hit the 1024 limit of vsyscall_0 zone when some debugging
      options are set, or if __vsyscall_gtod_data is 64 bytes larger.
      
      In order to save 128 bytes from the vsyscall_0 zone, we move __vgetcpu_mode
      & __jiffies to vsyscall_2 zone where they really belong, since they are
      used only from vgetcpu() (which is in this vsyscall_2 area).
      
      After patch is applied, new layout is :
      
      ffffffffff600000 T vgettimeofday
      ffffffffff60004e t vsysc2
      ffffffffff600140 t vread_hpet
      ffffffffff600150 t vread_tsc
      ffffffffff600180 D __vsyscall_gtod_data
      ffffffffff600400 T vtime
      ffffffffff600413 t vsysc1
      ffffffffff600800 T vgetcpu
      ffffffffff600870 D __vgetcpu_mode
      ffffffffff600880 D __jiffies
      ffffffffff600c00 T venosys_1
      Signed-off-by: NEric Dumazet <dada1@cosmosbay.com>
      Signed-off-by: NAndi Kleen <ak@suse.de>
      Cc: Andi Kleen <ak@suse.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      141a892f
    • J
      [PATCH] x86: Allow percpu variables to be page-aligned · b6e3590f
      Jeremy Fitzhardinge 提交于
      Let's allow page-alignment in general for per-cpu data (wanted by Xen, and
      Ingo suggested KVM as well).
      
      Because larger alignments can use more room, we increase the max per-cpu
      memory to 64k rather than 32k: it's getting a little tight.
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      Signed-off-by: NJeremy Fitzhardinge <jeremy@xensource.com>
      Signed-off-by: NAndi Kleen <ak@suse.de>
      Acked-by: NIngo Molnar <mingo@elte.hu>
      Cc: Andi Kleen <ak@suse.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      b6e3590f
    • J
      [PATCH] x86: tighten kernel image page access rights · 6fb14755
      Jan Beulich 提交于
      On x86-64, kernel memory freed after init can be entirely unmapped instead
      of just getting 'poisoned' by overwriting with a debug pattern.
      
      On i386 and x86-64 (under CONFIG_DEBUG_RODATA), kernel text and bug table
      can also be write-protected.
      
      Compared to the first version, this one prevents re-creating deleted
      mappings in the kernel image range on x86-64, if those got removed
      previously. This, together with the original changes, prevents temporarily
      having inconsistent mappings when cacheability attributes are being
      changed on such pages (e.g. from AGP code). While on i386 such duplicate
      mappings don't exist, the same change is done there, too, both for
      consistency and because checking pte_present() before using various other
      pte_XXX functions is a requirement anyway. At once, i386 code gets
      adjusted to use pte_huge() instead of open coding this.
      
      AK: split out cpa() changes
      Signed-off-by: NJan Beulich <jbeulich@novell.com>
      Signed-off-by: NAndi Kleen <ak@suse.de>
      6fb14755
  21. 16 4月, 2007 1 次提交
    • A
      [PATCH] x86: Fix gcc 4.2 _proxy_pda workaround · 08269c6d
      Andi Kleen 提交于
      Due to an over aggressive optimizer gcc 4.2 cannot optimize away _proxy_pda
      in all cases (counter intuitive, but true).  This breaks loading of some
      modules.
      
      The earlier workaround to just export a dummy symbol didn't work unfortunately
      because the module code ignores exports with 0 value.
      
      Make it 1 instead.
      Signed-off-by: NAndi Kleen <ak@suse.de>
      08269c6d
  22. 17 2月, 2007 1 次提交
  23. 12 2月, 2007 1 次提交