1. 15 Dec, 2020 7 commits
    • Christophe Leroy's avatar
      powerpc: force inlining of csum_partial() to avoid multiple csum_partial() with GCC10 · 328e7e48
      Christophe Leroy authored
      	ppc-linux-objdump -d vmlinux | grep -e "<csum_partial>" -e "<__csum_partial>"
      
      With gcc9 I get:
      
      	c0017ef8 <__csum_partial>:
      	c00182fc:	4b ff fb fd 	bl      c0017ef8 <__csum_partial>
      	c0018478:	4b ff fa 80 	b       c0017ef8 <__csum_partial>
      	c03e8458:	4b c2 fa a0 	b       c0017ef8 <__csum_partial>
      	c03e8518:	4b c2 f9 e1 	bl      c0017ef8 <__csum_partial>
      	c03ef410:	4b c2 8a e9 	bl      c0017ef8 <__csum_partial>
      	c03f0b24:	4b c2 73 d5 	bl      c0017ef8 <__csum_partial>
      	c04279a4:	4b bf 05 55 	bl      c0017ef8 <__csum_partial>
      	c0429820:	4b be e6 d9 	bl      c0017ef8 <__csum_partial>
      	c0429944:	4b be e5 b5 	bl      c0017ef8 <__csum_partial>
      	c042b478:	4b be ca 81 	bl      c0017ef8 <__csum_partial>
      	c042b554:	4b be c9 a5 	bl      c0017ef8 <__csum_partial>
      	c045f15c:	4b bb 8d 9d 	bl      c0017ef8 <__csum_partial>
      	c0492190:	4b b8 5d 69 	bl      c0017ef8 <__csum_partial>
      	c0492310:	4b b8 5b e9 	bl      c0017ef8 <__csum_partial>
      	c0495594:	4b b8 29 65 	bl      c0017ef8 <__csum_partial>
      	c049c420:	4b b7 ba d9 	bl      c0017ef8 <__csum_partial>
      	c049c870:	4b b7 b6 89 	bl      c0017ef8 <__csum_partial>
      	c049c930:	4b b7 b5 c9 	bl      c0017ef8 <__csum_partial>
      	c04a9ca0:	4b b6 e2 59 	bl      c0017ef8 <__csum_partial>
      	c04bdde4:	4b b5 a1 15 	bl      c0017ef8 <__csum_partial>
      	c04be480:	4b b5 9a 79 	bl      c0017ef8 <__csum_partial>
      	c04be710:	4b b5 97 e9 	bl      c0017ef8 <__csum_partial>
      	c04c969c:	4b b4 e8 5d 	bl      c0017ef8 <__csum_partial>
      	c04ca2fc:	4b b4 db fd 	bl      c0017ef8 <__csum_partial>
      	c04cf5bc:	4b b4 89 3d 	bl      c0017ef8 <__csum_partial>
      	c04d0440:	4b b4 7a b9 	bl      c0017ef8 <__csum_partial>
      
      With gcc10 I get:
      
      	c0018d08 <__csum_partial>:
      	c0019020 <csum_partial>:
      	c0019020:	4b ff fc e8 	b       c0018d08 <__csum_partial>
      	c001914c:	4b ff fe d4 	b       c0019020 <csum_partial>
      	c0019250:	4b ff fd d1 	bl      c0019020 <csum_partial>
      	c03e404c <csum_partial>:
      	c03e404c:	4b c3 4c bc 	b       c0018d08 <__csum_partial>
      	c03e4050:	4b ff ff fc 	b       c03e404c <csum_partial>
      	c03e40fc:	4b ff ff 51 	bl      c03e404c <csum_partial>
      	c03e6680:	4b ff d9 cd 	bl      c03e404c <csum_partial>
      	c03e68c4:	4b ff d7 89 	bl      c03e404c <csum_partial>
      	c03e7934:	4b ff c7 19 	bl      c03e404c <csum_partial>
      	c03e7bf8:	4b ff c4 55 	bl      c03e404c <csum_partial>
      	c03eb148:	4b ff 8f 05 	bl      c03e404c <csum_partial>
      	c03ecf68:	4b c2 bd a1 	bl      c0018d08 <__csum_partial>
      	c04275b8 <csum_partial>:
      	c04275b8:	4b bf 17 50 	b       c0018d08 <__csum_partial>
      	c0427884:	4b ff fd 35 	bl      c04275b8 <csum_partial>
      	c0427b18:	4b ff fa a1 	bl      c04275b8 <csum_partial>
      	c0427bd8:	4b ff f9 e1 	bl      c04275b8 <csum_partial>
      	c0427cd4:	4b ff f8 e5 	bl      c04275b8 <csum_partial>
      	c0427e34:	4b ff f7 85 	bl      c04275b8 <csum_partial>
      	c045a1c0:	4b bb eb 49 	bl      c0018d08 <__csum_partial>
      	c0489464 <csum_partial>:
      	c0489464:	4b b8 f8 a4 	b       c0018d08 <__csum_partial>
      	c04896b0:	4b ff fd b5 	bl      c0489464 <csum_partial>
      	c048982c:	4b ff fc 39 	bl      c0489464 <csum_partial>
      	c0490158:	4b b8 8b b1 	bl      c0018d08 <__csum_partial>
      	c0492f0c <csum_partial>:
      	c0492f0c:	4b b8 5d fc 	b       c0018d08 <__csum_partial>
      	c049326c:	4b ff fc a1 	bl      c0492f0c <csum_partial>
      	c049333c:	4b ff fb d1 	bl      c0492f0c <csum_partial>
      	c0493b18:	4b ff f3 f5 	bl      c0492f0c <csum_partial>
      	c0493f50:	4b ff ef bd 	bl      c0492f0c <csum_partial>
      	c0493ffc:	4b ff ef 11 	bl      c0492f0c <csum_partial>
      	c04a0f78:	4b b7 7d 91 	bl      c0018d08 <__csum_partial>
      	c04b3e3c:	4b b6 4e cd 	bl      c0018d08 <__csum_partial>
      	c04b40d0 <csum_partial>:
      	c04b40d0:	4b b6 4c 38 	b       c0018d08 <__csum_partial>
      	c04b4448:	4b ff fc 89 	bl      c04b40d0 <csum_partial>
      	c04b46f4:	4b ff f9 dd 	bl      c04b40d0 <csum_partial>
      	c04bf448:	4b b5 98 c0 	b       c0018d08 <__csum_partial>
      	c04c5264:	4b b5 3a a5 	bl      c0018d08 <__csum_partial>
      	c04c61e4:	4b b5 2b 25 	bl      c0018d08 <__csum_partial>
      
      gcc10 defines multiple versions of csum_partial() which are just
      an unconditionnal branch to __csum_partial().
      
      To enforce inlining of that branch to __csum_partial(),
      mark csum_partial() as __always_inline.
      
      With this patch with gcc10:
      
      	c0018d08 <__csum_partial>:
      	c0019148:	4b ff fb c0 	b       c0018d08 <__csum_partial>
      	c001924c:	4b ff fa bd 	bl      c0018d08 <__csum_partial>
      	c03e40ec:	4b c3 4c 1d 	bl      c0018d08 <__csum_partial>
      	c03e4120:	4b c3 4b e8 	b       c0018d08 <__csum_partial>
      	c03eb004:	4b c2 dd 05 	bl      c0018d08 <__csum_partial>
      	c03ecef4:	4b c2 be 15 	bl      c0018d08 <__csum_partial>
      	c0427558:	4b bf 17 b1 	bl      c0018d08 <__csum_partial>
      	c04286e4:	4b bf 06 25 	bl      c0018d08 <__csum_partial>
      	c0428cd8:	4b bf 00 31 	bl      c0018d08 <__csum_partial>
      	c0428d84:	4b be ff 85 	bl      c0018d08 <__csum_partial>
      	c045a17c:	4b bb eb 8d 	bl      c0018d08 <__csum_partial>
      	c0489450:	4b b8 f8 b9 	bl      c0018d08 <__csum_partial>
      	c0491860:	4b b8 74 a9 	bl      c0018d08 <__csum_partial>
      	c0492eec:	4b b8 5e 1d 	bl      c0018d08 <__csum_partial>
      	c04a0eac:	4b b7 7e 5d 	bl      c0018d08 <__csum_partial>
      	c04b3e34:	4b b6 4e d5 	bl      c0018d08 <__csum_partial>
      	c04b426c:	4b b6 4a 9d 	bl      c0018d08 <__csum_partial>
      	c04b463c:	4b b6 46 cd 	bl      c0018d08 <__csum_partial>
      	c04c004c:	4b b5 8c bd 	bl      c0018d08 <__csum_partial>
      	c04c0368:	4b b5 89 a1 	bl      c0018d08 <__csum_partial>
      	c04c5254:	4b b5 3a b5 	bl      c0018d08 <__csum_partial>
      	c04c60d4:	4b b5 2c 35 	bl      c0018d08 <__csum_partial>
      Signed-off-by: default avatarChristophe Leroy <christophe.leroy@csgroup.eu>
      Reviewed-by: default avatarSegher Boessenkool  <segher@kernel.crashing.org>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/a1d31f84ddb0926813b17fcd5cc7f3fa7b4deac2.1602759123.git.christophe.leroy@csgroup.eu
      328e7e48
    • Madhavan Srinivasan's avatar
      powerpc/perf: Fix Threshold Event Counter Multiplier width for P10 · ef0e3b65
      Madhavan Srinivasan authored
      Threshold Event Counter Multiplier (TECM) is part of Monitor Mode
      Control Register A (MMCRA). This field along with Threshold Event
      Counter Exponent (TECE) is used to get threshould counter value.
      In Power10, this is a 8bit field, so patch fixes the
      current code to modify the MMCRA[TECM] extraction macro to
      handle this change. ISA v3.1 says this is a 7 bit field but
      POWER10 it's actually 8 bits which will hopefully be fixed
      in ISA v3.1 update.
      
      Fixes: 170a315f ("powerpc/perf: Support to export MMCRA[TEC*] field to userspace")
      Signed-off-by: default avatarMadhavan Srinivasan <maddy@linux.ibm.com>
      Signed-off-by: default avatarAthira Rajeev <atrajeev@linux.vnet.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/1608022578-1532-1-git-send-email-atrajeev@linux.vnet.ibm.com
      ef0e3b65
    • Christophe Leroy's avatar
      powerpc/mm: Fix hugetlb_free_pmd_range() and hugetlb_free_pud_range() · 2198d493
      Christophe Leroy authored
      Commit 7bfe54b5 ("powerpc/mm: Refactor the floor/ceiling check in
      hugetlb range freeing functions") inadvertely removed the mask
      applied to start parameter in those two functions, leading to the
      following crash on power9.
      
        LTP: starting hugemmap05_1 (hugemmap05 -m)
        ------------[ cut here ]------------
        kernel BUG at arch/powerpc/mm/book3s64/pgtable.c:387!
        Oops: Exception in kernel mode, sig: 5 [#1]
        LE PAGE_SIZE=64K MMU=Radix SMP NR_CPUS=256 NUMA PowerNV
        ...
        CPU: 99 PID: 308 Comm: ksoftirqd/99 Tainted: G           O      5.10.0-rc7-next-20201211 #1
        NIP:  c00000000005dbec LR: c0000000003352f4 CTR: 0000000000000000
        REGS: c00020000bb6f830 TRAP: 0700   Tainted: G           O       (5.10.0-rc7-next-20201211)
        MSR:  900000000282b033 <SF,HV,VEC,VSX,EE,FP,ME,IR,DR,RI,LE>  CR: 24002284  XER: 20040000
        GPR00: c0000000003352f4 c00020000bb6fad0 c000000007f70b00 c0002000385b3ff0
        GPR04: 0000000000000000 0000000000000003 c00020000bb6f8b4 0000000000000001
        GPR08: 0000000000000001 0000000000000009 0000000000000008 0000000000000002
        GPR12: 0000000024002488 c000201fff649c00 c000000007f2a20c 0000000000000000
        GPR16: 0000000000000007 0000000000000000 c000000000194d10 c000000000194d10
        GPR24: 0000000000000014 0000000000000015 c000201cc6e72398 c000000007fac4b4
        GPR28: c000000007f2bf80 c000000007fac2f8 0000000000000008 c000200033870000
        NIP [c00000000005dbec] __tlb_remove_table+0x1dc/0x1e0
                               pgtable_free at arch/powerpc/mm/book3s64/pgtable.c:387
                               (inlined by) __tlb_remove_table at arch/powerpc/mm/book3s64/pgtable.c:405
        LR [c0000000003352f4] tlb_remove_table_rcu+0x54/0xa0
        Call Trace:
          __tlb_remove_table+0x13c/0x1e0 (unreliable)
          tlb_remove_table_rcu+0x54/0xa0
          __tlb_remove_table_free at mm/mmu_gather.c:101
          (inlined by) tlb_remove_table_rcu at mm/mmu_gather.c:156
          rcu_core+0x35c/0xbb0
          rcu_do_batch at kernel/rcu/tree.c:2502
          (inlined by) rcu_core at kernel/rcu/tree.c:2737
          __do_softirq+0x480/0x704
          run_ksoftirqd+0x74/0xd0
          run_ksoftirqd at kernel/softirq.c:651
          (inlined by) run_ksoftirqd at kernel/softirq.c:642
          smpboot_thread_fn+0x278/0x320
          kthread+0x1c4/0x1d0
          ret_from_kernel_thread+0x5c/0x80
      
      Properly apply the masks before calling pmd_free_tlb() and
      pud_free_tlb() respectively.
      
      Fixes: 7bfe54b5 ("powerpc/mm: Refactor the floor/ceiling check in hugetlb range freeing functions")
      Reported-by: default avatarQian Cai <qcai@redhat.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/56feccd7b6fcd98e353361a233fa7bb8e67c3164.1607780469.git.christophe.leroy@csgroup.eu
      2198d493
    • Leonardo Bras's avatar
      KVM: PPC: Book3S HV: Fix mask size for emulated msgsndp · 87fb4978
      Leonardo Bras authored
      According to ISAv3.1 and ISAv3.0b, the msgsndp is described to split
      RB in:
        msgtype <- (RB) 32:36
        payload <- (RB) 37:63
        t       <- (RB) 57:63
      
      The current way of getting 'msgtype', and 't' is missing their MSB:
        msgtype: ((arg >> 27) & 0xf) : Gets (RB) 33:36, missing bit 32
        t:       (arg &= 0x3f)       : Gets (RB) 58:63, missing bit 57
      
      Fixes this by applying the correct mask.
      Signed-off-by: default avatarLeonardo Bras <leobras.c@gmail.com>
      Acked-by: default avatarPaul Mackerras <paulus@ozlabs.org>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20201208215707.31149-1-leobras.c@gmail.com
      87fb4978
    • Kaixu Xia's avatar
      KVM: PPC: fix comparison to bool warning · a300bf8c
      Kaixu Xia authored
      Fix the following coccicheck warning:
      
      ./arch/powerpc/kvm/booke.c:503:6-16: WARNING: Comparison to bool
      ./arch/powerpc/kvm/booke.c:505:6-17: WARNING: Comparison to bool
      ./arch/powerpc/kvm/booke.c:507:6-16: WARNING: Comparison to bool
      Reported-by: default avatarTosk Robot <tencent_os_robot@tencent.com>
      Signed-off-by: default avatarKaixu Xia <kaixuxia@tencent.com>
      Acked-by: default avatarPaul Mackerras <paulus@ozlabs.org>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/1604764178-8087-1-git-send-email-kaixuxia@tencent.com
      a300bf8c
    • Kaixu Xia's avatar
      KVM: PPC: Book3S: Assign boolean values to a bool variable · 13751f87
      Kaixu Xia authored
      Fix the following coccinelle warnings:
      
      ./arch/powerpc/kvm/book3s_xics.c:476:3-15: WARNING: Assignment of 0/1 to bool variable
      ./arch/powerpc/kvm/book3s_xics.c:504:3-15: WARNING: Assignment of 0/1 to bool variable
      Reported-by: default avatarTosk Robot <tencent_os_robot@tencent.com>
      Signed-off-by: default avatarKaixu Xia <kaixuxia@tencent.com>
      Reviewed-by: default avatarGreg Kurz <groug@kaod.org>
      Acked-by: default avatarPaul Mackerras <paulus@ozlabs.org>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/1604730382-5810-1-git-send-email-kaixuxia@tencent.com
      13751f87
    • Michael Ellerman's avatar
      powerpc: Inline setup_kup() · 1791ebd1
      Michael Ellerman authored
      setup_kup() is used by both 64-bit and 32-bit code. However on 64-bit
      it must not be __init, because it's used for CPU hotplug, whereas on
      32-bit it should be __init because it calls setup_kuap/kuep() which
      are __init.
      
      We worked around that problem in the past by marking it __ref, see
      commit 67d53f30 ("powerpc/mm: fix section mismatch for
      setup_kup()").
      
      Marking it __ref basically just omits it from section mismatch
      checking, which can lead to bugs, and in fact it did, see commit
      44b4c445 ("powerpc/64s: Mark the kuap/kuep functions non __init")
      
      We can avoid all these problems by just making it static inline.
      Because all it does is call other functions, making it inline actually
      shrinks the 32-bit vmlinux by ~76 bytes.
      
      Make it __always_inline as pointed out by Christophe.
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20201214123011.311024-1-mpe@ellerman.id.au
      1791ebd1
  2. 14 Dec, 2020 1 commit
  3. 10 Dec, 2020 25 commits
  4. 09 Dec, 2020 7 commits