1. 03 8月, 2019 1 次提交
  2. 02 8月, 2019 2 次提交
    • M
      arm64: Make debug exception handlers visible from RCU · d8bb6718
      Masami Hiramatsu 提交于
      Make debug exceptions visible from RCU so that synchronize_rcu()
      correctly track the debug exception handler.
      
      This also introduces sanity checks for user-mode exceptions as same
      as x86's ist_enter()/ist_exit().
      
      The debug exception can interrupt in idle task. For example, it warns
      if we put a kprobe on a function called from idle task as below.
      The warning message showed that the rcu_read_lock() caused this
      problem. But actually, this means the RCU is lost the context which
      is already in NMI/IRQ.
      
        /sys/kernel/debug/tracing # echo p default_idle_call >> kprobe_events
        /sys/kernel/debug/tracing # echo 1 > events/kprobes/enable
        /sys/kernel/debug/tracing # [  135.122237]
        [  135.125035] =============================
        [  135.125310] WARNING: suspicious RCU usage
        [  135.125581] 5.2.0-08445-g9187c508bdc7 #20 Not tainted
        [  135.125904] -----------------------------
        [  135.126205] include/linux/rcupdate.h:594 rcu_read_lock() used illegally while idle!
        [  135.126839]
        [  135.126839] other info that might help us debug this:
        [  135.126839]
        [  135.127410]
        [  135.127410] RCU used illegally from idle CPU!
        [  135.127410] rcu_scheduler_active = 2, debug_locks = 1
        [  135.128114] RCU used illegally from extended quiescent state!
        [  135.128555] 1 lock held by swapper/0/0:
        [  135.128944]  #0: (____ptrval____) (rcu_read_lock){....}, at: call_break_hook+0x0/0x178
        [  135.130499]
        [  135.130499] stack backtrace:
        [  135.131192] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.2.0-08445-g9187c508bdc7 #20
        [  135.131841] Hardware name: linux,dummy-virt (DT)
        [  135.132224] Call trace:
        [  135.132491]  dump_backtrace+0x0/0x140
        [  135.132806]  show_stack+0x24/0x30
        [  135.133133]  dump_stack+0xc4/0x10c
        [  135.133726]  lockdep_rcu_suspicious+0xf8/0x108
        [  135.134171]  call_break_hook+0x170/0x178
        [  135.134486]  brk_handler+0x28/0x68
        [  135.134792]  do_debug_exception+0x90/0x150
        [  135.135051]  el1_dbg+0x18/0x8c
        [  135.135260]  default_idle_call+0x0/0x44
        [  135.135516]  cpu_startup_entry+0x2c/0x30
        [  135.135815]  rest_init+0x1b0/0x280
        [  135.136044]  arch_call_rest_init+0x14/0x1c
        [  135.136305]  start_kernel+0x4d4/0x500
        [  135.136597]
      
      So make debug exception visible to RCU can fix this warning.
      Reported-by: NNaresh Kamboju <naresh.kamboju@linaro.org>
      Acked-by: NPaul E. McKenney <paulmck@linux.ibm.com>
      Signed-off-by: NMasami Hiramatsu <mhiramat@kernel.org>
      Signed-off-by: NWill Deacon <will@kernel.org>
      d8bb6718
    • M
      arm64: kprobes: Recover pstate.D in single-step exception handler · b3980e48
      Masami Hiramatsu 提交于
      kprobes manipulates the interrupted PSTATE for single step, and
      doesn't restore it. Thus, if we put a kprobe where the pstate.D
      (debug) masked, the mask will be cleared after the kprobe hits.
      
      Moreover, in the most complicated case, this can lead a kernel
      crash with below message when a nested kprobe hits.
      
      [  152.118921] Unexpected kernel single-step exception at EL1
      
      When the 1st kprobe hits, do_debug_exception() will be called.
      At this point, debug exception (= pstate.D) must be masked (=1).
      But if another kprobes hits before single-step of the first kprobe
      (e.g. inside user pre_handler), it unmask the debug exception
      (pstate.D = 0) and return.
      Then, when the 1st kprobe setting up single-step, it saves current
      DAIF, mask DAIF, enable single-step, and restore DAIF.
      However, since "D" flag in DAIF is cleared by the 2nd kprobe, the
      single-step exception happens soon after restoring DAIF.
      
      This has been introduced by commit 7419333f ("arm64: kprobe:
      Always clear pstate.D in breakpoint exception handler")
      
      To solve this issue, this stores all DAIF bits and restore it
      after single stepping.
      Reported-by: NNaresh Kamboju <naresh.kamboju@linaro.org>
      Fixes: 7419333f ("arm64: kprobe: Always clear pstate.D in breakpoint exception handler")
      Reviewed-by: NJames Morse <james.morse@arm.com>
      Tested-by: NJames Morse <james.morse@arm.com>
      Signed-off-by: NMasami Hiramatsu <mhiramat@kernel.org>
      Signed-off-by: NWill Deacon <will@kernel.org>
      b3980e48
  3. 01 8月, 2019 14 次提交
  4. 31 7月, 2019 7 次提交
  5. 30 7月, 2019 10 次提交
    • M
      powerpc/spe: Mark expected switch fall-throughs · 7db57e77
      Michael Ellerman 提交于
      Mark switch cases where we are expecting to fall through.
      
      Fixes errors such as below, seen with mpc85xx_defconfig:
      
        arch/powerpc/kernel/align.c: In function 'emulate_spe':
        arch/powerpc/kernel/align.c:178:8: error: this statement may fall through
          ret |= __get_user_inatomic(temp.v[3], p++);
              ^~
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20190730141917.21817-1-mpe@ellerman.id.au
      7db57e77
    • A
      powerpc/nvdimm: Pick nearby online node if the device node is not online · da1115fd
      Aneesh Kumar K.V 提交于
      Currently, nvdimm subsystem expects the device numa node for SCM device to be
      an online node. It also doesn't try to bring the device numa node online. Hence
      if we use a non-online numa node as device node we hit crashes like below. This
      is because we try to access uninitialized NODE_DATA in different code paths.
      
      cpu 0x0: Vector: 300 (Data Access) at [c0000000fac53170]
          pc: c0000000004bbc50: ___slab_alloc+0x120/0xca0
          lr: c0000000004bc834: __slab_alloc+0x64/0xc0
          sp: c0000000fac53400
         msr: 8000000002009033
         dar: 73e8
       dsisr: 80000
        current = 0xc0000000fabb6d80
        paca    = 0xc000000003870000   irqmask: 0x03   irq_happened: 0x01
          pid   = 7, comm = kworker/u16:0
      Linux version 5.2.0-06234-g76bd729b2644 (kvaneesh@ltc-boston123) (gcc version 7.4.0 (Ubuntu 7.4.0-1ubuntu1~18.04.1)) #135 SMP Thu Jul 11 05:36:30 CDT 2019
      enter ? for help
      [link register   ] c0000000004bc834 __slab_alloc+0x64/0xc0
      [c0000000fac53400] c0000000fac53480 (unreliable)
      [c0000000fac53500] c0000000004bc818 __slab_alloc+0x48/0xc0
      [c0000000fac53560] c0000000004c30a0 __kmalloc_node_track_caller+0x3c0/0x6b0
      [c0000000fac535d0] c000000000cfafe4 devm_kmalloc+0x74/0xc0
      [c0000000fac53600] c000000000d69434 nd_region_activate+0x144/0x560
      [c0000000fac536d0] c000000000d6b19c nd_region_probe+0x17c/0x370
      [c0000000fac537b0] c000000000d6349c nvdimm_bus_probe+0x10c/0x230
      [c0000000fac53840] c000000000cf3cc4 really_probe+0x254/0x4e0
      [c0000000fac538d0] c000000000cf429c driver_probe_device+0x16c/0x1e0
      [c0000000fac53950] c000000000cf0b44 bus_for_each_drv+0x94/0x130
      [c0000000fac539b0] c000000000cf392c __device_attach+0xdc/0x200
      [c0000000fac53a50] c000000000cf231c bus_probe_device+0x4c/0xf0
      [c0000000fac53a90] c000000000ced268 device_add+0x528/0x810
      [c0000000fac53b60] c000000000d62a58 nd_async_device_register+0x28/0xa0
      [c0000000fac53bd0] c0000000001ccb8c async_run_entry_fn+0xcc/0x1f0
      [c0000000fac53c50] c0000000001bcd9c process_one_work+0x46c/0x860
      [c0000000fac53d20] c0000000001bd4f4 worker_thread+0x364/0x5f0
      [c0000000fac53db0] c0000000001c7260 kthread+0x1b0/0x1c0
      [c0000000fac53e20] c00000000000b954 ret_from_kernel_thread+0x5c/0x68
      
      The patch tries to fix this by picking the nearest online node as the SCM node.
      This does have a problem of us losing the information that SCM node is
      equidistant from two other online nodes. If applications need to understand these
      fine-grained details we should express then like x86 does via
      /sys/devices/system/node/nodeX/accessY/initiators/
      
      With the patch we get
      
       # numactl -H
      available: 2 nodes (0-1)
      node 0 cpus:
      node 0 size: 0 MB
      node 0 free: 0 MB
      node 1 cpus: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
      node 1 size: 130865 MB
      node 1 free: 129130 MB
      node distances:
      node   0   1
        0:  10  20
        1:  20  10
       # cat /sys/bus/nd/devices/region0/numa_node
      0
       # dmesg | grep papr_scm
      [   91.332305] papr_scm ibm,persistent-memory:ibm,pmemory@44104001: Region registered with target node 2 and online node 0
      Signed-off-by: NAneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20190729095128.23707-1-aneesh.kumar@linux.ibm.com
      da1115fd
    • H
      s390/mm: add fallthrough annotations · 7f5aa115
      Heiko Carstens 提交于
      Commit a035d552 ("Makefile: Globally enable fall-through warning")
      enables fall-through warnings globally. Add missing annotations.
      Signed-off-by: NHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: NVasily Gorbik <gor@linux.ibm.com>
      7f5aa115
    • V
      s390/mm: make gmap_test_and_clear_dirty_pmd static · ffbd2685
      Vasily Gorbik 提交于
      Since gmap_test_and_clear_dirty_pmd is not exported and has no reason to
      be globally visible make it static to avoid the following sparse warning:
      arch/s390/mm/gmap.c:2427:6: warning: symbol 'gmap_test_and_clear_dirty_pmd' was not declared. Should it be static?
      Signed-off-by: NVasily Gorbik <gor@linux.ibm.com>
      ffbd2685
    • V
      s390/kexec: add missing include to machine_kexec_reloc.c · 1877011a
      Vasily Gorbik 提交于
      Include <asm/kexec.h> into machine_kexec_reloc.c to expose
      arch_kexec_do_relocs declaration and avoid the following sparse warnings:
      arch/s390/kernel/machine_kexec_reloc.c:4:5: warning: symbol 'arch_kexec_do_relocs' was not declared. Should it be static?
      arch/s390/boot/../kernel/machine_kexec_reloc.c:4:5: warning: symbol 'arch_kexec_do_relocs' was not declared. Should it be static?
      Signed-off-by: NVasily Gorbik <gor@linux.ibm.com>
      1877011a
    • V
      s390/perf: make cf_diag_csd static · 06f9895f
      Vasily Gorbik 提交于
      Since there is really no reason for cf_diag_csd per cpu variable to be
      globally visible make it static to avoid the following sparse warning:
      arch/s390/kernel/perf_cpum_cf_diag.c:37:1: warning: symbol 'cf_diag_csd' was not declared. Should it be static?
      Signed-off-by: NVasily Gorbik <gor@linux.ibm.com>
      06f9895f
    • V
      s390/lib: add missing include · d25220d2
      Vasily Gorbik 提交于
      Include <asm/xor.h> into arch/s390/lib/xor.c to expose xor_block_xc
      declaration and avoid the following sparse warning:
      arch/s390/lib/xor.c:128:27: warning: symbol 'xor_block_xc' was not declared. Should it be static?
      Signed-off-by: NVasily Gorbik <gor@linux.ibm.com>
      d25220d2
    • V
      s390/boot: add missing declarations and includes · 868202ce
      Vasily Gorbik 提交于
      Add __swsusp_reset_dma declaration to avoid the following sparse warnings:
      arch/s390/kernel/setup.c:107:15: warning: symbol '__swsusp_reset_dma' was not declared. Should it be static?
      arch/s390/boot/startup.c:52:15: warning: symbol '__swsusp_reset_dma' was not declared. Should it be static?
      
      Add verify_facilities declaration to avoid the following sparse warning:
      arch/s390/boot/als.c:105:6: warning: symbol 'verify_facilities' was not declared. Should it be static?
      
      Include "boot.h" into arch/s390/boot/kaslr.c to expose get_random_base
      function declaration and avoid the following sparse warning:
      arch/s390/boot/kaslr.c:90:15: warning: symbol 'get_random_base' was not declared. Should it be static?
      Signed-off-by: NVasily Gorbik <gor@linux.ibm.com>
      868202ce
    • H
      s390: update configs · 3361f319
      Heiko Carstens 提交于
      Signed-off-by: NHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: NVasily Gorbik <gor@linux.ibm.com>
      3361f319
    • J
      s390: clean up qdio.h · d655e5b4
      Julian Wiedmann 提交于
      Fix two typos, document missing fields in the driver initialization
      data and remove the copy&pasted 'pfmt' field from the qdr struct.
      Signed-off-by: NJulian Wiedmann <jwi@linux.ibm.com>
      Reviewed-by: NJens Remus <jremus@linux.ibm.com>
      Signed-off-by: NVasily Gorbik <gor@linux.ibm.com>
      d655e5b4
  6. 29 7月, 2019 6 次提交