1. 23 8月, 2018 1 次提交
    • C
      powerpc/nohash: fix pte_access_permitted() · 810e9f86
      Christophe Leroy 提交于
      Commit 5769beaf ("powerpc/mm: Add proper pte access check helper
      for other platforms") replaced generic pte_access_permitted() by an
      arch specific one.
      
      The generic one is defined as
      (pte_present(pte) && (!(write) || pte_write(pte)))
      
      The arch specific one is open coded checking that _PAGE_USER and
      _PAGE_WRITE (_PAGE_RW) flags are set, but lacking to check that
      _PAGE_RO and _PAGE_PRIVILEGED are unset, leading to a useless test
      on targets like the 8xx which defines _PAGE_RW and _PAGE_USER as 0.
      
      Commit 5fa5b16b ("powerpc/mm/hugetlb: Use pte_access_permitted
      for hugetlb access check") replaced some tests performed with
      pte helpers by a call to pte_access_permitted(), leading to the same
      issue.
      
      This patch rewrites powerpc/nohash pte_access_permitted()
      using pte helpers.
      
      Fixes: 5769beaf ("powerpc/mm: Add proper pte access check helper for other platforms")
      Fixes: 5fa5b16b ("powerpc/mm/hugetlb: Use pte_access_permitted for hugetlb access check")
      Cc: stable@vger.kernel.org # v4.15+
      Signed-off-by: NChristophe Leroy <christophe.leroy@c-s.fr>
      Reviewed-by: NAneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      810e9f86
  2. 21 8月, 2018 2 次提交
    • S
      powerpc/topology: Get topology for shared processors at boot · 2ea62630
      Srikar Dronamraju 提交于
      On a shared LPAR, Phyp will not update the CPU associativity at boot
      time. Just after the boot system does recognize itself as a shared
      LPAR and trigger a request for correct CPU associativity. But by then
      the scheduler would have already created/destroyed its sched domains.
      
      This causes
        - Broken load balance across Nodes causing islands of cores.
        - Performance degradation esp if the system is lightly loaded
        - dmesg to wrongly report all CPUs to be in Node 0.
        - Messages in dmesg saying borken topology.
        - With commit 051f3ca0 ("sched/topology: Introduce NUMA identity
          node sched domain"), can cause rcu stalls at boot up.
      
      The sched_domains_numa_masks table which is used to generate cpumasks
      is only created at boot time just before creating sched domains and
      never updated. Hence, its better to get the topology correct before
      the sched domains are created.
      
      For example on 64 core Power 8 shared LPAR, dmesg reports
      
        Brought up 512 CPUs
        Node 0 CPUs: 0-511
        Node 1 CPUs:
        Node 2 CPUs:
        Node 3 CPUs:
        Node 4 CPUs:
        Node 5 CPUs:
        Node 6 CPUs:
        Node 7 CPUs:
        Node 8 CPUs:
        Node 9 CPUs:
        Node 10 CPUs:
        Node 11 CPUs:
        ...
        BUG: arch topology borken
             the DIE domain not a subset of the NUMA domain
        BUG: arch topology borken
             the DIE domain not a subset of the NUMA domain
      
      numactl/lscpu output will still be correct with cores spreading across
      all nodes:
      
        Socket(s):             64
        NUMA node(s):          12
        Model:                 2.0 (pvr 004d 0200)
        Model name:            POWER8 (architected), altivec supported
        Hypervisor vendor:     pHyp
        Virtualization type:   para
        L1d cache:             64K
        L1i cache:             32K
        NUMA node0 CPU(s): 0-7,32-39,64-71,96-103,176-183,272-279,368-375,464-471
        NUMA node1 CPU(s): 8-15,40-47,72-79,104-111,184-191,280-287,376-383,472-479
        NUMA node2 CPU(s): 16-23,48-55,80-87,112-119,192-199,288-295,384-391,480-487
        NUMA node3 CPU(s): 24-31,56-63,88-95,120-127,200-207,296-303,392-399,488-495
        NUMA node4 CPU(s):     208-215,304-311,400-407,496-503
        NUMA node5 CPU(s):     168-175,264-271,360-367,456-463
        NUMA node6 CPU(s):     128-135,224-231,320-327,416-423
        NUMA node7 CPU(s):     136-143,232-239,328-335,424-431
        NUMA node8 CPU(s):     216-223,312-319,408-415,504-511
        NUMA node9 CPU(s):     144-151,240-247,336-343,432-439
        NUMA node10 CPU(s):    152-159,248-255,344-351,440-447
        NUMA node11 CPU(s):    160-167,256-263,352-359,448-455
      
      Currently on this LPAR, the scheduler detects 2 levels of Numa and
      created numa sched domains for all CPUs, but it finds a single DIE
      domain consisting of all CPUs. Hence it deletes all numa sched
      domains.
      
      To address this, detect the shared processor and update topology soon
      after CPUs are setup so that correct topology is updated just before
      scheduler creates sched domain.
      
      With the fix, dmesg reports:
      
        numa: Node 0 CPUs: 0-7 32-39 64-71 96-103 176-183 272-279 368-375 464-471
        numa: Node 1 CPUs: 8-15 40-47 72-79 104-111 184-191 280-287 376-383 472-479
        numa: Node 2 CPUs: 16-23 48-55 80-87 112-119 192-199 288-295 384-391 480-487
        numa: Node 3 CPUs: 24-31 56-63 88-95 120-127 200-207 296-303 392-399 488-495
        numa: Node 4 CPUs: 208-215 304-311 400-407 496-503
        numa: Node 5 CPUs: 168-175 264-271 360-367 456-463
        numa: Node 6 CPUs: 128-135 224-231 320-327 416-423
        numa: Node 7 CPUs: 136-143 232-239 328-335 424-431
        numa: Node 8 CPUs: 216-223 312-319 408-415 504-511
        numa: Node 9 CPUs: 144-151 240-247 336-343 432-439
        numa: Node 10 CPUs: 152-159 248-255 344-351 440-447
        numa: Node 11 CPUs: 160-167 256-263 352-359 448-455
      
      and lscpu also reports:
      
        Socket(s):             64
        NUMA node(s):          12
        Model:                 2.0 (pvr 004d 0200)
        Model name:            POWER8 (architected), altivec supported
        Hypervisor vendor:     pHyp
        Virtualization type:   para
        L1d cache:             64K
        L1i cache:             32K
        NUMA node0 CPU(s): 0-7,32-39,64-71,96-103,176-183,272-279,368-375,464-471
        NUMA node1 CPU(s): 8-15,40-47,72-79,104-111,184-191,280-287,376-383,472-479
        NUMA node2 CPU(s): 16-23,48-55,80-87,112-119,192-199,288-295,384-391,480-487
        NUMA node3 CPU(s): 24-31,56-63,88-95,120-127,200-207,296-303,392-399,488-495
        NUMA node4 CPU(s):     208-215,304-311,400-407,496-503
        NUMA node5 CPU(s):     168-175,264-271,360-367,456-463
        NUMA node6 CPU(s):     128-135,224-231,320-327,416-423
        NUMA node7 CPU(s):     136-143,232-239,328-335,424-431
        NUMA node8 CPU(s):     216-223,312-319,408-415,504-511
        NUMA node9 CPU(s):     144-151,240-247,336-343,432-439
        NUMA node10 CPU(s):    152-159,248-255,344-351,440-447
        NUMA node11 CPU(s):    160-167,256-263,352-359,448-455
      Reported-by: NManjunatha H R <manjuhr1@in.ibm.com>
      Signed-off-by: NSrikar Dronamraju <srikar@linux.vnet.ibm.com>
      [mpe: Trim / format change log]
      Tested-by: NMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      2ea62630
    • L
      powerpc64/ftrace: Include ftrace.h needed for enable/disable calls · d6ee76d3
      Luke Dashjr 提交于
      this_cpu_disable_ftrace and this_cpu_enable_ftrace are inlines in
      ftrace.h Without it included, the build fails.
      
      Fixes: a4bc64d3 ("powerpc64/ftrace: Disable ftrace during kvm entry/exit")
      Cc: stable@vger.kernel.org # v4.18+
      Signed-off-by: NLuke Dashjr <luke-jr+git@utopios.org>
      Acked-by: Naveen N. Rao <naveen.n.rao at linux.vnet.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      d6ee76d3
  3. 20 8月, 2018 4 次提交
    • B
      powerpc/powernv/pci: Work around races in PCI bridge enabling · db217319
      Benjamin Herrenschmidt 提交于
      The generic code is racy when multiple children of a PCI bridge try to
      enable it simultaneously.
      
      This leads to drivers trying to access a device through a
      not-yet-enabled bridge, and this EEH errors under various
      circumstances when using parallel driver probing.
      
      There is work going on to fix that properly in the PCI core but it
      will take some time.
      
      x86 gets away with it because (outside of hotplug), the BIOS enables
      all the bridges at boot time.
      
      This patch does the same thing on powernv by enabling all bridges that
      have child devices at boot time, thus avoiding subsequent races. It's
      suitable for backporting to stable and distros, while the proper PCI
      fix will probably be significantly more invasive.
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      db217319
    • H
      powerpc/fadump: cleanup crash memory ranges support · a5818313
      Hari Bathini 提交于
      Commit 1bd6a1c4 ("powerpc/fadump: handle crash memory ranges array
      index overflow") changed crash memory ranges to a dynamic array that
      is reallocated on-demand with krealloc(). The relevant header for this
      call was not included. The kernel compiles though. But be cautious and
      add the header anyway.
      
      Also, memory allocation logic in fadump_add_crash_memory() takes care
      of memory allocation for crash memory ranges in all scenarios. Drop
      unnecessary memory allocation in fadump_setup_crash_memory_ranges().
      
      Fixes: 1bd6a1c4 ("powerpc/fadump: handle crash memory ranges array index overflow")
      Cc: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
      Signed-off-by: NHari Bathini <hbathini@linux.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      a5818313
    • N
      powerpc/powernv: provide a console flush operation for opal hvc driver · 95b861a7
      Nicholas Piggin 提交于
      Provide the flush hv_op for the opal hvc driver. This will flush the
      firmware console buffers without spinning with interrupts disabled.
      
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: linuxppc-dev@lists.ozlabs.org
      Signed-off-by: NNicholas Piggin <npiggin@gmail.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      95b861a7
    • M
      powerpc/traps: Avoid rate limit messages from show unhandled signals · 997dd26c
      Michael Ellerman 提交于
      In the recent commit to add an explicit ratelimit state when showing
      unhandled signals, commit 35a52a10 ("powerpc/traps: Use an
      explicit ratelimit state for show_signal_msg()"), I put the check of
      show_unhandled_signals and the ratelimit state before the call to
      unhandled_signal() so as to avoid unnecessarily calling the latter
      when show_unhandled_signals is false.
      
      However that causes us to check the ratelimit state on every call, so
      if we take a lot of *handled* signals that has the effect of making
      the ratelimit code print warnings that callbacks have been suppressed
      when they haven't.
      
      So rearrange the code so that we check show_unhandled_signals first,
      then call unhandled_signal() and finally check the ratelimit state.
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      Reviewed-by: NMurilo Opsfelder Araujo <muriloo@linux.ibm.com>
      997dd26c
  4. 14 8月, 2018 1 次提交
  5. 13 8月, 2018 4 次提交
  6. 10 8月, 2018 23 次提交
    • M
      powerpc/uaccess: Enable get_user(u64, *p) on 32-bit · f7a6947c
      Michael Ellerman 提交于
      Currently if you build a 32-bit powerpc kernel and use get_user() to
      load a u64 value it will fail to build with eg:
      
        kernel/rseq.o: In function `rseq_get_rseq_cs':
        kernel/rseq.c:123: undefined reference to `__get_user_bad'
      
      This is hitting the check in __get_user_size() that makes sure the
      size we're copying doesn't exceed the size of the destination:
      
        #define __get_user_size(x, ptr, size, retval)
        do {
        	retval = 0;
        	__chk_user_ptr(ptr);
        	if (size > sizeof(x))
        		(x) = __get_user_bad();
      
      Which doesn't immediately make sense because the size of the
      destination is u64, but it's not really, because __get_user_check()
      etc. internally create an unsigned long and copy into that:
      
        #define __get_user_check(x, ptr, size)
        ({
        	long __gu_err = -EFAULT;
        	unsigned long  __gu_val = 0;
      
      The problem being that on 32-bit unsigned long is not big enough to
      hold a u64. We can fix this with a trick from hpa in the x86 code, we
      statically check the type of x and set the type of __gu_val to either
      unsigned long or unsigned long long.
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      f7a6947c
    • A
      powerpc/mm/hash: Remove unnecessary do { } while(0) loop · f405b510
      Aneesh Kumar K.V 提交于
      Avoid coverity false warnings like:
      
        *** CID 187347:  Control flow issues  (UNREACHABLE)
        /arch/powerpc/mm/hash_native_64.c: 819 in native_flush_hash_range()
        813        slot += hidx & _PTEIDX_GROUP_IX;
        814        hptep = htab_address + slot;
        815        want_v = hpte_encode_avpn(vpn, psize, ssize);
        816        hpte_v = hpte_get_old_v(hptep);
        817
        818        if (!HPTE_V_COMPARE(hpte_v, want_v) || !(hpte_v & HPTE_V_VALID))
        >>>     CID 187347:  Control flow issues  (UNREACHABLE)
      Signed-off-by: NAneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      f405b510
    • N
      powerpc/64s: move machine check SLB flushing to mm/slb.c · e7e81847
      Nicholas Piggin 提交于
      The machine check code that flushes and restores bolted segments in
      real mode belongs in mm/slb.c. This will also be used by pseries
      machine check and idle code in future changes.
      Signed-off-by: NNicholas Piggin <npiggin@gmail.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      e7e81847
    • A
      powerpc/powernv/idle: Fix build error · ae24ce5e
      Aneesh Kumar K.V 提交于
      Fix the below build error using strlcpy instead of strncpy
      
      In function 'pnv_parse_cpuidle_dt',
          inlined from 'pnv_init_idle_states' at arch/powerpc/platforms/powernv/idle.c:840:7,
          inlined from '__machine_initcall_powernv_pnv_init_idle_states' at arch/powerpc/platforms/powernv/idle.c:870:1:
      arch/powerpc/platforms/powernv/idle.c:820:3: error: 'strncpy' specified bound 16 equals destination size [-Werror=stringop-truncation]
         strncpy(pnv_idle_states[i].name, temp_string[i],
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          PNV_IDLE_NAME_LEN);
      Signed-off-by: NAneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      ae24ce5e
    • A
      powerpc/mm/tlbflush: update the mmu_gather page size while iterating address range · 0b6aa1a2
      Aneesh Kumar K.V 提交于
      This patch makes sure we update the mmu_gather page size even if we are
      requesting for a fullmm flush. This avoids triggering VM_WARN_ON in code
      paths like __tlb_remove_page_size that explicitly check for removing range page
      size to be same as mmu gather page size.
      
      Fixes: 5a609934 ("powerpc/64s/radix: tlb do not flush on page size when fullmm")
      Signed-off-by: NAneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
      Acked-by: NNicholas Piggin <npiggin@gmail.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      0b6aa1a2
    • M
      powerpc/mm: remove warning about ‘type’ being set · fce278af
      Mathieu Malaterre 提交于
      ‘type’ is only used when CONFIG_DEBUG_HIGHMEM is set. So add a possibly
      unused tag to variable. Remove warning treated as error with W=1:
      
        arch/powerpc/mm/highmem.c:59:6: error: variable ‘type’ set but not used [-Werror=unused-but-set-variable]
      Signed-off-by: NMathieu Malaterre <malat@debian.org>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      fce278af
    • M
      powerpc/32: Include setup.h header file to fix warnings · f2c6d0d1
      Mathieu Malaterre 提交于
      Make sure to include setup.h to provide the following prototypes:
      
        - irqstack_early_init
        - setup_power_save
        - initialize_cache_info
      
      Fix the following warnings (treated as error in W=1):
      
        arch/powerpc/kernel/setup_32.c:198:13: error: no previous prototype for ‘irqstack_early_init’
        arch/powerpc/kernel/setup_32.c:238:13: error: no previous prototype for ‘setup_power_save’
        arch/powerpc/kernel/setup_32.c:253:13: error: no previous prototype for ‘initialize_cache_info’
      Signed-off-by: NMathieu Malaterre <malat@debian.org>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      f2c6d0d1
    • M
      powerpc: Move `path` variable inside DEBUG_PROM · eab00a20
      Mathieu Malaterre 提交于
      Add gcc attribute unused for two variables. Fix warnings treated as errors
      with W=1:
      
        arch/powerpc/kernel/prom_init.c:1388:8: error: variable ‘path’ set but not used [-Werror=unused-but-set-variable]
      Suggested-by: NChristophe Leroy <christophe.leroy@c-s.fr>
      Signed-off-by: NMathieu Malaterre <malat@debian.org>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      eab00a20
    • M
      powerpc/powermac: Make some functions static · 618a89d7
      Mathieu Malaterre 提交于
      These functions can all be static, make it so. Fix warnings treated as
      errors with W=1:
      
        arch/powerpc/platforms/powermac/pci.c:1022:6: error: no previous prototype for ‘pmac_pci_fixup_ohci’
        arch/powerpc/platforms/powermac/pci.c:1057:6: error: no previous prototype for ‘pmac_pci_fixup_cardbus’
        arch/powerpc/platforms/powermac/pci.c:1094:6: error: no previous prototype for ‘pmac_pci_fixup_pciata’
      
      Remove has_address declaration and assignment since it's not used.
      Also add gcc attribute unused to fix a warning treated as error with
      W=1:
      
        arch/powerpc/platforms/powermac/pci.c:784:19: error: variable ‘has_address’ set but not used
        arch/powerpc/platforms/powermac/pci.c:907:22: error: variable ‘ht’ set but not used
      Suggested-by: NChristophe Leroy <christophe.leroy@c-s.fr>
      Signed-off-by: NMathieu Malaterre <malat@debian.org>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      618a89d7
    • M
      powerpc/powermac: Remove variable x that's never read · 8921305c
      Mathieu Malaterre 提交于
      Since the value of x is never intended to be read, remove it. Fix
      warning treated as error with W=1:
      
        arch/powerpc/platforms/powermac/udbg_scc.c:76:9: error: variable ‘x’ set but not used
      Suggested-by: NChristophe Leroy <christophe.leroy@c-s.fr>
      Signed-off-by: NMathieu Malaterre <malat@debian.org>
      Reviewed-by: NChristophe Leroy <christophe.leroy@c-s.fr>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      8921305c
    • M
      cxl: remove a dead branch · e4ecafb1
      Mathieu Malaterre 提交于
      In commit 14baf4d9 ("cxl: Add guest-specific code") the following code
      was added:
      
      	if (afu->crs_len < 0) {
      		dev_err(&afu->dev, "Unexpected configuration record size value\n");
      		return -EINVAL;
      	}
      
      However the variable `crs_len` is of type u64 and cannot be compared < 0.
      Remove the dead code section. Fix the following warning treated as error
      with W=1:
      
      ../drivers/misc/cxl/guest.c:919:19: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits]
      Signed-off-by: NMathieu Malaterre <malat@debian.org>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      e4ecafb1
    • M
      powerpc/powermac: Add missing include of header pmac.h · 2fff0f07
      Mathieu Malaterre 提交于
      The header `pmac.h` was not included, leading to the following warnings,
      treated as error with W=1:
      
        arch/powerpc/platforms/powermac/time.c:69:13: error: no previous prototype for ‘pmac_time_init’ [-Werror=missing-prototypes]
        arch/powerpc/platforms/powermac/time.c:207:15: error: no previous prototype for ‘pmac_get_boot_time’ [-Werror=missing-prototypes]
        arch/powerpc/platforms/powermac/time.c:222:6: error: no previous prototype for ‘pmac_get_rtc_time’ [-Werror=missing-prototypes]
        arch/powerpc/platforms/powermac/time.c:240:5: error: no previous prototype for ‘pmac_set_rtc_time’ [-Werror=missing-prototypes]
        arch/powerpc/platforms/powermac/time.c:259:12: error: no previous prototype for ‘via_calibrate_decr’ [-Werror=missing-prototypes]
        arch/powerpc/platforms/powermac/time.c:311:13: error: no previous prototype for ‘pmac_calibrate_decr’ [-Werror=missing-prototypes]
      
      The function `via_calibrate_decr` was made static to silence a warning.
      Signed-off-by: NMathieu Malaterre <malat@debian.org>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      2fff0f07
    • M
      powerpc/kexec: Use common error handling code in setup_new_fdt() · baedcdf5
      Markus Elfring 提交于
      Add a jump target so that a bit of exception handling can be better
      reused at the end of this function.
      
      This issue was detected by using the Coccinelle software.
      Signed-off-by: NMarkus Elfring <elfring@users.sourceforge.net>
      Reviewed-by: NThiago Jung Bauermann <bauerman@linux.vnet.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      baedcdf5
    • B
      powerpc/xmon: Add address lookup for percpu symbols · 302c7b0c
      Boqun Feng 提交于
      Currently, in xmon, there is no obvious way to get an address for a
      percpu symbol for a particular cpu. Having such an ability would be
      good for debugging the system when percpu variables got involved.
      
      Therefore, this patch introduces a new xmon command "lp" to lookup the
      address for percpu symbols. Usage of "lp" is similar to "ls", except
      that we could add a cpu number to choose the variable of which cpu we
      want to lookup. If no cpu number is given, lookup for current cpu.
      Signed-off-by: NBoqun Feng <boqun.feng@gmail.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      302c7b0c
    • C
      powerpc/mm: remove huge_pte_offset_and_shift() prototype · 646dbe40
      Christophe Leroy 提交于
      huge_pte_offset_and_shift() has never existed
      Signed-off-by: NChristophe Leroy <christophe.leroy@c-s.fr>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      646dbe40
    • C
      powerpc/lib: Use patch_site to patch copy_32 functions once cache is enabled · fa54a981
      Christophe Leroy 提交于
      The symbol memcpy_nocache_branch defined in order to allow patching
      of memset function once cache is enabled leads to confusing reports
      by perf tool.
      
      Using the new patch_site functionality solves this issue.
      Signed-off-by: NChristophe Leroy <christophe.leroy@c-s.fr>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      fa54a981
    • M
      powerpc/pseries: Fix endianness while restoring of r3 in MCE handler. · cd813e1c
      Mahesh Salgaonkar 提交于
      During Machine Check interrupt on pseries platform, register r3 points
      RTAS extended event log passed by hypervisor. Since hypervisor uses r3
      to pass pointer to rtas log, it stores the original r3 value at the
      start of the memory (first 8 bytes) pointed by r3. Since hypervisor
      stores this info and rtas log is in BE format, linux should make
      sure to restore r3 value in correct endian format.
      
      Without this patch when MCE handler, after recovery, returns to code that
      that caused the MCE may end up with Data SLB access interrupt for invalid
      address followed by kernel panic or hang.
      
        Severe Machine check interrupt [Recovered]
          NIP [d00000000ca301b8]: init_module+0x1b8/0x338 [bork_kernel]
          Initiator: CPU
          Error type: SLB [Multihit]
            Effective address: d00000000ca70000
        cpu 0xa: Vector: 380 (Data SLB Access) at [c0000000fc7775b0]
            pc: c0000000009694c0: vsnprintf+0x80/0x480
            lr: c0000000009698e0: vscnprintf+0x20/0x60
            sp: c0000000fc777830
           msr: 8000000002009033
           dar: a803a30c000000d0
          current = 0xc00000000bc9ef00
          paca    = 0xc00000001eca5c00	 softe: 3	 irq_happened: 0x01
            pid   = 8860, comm = insmod
        vscnprintf+0x20/0x60
        vprintk_emit+0xb4/0x4b0
        vprintk_func+0x5c/0xd0
        printk+0x38/0x4c
        init_module+0x1c0/0x338 [bork_kernel]
        do_one_initcall+0x54/0x230
        do_init_module+0x8c/0x248
        load_module+0x12b8/0x15b0
        sys_finit_module+0xa8/0x110
        system_call+0x58/0x6c
        --- Exception: c00 (System Call) at 00007fff8bda0644
        SP (7fffdfbfe980) is in userspace
      
      This patch fixes this issue.
      
      Fixes: a08a53ea ("powerpc/le: Enable RTAS events support")
      Cc: stable@vger.kernel.org # v3.15+
      Reviewed-by: NNicholas Piggin <npiggin@gmail.com>
      Signed-off-by: NMahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      cd813e1c
    • H
      powerpc/fadump: merge adjacent memory ranges to reduce PT_LOAD segements · ced1bf52
      Hari Bathini 提交于
      With dynamic memory allocation support for crash memory ranges array,
      there is no hard limit on the no. of crash memory ranges kernel could
      export, but program headers count could overflow in the /proc/vmcore
      ELF file while exporting each memory range as PT_LOAD segment. Reduce
      the likelihood of a such scenario, by folding adjacent crash memory
      ranges which minimizes the total number of PT_LOAD segments.
      Signed-off-by: NHari Bathini <hbathini@linux.ibm.com>
      Reviewed-by: NMahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      ced1bf52
    • H
      powerpc/fadump: handle crash memory ranges array index overflow · 1bd6a1c4
      Hari Bathini 提交于
      Crash memory ranges is an array of memory ranges of the crashing kernel
      to be exported as a dump via /proc/vmcore file. The size of the array
      is set based on INIT_MEMBLOCK_REGIONS, which works alright in most cases
      where memblock memory regions count is less than INIT_MEMBLOCK_REGIONS
      value. But this count can grow beyond INIT_MEMBLOCK_REGIONS value since
      commit 142b45a7 ("memblock: Add array resizing support").
      
      On large memory systems with a few DLPAR operations, the memblock memory
      regions count could be larger than INIT_MEMBLOCK_REGIONS value. On such
      systems, registering fadump results in crash or other system failures
      like below:
      
        task: c00007f39a290010 ti: c00000000b738000 task.ti: c00000000b738000
        NIP: c000000000047df4 LR: c0000000000f9e58 CTR: c00000000010f180
        REGS: c00000000b73b570 TRAP: 0300   Tainted: G          L   X  (4.4.140+)
        MSR: 8000000000009033 <SF,EE,ME,IR,DR,RI,LE>  CR: 22004484  XER: 20000000
        CFAR: c000000000008500 DAR: 000007a450000000 DSISR: 40000000 SOFTE: 0
        ...
        NIP [c000000000047df4] smp_send_reschedule+0x24/0x80
        LR [c0000000000f9e58] resched_curr+0x138/0x160
        Call Trace:
          resched_curr+0x138/0x160 (unreliable)
          check_preempt_curr+0xc8/0xf0
          ttwu_do_wakeup+0x38/0x150
          try_to_wake_up+0x224/0x4d0
          __wake_up_common+0x94/0x100
          ep_poll_callback+0xac/0x1c0
          __wake_up_common+0x94/0x100
          __wake_up_sync_key+0x70/0xa0
          sock_def_readable+0x58/0xa0
          unix_stream_sendmsg+0x2dc/0x4c0
          sock_sendmsg+0x68/0xa0
          ___sys_sendmsg+0x2cc/0x2e0
          __sys_sendmsg+0x5c/0xc0
          SyS_socketcall+0x36c/0x3f0
          system_call+0x3c/0x100
      
      as array index overflow is not checked for while setting up crash memory
      ranges causing memory corruption. To resolve this issue, dynamically
      allocate memory for crash memory ranges and resize it incrementally,
      in units of pagesize, on hitting array size limit.
      
      Fixes: 2df173d9 ("fadump: Initialize elfcore header and add PT_LOAD program headers.")
      Cc: stable@vger.kernel.org # v3.4+
      Signed-off-by: NHari Bathini <hbathini@linux.ibm.com>
      Reviewed-by: NMahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
      [mpe: Just use PAGE_SIZE directly, fixup variable placement]
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      1bd6a1c4
    • C
      powerpc/cpm1: fix compilation error with CONFIG_PPC_EARLY_DEBUG_CPM · 6bd6d867
      Christophe Leroy 提交于
      commit e8cb7a55 ("powerpc: remove superflous inclusions of
      asm/fixmap.h") removed inclusion of asm/fixmap.h from files not
      including objects from that file.
      
      However, asm/mmu-8xx.h includes  call to __fix_to_virt(). The proper
      way would be to include asm/fixmap.h in asm/mmu-8xx.h but it creates
      an inclusion loop.
      
      So we have to leave asm/fixmap.h in sysdep/cpm_common.c for
      CONFIG_PPC_EARLY_DEBUG_CPM
      
        CC      arch/powerpc/sysdev/cpm_common.o
      In file included from ./arch/powerpc/include/asm/mmu.h:340:0,
                       from ./arch/powerpc/include/asm/reg_8xx.h:8,
                       from ./arch/powerpc/include/asm/reg.h:29,
                       from ./arch/powerpc/include/asm/processor.h:13,
                       from ./arch/powerpc/include/asm/thread_info.h:28,
                       from ./include/linux/thread_info.h:38,
                       from ./arch/powerpc/include/asm/ptrace.h:159,
                       from ./arch/powerpc/include/asm/hw_irq.h:12,
                       from ./arch/powerpc/include/asm/irqflags.h:12,
                       from ./include/linux/irqflags.h:16,
                       from ./include/asm-generic/cmpxchg-local.h:6,
                       from ./arch/powerpc/include/asm/cmpxchg.h:537,
                       from ./arch/powerpc/include/asm/atomic.h:11,
                       from ./include/linux/atomic.h:5,
                       from ./include/linux/mutex.h:18,
                       from ./include/linux/kernfs.h:13,
                       from ./include/linux/sysfs.h:16,
                       from ./include/linux/kobject.h:20,
                       from ./include/linux/device.h:16,
                       from ./include/linux/node.h:18,
                       from ./include/linux/cpu.h:17,
                       from ./include/linux/of_device.h:5,
                       from arch/powerpc/sysdev/cpm_common.c:21:
      arch/powerpc/sysdev/cpm_common.c: In function ‘udbg_init_cpm’:
      ./arch/powerpc/include/asm/mmu-8xx.h:218:25: error: implicit declaration of function ‘__fix_to_virt’ [-Werror=implicit-function-declaration]
       #define VIRT_IMMR_BASE (__fix_to_virt(FIX_IMMR_BASE))
                               ^
      arch/powerpc/sysdev/cpm_common.c:75:7: note: in expansion of macro ‘VIRT_IMMR_BASE’
             VIRT_IMMR_BASE);
             ^
      ./arch/powerpc/include/asm/mmu-8xx.h:218:39: error: ‘FIX_IMMR_BASE’ undeclared (first use in this function)
       #define VIRT_IMMR_BASE (__fix_to_virt(FIX_IMMR_BASE))
                                             ^
      arch/powerpc/sysdev/cpm_common.c:75:7: note: in expansion of macro ‘VIRT_IMMR_BASE’
             VIRT_IMMR_BASE);
             ^
      ./arch/powerpc/include/asm/mmu-8xx.h:218:39: note: each undeclared identifier is reported only once for each function it appears in
       #define VIRT_IMMR_BASE (__fix_to_virt(FIX_IMMR_BASE))
                                             ^
      arch/powerpc/sysdev/cpm_common.c:75:7: note: in expansion of macro ‘VIRT_IMMR_BASE’
             VIRT_IMMR_BASE);
             ^
      cc1: all warnings being treated as errors
      make[1]: *** [arch/powerpc/sysdev/cpm_common.o] Error 1
      
      Fixes: e8cb7a55 ("powerpc: remove superflous inclusions of asm/fixmap.h")
      Signed-off-by: NChristophe Leroy <christophe.leroy@c-s.fr>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      6bd6d867
    • D
      powerpc: Fix size calculation using resource_size() · c42d3be0
      Dan Carpenter 提交于
      The problem is the the calculation should be "end - start + 1" but the
      plus one is missing in this calculation.
      
      Fixes: 8626816e ("powerpc: add support for MPIC message register API")
      Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
      Reviewed-by: NTyrel Datwyler <tyreld@linux.vnet.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      c42d3be0
    • R
      24576a70
    • R
      powerpc/powernv: Allow memory that has been hot-removed to be hot-added · d3da701d
      Rashmica Gupta 提交于
      This patch allows the memory removed by memtrace to be readded to the
      kernel. So now you don't have to reboot your system to add the memory
      back to the kernel or to have a different amount of memory removed.
      Signed-off-by: NRashmica Gupta <rashmica.g@gmail.com>
      Tested-by: NMichael Neuling <mikey@neuling.org>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      d3da701d
  7. 09 8月, 2018 4 次提交
    • C
      powerpc/dts/fsl: t2080rdb: use the Cortina PHY driver compatible · bd964612
      Camelia Groza 提交于
      The Cortina PHY is not compatible with IEEE 802.3 clause 45.
      Signed-off-by: NCamelia Groza <camelia.groza@nxp.com>
      [scottwood: made commit message about compatibility, not driver choice]
      Signed-off-by: NScott Wood <oss@buserror.net>
      bd964612
    • C
      powerpc/dts/fsl: t4240rdb: use the Cortina PHY driver compatible · 39e560a9
      Camelia Groza 提交于
      The Cortina PHY is not compatible with IEEE 802.3 clause 45.
      Signed-off-by: NCamelia Groza <camelia.groza@nxp.com>
      [scottwood: made commit message about compatibility, not driver choice]
      Signed-off-by: NScott Wood <oss@buserror.net>
      39e560a9
    • C
      powerpc/configs/dpaa: enable the Cortina PHY driver · 24f36ce6
      Camelia Groza 提交于
      Cortina PHYs are present on T4240RDB and T2080RDB. Enable the driver
      by default.
      Signed-off-by: NCamelia Groza <camelia.groza@nxp.com>
      Signed-off-by: NScott Wood <oss@buserror.net>
      24f36ce6
    • C
      powerpc/cpm1: fix compilation error with CONFIG_PPC_EARLY_DEBUG_CPM · 2a39926c
      Christophe Leroy 提交于
      commit e8cb7a55 ("powerpc: remove superflous inclusions of
      asm/fixmap.h") removed inclusion of asm/fixmap.h from files not
      including objects from that file.
      
      However, asm/mmu-8xx.h includes  call to __fix_to_virt(). The proper
      way would be to include asm/fixmap.h in asm/mmu-8xx.h but it creates
      an inclusion loop.
      
      So we have to leave asm/fixmap.h in sysdep/cpm_common.c for
      CONFIG_PPC_EARLY_DEBUG_CPM
      
        CC      arch/powerpc/sysdev/cpm_common.o
      In file included from ./arch/powerpc/include/asm/mmu.h:340:0,
                       from ./arch/powerpc/include/asm/reg_8xx.h:8,
                       from ./arch/powerpc/include/asm/reg.h:29,
                       from ./arch/powerpc/include/asm/processor.h:13,
                       from ./arch/powerpc/include/asm/thread_info.h:28,
                       from ./include/linux/thread_info.h:38,
                       from ./arch/powerpc/include/asm/ptrace.h:159,
                       from ./arch/powerpc/include/asm/hw_irq.h:12,
                       from ./arch/powerpc/include/asm/irqflags.h:12,
                       from ./include/linux/irqflags.h:16,
                       from ./include/asm-generic/cmpxchg-local.h:6,
                       from ./arch/powerpc/include/asm/cmpxchg.h:537,
                       from ./arch/powerpc/include/asm/atomic.h:11,
                       from ./include/linux/atomic.h:5,
                       from ./include/linux/mutex.h:18,
                       from ./include/linux/kernfs.h:13,
                       from ./include/linux/sysfs.h:16,
                       from ./include/linux/kobject.h:20,
                       from ./include/linux/device.h:16,
                       from ./include/linux/node.h:18,
                       from ./include/linux/cpu.h:17,
                       from ./include/linux/of_device.h:5,
                       from arch/powerpc/sysdev/cpm_common.c:21:
      arch/powerpc/sysdev/cpm_common.c: In function ‘udbg_init_cpm’:
      ./arch/powerpc/include/asm/mmu-8xx.h:218:25: error: implicit declaration of function ‘__fix_to_virt’ [-Werror=implicit-function-declaration]
       #define VIRT_IMMR_BASE (__fix_to_virt(FIX_IMMR_BASE))
                               ^
      arch/powerpc/sysdev/cpm_common.c:75:7: note: in expansion of macro ‘VIRT_IMMR_BASE’
             VIRT_IMMR_BASE);
             ^
      ./arch/powerpc/include/asm/mmu-8xx.h:218:39: error: ‘FIX_IMMR_BASE’ undeclared (first use in this function)
       #define VIRT_IMMR_BASE (__fix_to_virt(FIX_IMMR_BASE))
                                             ^
      arch/powerpc/sysdev/cpm_common.c:75:7: note: in expansion of macro ‘VIRT_IMMR_BASE’
             VIRT_IMMR_BASE);
             ^
      ./arch/powerpc/include/asm/mmu-8xx.h:218:39: note: each undeclared identifier is reported only once for each function it appears in
       #define VIRT_IMMR_BASE (__fix_to_virt(FIX_IMMR_BASE))
                                             ^
      arch/powerpc/sysdev/cpm_common.c:75:7: note: in expansion of macro ‘VIRT_IMMR_BASE’
             VIRT_IMMR_BASE);
             ^
      cc1: all warnings being treated as errors
      make[1]: *** [arch/powerpc/sysdev/cpm_common.o] Error 1
      
      Fixes: e8cb7a55 ("powerpc: remove superflous inclusions of asm/fixmap.h")
      Signed-off-by: NChristophe Leroy <christophe.leroy@c-s.fr>
      Signed-off-by: NScott Wood <oss@buserror.net>
      2a39926c
  8. 08 8月, 2018 1 次提交
    • B
      selftests/powerpc: Kill child processes on SIGINT · 7c27a26e
      Breno Leitao 提交于
      There are some powerpc selftests, as tm/tm-unavailable, that run for a long
      period (>120 seconds), and if it is interrupted, as pressing CRTL-C
      (SIGINT), the foreground process (harness) dies but the child process and
      threads continue to execute (with PPID = 1 now) in background.
      
      In this case, you'd think the whole test exited, but there are remaining
      threads and processes being executed in background. Sometimes these
      zombies processes are doing annoying things, as consuming the whole CPU or
      dumping things to STDOUT.
      
      This patch fixes this problem by attaching an empty signal handler to
      SIGINT in the harness process. This handler will interrupt (EINTR) the
      parent process waitpid() call, letting the code to follow through the
      normal flow, which will kill all the processes in the child process group.
      
      This patch also fixes a typo.
      Signed-off-by: NBreno Leitao <leitao@debian.org>
      Signed-off-by: NGustavo Romero <gromero@linux.vnet.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      7c27a26e