05 May, 2010

1 commit


17 Feb, 2010

2 commits

  • powerpc/booke: Add support for advanced debug registers

    From: Dave Kleikamp

    Based on patches originally written by Torez Smith.

    This patch defines context switch and trap related functionality
    for BookE specific Debug Registers. It adds support to ptrace()
    for setting and getting BookE related Debug Registers

    Signed-off-by: Dave Kleikamp
    Cc: Torez Smith
    Cc: Benjamin Herrenschmidt
    Cc: David Gibson
    Cc: Josh Boyer
    Cc: Kumar Gala
    Cc: Sergio Durigan Junior
    Cc: Thiago Jung Bauermann
    Cc: linuxppc-dev list
    Signed-off-by: Benjamin Herrenschmidt

    Dave Kleikamp
     
  • powerpc/booke: Introduce new CONFIG options for advanced debug registers

    From: Dave Kleikamp

    Introduce new config options to simplify the ifdefs pertaining to the
    advanced debug registers for booke and 40x processors:

    CONFIG_PPC_ADV_DEBUG_REGS - boolean: true for dac-based processors
    CONFIG_PPC_ADV_DEBUG_IACS - number of IAC registers
    CONFIG_PPC_ADV_DEBUG_DACS - number of DAC registers
    CONFIG_PPC_ADV_DEBUG_DVCS - number of DVC registers
    CONFIG_PPC_ADV_DEBUG_DAC_RANGE - DAC ranges supported

    Beginning conservatively, since I only have the facilities to test 440
    hardware. I believe all 40x and booke platforms support at least 2 IAC
    and 2 DAC registers. For 440, 4 IAC and 2 DVC registers are enabled, as
    well as the DAC ranges.

    Signed-off-by: Dave Kleikamp
    Acked-by: David Gibson
    Signed-off-by: Benjamin Herrenschmidt

    Dave Kleikamp
     

01 Feb, 2010

1 commit


27 Oct, 2009

1 commit

  • Fix the following 3 issues:

    arch/powerpc/kernel/process.c: In function 'arch_randomize_brk':
    arch/powerpc/kernel/process.c:1183: error: 'mmu_highuser_ssize' undeclared (first use in this function)
    arch/powerpc/kernel/process.c:1183: error: (Each undeclared identifier is reported only once
    arch/powerpc/kernel/process.c:1183: error: for each function it appears in.)
    arch/powerpc/kernel/process.c:1183: error: 'MMU_SEGSIZE_1T' undeclared (first use in this function)

    In file included from arch/powerpc/kernel/setup_64.c:60:
    arch/powerpc/include/asm/mmu-hash64.h:132: error: redefinition of 'struct mmu_psize_def'
    arch/powerpc/include/asm/mmu-hash64.h:159: error: expected identifier or '(' before numeric constant
    arch/powerpc/include/asm/mmu-hash64.h:396: error: conflicting types for 'mm_context_t'
    arch/powerpc/include/asm/mmu-book3e.h:184: error: previous declaration of 'mm_context_t' was here

    cc1: warnings being treated as errors
    arch/powerpc/kernel/pci_64.c: In function 'pcibios_unmap_io_space':
    arch/powerpc/kernel/pci_64.c:100: error: unused variable 'res'

    Signed-off-by: Kumar Gala
    Signed-off-by: Benjamin Herrenschmidt

    Kumar Gala
     

14 Oct, 2009

1 commit

  • When the function graph tracer is enabled, it replaces the return address
    with a hook back to the tracer. This makes back traces see the hook instead
    of the actual return address.

    The current code also shows the real address by checking if the return
    address jumps to the return_to_handler. If it is, is also prints out
    the saved real return address.

    On powerpc64, some modules may return to mod_return_to_handler, which
    is not checked. This patch will also show the real address if a return
    is to mod_return_to_handler as well.

    Signed-off-by: Steven Rostedt

    Steven Rostedt
     

24 Sep, 2009

1 commit

  • If we are using 1TB segments and we are allowed to randomise the heap, we can
    put it above 1TB so it is backed by a 1TB segment. Otherwise the heap will be
    in the bottom 1TB which always uses 256MB segments and this may result in a
    performance penalty.

    This functionality is disabled when heap randomisation is turned off:

    echo 1 > /proc/sys/kernel/randomize_va_space

    which may be useful when trying to allocate the maximum amount of 16M or 16G
    pages.

    On a microbenchmark that repeatedly touches 32GB of memory with a stride of
    256MB + 4kB (designed to stress 256MB segments while still mapping nicely into
    the L1 cache), we see the improvement:

    Force malloc to use heap all the time:
    # export MALLOC_MMAP_MAX_=0 MALLOC_TRIM_THRESHOLD_=-1

    Disable heap randomization:
    # echo 1 > /proc/sys/kernel/randomize_va_space
    # time ./test
    12.51s

    Enable heap randomization:
    # echo 2 > /proc/sys/kernel/randomize_va_space
    # time ./test
    1.70s

    Signed-off-by: Anton Blanchard
    Signed-off-by: Benjamin Herrenschmidt

    Anton Blanchard
     

