Skip to content
  1. Apr 22, 2021
  2. Apr 21, 2021
  3. Apr 20, 2021
  4. Apr 19, 2021
  5. Apr 18, 2021
  6. Apr 17, 2021
    • Srikar Dronamraju's avatar
      powerpc/smp: Set numa node before updating mask · 6980d13f
      Srikar Dronamraju authored
      
      
      Geethika reported a trace when doing a dlpar CPU add.
      
      ------------[ cut here ]------------
      WARNING: CPU: 152 PID: 1134 at kernel/sched/topology.c:2057
      CPU: 152 PID: 1134 Comm: kworker/152:1 Not tainted 5.12.0-rc5-master #5
      Workqueue: events cpuset_hotplug_workfn
      NIP:  c0000000001cfc14 LR: c0000000001cfc10 CTR: c0000000007e3420
      REGS: c0000034a08eb260 TRAP: 0700   Not tainted  (5.12.0-rc5-master+)
      MSR:  8000000000029033 <SF,EE,ME,IR,DR,RI,LE>  CR: 28828422  XER: 00000020
      CFAR: c0000000001fd888 IRQMASK: 0 #012GPR00: c0000000001cfc10
      c0000034a08eb500 c000000001f35400 0000000000000027 #012GPR04:
      c0000035abaa8010 c0000035abb30a00 0000000000000027 c0000035abaa8018
      #012GPR08: 0000000000000023 c0000035abaaef48 00000035aa540000
      c0000035a49dffe8 #012GPR12: 0000000028828424 c0000035bf1a1c80
      0000000000000497 0000000000000004 #012GPR16: c00000000347a258
      0000000000000140 c00000000203d468 c000000001a1a490 #012GPR20:
      c000000001f9c160 c0000034adf70920 c0000034aec9fd20 0000000100087bd3
      #012GPR24: 0000000100087bd3 c0000035b3de09f8 0000000000000030
      c0000035b3de09f8 #012GPR28: 0000000000000028 c00000000347a280
      c0000034aefe0b00 c0000000010a2a68
      NIP [c0000000001cfc14] build_sched_domains+0x6a4/0x1500
      LR [c0000000001cfc10] build_sched_domains+0x6a0/0x1500
      Call Trace:
      [c0000034a08eb500] [c0000000001cfc10] build_sched_domains+0x6a0/0x1500 (unreliable)
      [c0000034a08eb640] [c0000000001d1e6c] partition_sched_domains_locked+0x3ec/0x530
      [c0000034a08eb6e0] [c0000000002936d4] rebuild_sched_domains_locked+0x524/0xbf0
      [c0000034a08eb7e0] [c000000000296bb0] rebuild_sched_domains+0x40/0x70
      [c0000034a08eb810] [c000000000296e74] cpuset_hotplug_workfn+0x294/0xe20
      [c0000034a08ebc30] [c000000000178dd0] process_one_work+0x300/0x670
      [c0000034a08ebd10] [c0000000001791b8] worker_thread+0x78/0x520
      [c0000034a08ebda0] [c000000000185090] kthread+0x1a0/0x1b0
      [c0000034a08ebe10] [c00000000000ccec] ret_from_kernel_thread+0x5c/0x70
      Instruction dump:
      7d2903a6 4e800421 e8410018 7f67db78 7fe6fb78 7f45d378 7f84e378 7c681b78
      3c62ff1a 3863c6f8 4802dc35 60000000 <0fe00000> 3920fff4 f9210070 e86100a0
      ---[ end trace 532d9066d3d4d7ec ]---
      
      Some of the per-CPU masks use cpu_cpu_mask as a filter to limit the search
      for related CPUs. On a dlpar add of a CPU, update cpu_cpu_mask before
      updating the per-CPU masks. This will ensure the cpu_cpu_mask is updated
      correctly before its used in setting the masks. Setting the numa_node will
      ensure that when cpu_cpu_mask() gets called, the correct node number is
      used. This code movement helped fix the above call trace.
      
      Reported-by: default avatarGeetika Moolchandani <Geetika.Moolchandani1@ibm.com>
      Signed-off-by: default avatarSrikar Dronamraju <srikar@linux.vnet.ibm.com>
      Reviewed-by: default avatarNathan Lynch <nathanl@linux.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20210401154200.150077-1-srikar@linux.vnet.ibm.com
      6980d13f
    • Xiongwei Song's avatar
      powerpc/traps: Enhance readability for trap types · 7153d4bf
      Xiongwei Song authored
      
      
      Define macros to list ppc interrupt types in interttupt.h, replace the
      reference of the trap hex values with these macros.
      
      Referred the hex numbers in arch/powerpc/kernel/exceptions-64e.S,
      arch/powerpc/kernel/exceptions-64s.S, arch/powerpc/kernel/head_*.S,
      arch/powerpc/kernel/head_booke.h and arch/powerpc/include/asm/kvm_asm.h.
      
      Signed-off-by: default avatarXiongwei Song <sxwjean@gmail.com>
      [mpe: Resolve conflicts in nmi_disables_ftrace(), fix 40x build]
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/1618398033-13025-1-git-send-email-sxwjean@me.com
      7153d4bf
    • Tony Ambardar's avatar
      powerpc: fix EDEADLOCK redefinition error in uapi/asm/errno.h · 7de21e67
      Tony Ambardar authored
      
      
      A few archs like powerpc have different errno.h values for macros
      EDEADLOCK and EDEADLK. In code including both libc and linux versions of
      errno.h, this can result in multiple definitions of EDEADLOCK in the
      include chain. Definitions to the same value (e.g. seen with mips) do
      not raise warnings, but on powerpc there are redefinitions changing the
      value, which raise warnings and errors (if using "-Werror").
      
      Guard against these redefinitions to avoid build errors like the following,
      first seen cross-compiling libbpf v5.8.9 for powerpc using GCC 8.4.0 with
      musl 1.1.24:
      
        In file included from ../../arch/powerpc/include/uapi/asm/errno.h:5,
                         from ../../include/linux/err.h:8,
                         from libbpf.c:29:
        ../../include/uapi/asm-generic/errno.h:40: error: "EDEADLOCK" redefined [-Werror]
         #define EDEADLOCK EDEADLK
      
        In file included from toolchain-powerpc_8540_gcc-8.4.0_musl/include/errno.h:10,
                         from libbpf.c:26:
        toolchain-powerpc_8540_gcc-8.4.0_musl/include/bits/errno.h:58: note: this is the location of the previous definition
         #define EDEADLOCK       58
      
        cc1: all warnings being treated as errors
      
      Cc: Stable <stable@vger.kernel.org>
      Reported-by: default avatarRosen Penev <rosenp@gmail.com>
      Signed-off-by: default avatarTony Ambardar <Tony.Ambardar@gmail.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20200917135437.1238787-1-Tony.Ambardar@gmail.com
      7de21e67
    • Srikar Dronamraju's avatar
      powerpc/smp: Cache CPU to chip lookup · c1e53367
      Srikar Dronamraju authored
      
      
      On systems with large CPUs per node, even with the filtered matching of
      related CPUs, there can be large number of calls to cpu_to_chip_id for
      the same CPU. For example with 4096 vCPU, 1 node QEMU configuration,
      with 4 threads per core, system could be see upto 1024 calls to
      cpu_to_chip_id() for the same CPU. On a given system, cpu_to_chip_id()
      for a given CPU would always return the same. Hence cache the result in
      a lookup table for use in subsequent calls.
      
      Since all CPUs sharing the same core will belong to the same chip, the
      lookup_table has an entry for one CPU per core.  chip_id_lookup_table is
      not being freed and would be used on subsequent CPU online post CPU
      offline.
      
      Reported-by: default avatarDaniel Henrique Barboza <danielhb413@gmail.com>
      Suggested-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: default avatarSrikar Dronamraju <srikar@linux.vnet.ibm.com>
      Tested-by: default avatarDaniel Henrique Barboza <danielhb413@gmail.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20210415120934.232271-4-srikar@linux.vnet.ibm.com
      c1e53367
    • Srikar Dronamraju's avatar
      Revert "powerpc/topology: Update topology_core_cpumask" · 131c82b6
      Srikar Dronamraju authored
      Now that cpu_core_mask has been reintroduced, lets revert
      commit 4bce5459
      
       ("powerpc/topology: Update topology_core_cpumask")
      
      Post this commit, lscpu should reflect topologies as requested by a user
      when a QEMU instance is launched with NUMA spanning multiple sockets.
      
      Reported-by: default avatarDaniel Henrique Barboza <danielhb413@gmail.com>
      Signed-off-by: default avatarSrikar Dronamraju <srikar@linux.vnet.ibm.com>
      Tested-by: default avatarDaniel Henrique Barboza <danielhb413@gmail.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20210415120934.232271-3-srikar@linux.vnet.ibm.com
      131c82b6
    • Srikar Dronamraju's avatar
      powerpc/smp: Reintroduce cpu_core_mask · c47f892d
      Srikar Dronamraju authored
      Daniel reported that with Commit 4ca234a9 ("powerpc/smp: Stop
      updating cpu_core_mask") QEMU was unable to set single NUMA node SMP
      topologies such as:
       -smp 8,maxcpus=8,cores=2,threads=2,sockets=2
       i.e he expected 2 sockets in one NUMA node.
      
      The above commit helped to reduce boot time on Large Systems for
      example 4096 vCPU single socket QEMU instance. PAPR is silent on
      having more than one socket within a NUMA node.
      
      cpu_core_mask and cpu_cpu_mask for any CPU would be same unless the
      number of sockets is different from the number of NUMA nodes.
      
      One option is to reintroduce cpu_core_mask but use a slightly
      different method to arrive at the cpu_core_mask. Previously each CPU's
      chip-id would be compared with all other CPU's chip-id to verify if
      both the CPUs were related at the chip level. Now if a CPU 'A' is
      found related / (unrelated) to another CPU 'B', all the thread
      siblings of 'A' and thread siblings of 'B' are automatically marked as
      related / (unrelated).
      
      Also if a platform doesn't support ibm,chip-id property, i.e its
      cpu_to_chip_id returns -1, cpu_core_map holds a copy of
      cpu_cpu_mask().
      
      Fixes: 4ca234a9
      
       ("powerpc/smp: Stop updating cpu_core_mask")
      Reported-by: default avatarDaniel Henrique Barboza <danielhb413@gmail.com>
      Signed-off-by: default avatarSrikar Dronamraju <srikar@linux.vnet.ibm.com>
      Tested-by: default avatarDaniel Henrique Barboza <danielhb413@gmail.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20210415120934.232271-2-srikar@linux.vnet.ibm.com
      c47f892d