20 May, 2014

1 commit

  • Currently, on 8641D, which doesn't set CONFIG_HAVE_HW_BREAKPOINT
    we get the following splat:

    BUG: using smp_processor_id() in preemptible [00000000] code: login/1382
    caller is set_breakpoint+0x1c/0xa0
    CPU: 0 PID: 1382 Comm: login Not tainted 3.15.0-rc3-00041-g2aafe1a4d451 #1
    Call Trace:
    [decd5d80] [c0008dc4] show_stack+0x50/0x158 (unreliable)
    [decd5dc0] [c03c6fa0] dump_stack+0x7c/0xdc
    [decd5de0] [c01f8818] check_preemption_disabled+0xf4/0x104
    [decd5e00] [c00086b8] set_breakpoint+0x1c/0xa0
    [decd5e10] [c00d4530] flush_old_exec+0x2bc/0x588
    [decd5e40] [c011c468] load_elf_binary+0x2ac/0x1164
    [decd5ec0] [c00d35f8] search_binary_handler+0xc4/0x1f8
    [decd5ef0] [c00d4ee8] do_execve+0x3d8/0x4b8
    [decd5f40] [c001185c] ret_from_syscall+0x0/0x38
    --- Exception: c01 at 0xfeee554
    LR = 0xfeee7d4

    The call path in this case is:

    flush_thread
    --> set_debug_reg_defaults
    --> set_breakpoint
    --> __get_cpu_var

    Since preemption is enabled in the cleanup of flush thread, and
    there is no need to disable it, introduce the distinction between
    set_breakpoint and __set_breakpoint, leaving only the flush_thread
    instance as the current user of set_breakpoint.

    Signed-off-by: Paul Gortmaker
    Signed-off-by: Benjamin Herrenschmidt

    Paul Gortmaker
     

15 Jan, 2014

1 commit

  • None of these files are actually using any __init type directives
    and hence don't need to include . Most are just a
    left over from __devinit and __cpuinit removal, or simply due to
    code getting copied from one driver to the next.

    The one instance where we add an include for init.h covers off
    a case where that file was implicitly getting it from another
    header which itself didn't need it.

    Signed-off-by: Paul Gortmaker
    Signed-off-by: Benjamin Herrenschmidt

    Paul Gortmaker
     

02 Jul, 2013

1 commit

  • The Data Address Watchpoint Register (DAWR) on POWER8 can take a 512
    byte range but this range must not cross a 512 byte boundary.

    Unfortunately we were off by one when calculating the end of the region,
    hence we were not allowing some breakpoint regions which were actually
    valid. This fixes this error.

    Signed-off-by: Michael Neuling
    Reported-by: Edjunior Barbosa Machado
    Cc: stable@vger.kernel.org # 3.9+
    Signed-off-by: Benjamin Herrenschmidt

    Michael Neuling
     

25 Jun, 2013

1 commit

  • In 9422de3 "powerpc: Hardware breakpoints rewrite to handle non DABR breakpoint
    registers" we changed the way we mark extraneous irqs with this:

    - info->extraneous_interrupt = !((bp->attr.bp_addr attr.bp_addr < bp->attr.bp_len));
    + if (!((bp->attr.bp_addr attr.bp_addr < bp->attr.bp_len)))
    + info->type |= HW_BRK_TYPE_EXTRANEOUS_IRQ;

    Unfortunately this is bogus as it never clears extraneous IRQ if it's already
    set.

    This correctly clears extraneous IRQ before possibly setting it.

    Signed-off-by: Michael Neuling
    Reported-by: Edjunior Barbosa Machado
    Cc: stable@vger.kernel.org
    Signed-off-by: Benjamin Herrenschmidt

    Michael Neuling
     

29 Jan, 2013

1 commit


16 Jan, 2013

1 commit

  • With allmodconfig we are getting:
    drivers/tty/synclink_gt.c:160:12: error: conflicting types for 'set_break'
    arch/powerpc/include/asm/debug.h:49:5: note: previous declaration of 'set_break' was here

    drivers/tty/synclinkmp.c:526:12: error: conflicting types for 'set_break'
    arch/powerpc/include/asm/debug.h:49:5: note: previous declaration of 'set_break' was here

    This renames set_break to set_breakpoint to avoid this naming conflict

    Signed-off-by: Michael Neuling
    Reported-by: Fengguang Wu
    Signed-off-by: Benjamin Herrenschmidt

    Michael Neuling
     

10 Jan, 2013

1 commit

  • This is a rewrite so that we don't assume we are using the DABR throughout the
    code. We now use the arch_hw_breakpoint to store the breakpoint in a generic
    manner in the thread_struct, rather than storing the raw DABR value.

    The ptrace GET/SET_DEBUGREG interface currently passes the raw DABR in from
    userspace. We keep this functionality, so that future changes (like the POWER8
    DAWR), will still fake the DABR to userspace.

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

    Michael Neuling
     

10 Sep, 2012