11 Sep, 2009

1 commit


20 Aug, 2009

1 commit


26 Jun, 2009

1 commit

  • For some reason we've had an explicit KERN_INFO for GPR dumps. With
    recent changes we get output like:

    GPR00: 00000000 ef855eb0 ef858000 00000001 000000d0 f1000000 ffbc8000 ffffffff

    The KERN_INFO is causing the . Don't see any reason to keep it
    around.

    Signed-off-by: Kumar Gala
    Signed-off-by: Benjamin Herrenschmidt

    Kumar Gala
     

09 Jun, 2009

1 commit


03 Apr, 2009

1 commit


23 Feb, 2009

4 commits

  • Randomise ELF_ET_DYN_BASE, which is used when loading position independent
    executables.

    Signed-off-by: Anton Blanchard
    Signed-off-by: Benjamin Herrenschmidt

    Anton Blanchard
     
  • Randomize the heap.

    before:
    tundro2:~ # sleep 1 & cat /proc/${!}/maps | grep heap
    10017000-10118000 rw-p 10017000 00:00 0 [heap]
    10017000-10118000 rw-p 10017000 00:00 0 [heap]
    10017000-10118000 rw-p 10017000 00:00 0 [heap]
    10017000-10118000 rw-p 10017000 00:00 0 [heap]
    10017000-10118000 rw-p 10017000 00:00 0 [heap]

    after
    tundro2:~ # sleep 1 & cat /proc/${!}/maps | grep heap
    19419000-1951a000 rw-p 19419000 00:00 0 [heap]
    325ff000-32700000 rw-p 325ff000 00:00 0 [heap]
    1a97c000-1aa7d000 rw-p 1a97c000 00:00 0 [heap]
    1cc60000-1cd61000 rw-p 1cc60000 00:00 0 [heap]
    1afa9000-1b0aa000 rw-p 1afa9000 00:00 0 [heap]

    Signed-off-by: Anton Blanchard
    Signed-off-by: Benjamin Herrenschmidt

    Anton Blanchard
     
  • Randomise the lower bits of the stack address. More randomisation is good for
    security but the scatter can also help with SMT threads that share an L1. A
    quick test case shows this working:

    int main()
    {
    int sp;
    printf("%x\n", (unsigned long)&sp & 4095);
    }

    before:
    80
    80
    80
    80
    80

    after:
    610
    490
    300
    6b0
    d80

    Signed-off-by: Anton Blanchard
    Signed-off-by: Benjamin Herrenschmidt

    Anton Blanchard
     
  • This is a port of the function graph tracer that was written by
    Frederic Weisbecker for the x86.

    This only works for PPC64 at the moment and only for static tracing.
    PPC32 and dynamic function graph tracing support will come later.

    The trace produces a visual calling of functions:

    # tracer: function_graph
    #
    # CPU DURATION FUNCTION CALLS
    # | | | | | | |
    0) 2.224 us | }
    0) ! 271.024 us | }
    0) ! 320.080 us | }
    0) ! 324.656 us | }
    0) ! 329.136 us | }
    0) | .put_prev_task_fair() {
    0) | .update_curr() {
    0) 2.240 us | .update_min_vruntime();
    0) 6.512 us | }
    0) 2.528 us | .__enqueue_entity();
    0) + 15.536 us | }
    0) | .pick_next_task_fair() {
    0) 2.032 us | .__pick_next_entity();
    0) 2.064 us | .__clear_buddies();
    0) | .set_next_entity() {
    0) 2.672 us | .__dequeue_entity();
    0) 6.864 us | }

    Geoff Lavand tested on PS3.

    Tested-by: Geoff Levand
    Acked-by: Benjamin Herrenschmidt
    Signed-off-by: Steven Rostedt
    Signed-off-by: Benjamin Herrenschmidt

    Steven Rostedt
     

31 Dec, 2008

