Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

s390/alternatives: provide identical sized orginal/alternative sequences

Explicitly provide identical sized original/alternative instruction
sequences. This way there is no need for the s390 specific alternatives
infrastructure to generate padding sequences.
The code which generates such sequences will be removed with a follow on
patch.

Acked-by: Vasily Gorbik <gor@linux.ibm.com>
Tested-by: Nathan Chancellor <nathan@kernel.org>
Tested-by: Nick Desaulniers <ndesaulniers@google.com>
Link: https://lore.kernel.org/r/20220511120532.2228616-2-hca@linux.ibm.com
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>

+13 -13
+1 -1
arch/s390/include/asm/spinlock.h
··· 79 79 typecheck(int, lp->lock); 80 80 kcsan_release(); 81 81 asm_inline volatile( 82 - ALTERNATIVE("", ".insn rre,0xb2fa0000,7,0", 49) /* NIAI 7 */ 82 + ALTERNATIVE("nop", ".insn rre,0xb2fa0000,7,0", 49) /* NIAI 7 */ 83 83 " sth %1,%0\n" 84 84 : "=R" (((unsigned short *) &lp->lock)[1]) 85 85 : "d" (0) : "cc", "memory");
+10 -10
arch/s390/kernel/entry.S
··· 53 53 _LPP_OFFSET = __LC_LPP 54 54 55 55 .macro STBEAR address 56 - ALTERNATIVE "", ".insn s,0xb2010000,\address", 193 56 + ALTERNATIVE "nop", ".insn s,0xb2010000,\address", 193 57 57 .endm 58 58 59 59 .macro LBEAR address 60 - ALTERNATIVE "", ".insn s,0xb2000000,\address", 193 60 + ALTERNATIVE "nop", ".insn s,0xb2000000,\address", 193 61 61 .endm 62 62 63 63 .macro LPSWEY address,lpswe 64 - ALTERNATIVE "b \lpswe", ".insn siy,0xeb0000000071,\address,0", 193 64 + ALTERNATIVE "b \lpswe; nopr", ".insn siy,0xeb0000000071,\address,0", 193 65 65 .endm 66 66 67 67 .macro MBEAR reg 68 - ALTERNATIVE "", __stringify(mvc __PT_LAST_BREAK(8,\reg),__LC_LAST_BREAK), 193 68 + ALTERNATIVE "brcl 0,0", __stringify(mvc __PT_LAST_BREAK(8,\reg),__LC_LAST_BREAK), 193 69 69 .endm 70 70 71 71 .macro CHECK_STACK savearea ··· 121 121 .endm 122 122 123 123 .macro BPOFF 124 - ALTERNATIVE "", ".insn rrf,0xb2e80000,0,0,12,0", 82 124 + ALTERNATIVE "nop", ".insn rrf,0xb2e80000,0,0,12,0", 82 125 125 .endm 126 126 127 127 .macro BPON 128 - ALTERNATIVE "", ".insn rrf,0xb2e80000,0,0,13,0", 82 128 + ALTERNATIVE "nop", ".insn rrf,0xb2e80000,0,0,13,0", 82 129 129 .endm 130 130 131 131 .macro BPENTER tif_ptr,tif_mask 132 132 ALTERNATIVE "TSTMSK \tif_ptr,\tif_mask; jz .+8; .insn rrf,0xb2e80000,0,0,13,0", \ 133 - "", 82 133 + "j .+12; nop; nop", 82 134 134 .endm 135 135 136 136 .macro BPEXIT tif_ptr,tif_mask ··· 226 226 aghi %r3,__TASK_pid 227 227 mvc __LC_CURRENT_PID(4,%r0),0(%r3) # store pid of next 228 228 lmg %r6,%r15,__SF_GPRS(%r15) # load gprs of next task 229 - ALTERNATIVE "", "lpp _LPP_OFFSET", 40 229 + ALTERNATIVE "nop", "lpp _LPP_OFFSET", 40 230 230 BR_EX %r14 231 231 ENDPROC(__switch_to) 232 232 ··· 610 610 jno 0f 611 611 BPEXIT __TI_flags(%r12),_TIF_ISOLATE_BP 612 612 stpt __LC_EXIT_TIMER 613 - 0: ALTERNATIVE "", __stringify(lghi %r12,__LC_LAST_BREAK_SAVE_AREA),193 613 + 0: ALTERNATIVE "nop", __stringify(lghi %r12,__LC_LAST_BREAK_SAVE_AREA),193 614 614 LBEAR 0(%r12) 615 615 lmg %r11,%r15,__PT_R11(%r11) 616 616 LPSWEY __LC_RETURN_MCCK_PSW,__LC_RETURN_MCCK_LPSWE ··· 646 646 ENDPROC(mcck_int_handler) 647 647 648 648 ENTRY(restart_int_handler) 649 - ALTERNATIVE "", "lpp _LPP_OFFSET", 40 649 + ALTERNATIVE "nop", "lpp _LPP_OFFSET", 40 650 650 stg %r15,__LC_SAVE_AREA_RESTART 651 651 TSTMSK __LC_RESTART_FLAGS,RESTART_FLAG_CTLREGS,4 652 652 jz 0f
+2 -2
arch/s390/lib/spinlock.c
··· 75 75 int owner; 76 76 77 77 asm_inline volatile( 78 - ALTERNATIVE("", ".insn rre,0xb2fa0000,4,0", 49) /* NIAI 4 */ 78 + ALTERNATIVE("nop", ".insn rre,0xb2fa0000,4,0", 49) /* NIAI 4 */ 79 79 " l %0,%1\n" 80 80 : "=d" (owner) : "Q" (*lock) : "memory"); 81 81 return owner; ··· 86 86 int expected = old; 87 87 88 88 asm_inline volatile( 89 - ALTERNATIVE("", ".insn rre,0xb2fa0000,8,0", 49) /* NIAI 8 */ 89 + ALTERNATIVE("nop", ".insn rre,0xb2fa0000,8,0", 49) /* NIAI 8 */ 90 90 " cs %0,%3,%1\n" 91 91 : "=d" (old), "=Q" (*lock) 92 92 : "0" (old), "d" (new), "Q" (*lock)