12 Feb, 2015

1 commit

  • Pull powerpc updates from Michael Ellerman:

    - Update of all defconfigs

    - Addition of a bunch of config options to modernise our defconfigs

    - Some PS3 updates from Geoff

    - Optimised memcmp for 64 bit from Anton

    - Fix for kprobes that allows 'perf probe' to work from Naveen

    - Several cxl updates from Ian & Ryan

    - Expanded support for the '24x7' PMU from Cody & Sukadev

    - Freescale updates from Scott:
    "Highlights include 8xx optimizations, some more work on datapath
    device tree content, e300 machine check support, t1040 corenet
    error reporting, and various cleanups and fixes"

    * tag 'powerpc-3.20-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mpe/linux: (102 commits)
    cxl: Add missing return statement after handling AFU errror
    cxl: Fail AFU initialisation if an invalid configuration record is found
    cxl: Export optional AFU configuration record in sysfs
    powerpc/mm: Warn on flushing tlb page in kernel context
    powerpc/powernv: Add OPAL soft-poweroff routine
    powerpc/perf/hv-24x7: Document sysfs event description entries
    powerpc/perf/hv-gpci: add the remaining gpci requests
    powerpc/perf/{hv-gpci, hv-common}: generate requests with counters annotated
    powerpc/perf/hv-24x7: parse catalog and populate sysfs with events
    perf: define EVENT_DEFINE_RANGE_FORMAT_LITE helper
    perf: add PMU_EVENT_ATTR_STRING() helper
    perf: provide sysfs_show for struct perf_pmu_events_attr
    powerpc/kernel: Avoid initializing device-tree pointer twice
    powerpc: Remove old compile time disabled syscall tracing code
    powerpc/kernel: Make syscall_exit a local label
    cxl: Fix device_node reference counting
    powerpc/mm: bail out early when flushing TLB page
    powerpc: defconfigs: add MTD_SPI_NOR (new dependency for M25P80)
    perf/powerpc: reset event hw state when adding it to the PMU
    powerpc/qe: Use strlcpy()
    ...

    Linus Torvalds
     

19 Jan, 2015