1 commit

  • The cpu time spent by the idle process actually doing something is
    currently accounted as idle time. This is plain wrong, the architectures
    that support VIRT_CPU_ACCOUNTING=y can do better: distinguish between the
    time spent doing nothing and the time spent by idle doing work. The first
    is accounted with account_idle_time and the second with account_system_time.
    The architectures that use the account_xxx_time interface directly and not
    the account_xxx_ticks interface now need to do the check for the idle
    process in their arch code. In particular to improve the system vs true
    idle time accounting the arch code needs to measure the true idle time
    instead of just testing for the idle process.
    To improve the tick based accounting as well we would need an architecture
    primitive that can tell us if the pt_regs of the interrupted context
    points to the magic instruction that halts the cpu.

    In addition idle time is no more added to the stime of the idle process.
    This field now contains the system time of the idle process as it should
    be. On systems without VIRT_CPU_ACCOUNTING this will always be zero as
    every tick that occurs while idle is running will be accounted as idle
    time.

    This patch contains the necessary common code changes to be able to
    distinguish idle system time and true idle time. The architectures with
    support for VIRT_CPU_ACCOUNTING need some changes to exploit this.

    Signed-off-by: Martin Schwidefsky

    Martin Schwidefsky
     

03 Dec, 2008

2 commits


04 Aug, 2008

1 commit


28 Jul, 2008

1 commit


25 Jul, 2008

1 commit

  • This patch implements support for HW based watchpoint via the
    DBSR_DAC (Data Address Compare) facility of the BookE processors.

    It does so by interfacing with the existing DABR breakpoint code
    and adding the necessary bits and pieces for the new bits to
    be properly set or cleared

    Signed-off-by: Luis Machado
    Signed-off-by: Benjamin Herrenschmidt

    Luis Machado
     

15 Jul, 2008

1 commit

  • giveup_vsx didn't save the FPU and VMX regsiters. Change it to be
    like giveup_fpr/altivec which save these registers.

    Also update call sites where FPU and VMX are already saved to use the
    original giveup_vsx (renamed to __giveup_vsx).

    Signed-off-by: Michael Neuling
    Signed-off-by: Benjamin Herrenschmidt

    Michael Neuling
     

09 Jul, 2008

1 commit


03 Jul, 2008

1 commit


01 Jul, 2008

3 commits

  • This correctly hooks the VSX dump into Roland McGrath core file
    infrastructure. It adds the VSX dump information as an additional elf
    note in the core file (after talking more to the tool chain/gdb guys).
    This also ensures the formats are consistent between signals, ptrace
    and core files.

    Signed-off-by: Michael Neuling
    Signed-off-by: Paul Mackerras

    Michael Neuling
     
  • This patch extends the floating point save and restore code to use the
    VSX load/stores when VSX is available. This will make FP context
    save/restore marginally slower on FP only code, when VSX is available,
    as it has to load/store 128bits rather than just 64bits.

    Mixing FP, VMX and VSX code will get constant architected state.

    The signals interface is extended to enable access to VSR 0-31
    doubleword 1 after discussions with tool chain maintainers. Backward
    compatibility is maintained.

    The ptrace interface is also extended to allow access to VSR 0-31 full
    registers.

    Signed-off-by: Michael Neuling
    Signed-off-by: Paul Mackerras

    Michael Neuling
     
  • We are going to change where the floating point registers are stored
    in the thread_struct, so in preparation add some macros to access the
    floating point registers. Update all code to use these new macros.

    Signed-off-by: Michael Neuling
    Signed-off-by: Paul Mackerras

    Michael Neuling
     

29 Apr, 2008

1 commit

  • This makes it possible to use separate stacks for hard and soft IRQs
    on 32-bit powerpc as well as on 64-bit. The code for 32-bit is just
    the 32-bit analog of the 64-bit code.

    * Added allocation and initialization of the irq stacks. We limit the
    stacks to be in lowmem for ppc32.
    * Implemented ppc32 versions of call_do_softirq() and call_handle_irq()
    to switch the stack pointers
    * Reworked how we do stack overflow detection. We now keep around the
    limit of the stack in the thread_struct and compare against the limit
    to see if we've overflowed. We can now use this on ppc64 if desired.

    [ paulus@samba.org: Fixed bug on 6xx where we need to reload r9 with the
    thread_info pointer. ]

    Signed-off-by: Kumar Gala
    Signed-off-by: Paul Mackerras

    Kumar Gala
     

24 Apr, 2008

1 commit

  • The powerpc kernel stacks need to be naturally aligned, as they
    contain the thread info at the bottom, which is obtained by
    clearing the low bits of the stack pointer.

    However, when using 64K pages, the stack is smaller than a page,
    so we use kmalloc to allocate it, but that doesn't provide the
    alignment guarantee we need.

    It appeared to work so far... until one enables SLUB debugging
    which then returns unaligned pointers. Ooops...

    This fixes it by using a slab cache with enforced alignment. It
    relies on my previous patch that adds a thread_info_cache_init()
    callback.

    Signed-off-by: Benjamin Herrenschmidt
    Acked-by: Andrew Morton
    Signed-off-by: Paul Mackerras

    Benjamin Herrenschmidt
     

