1. 26 Aug, 2021 21 commits
    • Srikar Dronamraju's avatar
      powerpc/smp: Enable CACHE domain for shared processor · 5bf63497
      Srikar Dronamraju authored
      Currently CACHE domain is not enabled on shared processor mode PowerVM
      LPARS. On PowerVM systems, 'ibm,thread-group' device-tree property 2
      under cpu-device-node indicates which all CPUs share L2-cache. However
      'ibm,thread-group' device-tree property 2 is a relatively new property.
      In absence of 'ibm,thread-group' property 2, 'l2-cache' device property
      under cpu-device-node could help system to identify CPUs sharing L2-cache.
      However this property is not exposed by PhyP in shared processor mode
      configurations.
      
      In absence of properties that inform OS about which CPUs share L2-cache,
      fallback on core boundary.
      
      Here are some stats from Power9 shared LPAR with the changes.
      
      $ lscpu
      Architecture:        ppc64le
      Byte Order:          Little Endian
      CPU(s):              32
      On-line CPU(s) list: 0-31
      Thread(s) per core:  8
      Core(s) per socket:  1
      Socket(s):           3
      NUMA node(s):        2
      Model:               2.2 (pvr 004e 0202)
      Model name:          POWER9 (architected), altivec supported
      Hypervisor vendor:   pHyp
      Virtualization type: para
      L1d cache:           32K
      L1i cache:           32K
      NUMA node0 CPU(s):   16-23
      NUMA node1 CPU(s):   0-15,24-31
      Physical sockets:    2
      Physical chips:      1
      Physical cores/chip: 10
      
      Before patch
      $ grep -r . /sys/kernel/debug/sched/domains/cpu0/domain*/name
      Before
      /sys/kernel/debug/sched/domains/cpu0/domain0/name:SMT
      /sys/kernel/debug/sched/domains/cpu0/domain1/name:DIE
      /sys/kernel/debug/sched/domains/cpu0/domain2/name:NUMA
      
      After
      /sys/kernel/debug/sched/domains/cpu0/domain0/name:SMT
      /sys/kernel/debug/sched/domains/cpu0/domain1/name:CACHE
      /sys/kernel/debug/sched/domains/cpu0/domain2/name:DIE
      /sys/kernel/debug/sched/domains/cpu0/domain3/name:NUMA
      
      $  awk '/domain/{print $1, $2}' /proc/schedstat | sort -u | sed -e 's/00000000,//g'
      Before
      domain0 00000055
      domain0 000000aa
      domain0 00005500
      domain0 0000aa00
      domain0 00550000
      domain0 00aa0000
      domain0 55000000
      domain0 aa000000
      domain1 00ff0000
      domain1 ff00ffff
      domain2 ffffffff
      
      After
      domain0 00000055
      domain0 000000aa
      domain0 00005500
      domain0 0000aa00
      domain0 00550000
      domain0 00aa0000
      domain0 55000000
      domain0 aa000000
      domain1 000000ff
      domain1 0000ff00
      domain1 00ff0000
      domain1 ff000000
      domain2 ff00ffff
      domain2 ffffffff
      domain3 ffffffff
      
      (Lower is better)
      perf stat -a -r 5 -n perf bench sched pipe  | tail -n 2
      Before
                 153.798 +- 0.142 seconds time elapsed  ( +-  0.09% )
      
      After
                 111.545 +- 0.652 seconds time elapsed  ( +-  0.58% )
      
      which is an improvement of 27.47%
      Signed-off-by: default avatarSrikar Dronamraju <srikar@linux.vnet.ibm.com>
      Reviewed-by: default avatarGautham R. Shenoy <ego@linux.vnet.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20210826100401.412519-4-srikar@linux.vnet.ibm.com
      5bf63497
    • Srikar Dronamraju's avatar
      powerpc/smp: Update cpu_core_map on all PowerPc systems · b8b92803
      Srikar Dronamraju authored
      lscpu() uses core_siblings to list the number of sockets in the
      system. core_siblings is set using topology_core_cpumask.
      
      While optimizing the powerpc bootup path, Commit 4ca234a9
      ("powerpc/smp: Stop updating cpu_core_mask").  it was found that
      updating cpu_core_mask() ended up taking a lot of time. It was thought
      that on Powerpc, cpu_core_mask() would always be same as
      cpu_cpu_mask() i.e number of sockets will always be equal to number of
      nodes. As an optimization, cpu_core_mask() was made a snapshot of
      cpu_cpu_mask().
      
      However that was found to be false with PowerPc KVM guests, where each
      node could have more than one socket. So with Commit c47f892d
      ("powerpc/smp: Reintroduce cpu_core_mask"), cpu_core_mask was updated
      based on chip_id but in an optimized way using some mask manipulations
      and chip_id caching.
      
      However on non-PowerNV and non-pseries KVM guests (i.e not
      implementing cpu_to_chip_id(), continued to use a copy of
      cpu_cpu_mask().
      
      There are two issues that were noticed on such systems
      1. lscpu would report one extra socket.
      On a IBM,9009-42A (aka zz system) which has only 2 chips/ sockets/
      nodes, lscpu would report
      Architecture:        ppc64le
      Byte Order:          Little Endian
      CPU(s):              160
      On-line CPU(s) list: 0-159
      Thread(s) per core:  8
      Core(s) per socket:  6
      Socket(s):           3                <--------------
      NUMA node(s):        2
      Model:               2.2 (pvr 004e 0202)
      Model name:          POWER9 (architected), altivec supported
      Hypervisor vendor:   pHyp
      Virtualization type: para
      L1d cache:           32K
      L1i cache:           32K
      L2 cache:            512K
      L3 cache:            10240K
      NUMA node0 CPU(s):   0-79
      NUMA node1 CPU(s):   80-159
      
      2. Currently cpu_cpu_mask is updated when a core is
      added/removed. However its not updated when smt mode switching or on
      CPUs are explicitly offlined. However all other percpu masks are
      updated to ensure only active/online CPUs are in the masks.
      This results in build_sched_domain traces since there will be CPUs in
      cpu_cpu_mask() but those CPUs are not present in SMT / CACHE / MC /
      NUMA domains. A loop of threads running smt mode switching and core
      add/remove will soon show this trace.
      Hence cpu_cpu_mask has to be update at smt mode switch.
      
      This will have impact on cpu_core_mask(). cpu_core_mask() is a
      snapshot of cpu_cpu_mask. Different CPUs within the same socket will
      end up having different cpu_core_masks since they are snapshots at
      different points of time. This means when lscpu will start reporting
      many more sockets than the actual number of sockets/ nodes / chips.
      
      Different ways to handle this problem:
      A. Update the snapshot aka cpu_core_mask for all CPUs whenever
         cpu_cpu_mask is updated. This would a non-optimal solution.
      B. Instead of a cpumask_var_t, make cpu_core_map a cpumask pointer
         pointing to cpu_cpu_mask. However percpu cpumask pointer is frowned
         upon and we need a clean way to handle PowerPc KVM guest which is
         not a snapshot.
      C. Update cpu_core_masks all PowerPc systems like in PowerPc KVM
      guests using mask manipulations. This approach is relatively simple
      and unifies with the existing code.
      D. On top of 3, we could also resurrect get_physical_package_id which
         could return a nid for the said CPU. However this is not needed at this
         time.
      
      Option C is the preferred approach for now.
      
      While this is somewhat a revert of Commit 4ca234a9 ("powerpc/smp:
      Stop updating cpu_core_mask").
      
      1. Plain revert has some conflicts
      2. For chip_id == -1, the cpu_core_mask is made identical to
      cpu_cpu_mask, unlike previously where cpu_core_mask was set to a core
      if chip_id doesn't exist.
      
      This goes by the principle that if chip_id is not exposed, then
      sockets / chip / node share the same set of CPUs.
      
      With the fix, lscpu o/p would be
      Architecture:        ppc64le
      Byte Order:          Little Endian
      CPU(s):              160
      On-line CPU(s) list: 0-159
      Thread(s) per core:  8
      Core(s) per socket:  6
      Socket(s):           2                     <--------------
      NUMA node(s):        2
      Model:               2.2 (pvr 004e 0202)
      Model name:          POWER9 (architected), altivec supported
      Hypervisor vendor:   pHyp
      Virtualization type: para
      L1d cache:           32K
      L1i cache:           32K
      L2 cache:            512K
      L3 cache:            10240K
      NUMA node0 CPU(s):   0-79
      NUMA node1 CPU(s):   80-159
      
      Fixes: 4ca234a9 ("powerpc/smp: Stop updating cpu_core_mask")
      Signed-off-by: default avatarSrikar Dronamraju <srikar@linux.vnet.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20210826100401.412519-3-srikar@linux.vnet.ibm.com
      b8b92803
    • Srikar Dronamraju's avatar
      powerpc/smp: Fix a crash while booting kvm guest with nr_cpus=2 · 8efd249b
      Srikar Dronamraju authored
      Aneesh reported a crash with a fairly recent upstream kernel when
      booting kernel whose commandline was appended with nr_cpus=2
      
      1:mon> e
      cpu 0x1: Vector: 300 (Data Access) at [c000000008a67bd0]
          pc: c00000000002557c: cpu_to_chip_id+0x3c/0x100
          lr: c000000000058380: start_secondary+0x460/0xb00
          sp: c000000008a67e70
         msr: 8000000000001033
         dar: 10
       dsisr: 80000
        current = 0xc00000000891bb00
        paca    = 0xc0000018ff981f80   irqmask: 0x03   irq_happened: 0x01
          pid   = 0, comm = swapper/1
      Linux version 5.13.0-rc3-15704-ga050a6d2 (kvaneesh@ltc-boston8) (gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #433 SMP Tue May 25 02:38:49 CDT 2021
      1:mon> t
      [link register   ] c000000000058380 start_secondary+0x460/0xb00
      [c000000008a67e70] c000000008a67eb0 (unreliable)
      [c000000008a67eb0] c0000000000589d4 start_secondary+0xab4/0xb00
      [c000000008a67f90] c00000000000c654 start_secondary_prolog+0x10/0x14
      
      Current code assumes that num_possible_cpus() is always greater than
      threads_per_core. However this may not be true when using nr_cpus=2 or
      similar options. Handle the case where num_possible_cpus() is not an
      exact multiple of  threads_per_core.
      
      Fixes: c1e53367 ("powerpc/smp: Cache CPU to chip lookup")
      Reported-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
      Signed-off-by: default avatarSrikar Dronamraju <srikar@linux.vnet.ibm.com>
      Debugged-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20210826100401.412519-2-srikar@linux.vnet.ibm.com
      8efd249b
    • Joel Stanley's avatar
      powerpc/configs/microwatt: Enable options for systemd · 3e18e271
      Joel Stanley authored
      When booting with systemd these options are required.
      
      This increases the image by about 50KB, or 2%.
      Signed-off-by: default avatarJoel Stanley <joel@jms.id.au>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20210826122653.3236867-4-joel@jms.id.au
      3e18e271
    • Joel Stanley's avatar
      powerpc/configs/microwattt: Enable Liteeth · ef4fcaf9
      Joel Stanley authored
      Liteeth is the network device used by Microwatt.
      Signed-off-by: default avatarJoel Stanley <joel@jms.id.au>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20210826122653.3236867-3-joel@jms.id.au
      ef4fcaf9
    • Joel Stanley's avatar
      powerpc/microwatt: Add Ethernet to device tree · 602d0f96
      Joel Stanley authored
      The liteeth network device is used in the Microwatt soc.
      Signed-off-by: default avatarJoel Stanley <joel@jms.id.au>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20210826122653.3236867-2-joel@jms.id.au
      602d0f96
    • Christophe Leroy's avatar
      powerpc: Redefine HMT_xxx macros as empty on PPC32 · 8149238f
      Christophe Leroy authored
      HMT_xxx macros are macros for adjusting thread priority
      (hardware multi-threading) are macros inherited from PPC64
      via commit 5f7c6907 ("[PATCH] powerpc: Merged ppc_asm.h")
      
      Those instructions are pointless on PPC32, but some common
      fonctions like arch_cpu_idle() use them.
      
      So make them empty on PPC32 to avoid those instructions.
      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/c5a07fadea33d640ad10cecf0ac8faaec1c524e0.1629898474.git.christophe.leroy@csgroup.eu
      8149238f
    • Aneesh Kumar K.V's avatar
      powerpc/doc: Fix htmldocs errors · f50da6ed
      Aneesh Kumar K.V authored
      Fix make htmldocs related errors with the newly added associativity.rst
      doc file.
      Reported-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
      Tested-by: Stephen Rothwell <sfr@canb.auug.org.au> # build test
      Signed-off-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20210825042447.106219-1-aneesh.kumar@linux.ibm.com
      f50da6ed
    • Michael Ellerman's avatar
      Merge changes from Paul Gortmaker · 627e66f2
      Michael Ellerman authored
      Merge the changes to retire the legacy WR sbc8548 and sbc8641 platforms
      from Paul. These were sent as a pull request, but I rebased them onto
      rc2 so as not to pull too many unrelated changes in to my next.
      
      Description from Paul's pull request follows:
      
      In v2.6.27 (2008, 917f0af9) the sbc8260 support was implicitly
      retired by not being carried forward through the ppc --> powerpc
      device tree transition.
      
      Then, in v3.6 (2012, b048b4e1) we retired the support for the
      sbc8560 boards.
      
      Next, in v4.18 (2017, 3bc6cf5a) we retired the support for the
      2006 vintage sbc834x boards.
      
      The sbc8548 and sbc8641d boards were maybe 1-2 years newer than the
      sbc834x boards, but it is also 3+ years later, so it makes sense to
      now retire them as well - which is what is done here.
      
      These two remaining WR boards were based on the Freescale MPC8548-CDS
      and the MPC8641D-HPCN reference board implementations.  Having had the
      chance to use these and many other Fsl ref boards, I know this:  The
      Freescale reference boards were typically produced in limited quantity
      and primarily available to BSP developers and hardware designers, and
      not likely to have found a 2nd life with hobbyists and/or collectors.
      
      It was good to have that BSP code subjected to mainline review and
      hence also widely available back in the day. But given the above, we
      should probably also be giving serious consideration to retiring
      additional similar age/type reference board platforms as well.
      
      I've always felt it is important for us to be proactive in retiring
      old code, since it has a genuine non-zero carrying cost, as described
      in the 930d52c0 merge log.  But for the here and now, we just
      clean up the remaining BSP code that I had added for SBC platforms.
      
      Link: https://lore.kernel.org/r/20210824174209.GB160508@windriver.com
      627e66f2
    • Paul Gortmaker's avatar
    • Paul Gortmaker's avatar
      powerpc: retire sbc8641d board support · d7c1814f
      Paul Gortmaker authored
      The support was for this was added to mainline over 12 years ago, in
      v2.6.26 [4e8aae89] just around the ppc --> powerpc migration.
      
      I believe the board was introduced shortly after the sbc8548 board,
      making it roughly a 14 year old platform - with the CPU speed and
      memory size typical for that era.
      
      I haven't had one of these boards for several years, and availability
      was discontinued several years before that.
      
      Given that, there is no point in adding a burden to testing coverage
      that builds all possible defconfigs, so it makes sense to remove it.
      
      Of course it will remain in the git history forever, for anyone who
      happens to find a functional board and wants to tinker with it.
      Acked-by: default avatarScott Wood <oss@buserror.net>
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      d7c1814f
    • Paul Gortmaker's avatar
      powerpc: retire sbc8548 board support · c12adb06
      Paul Gortmaker authored
      The support was for this was mainlined 13 years ago, in v2.6.25
      [0e0fffe8] just around the ppc --> powerpc migration.
      
      I believe the board was introduced a year or two before that, so it
      is roughly a 15 year old platform - with the CPU speed and memory size
      that was typical for that era.
      
      I haven't had one of these boards for several years, and availability
      was discontinued several years before that.
      
      Given that, there is no point in adding a burden to testing coverage
      that builds all possible defconfigs, so it makes sense to remove it.
      
      Of course it will remain in the git history forever, for anyone who
      happens to find a functional board and wants to tinker with it.
      Acked-by: default avatarScott Wood <oss@buserror.net>
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      c12adb06
    • Michael Ellerman's avatar
      Merge branch 'topic/ppc-kvm' into next · 465e333e
      Michael Ellerman authored
      Merge some KVM patches we are keeping in a topic branch in case there
      are any merge conflicts that need resolving.
      465e333e
    • Christophe Leroy's avatar
      powerpc: Refactor verification of MSR_RI · 806c0e6e
      Christophe Leroy authored
      40x and BOOKE don't have MSR_RI therefore all tests involving
      MSR_RI may be problematic on those plateforms.
      
      Create helpers to check or set MSR_RI in regs, and use them
      in common code.
      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/c2fb93708196734f4176dda334aaa3055f213b89.1629707037.git.christophe.leroy@csgroup.eu
      806c0e6e
    • Christophe Leroy's avatar
      powerpc: Remove MSR_PR check in interrupt_exit_{user/kernel}_prepare() · 133c17a1
      Christophe Leroy authored
      In those hot functions that are called at every interrupt, any saved
      cycle is worth it.
      
      interrupt_exit_user_prepare() and interrupt_exit_kernel_prepare() are
      called from three places:
      - From entry_32.S
      - From interrupt_64.S
      - From interrupt_exit_user_restart() and interrupt_exit_kernel_restart()
      
      In entry_32.S, there are inambiguously called based on MSR_PR:
      
      	interrupt_return:
      		lwz	r4,_MSR(r1)
      		addi	r3,r1,STACK_FRAME_OVERHEAD
      		andi.	r0,r4,MSR_PR
      		beq	.Lkernel_interrupt_return
      		bl	interrupt_exit_user_prepare
      	...
      	.Lkernel_interrupt_return:
      		bl	interrupt_exit_kernel_prepare
      
      In interrupt_64.S, that's similar:
      
      	interrupt_return_\srr\():
      		ld	r4,_MSR(r1)
      		andi.	r0,r4,MSR_PR
      		beq	interrupt_return_\srr\()_kernel
      	interrupt_return_\srr\()_user: /* make backtraces match the _kernel variant */
      		addi	r3,r1,STACK_FRAME_OVERHEAD
      		bl	interrupt_exit_user_prepare
      	...
      	interrupt_return_\srr\()_kernel:
      		addi	r3,r1,STACK_FRAME_OVERHEAD
      		bl	interrupt_exit_kernel_prepare
      
      In interrupt_exit_user_restart() and interrupt_exit_kernel_restart(),
      MSR_PR is verified respectively by BUG_ON(!user_mode(regs)) and
      BUG_ON(user_mode(regs)) prior to calling interrupt_exit_user_prepare()
      and interrupt_exit_kernel_prepare().
      
      The verification in interrupt_exit_user_prepare() and
      interrupt_exit_kernel_prepare() are therefore useless and can be removed.
      Signed-off-by: default avatarChristophe Leroy <christophe.leroy@csgroup.eu>
      Acked-by: default avatarNicholas Piggin <npiggin@gmail.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/385ead49ccb66a259b25fee3eebf0bd4094068f3.1629707037.git.christophe.leroy@csgroup.eu
      133c17a1
    • Xiongwei Song's avatar
      powerpc/64e: Get dear offset with _DEAR macro · d9db6e42
      Xiongwei Song authored
      Use _DEAR to get the offset of dear register in pr_regs for 64e cpus.
      Signed-off-by: default avatarXiongwei Song <sxwjean@gmail.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20210807010239.416055-5-sxwjean@me.com
      d9db6e42
    • Xiongwei Song's avatar
      powerpc: Add dear as a synonym for pt_regs.dar register · 4872cbd0
      Xiongwei Song authored
      Create an anonymous union for dar and dear regsiters, we can reference
      dear to get the effective address when CONFIG_4xx=y or CONFIG_BOOKE=y.
      Otherwise, reference dar. This makes code more clear.
      Signed-off-by: default avatarXiongwei Song <sxwjean@gmail.com>
      [mpe: Reword commit title]
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20210807010239.416055-4-sxwjean@me.com
      4872cbd0
    • Xiongwei Song's avatar
      powerpc/64e: Get esr offset with _ESR macro · cfa47772
      Xiongwei Song authored
      Use _ESR to get the offset of esr register in pr_regs for 64e cpus.
      Signed-off-by: default avatarXiongwei Song <sxwjean@gmail.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20210807010239.416055-3-sxwjean@me.com
      cfa47772
    • Xiongwei Song's avatar
      powerpc: Add esr as a synonym for pt_regs.dsisr · 4f8e78c0
      Xiongwei Song authored
      Create an anonymous union for dsisr and esr regsiters, we can reference
      esr to get the exception detail when CONFIG_4xx=y or CONFIG_BOOKE=y.
      Otherwise, reference dsisr. This makes code more clear.
      Signed-off-by: default avatarXiongwei Song <sxwjean@gmail.com>
      [mpe: Reword commit title]
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20210807010239.416055-2-sxwjean@me.com
      4f8e78c0
    • Jordan Niethe's avatar
      selftests: Skip TM tests on synthetic TM implementations · e42edf9b
      Jordan Niethe authored
      Transactional Memory was removed from the architecture in ISA v3.1. For
      threads running in P8/P9 compatibility mode on P10 a synthetic TM
      implementation is provided. In this implementation, tbegin. always sets
      cr0 eq meaning the abort handler is always called. This is not an issue
      as users of TM are expected to have a fallback non transactional way to
      make forward progress in the abort handler.  The TEXASR indicates if a
      transaction failure is due to a synthetic implementation.
      
      Some of the TM self tests need a non-degenerate TM implementation for
      their testing to be meaningful so check for a synthetic implementation
      and skip the test if so.
      Signed-off-by: default avatarJordan Niethe <jniethe5@gmail.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20210729041317.366612-2-jniethe5@gmail.com
      e42edf9b
    • Jordan Niethe's avatar
      selftests/powerpc: Add missing clobbered register to to ptrace TM tests · c95278a0
      Jordan Niethe authored
      ISA v3.1 removes TM but includes a synthetic implementation for
      backwards compatibility.  With this implementation,  the tests
      ptrace-tm-spd-gpr and ptrace-tm-gpr should never be able to make any
      forward progress and eventually should be killed by the timeout.
      Instead on a P10 running in P9 mode, ptrace_tm_gpr fails like so:
      
      test: ptrace_tm_gpr
      tags: git_version:unknown
      Starting the child
      ...
      ...
      GPR[27]: 1 Expected: 2
      GPR[28]: 1 Expected: 2
      GPR[29]: 1 Expected: 2
      GPR[30]: 1 Expected: 2
      GPR[31]: 1 Expected: 2
      [FAIL] Test FAILED on line 98
      failure: ptrace_tm_gpr
      selftests:  ptrace-tm-gpr [FAIL]
      
      The problem is in the inline assembly of the child. r0 is loaded with a
      value in the child's transaction abort handler but this register is not
      included in the clobbers list.  This means it is possible that this
      statement:
      	cptr[1] = 0;
      which is meant to signal the parent to wait may actually use the value
      placed into r0 by the inline assembly incorrectly signal the parent to
      continue.
      
      By inspection the same problem is present in ptrace-tm-spd-gpr.
      
      Adding r0 to the clobbbers list makes the test fail correctly via a
      timeout on a P10 running in P8/P9 compatibility mode.
      Suggested-by: default avatarMichael Neuling <mikey@neuling.org>
      Signed-off-by: default avatarJordan Niethe <jniethe5@gmail.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20210729041317.366612-1-jniethe5@gmail.com
      c95278a0
  2. 25 Aug, 2021 19 commits