1. 18 3月, 2009 1 次提交
  2. 15 3月, 2009 3 次提交
    • J
      x86: allow extend_brk users to reserve brk space · 796216a5
      Jeremy Fitzhardinge 提交于
      Impact: new interface; remove hard-coded limit
      
      Add RESERVE_BRK(name, size) macro to reserve space in the brk
      area.  This should be a conservative (ie, larger) estimate of
      how much space might possibly be required from the brk area.
      Any unused space will be freed, so there's no real downside
      on making the reservation too large (within limits).
      
      The name should be unique within a given file, and somewhat
      descriptive.
      
      The C definition of RESERVE_BRK() ends up being more complex than
      one would expect to work around a cluster of gcc infelicities:
      
        The first attempt was to simply try putting __section(.brk_reservation)
        on a variable.  This doesn't work because it ends up making it a
        @progbits section, which gets actual space allocated in the vmlinux
        executable.
      
        The second attempt was to emit the space into a section using asm,
        but gcc doesn't allow arguments to be passed to file-level asm()
        statements, making it hard to pass in the size.
      
        The final attempt is to wrap the asm() in a function to allow
        it to have arguments, and put the function itself into the
        .discard section, which vmlinux*.lds drops entirely from the
        emitted vmlinux.
      Signed-off-by: NJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
      Signed-off-by: NH. Peter Anvin <hpa@zytor.com>
      796216a5
    • J
      x86: add brk allocation for very, very early allocations · 93dbda7c
      Jeremy Fitzhardinge 提交于
      Impact: new interface
      
      Add a brk()-like allocator which effectively extends the bss in order
      to allow very early code to do dynamic allocations.  This is better than
      using statically allocated arrays for data in subsystems which may never
      get used.
      
      The space for brk allocations is in the bss ELF segment, so that the
      space is mapped properly by the code which maps the kernel, and so
      that bootloaders keep the space free rather than putting a ramdisk or
      something into it.
      
      The bss itself, delimited by __bss_stop, ends before the brk area
      (__brk_base to __brk_limit).  The kernel text, data and bss is reserved
      up to __bss_stop.
      
      Any brk-allocated data is reserved separately just before the kernel
      pagetable is built, as that code allocates from unreserved spaces
      in the e820 map, potentially allocating from any unused brk memory.
      Ultimately any unused memory in the brk area is used in the general
      kernel memory pool.
      
      Initially the brk space is set to 1MB, which is probably much larger
      than any user needs (the largest current user is i386 head_32.S's code
      to build the pagetables to map the kernel, which can get fairly large
      with a big kernel image and no PSE support).  So long as the system
      has sufficient memory for the bootloader to reserve the kernel+1MB brk,
      there are no bad effects resulting from an over-large brk.
      Signed-off-by: NJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
      Signed-off-by: NH. Peter Anvin <hpa@zytor.com>
      93dbda7c
    • J
      x86: make section delimiter symbols part of their section · b9719a4d
      Jeremy Fitzhardinge 提交于
      Impact: cleanup
      
      Move the symbols delimiting a section part of the section
      (section relative) rather than absolute.  This avoids any
      unexpected gaps between the section-start symbol and the first
      data in the section, which could be caused by implicit
      alignment of the section data.  It also makes the general
      form of vmlinux_64.lds.S consistent with vmlinux_32.lds.S.
      Signed-off-by: NJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Cc: "Eric W. Biederman" <ebiederm@xmission.com>
      Signed-off-by: NH. Peter Anvin <hpa@zytor.com>
      b9719a4d
  3. 11 3月, 2009 1 次提交
  4. 14 2月, 2009 1 次提交
  5. 09 2月, 2009 1 次提交
  6. 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
  7. 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
  8. 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
  9. 12 12月, 2008 1 次提交
  10. 16 10月, 2008 3 次提交
  11. 12 10月, 2008 1 次提交
  12. 05 9月, 2008 1 次提交
  13. 08 7月, 2008 1 次提交
  14. 25 5月, 2008 2 次提交
  15. 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
  16. 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
  17. 19 2月, 2008 2 次提交
  18. 30 1月, 2008 2 次提交
  19. 29 1月, 2008 1 次提交
  20. 11 10月, 2007 2 次提交
  21. 23 7月, 2007 1 次提交
  22. 22 7月, 2007 3 次提交
  23. 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
  24. 19 5月, 2007 2 次提交