18 Apr, 2008

1 commit


14 Apr, 2008

1 commit


28 Mar, 2008

1 commit

  • There is a bug in the powerpc DABR (data access breakpoint) handling,
    which can result in us missing breakpoints if several threads are trying
    to break on the same address.

    The circumstances are that do_page_fault() calls do_dabr(), this clears
    the DABR (sets it to 0) and sets up the signal which will report to
    userspace that the DABR was hit. The do_signal() code will restore the DABR
    value on the way out to userspace.

    If we reschedule before calling do_signal(), __switch_to() will check the
    cached DABR value and compare it to the new thread's value, if they match
    we don't set the DABR in hardware.

    So if two threads have the same DABR value, and we schedule from one to
    the other after taking the interrupt for the first thread hitting the DABR,
    the second thread will run without the DABR set in hardware.

    The cleanest fix is to move the cache update into set_dabr(), that way we
    can't forget to do it.

    Reported-by: Jan Kratochvil
    Signed-off-by: Michael Ellerman
    Signed-off-by: Paul Mackerras

    Michael Ellerman
     

26 Mar, 2008

2 commits


20 Mar, 2008

1 commit

  • Since the PMU is an NMI now, it can come at any time we are only soft
    disabled. We must hard disable around the two places we allow the kernel
    stack SLB and r1 to go out of sync. Otherwise the PMU exception can
    force a kernel stack SLB into another slot, which can lead to it
    getting evicted, which can lead to a nasty unrecoverable SLB miss
    in the exception entry code.

    Signed-off-by: Anton Blanchard
    Acked-by: Benjamin Herrenschmidt
    Acked-by: Olof Johansson
    Signed-off-by: Paul Mackerras

    Anton Blanchard
     

14 Feb, 2008

1 commit

  • The powerpc show_regs prints CPU using smp_processor_id: change that to
    raw_smp_processor_id, so that when it's showing a WARN_ON backtrace without
    preemption disabled, DEBUG_PREEMPT doesn't mess up that warning with its own.

    Signed-off-by: Hugh Dickins
    Signed-off-by: Paul Mackerras

    Hugh Dickins
     

06 Dec, 2007

1 commit

  • The commit fa13a5a1f25f671d084d8884be96fc48d9b68275 (sched: restore
    deterministic CPU accounting on powerpc), unconditionally calls
    update_process_tick() in system context. In the deterministic
    accounting case this is the correct thing to do. However, in the
    non-deterministic accounting case we need to not do this, since doing
    this results in the time accounted as hardware irq time being
    artificially elevated.

    Also this collapses 2 consecutive '#ifdef CONFIG_VIRT_CPU_ACCOUNTING'
    checks in time.h into one for neatness.

    Signed-off-by: Tony Breeds
    Signed-off-by: Paul Mackerras

    Tony Breeds
     

10 Nov, 2007

1 commit

  • Since powerpc started using CONFIG_GENERIC_CLOCKEVENTS, the
    deterministic CPU accounting (CONFIG_VIRT_CPU_ACCOUNTING) has been
    broken on powerpc, because we end up counting user time twice: once in
    timer_interrupt() and once in update_process_times().

    This fixes the problem by pulling the code in update_process_times
    that updates utime and stime into a separate function called
    account_process_tick. If CONFIG_VIRT_CPU_ACCOUNTING is not defined,
    there is a version of account_process_tick in kernel/timer.c that
    simply accounts a whole tick to either utime or stime as before. If
    CONFIG_VIRT_CPU_ACCOUNTING is defined, then arch code gets to
    implement account_process_tick.

    This also lets us simplify the s390 code a bit; it means that the s390
    timer interrupt can now call update_process_times even when
    CONFIG_VIRT_CPU_ACCOUNTING is turned on, and can just implement a
    suitable account_process_tick().

    account_process_tick() now takes the task_struct * as an argument.
    Tested both with and without CONFIG_VIRT_CPU_ACCOUNTING.

    Signed-off-by: Paul Mackerras
    Signed-off-by: Ingo Molnar

    Paul Mackerras
     

20 Oct, 2007

1 commit

  • One of the easiest things to isolate is the pid printed in kernel log.
    There was a patch, that made this for arch-independent code, this one makes
    so for arch/xxx files.

    It took some time to cross-compile it, but hopefully these are all the
    printks in arch code.

    Signed-off-by: Alexey Dobriyan
    Signed-off-by: Pavel Emelyanov
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexey Dobriyan