1 commit

  • The commit 3b8a3c010969 ("powerpc/pseries: Fix endiannes issue in RTAS
    call from xmon") was fixing an endianness issue in the call made from
    xmon to RTAS.

    However, as Michael Ellerman noticed, this fix was not complete, the
    token value was not byte swapped. This lead to call an unexpected and
    most of the time unexisting RTAS function, which is silently ignored by
    RTAS.

    This fix addresses this hole.

    Reported-by: Michael Ellerman
    Cc: stable@vger.kernel.org
    Signed-off-by: Laurent Dufour
    Signed-off-by: Michael Ellerman

    Laurent Dufour
     

29 Dec, 2014

1 commit

  • isxdigit() macro definition is the same.

    isalnum() from linux/ctype.h will accept additional latin non-ASCII
    characters. This is harmless since this macro is used in scanhex() which
    parses user input.

    isspace() from linux/ctype.h will accept vertical tab and form feed but
    not NULL. The use of this macro is modified to accept NULL as
    well. Additional characters are harmless since this macro is also only
    used in scanhex().

    Signed-off-by: Vincent Bernat
    Signed-off-by: Michael Ellerman

    Vincent Bernat
     

12 Dec, 2014

1 commit

  • Pull powerpc updates from Michael Ellerman:
    "Some nice cleanups like removing bootmem, and removal of
    __get_cpu_var().

    There is one patch to mm/gup.c. This is the generic GUP
    implementation, but is only used by us and arm(64). We have an ack
    from Steve Capper, and although we didn't get an ack from Andrew he
    told us to take the patch through the powerpc tree.

    There's one cxl patch. This is in drivers/misc, but Greg said he was
    happy for us to manage fixes for it.

    There is an infrastructure patch to support an IPMI driver for OPAL.

    There is also an RTC driver for OPAL. We weren't able to get any
    response from the RTC maintainer, Alessandro Zummo, so in the end we
    just merged the driver.

    The usual batch of Freescale updates from Scott"

    * tag 'powerpc-3.19-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mpe/linux: (101 commits)
    powerpc/powernv: Return to cpu offline loop when finished in KVM guest
    powerpc/book3s: Fix partial invalidation of TLBs in MCE code.
    powerpc/mm: don't do tlbie for updatepp request with NO HPTE fault
    powerpc/xmon: Cleanup the breakpoint flags
    powerpc/xmon: Enable HW instruction breakpoint on POWER8
    powerpc/mm/thp: Use tlbiel if possible
    powerpc/mm/thp: Remove code duplication
    powerpc/mm/hugetlb: Sanity check gigantic hugepage count
    powerpc/oprofile: Disable pagefaults during user stack read
    powerpc/mm: Check for matching hpte without taking hpte lock
    powerpc: Drop useless warning in eeh_init()
    powerpc/powernv: Cleanup unused MCE definitions/declarations.
    powerpc/eeh: Dump PHB diag-data early
    powerpc/eeh: Recover EEH error on ownership change for BCM5719
    powerpc/eeh: Set EEH_PE_RESET on PE reset
    powerpc/eeh: Refactor eeh_reset_pe()
    powerpc: Remove more traces of bootmem
    powerpc/pseries: Initialise nvram_pstore_info's buf_lock
    cxl: Name interrupts in /proc/interrupt
    cxl: Return error to PSL if IRQ demultiplexing fails & print clearer warning
    ...

    Linus Torvalds
     

02 Dec, 2014

2 commits

  • Drop BP_IABR_TE, which though used, does not do anything useful. Rename
    BP_IABR to BP_CIABR. Renumber the flags.

    Signed-off-by: Michael Ellerman

    Michael Ellerman
     
  • This patch enables support for hardware instruction breakpoint in xmon
    on POWER8 platform with the help of a new register called the CIABR
    (Completed Instruction Address Breakpoint Register). With this patch, a
    single hardware instruction breakpoint can be added and cleared during
    any active xmon debug session. The hardware based instruction breakpoint
    mechanism works correctly with the existing TRAP based instruction
    breakpoint available on xmon.

    There are no powerpc CPU with CPU_FTR_IABR feature any more. This patch
    has re-purposed all the existing IABR related code to work with CIABR
    register based HW instruction breakpoint.

    This has one odd feature, which is that when we hit a breakpoint xmon
    doesn't tell us we have hit the breakpoint. This is because xmon is
    expecting bp->address == regs->nip. Because CIABR fires on completition
    regs->nip points to the instruction after the breakpoint. We could fix
    that, but it would then confuse other parts of the xmon code which think
    we need to emulate the instruction. [mpe]

    Signed-off-by: Michael Ellerman
    Signed-off-by: Anshuman Khandual

    Anshuman Khandual
     

27 Nov, 2014

1 commit

  • On pseries system (LPAR) xmon failed to enter when running in LE mode,
    system is hunging. Inititating xmon will lead to such an output on the
    console:

    SysRq : Entering xmon
    cpu 0x15: Vector: 0 at [c0000003f39ffb10]
    pc: c00000000007ed7c: sysrq_handle_xmon+0x5c/0x70
    lr: c00000000007ed7c: sysrq_handle_xmon+0x5c/0x70
    sp: c0000003f39ffc70
    msr: 8000000000009033
    current = 0xc0000003fafa7180
    paca = 0xc000000007d75e80 softe: 0 irq_happened: 0x01
    pid = 14617, comm = bash
    Bad kernel stack pointer fafb4b0 at eca7cc4
    cpu 0x15: Vector: 300 (Data Access) at [c000000007f07d40]
    pc: 000000000eca7cc4
    lr: 000000000eca7c44
    sp: fafb4b0
    msr: 8000000000001000
    dar: 10000000
    dsisr: 42000000
    current = 0xc0000003fafa7180
    paca = 0xc000000007d75e80 softe: 0 irq_happened: 0x01
    pid = 14617, comm = bash
    cpu 0x15: Exception 300 (Data Access) in xmon, returning to main loop
    xmon: WARNING: bad recursive fault on cpu 0x15

    The root cause is that xmon is calling RTAS to turn off the surveillance
    when entering xmon, and RTAS is requiring big endian parameters.

    This patch is byte swapping the RTAS arguments when running in LE mode.

    Cc: stable@vger.kernel.org
    Signed-off-by: Laurent Dufour
    Signed-off-by: Michael Ellerman

    Laurent Dufour
     

12 Nov, 2014

1 commit


03 Nov, 2014

1 commit

  • The generic Linux framework to power off the machine is a function pointer
    called pm_power_off. The trick about this pointer is that device drivers can
    potentially implement it rather than board files.

    Today on powerpc we set pm_power_off to invoke our generic full machine power
    off logic which then calls ppc_md.power_off to invoke machine specific power
    off.

    However, when we want to add a power off GPIO via the "gpio-poweroff" driver,
    this card house falls apart. That driver only registers itself if pm_power_off
    is NULL to ensure it doesn't override board specific logic. However, since we
    always set pm_power_off to the generic power off logic (which will just not
    power off the machine if no ppc_md.power_off call is implemented), we can't
    implement power off via the generic GPIO power off driver.

    To fix this up, let's get rid of the ppc_md.power_off logic and just always use
    pm_power_off as was intended. Then individual drivers such as the GPIO power off
    driver can implement power off logic via that function pointer.

    With this patch set applied and a few patches on top of QEMU that implement a
    power off GPIO on the virt e500 machine, I can successfully turn off my virtual
    machine after halt.

    Signed-off-by: Alexander Graf
    [mpe: Squash into one patch and update changelog based on cover letter]
    Signed-off-by: Michael Ellerman

    Alexander Graf
     

13 Aug, 2014

1 commit

  • xmon only soft disables interrupts. This seems like a bad idea - we
    certainly don't want decrementer and PMU exceptions going off when
    we are debugging something inside xmon.

    This issue was uncovered when the hard lockup detector went off
    inside xmon. To ensure we wont get a spurious hard lockup warning,
    I also call touch_nmi_watchdog() when exiting xmon.

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

    Anton Blanchard
     

28 Jul, 2014

2 commits

  • We now only support cpus that use an SLB, so we don't need an MMU
    feature to indicate that.

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

    Michael Ellerman
     
  • Old cpus didn't have a Segment Lookaside Buffer (SLB), instead they had
    a Segment Table (STAB). Now that we've dropped support for those cpus,
    we can remove the STAB support entirely.

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

    Michael Ellerman
     

11 Jun, 2014

1 commit


05 Jun, 2014

1 commit

  • There are a couple of places where xmon is using %x to print values that
    are unsigned long.

    I found this out the hard way recently:

    0:mon> p c000000000d0e7c8 c00000033dc90000 00000000a0000089 c000000000000000
    return value is 0x96300500

    Which is calling find_linux_pte_or_hugepte(), the result should be a
    kernel pointer. After decoding the page tables by hand I discovered the
    correct value was c000000396300500.

    So fix up that case and a few others.

    We also use a mix of 0x%x, %x and %u to print cpu numbers. So
    standardise on 0x%x.

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

    Michael Ellerman
     

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
     

07 Mar, 2014

1 commit


11 Feb, 2014

3 commits

  • Currently we set our cpu's bit in cpus_in_xmon, and then we take the
    output lock and print the exception information.

    This can race with the master cpu entering the command loop and printing
    the backtrace. The result is that the backtrace gets garbled with
    another cpu's exception print out.

    Fix it by delaying the set of cpus_in_xmon until we are finished
    printing.

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

    Michael Ellerman
     
  • As far as I can tell, our 70s era timeout loop in get_output_lock() is
    generating no code.

    This leads to the hostile takeover happening more or less simultaneously
    on all cpus. The result is "interesting", some example output that is
    more readable than most:

    cpu 0x1: Vector: 100 (Scypsut e0mx bR:e setV)e catto xc0p:u[ c 00
    c0:0 000t0o0V0erc0td:o5 rfc28050000]0c00 0 0 0 6t(pSrycsV1ppuot
    uxe 1m 2 0Rx21e3:0s0ce000c00000t00)00 60602oV2SerucSayt0y 0p 1sxs

    Fix it by using udelay() in the timeout loop. The wait time and check
    frequency are arbitrary, but seem to work OK. We already rely on
    udelay() working so this is not a new dependency.

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

    Michael Ellerman
     
  • If we enter with xmon_speaker != 0 we skip the first cmpxchg(), we also
    skip the while loop because xmon_speaker != last_speaker (0) - meaning we
    skip the second cmpxchg() also.

    Following that code path the compiler sees no memory barriers and so is
    within its rights to never reload xmon_speaker. The end result is we loop
    forever.

    This manifests as all cpus being in xmon ('c' command), but they refuse
    to take control when you switch to them ('c x' for cpu # x).

    I have seen this deadlock in practice and also checked the generated code to
    confirm this is what's happening.

    The simplest fix is just to always try the cmpxchg().

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

    Michael Ellerman
     

05 Dec, 2013

1 commit

  • This patch introduces exclusive emergency stack for machine check exception.
    We use emergency stack to handle machine check exception so that we can save
    MCE information (srr1, srr0, dar and dsisr) before turning on ME bit and be
    ready for re-entrancy. This helps us to prevent clobbering of MCE information
    in case of nested machine checks.

    The reason for using emergency stack over normal kernel stack is that the
    machine check might occur in the middle of setting up a stack frame which may
    result into improper use of kernel stack.

    Signed-off-by: Mahesh Salgaonkar
    Acked-by: Paul Mackerras
    Signed-off-by: Benjamin Herrenschmidt

    Mahesh Salgaonkar
     

05 Sep, 2013

1 commit

  • Commit 24ec2125f3 ("powerpc/xmon: Use cpumask iterator to avoid warning")
    replaced a loop from 0 to NR_CPUS-1 with a for_each_possible_cpu() loop,
    which means that if the last possible cpu is in xmon, we print the
    wrong value for the end of the range. For example, if 4 cpus are
    possible, NR_CPUS is 128, and all cpus are in xmon, we print "0-7f"
    rather than "0-3". The code also assumes that the set of possible
    cpus is contiguous, which may not necessarily be true.

    This fixes the code to check explicitly for contiguity, and to print
    the ending value correctly.

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

    Paul Mackerras
     

27 Aug, 2013

1 commit


03 May, 2013

1 commit

  • Pull powerpc update from Benjamin Herrenschmidt:
    "The main highlights this time around are:

    - A pile of addition POWER8 bits and nits, such as updated
    performance counter support (Michael Ellerman), new branch history
    buffer support (Anshuman Khandual), base support for the new PCI
    host bridge when not using the hypervisor (Gavin Shan) and other
    random related bits and fixes from various contributors.

    - Some rework of our page table format by Aneesh Kumar which fixes a
    thing or two and paves the way for THP support. THP itself will
    not make it this time around however.

    - More Freescale updates, including Altivec support on the new e6500
    cores, new PCI controller support, and a pile of new boards support
    and updates.

    - The usual batch of trivial cleanups & fixes"

    * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc: (156 commits)
    powerpc: Fix build error for book3e
    powerpc: Context switch the new EBB SPRs
    powerpc: Turn on the EBB H/FSCR bits
    powerpc: Replace CPU_FTR_BCTAR with CPU_FTR_ARCH_207S
    powerpc: Setup BHRB instructions facility in HFSCR for POWER8
    powerpc: Fix interrupt range check on debug exception
    powerpc: Update tlbie/tlbiel as per ISA doc
    powerpc: Print page size info during boot
    powerpc: print both base and actual page size on hash failure
    powerpc: Fix hpte_decode to use the correct decoding for page sizes
    powerpc: Decode the pte-lp-encoding bits correctly.
    powerpc: Use encode avpn where we need only avpn values
    powerpc: Reduce PTE table memory wastage
    powerpc: Move the pte free routines from common header
    powerpc: Reduce the PTE_INDEX_SIZE
    powerpc: Switch 16GB and 16MB explicit hugepages to a different page table format
    powerpc: New hugepage directory format
    powerpc: Don't truncate pgd_index wrongly
    powerpc: Don't hard code the size of pte page
    powerpc: Save DAR and DSISR in pt_regs on MCE
    ...

    Linus Torvalds
     

01 May, 2013

1 commit

  • Currently help message of /proc/sysrq-trigger highlight its
    upper-case characters, like below:

    SysRq : HELP : loglevel(0-9) reBoot Crash terminate-all-tasks(E)
    memory-full-oom-kill(F) kill-all-tasks(I) ...

    this would confuse user trigger sysrq by upper-case character, which is
    inconsistent with the real lower-case character registed key.

    This inconsistent help message will also lead more confused when
    26 upper-case letters put into use in future.

    This patch fix powerpc xmon sysrq key: "xmon(x)"

    Signed-off-by: zhangwei(Jovi)
    Cc: Benjamin Herrenschmidt
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    zhangwei(Jovi)
     

30 Apr, 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

2 commits

  • 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
     
  • Finally remove the two level TOC and build with -mcmodel=medium.

    Unfortunately we can't build modules with -mcmodel=medium due to
    the tricks the kernel module loader plays with percpu data:

    # -mcmodel=medium breaks modules because it uses 32bit offsets from
    # the TOC pointer to create pointers where possible. Pointers into the
    # percpu data area are created by this method.
    #
    # The kernel module loader relocates the percpu data section from the
    # original location (starting with 0xd...) to somewhere in the base
    # kernel percpu data space (starting with 0xc...). We need a full
    # 64bit relocation for this to work, hence -mcmodel=large.

    On older kernels we fall back to the two level TOC (-mminimal-toc)

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

    Anton Blanchard
     

15 Nov, 2012

9 commits


18 Sep, 2012

1 commit

  • This was originally motivated by a desire to see the mapping between
    logical and hardware cpu numbers.

    But it seemed that it made more sense to just add a command to dump
    (most of) the paca.

    With no arguments "dp" will dump the paca for the current cpu.

    It also takes an argument, eg. "dp 3" which is the logical cpu number
    in hex. This form does not check if the cpu is possible, but displays
    the paca regardless, as well as the cpu's state in the possible, present
    and online masks.

    Thirdly, "dpa" will display the paca for all possible cpus. If there are
    no possible cpus, like early in boot, it will tell you that.

    Sample output, number in brackets is the offset into the struct:

    2:mon> dp 3
    paca for cpu 0x3 @ c00000000ff20a80:
    possible = yes
    present = yes
    online = yes
    lock_token = 0x8000 (0x8)
    paca_index = 0x3 (0xa)
    kernel_toc = 0xc00000000144f990 (0x10)
    kernelbase = 0xc000000000000000 (0x18)
    kernel_msr = 0xb000000000001032 (0x20)
    stab_real = 0x0 (0x28)
    stab_addr = 0x0 (0x30)
    emergency_sp = 0xc00000003ffe4000 (0x38)
    data_offset = 0xa40000 (0x40)
    hw_cpu_id = 0x9 (0x50)
    cpu_start = 0x1 (0x52)
    kexec_state = 0x0 (0x53)
    __current = 0xc00000007e568680 (0x218)
    kstack = 0xc00000007e5a3e30 (0x220)
    stab_rr = 0x1a (0x228)
    saved_r1 = 0xc00000007e7cb450 (0x230)
    trap_save = 0x0 (0x240)
    soft_enabled = 0x0 (0x242)
    irq_happened = 0x0 (0x243)
    io_sync = 0x0 (0x244)
    irq_work_pending = 0x0 (0x245)
    nap_state_lost = 0x0 (0x246)

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

    Michael Ellerman
     

10 Sep, 2012

1 commit

  • 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
     

24 Aug, 2012

1 commit