1. 25 Jun, 2021 2 commits
    • Vaibhav Jain's avatar
      powerpc/papr_scm: Make 'perf_stats' invisible if perf-stats unavailable · ed78f56e
      Vaibhav Jain authored
      In case performance stats for an nvdimm are not available, reading the
      'perf_stats' sysfs file returns an -ENOENT error. A better approach is
      to make the 'perf_stats' file entirely invisible to indicate that
      performance stats for an nvdimm are unavailable.
      
      So this patch updates 'papr_nd_attribute_group' to add a 'is_visible'
      callback implemented as newly introduced 'papr_nd_attribute_visible()'
      that returns an appropriate mode in case performance stats aren't
      supported in a given nvdimm.
      
      Also the initialization of 'papr_scm_priv.stat_buffer_len' is moved
      from papr_scm_nvdimm_init() to papr_scm_probe() so that it value is
      available when 'papr_nd_attribute_visible()' is called during nvdimm
      initialization.
      
      Even though 'perf_stats' attribute is available since v5.9, there are
      no known user-space tools/scripts that are dependent on presence of its
      sysfs file. Hence I dont expect any user-space breakage with this
      patch.
      
      Fixes: 2d02bf83 ("powerpc/papr_scm: Fetch nvdimm performance stats from PHYP")
      Signed-off-by: default avatarVaibhav Jain <vaibhav@linux.ibm.com>
      Reviewed-by: default avatarDan Williams <dan.j.williams@intel.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20210513092349.285021-1-vaibhav@linux.ibm.com
      ed78f56e
    • Naveen N. Rao's avatar
      powerpc/kprobes: Fix Oops by passing ppc_inst as a pointer to emulate_step() on ppc32 · 511eea5e
      Naveen N. Rao authored
      Trying to use a kprobe on ppc32 results in the below splat:
          BUG: Unable to handle kernel data access on read at 0x7c0802a6
          Faulting instruction address: 0xc002e9f0
          Oops: Kernel access of bad area, sig: 11 [#1]
          BE PAGE_SIZE=4K PowerPC 44x Platform
          Modules linked in:
          CPU: 0 PID: 89 Comm: sh Not tainted 5.13.0-rc1-01824-g3a81c0495fdb #7
          NIP:  c002e9f0 LR: c0011858 CTR: 00008a47
          REGS: c292fd50 TRAP: 0300   Not tainted  (5.13.0-rc1-01824-g3a81c0495fdb)
          MSR:  00009000 <EE,ME>  CR: 24002002  XER: 20000000
          DEAR: 7c0802a6 ESR: 00000000
          <snip>
          NIP [c002e9f0] emulate_step+0x28/0x324
          LR [c0011858] optinsn_slot+0x128/0x10000
          Call Trace:
           opt_pre_handler+0x7c/0xb4 (unreliable)
           optinsn_slot+0x128/0x10000
           ret_from_syscall+0x0/0x28
      
      The offending instruction is:
          81 24 00 00     lwz     r9,0(r4)
      
      Here, we are trying to load the second argument to emulate_step():
      struct ppc_inst, which is the instruction to be emulated. On ppc64,
      structures are passed in registers when passed by value. However, per
      the ppc32 ABI, structures are always passed to functions as pointers.
      This isn't being adhered to when setting up the call to emulate_step()
      in the optprobe trampoline. Fix the same.
      
      Fixes: eacf4c02 ("powerpc: Enable OPTPROBES on PPC32")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Signed-off-by: default avatarChristophe Leroy <christophe.leroy@csgroup.eu>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/5bdc8cbc9a95d0779e27c9ddbf42b40f51f883c0.1624425798.git.christophe.leroy@csgroup.eu
      511eea5e
  2. 24 Jun, 2021 36 commits
  3. 22 Jun, 2021 2 commits