1. 23 1月, 2012 2 次提交
  2. 06 12月, 2011 1 次提交
  3. 17 10月, 2011 1 次提交
    • S
      ARM: 7017/1: Use generic BUG() handler · 87e040b6
      Simon Glass 提交于
      ARM uses its own BUG() handler which makes its output slightly different
      from other archtectures.
      
      One of the problems is that the ARM implementation doesn't report the function
      with the BUG() in it, but always reports the PC being in __bug(). The generic
      implementation doesn't have this problem.
      
      Currently we get something like:
      
      kernel BUG at fs/proc/breakme.c:35!
      Unable to handle kernel NULL pointer dereference at virtual address 00000000
      ...
      PC is at __bug+0x20/0x2c
      
      With this patch it displays:
      
      kernel BUG at fs/proc/breakme.c:35!
      Internal error: Oops - undefined instruction: 0 [#1] PREEMPT SMP
      ...
      PC is at write_breakme+0xd0/0x1b4
      
      This implementation uses an undefined instruction to implement BUG, and sets up
      a bug table containing the relevant information. Many versions of gcc do not
      support %c properly for ARM (inserting a # when they shouldn't) so we work
      around this using distasteful macro magic.
      
      v1: Initial version to replace existing ARM BUG() implementation with something
      more similar to other architectures.
      
      v2: Add Thumb support, remove backtrace whitespace output changes. Change to
      use macros instead of requiring the asm %d flag to work (thanks to
      Dave Martin <dave.martin@linaro.org>)
      
      v3: Remove old BUG() implementation in favor of this one.
      Remove the Backtrace: message (will submit this separately).
      Use ARM_EXIT_KEEP() so that some architectures can dump exit text at link time
      thanks to Stephen Boyd <sboyd@codeaurora.org> (although since we always
      define GENERIC_BUG this might be academic.)
      Rebase to linux-2.6.git master.
      
      v4: Allow BUGS in modules (these were not reported correctly in v3)
      (thanks to Stephen Boyd <sboyd@codeaurora.org> for suggesting that.)
      Remove __bug() as this is no longer needed.
      
      v5: Add %progbits as the section flags.
      Signed-off-by: NSimon Glass <sjg@chromium.org>
      Reviewed-by: NStephen Boyd <sboyd@codeaurora.org>
      Tested-by: NStephen Boyd <sboyd@codeaurora.org>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      87e040b6
  4. 21 9月, 2011 1 次提交
    • R
      ARM: fix vmlinux.lds.S discarding sections · 6760b109
      Russell King 提交于
      We are seeing linker errors caused by sections being discarded, despite
      the linker script trying to keep them.  The result is (eg):
      
      `.exit.text' referenced in section `.alt.smp.init' of drivers/built-in.o: defined in discarded section `.exit.text' of drivers/built-in.o
      `.exit.text' referenced in section `.alt.smp.init' of net/built-in.o: defined in discarded section `.exit.text' of net/built-in.o
      
      This is the relevent part of the linker script (reformatted to make it
      clearer):
      | SECTIONS
      | {
      | /*
      | * unwind exit sections must be discarded before the rest of the
      | * unwind sections get included.
      | */
      | /DISCARD/ : {
      | *(.ARM.exidx.exit.text)
      | *(.ARM.extab.exit.text)
      | }
      | ...
      | .exit.text : {
      | *(.exit.text)
      | *(.memexit.text)
      | }
      | ...
      | /DISCARD/ : {
      | *(.exit.text)
      | *(.memexit.text)
      | *(.exit.data)
      | *(.memexit.data)
      | *(.memexit.rodata)
      | *(.exitcall.exit)
      | *(.discard)
      | *(.discard.*)
      | }
      | }
      
      Now, this is what the linker manual says about discarded output sections:
      
      |    The special output section name `/DISCARD/' may be used to discard
      | input sections.  Any input sections which are assigned to an output
      | section named `/DISCARD/' are not included in the output file.
      
      No questions, no exceptions. It doesn't say "unless they are listed
      before the /DISCARD/ section." Now, this is what asn-generic/vmlinux.lds.S
      says:
      | /*
      |  * Default discarded sections.
      |  *
      |  * Some archs want to discard exit text/data at runtime rather than
      |  * link time due to cross-section references such as alt instructions,
      |  * bug table, eh_frame, etc. DISCARDS must be the last of output
      |  * section definitions so that such archs put those in earlier section
      |  * definitions.
      |  */
      
      And guess what - the list _always_ includes .exit.text etc.
      
      Now, what's actually happening is that the linker is reading the script,
      and it finds the first /DISCARD/ output section at the beginning of the
      script. It continues reading the script, and finds the 'DISCARD' macro
      at the end, which having been postprocessed results in another
      /DISCARD/ output section. As the linker already contains the earlier
      /DISCARD/ output section, it adds it to that existing section, so it
      effectively is placed at the start. This can be seen by using the -M
      option to ld:
      
      | Linker script and memory map
      |
      |                 0xc037c080                jiffies = jiffies_64
      |
      | /DISCARD/
      |  *(.ARM.exidx.exit.text)
      |  *(.ARM.extab.exit.text)
      |  *(.exit.text)
      |  *(.memexit.text)
      |  *(.exit.data)
      |  *(.memexit.data)
      |  *(.memexit.rodata)
      |  *(.exitcall.exit)
      |  *(.discard)
      |  *(.discard.*)
      |
      |                 0xc0008000                . = 0xc0008000
      |
      | .head.text      0xc0008000      0x1d0
      |                 0xc0008000                _text = .
      |  *(.head.text)
      |  .head.text     0xc0008000      0x1d0 arch/arm/kernel/head.o
      |                 0xc0008000                stext
      |
      | .text           0xc0008200   0x2d78d0
      |                 0xc0008200                _stext = .
      |                 0xc0008200                __exception_text_start = .
      |  *(.exception.text)
      |  .exception.text
      | ...
      
      As you can see, all the discarded sections are grouped together - and
      as a result of it being the first output section, they all appear before
      any other section.
      
      The result is that not only is the unwind information discarded (as
      intended), but also the .exit.text, despite us wanting to have the
      .exit.text preserved.
      
      We can't move the unwind information elsewhere, because it'll then be
      included even when we do actually discard the .exit.text (and similar)
      sections.
      
      So, work around this by avoiding the generic DISCARDS macro, and instead
      conditionalize the sections to be discarded ourselves.  This avoids the
      ambiguity in how the linker assigns input sections to output sections,
      making our script less dependent on undocumented linker behaviour.
      Reported-by: NRob Herring <robherring2@gmail.com>
      Tested-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      6760b109
  5. 08 7月, 2011 5 次提交
  6. 25 3月, 2011 1 次提交
    • T
      percpu: Always align percpu output section to PAGE_SIZE · 0415b00d
      Tejun Heo 提交于
      Percpu allocator honors alignment request upto PAGE_SIZE and both the
      percpu addresses in the percpu address space and the translated kernel
      addresses should be aligned accordingly.  The calculation of the
      former depends on the alignment of percpu output section in the kernel
      image.
      
      The linker script macros PERCPU_VADDR() and PERCPU() are used to
      define this output section and the latter takes @align parameter.
      Several architectures are using @align smaller than PAGE_SIZE breaking
      percpu memory alignment.
      
      This patch removes @align parameter from PERCPU(), renames it to
      PERCPU_SECTION() and makes it always align to PAGE_SIZE.  While at it,
      add PCPU_SETUP_BUG_ON() checks such that alignment problems are
      reliably detected and remove percpu alignment comment recently added
      in workqueue.c as the condition would trigger BUG way before reaching
      there.
      
      For um, this patch raises the alignment of percpu area.  As the area
      is in .init, there shouldn't be any noticeable difference.
      
      This problem was discovered by David Howells while debugging boot
      failure on mn10300.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Acked-by: NMike Frysinger <vapier@gentoo.org>
      Cc: uclinux-dist-devel@blackfin.uclinux.org
      Cc: David Howells <dhowells@redhat.com>
      Cc: Jeff Dike <jdike@addtoit.com>
      Cc: user-mode-linux-devel@lists.sourceforge.net
      0415b00d
  7. 22 2月, 2011 2 次提交
  8. 18 2月, 2011 1 次提交
    • R
      ARM: P2V: introduce phys_to_virt/virt_to_phys runtime patching · dc21af99
      Russell King 提交于
      This idea came from Nicolas, Eric Miao produced an initial version,
      which was then rewritten into this.
      
      Patch the physical to virtual translations at runtime.  As we modify
      the code, this makes it incompatible with XIP kernels, but allows us
      to achieve this with minimal loss of performance.
      
      As many translations are of the form:
      
      	physical = virtual + (PHYS_OFFSET - PAGE_OFFSET)
      	virtual = physical - (PHYS_OFFSET - PAGE_OFFSET)
      
      we generate an 'add' instruction for __virt_to_phys(), and a 'sub'
      instruction for __phys_to_virt().  We calculate at run time (PHYS_OFFSET
      - PAGE_OFFSET) by comparing the address prior to MMU initialization with
      where it should be once the MMU has been initialized, and place this
      constant into the above add/sub instructions.
      
      Once we have (PHYS_OFFSET - PAGE_OFFSET), we can calculate the real
      PHYS_OFFSET as PAGE_OFFSET is a build-time constant, and save this for
      the C-mode PHYS_OFFSET variable definition to use.
      
      At present, we are unable to support Realview with Sparsemem enabled
      as this uses a complex mapping function, and MSM as this requires a
      constant which will not fit in our math instruction.
      
      Add a module version magic string for this feature to prevent
      incompatible modules being loaded.
      Tested-by: NTony Lindgren <tony@atomide.com>
      Reviewed-by: NNicolas Pitre <nicolas.pitre@linaro.org>
      Tested-by: NNicolas Pitre <nicolas.pitre@linaro.org>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      dc21af99
  9. 25 1月, 2011 1 次提交
    • T
      percpu: align percpu readmostly subsection to cacheline · 19df0c2f
      Tejun Heo 提交于
      Currently percpu readmostly subsection may share cachelines with other
      percpu subsections which may result in unnecessary cacheline bounce
      and performance degradation.
      
      This patch adds @cacheline parameter to PERCPU() and PERCPU_VADDR()
      linker macros, makes each arch linker scripts specify its cacheline
      size and use it to align percpu subsections.
      
      This is based on Shaohua's x86 only patch.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Cc: Shaohua Li <shaohua.li@intel.com>
      19df0c2f
  10. 05 12月, 2010 1 次提交
    • R
      ARM: implement support for read-mostly sections · daf87416
      Russell King 提交于
      As our SMP implementation uses MESI protocols.  Grouping together data
      which is mostly only read together means that we avoid unnecessary
      cache line bouncing when this code shares a cache line with other data.
      
      In other words, cache lines associated with read-mostly data are
      expected to spend most of their time in shared state.
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      daf87416
  11. 20 11月, 2010 1 次提交
  12. 28 10月, 2010 1 次提交
  13. 08 10月, 2010 2 次提交
  14. 05 10月, 2010 1 次提交
    • R
      ARM: Allow SMP kernels to boot on UP systems · f00ec48f
      Russell King 提交于
      UP systems do not implement all the instructions that SMP systems have,
      so in order to boot a SMP kernel on a UP system, we need to rewrite
      parts of the kernel.
      
      Do this using an 'alternatives' scheme, where the kernel code and data
      is modified prior to initialization to replace the SMP instructions,
      thereby rendering the problematical code ineffectual.  We use the linker
      to generate a list of 32-bit word locations and their replacement values,
      and run through these replacements when we detect a UP system.
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      f00ec48f
  15. 16 2月, 2010 1 次提交
  16. 15 12月, 2009 1 次提交
    • A
      ARM: use unified discard definition in linker script · e3f28c13
      Alan Jenkins 提交于
      Commit 023bf6f1 "linker script: unify usage of discard definition"
      changed the linker scripts for all architectures except for ARM.
      I can find no discussion about this ommision, so here are the changes
      for ARM.
      
      These changes are exactly parallel to the ia64 case.
      
      "ia64 is notable because it first throws away some ia64 specific
       subsections and then include the rest of the sections into the final
       image, so those sections must be discarded before the inclusion."
      
      Not boot-tested.  In build testing, the modified linker script generated
      an identical vmlinux file.
      
      [I would like to be able to rely on this unified discard definition.
       I want to sort the kernel symbol tables to allow faster symbol
       resolution during module loading. The simplest way appears to be
       to generate sorted versions from vmlinux.o, link them in to vmlinux,
       _and discard the original unsorted tables_.
      
       This work is driven by my x86 netbook, but it is implemented at a
       generic level. It is possible it will benefit some ARM systems also.]
      Signed-off-by: NAlan Jenkins <alan-jenkins@tuffmail.co.uk>
      Acked-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      Acked-by-without-testing: Tejun Heo <tj@kernel.org>
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      e3f28c13
  17. 24 11月, 2009 2 次提交
  18. 16 9月, 2009 1 次提交
  19. 25 6月, 2009 1 次提交
  20. 24 6月, 2009 1 次提交
    • T
      linker script: throw away .discard section · 405d967d
      Tejun Heo 提交于
      x86 throws away .discard section but no other archs do.  Also,
      .discard is not thrown away while linking modules.  Make every arch
      and module linking throw it away.  This will be used to define dummy
      variables for percpu declarations and definitions.
      
      This patch is based on Ivan Kokshaysky's alpha percpu patch.
      
      [ Impact: always throw away everything in .discard ]
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Haavard Skinnemoen <hskinnemoen@atmel.com>
      Cc: Bryan Wu <cooloney@kernel.org>
      Cc: Mikael Starvik <starvik@axis.com>
      Cc: Jesper Nilsson <jesper.nilsson@axis.com>
      Cc: David Howells <dhowells@redhat.com>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Hirokazu Takata <takata@linux-m32r.org>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Kyle McMartin <kyle@mcmartin.ca>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Paul Mundt <lethal@linux-sh.org>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Jeff Dike <jdike@addtoit.com>
      Cc: Chris Zankel <chris@zankel.net>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Cc: Ingo Molnar <mingo@elte.hu>
      405d967d
  21. 19 6月, 2009 1 次提交
  22. 30 5月, 2009 1 次提交
  23. 10 3月, 2009 1 次提交
    • T
      linker script: define __per_cpu_load on all SMP capable archs · 19390c4d
      Tejun Heo 提交于
      Impact: __per_cpu_load available on all SMP capable archs
      
      Percpu now requires three symbols to be defined - __per_cpu_load,
      __per_cpu_start and __per_cpu_end.  There were three archs which
      didn't have it.  Update them as follows.
      
      * powerpc: can use generic PERCPU() macro.  Compile tested for
        powerpc32, compile/boot tested for powerpc64.
      
      * ia64: can use generic PERCPU_VADDR() macro.  __phys_per_cpu_start is
        identical to __per_cpu_load.  Compile tested and symbol table looks
        identical after the change except for the additional __per_cpu_load.
      
      * arm: added explicit __per_cpu_load definition.  Currently uses
        unified .init output section so can't use the generic macro.  Dunno
        whether the unified .init ouput section is required by arch
        peculiarity so I left it alone.  Please break it up and use PERCPU()
        if possible.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Pat Gefre <pfg@sgi.com>
      Cc: Russell King <rmk@arm.linux.org.uk>
      19390c4d
  24. 19 2月, 2009 1 次提交
  25. 17 1月, 2009 1 次提交
  26. 01 12月, 2008 1 次提交
  27. 29 1月, 2008 1 次提交
  28. 26 1月, 2008 1 次提交
  29. 20 7月, 2007 1 次提交
    • 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
  30. 19 5月, 2007 2 次提交
  31. 08 5月, 2007 1 次提交