2 commits

  • Currently we mark the DABRX to interrupt on all matches
    (hypervisor/kernel/user and then filter in software. We can be a lot
    smarter now that we can set the DABRX dynamically.

    This sets the DABRX based on the flags passed by the user.

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

    Michael Neuling
     
  • Rework set_dabr to take a DABRX value as well.

    Both the pseries and PS3 hypervisors do some checks on the DABRX
    values that are passed in the hcall. This patch stops bogus values
    from being passed to hypervisor. Also, in the case where we are
    clearing the breakpoint, where DABR and DABRX are zero, we modify the
    DABRX value to make it valid so that the hcall won't fail.

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

    Michael Neuling
     

07 Sep, 2012

1 commit


24 Aug, 2012

1 commit

  • Currently if you are doing a global perf recording with hardware
    breakpoints (ie perf record -e mem:0xdeadbeef -a), you can oops with:

    Faulting instruction address: 0xc000000000738890
    cpu 0xc: Vector: 300 (Data Access) at [c0000003f76af8d0]
    pc: c000000000738890: .hw_breakpoint_handler+0xa0/0x1e0
    lr: c000000000738830: .hw_breakpoint_handler+0x40/0x1e0
    sp: c0000003f76afb50
    msr: 8000000000001032
    dar: 6f0
    dsisr: 42000000
    current = 0xc0000003f765ac00
    paca = 0xc00000000f262a00 softe: 0 irq_happened: 0x01
    pid = 6810, comm = loop-read
    enter ? for help
    [c0000003f76afbe0] c00000000073cd04 .notifier_call_chain.isra.0+0x84/0xe0
    [c0000003f76afc80] c00000000073cdbc .notify_die+0x3c/0x60
    [c0000003f76afd20] c0000000000139f0 .do_dabr+0x40/0xf0
    [c0000003f76afe30] c000000000005a9c handle_dabr_fault+0x14/0x48
    --- Exception: 300 (Data Access) at 0000000010000480
    SP (ff8679e0) is in userspace

    This is because we don't check to see if the break point is associated
    with task before we deference the task_struct pointer.

    This changes the update to use current.

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

    Michael Neuling
     

11 Jul, 2012

1 commit


01 Nov, 2011

1 commit


30 Jun, 2010

1 commit

  • At present, hw_breakpoint_slots() returns 1 regardless of what
    type of breakpoint is specified in the type argument. Since we
    don't define CONFIG_HAVE_MIXED_BREAKPOINTS_REGS, there are
    separate values for TYPE_INST and TYPE_DATA, and hw_breakpoint_slots()
    returns 1 for both, effectively advertising instruction breakpoint
    support which doesn't exist.

    This fixes it by making hw_breakpoint_slots return 1 for TYPE_DATA
    and 0 for TYPE_INST. This moves hw_breakpoint_slots() from the
    powerpc hw_breakpoint.h to hw_breakpoint.c because the definitions
    of TYPE_INST and TYPE_DATA aren't available in .
    They are defined in but we can't include
    that header in , and nor can we rely on
    being included before .
    Since hw_breakpoint_slots() is only called at boot time, there is
    no performance impact from making it a real function rather than
    a static inline.

    Signed-off-by: Paul Mackerras

    Paul Mackerras
     

23 Jun, 2010

2 commits


22 Jun, 2010

3 commits

  • Many a times, the requested breakpoint length can be less than the
    fixed breakpoint length i.e. 8 bytes supported by PowerPC 64-bit
    server (Book III S) processors. This could lead to extraneous
    interrupts resulting in false breakpoint notifications. This
    detects and discards such interrupts for non-ptrace requests.
    We don't change ptrace behaviour to avoid breaking compatability.

    [Suggestion from Paul Mackerras to add a new flag in
    'struct arch_hw_breakpoint' to identify extraneous interrupts]

    Signed-off-by: K.Prasad
    Signed-off-by: Paul Mackerras

    K.Prasad
     
  • A signal delivered between a hw_breakpoint_handler() and the
    single_step_dabr_instruction() will not have the breakpoint active
    while the signal handler is running -- the signal delivery will
    set up a new MSR value which will not have MSR_SE set, so we
    won't get the signal step interrupt until and unless the signal
    handler returns (which it may never do).

    To fix this, we restore the breakpoint when delivering a signal --
    we clear the MSR_SE bit and set the DABR again. If the signal
    handler returns, the DABR interrupt will occur again when the
    instruction that we were originally trying to single-step gets
    re-executed.

    [Paul Mackerras pointed out the need to do this.]

    Signed-off-by: K.Prasad
    Signed-off-by: Paul Mackerras

    K.Prasad
     
  • Implement perf-events based hw-breakpoint interfaces for PowerPC
    64-bit server (Book III S) processors. This allows access to a
    given location to be used as an event that can be counted or
    profiled by the perf_events subsystem.

    This is done using the DABR (data breakpoint register), which can
    also be used for process debugging via ptrace. When perf_event
    hw_breakpoint support is configured in, the perf_event subsystem
    manages the DABR and arbitrates access to it, and ptrace then
    creates a perf_event when it is requested to set a data breakpoint.

    [Adopted suggestions from Paul Mackerras to
    - emulate_step() all system-wide breakpoints and single-step only the
    per-task breakpoints
    - perform arch-specific cleanup before unregistration through
    arch_unregister_hw_breakpoint()
    ]

    Signed-off-by: K.Prasad
    Signed-off-by: Paul Mackerras

    K.Prasad