parisc patch queue
Subsystems (3)
cover parisc patch queue
From: Helge Deller <[email protected]>
Some current patches for parisc, mostly section alignment fixes.
Helge Deller (8):
parisc: Mark __ex_table entries 32-bit aligned in assembly.h
parisc: Mark __ex_table entries 32-bit aligned in uaccess.h
parisc: Specify alignments for .PARISC.unwind and .data..lock_aligned
parisc: Mark altinstructions 32-bit aligned
parisc: Mark __jump_table aligned to CPU long width
parisc: Use correct alignment in __bug_table
parisc: Drop the HP-UX ENOSYM and EREMOTERELEASE error codes
parisc: Reduce size of __bug_table[] on 64-bit kernel by half
arch/parisc/Kconfig | 7 ++-- arch/parisc/include/asm/alternative.h | 9 +++-- arch/parisc/include/asm/assembly.h | 1 + arch/parisc/include/asm/bug.h | 38 +++++++++++++--------- arch/parisc/include/asm/jump_label.h | 8 +++-- arch/parisc/include/asm/ldcw.h | 2 +- arch/parisc/include/asm/uaccess.h | 1 + arch/parisc/include/uapi/asm/errno.h | 2 -- arch/parisc/kernel/vmlinux.lds.S | 4 +-- lib/errname.c | 6 ---- tools/arch/parisc/include/uapi/asm/errno.h | 2 -- 11 files changed, 44 insertions(+), 36 deletions(-)
Signature · 1 line
2.42.0
PATCH 1/8 parisc: Mark __ex_table entries 32-bit aligned in assembly.h
From: Helge Deller <[email protected]>
Add an align statement to tell the linker that all __ex_table entries and as such the whole __ex_table section should be 32-bit aligned in vmlinux and modules.
--- arch/parisc/include/asm/assembly.h | 1 + 1 file changed, 1 insertion(+)
arch/parisc/include/asm/assembly.h +1 -0
@@ -574,6 +574,7 @@*/ #define ASM_EXCEPTIONTABLE_ENTRY (fault_addr, except_addr) \ .section __ex_table,"aw" ! \ + .align 4 ! \ .word (fault_addr - .), (except_addr - .) ! \ .previous
Signature · 1 line
2.42.0
PATCH 2/8 parisc: Mark __ex_table entries 32-bit aligned in uaccess.h
In reply to [email protected]From: Helge Deller <[email protected]>
Add an align statement to tell the linker that all __ex_table entries and as such the whole __ex_table section should be 32-bit aligned in vmlinux and modules.
--- arch/parisc/include/asm/uaccess.h | 1 + 1 file changed, 1 insertion(+)
arch/parisc/include/asm/uaccess.h +1 -0
@@ -41,6 +41,7 @@ struct exception_table_entry {#define ASM_EXCEPTIONTABLE_ENTRY ( fault_addr, except_addr )\ ".section __ex_table,\"aw\"\n" \ + ".align 4\n" \ ".word (" #fault_addr " - .), (" #except_addr " - .)\n\t" \ ".previous\n"
Signature · 1 line
2.42.0
PATCH 3/8 parisc: Specify alignments for .PARISC.unwind and .data..lock_aligned
In reply to [email protected]From: Helge Deller <[email protected]>
Make sure the unwind section will be 32-bit aligned.
Explicitely mark the .data..lock_aligned explicitely 16-byte aligned in vmlinux.lds.S although the previous ALIGN(16) statement already does it right.
Add __aligned(16) to __lock_aligned define to ensure that such variables will have an alignment of 16 in the sections of the object files.
--- arch/parisc/include/asm/ldcw.h | 2 +- arch/parisc/kernel/vmlinux.lds.S | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
arch/parisc/include/asm/ldcw.h +1 -1
@@ -55,7 +55,7 @@ })#ifdef CONFIG_SMP -# define __lock_aligned __section(".data..lock_aligned") +# define __lock_aligned __section(".data..lock_aligned") __aligned(16)#endif #endif /* __PARISC_LDCW_H */
arch/parisc/kernel/vmlinux.lds.S +2 -2
@@ -130,7 +130,7 @@ SECTIONS RO_DATA(8) /* unwind info */ - .PARISC.unwind : { + .PARISC.unwind ALIGN(4) : { __start___unwind = .; *(.PARISC.unwind) __stop___unwind = .;
@@ -149,7 +149,7 @@ SECTIONS /* PA-RISC locks requires 16-byte alignment */ . = ALIGN(16); - .data..lock_aligned : { + .data..lock_aligned ALIGN(16) : { *(.data..lock_aligned) }
Signature · 1 line
2.42.0
PATCH 4/8 parisc: Mark altinstructions 32-bit aligned
In reply to [email protected]From: Helge Deller <[email protected]>
Make sure that the altinstruction section gets 32-bit aligned.
--- arch/parisc/include/asm/alternative.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
arch/parisc/include/asm/alternative.h +6 -3
@@ -34,7 +34,8 @@ void apply_alternatives(struct alt_instr *start, struct alt_instr *end,/* Alternative SMP implementation. */ #define ALTERNATIVE (cond, replacement) "!0:" \ - ".section .altinstructions, \"aw\" !" \ + ".section .altinstructions, \"a\" !" \ + ".align 4 !" \ ".word (0b-4-.) !" \ ".hword 1, " __stringify(cond) " !" \ ".word " __stringify(replacement) " !" \
@@ -44,7 +45,8 @@ void apply_alternatives(struct alt_instr *start, struct alt_instr *end,/* to replace one single instructions by a new instruction */ #define ALTERNATIVE (from, to, cond, replacement)\ - .section .altinstructions, "aw" ! \ + .section .altinstructions, "a" ! \ + .align 4 ! \ .word (from - .) ! \ .hword (to - from)/4, cond ! \ .word replacement ! \
@@ -52,7 +54,8 @@ void apply_alternatives(struct alt_instr *start, struct alt_instr *end,/* to replace multiple instructions by new code */ #define ALTERNATIVE_CODE (from, num_instructions, cond, new_instr_ptr)\ - .section .altinstructions, "aw" ! \ + .section .altinstructions, "a" ! \ + .align 4 ! \ .word (from - .) ! \ .hword -num_instructions, cond ! \ .word (new_instr_ptr - .) ! \
Signature · 1 line
2.42.0
PATCH 5/8 parisc: Mark __jump_table aligned to CPU long width
In reply to [email protected]From: Helge Deller <[email protected]>
The __jump_table stores two 32-bit words and one 32- or 64-bit word (for 64-bit kernel).
Ensure that the third word is correctly 64-bit aligned by aligning the whole structure correctly.
--- arch/parisc/include/asm/jump_label.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
arch/parisc/include/asm/jump_label.h +6 -2
@@ -15,10 +15,12 @@ static __always_inline bool arch_static_branch(struct static_key *key, bool bran asm_volatile_goto("1:\n\t" "nop\n\t" ".pushsection __jump_table, \"aw\"\n\t" + ".align %1\n\t" ".word 1b - ., %l[l_yes] - .\n\t" __stringify(ASM_ULONG_INSN) " %c0 - .\n\t" ".popsection\n\t" - : : "i" (&((char *)key)[branch]) : : l_yes); + : : "i" (&((char *)key)[branch]), "i" (sizeof(long)) + : : l_yes);return false; l_yes:
@@ -30,10 +32,12 @@ static __always_inline bool arch_static_branch_jump(struct static_key *key, bool asm_volatile_goto("1:\n\t" "b,n %l[l_yes]\n\t" ".pushsection __jump_table, \"aw\"\n\t" + ".align %1\n\t" ".word 1b - ., %l[l_yes] - .\n\t" __stringify(ASM_ULONG_INSN) " %c0 - .\n\t" ".popsection\n\t" - : : "i" (&((char *)key)[branch]) : : l_yes); + : : "i" (&((char *)key)[branch]), "i" (sizeof(long)) + : : l_yes);return false; l_yes:
Signature · 1 line
2.42.0
PATCH 6/8 parisc: Use correct alignment in __bug_table
In reply to [email protected]From: Helge Deller <[email protected]>
Make sure that the __bug_table section gets 32- or 64-bit aligned, depending if a 32- or 64-bit kernel is being built. Mark the ____bug_table not writeable, and use .blockz instead of .org assembler directive to pad the struct.
--- arch/parisc/include/asm/bug.h | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-)
arch/parisc/include/asm/bug.h +18 -12
@@ -28,13 +28,15 @@do { \ asmvolatile ("\n" \"1:\t" PARISC_BUG_BREAK_ASM "\n" \ -"\t.pushsection __bug_table,\"aw\"\n" \ +"\t.pushsection __bug_table,\"a\"\n" \ +"\t.align %4\n" \"2:\t" ASM_WORD_INSN "1b, %c0\n" \ -"\t.short %c1, %c2\n" \ -"\t.org 2b+%c3\n" \ +"\t.short %1, %2\n" \ +"\t.blockz %3-2*%4-2*2\n" \"\t.popsection" \ : :"i" (__FILE__),"i" (__LINE__), \ -"i" (0 ),"i" (sizeof (struct bug_entry )) ); \ +"i" (0 ),"i" (sizeof (struct bug_entry )), \ +"i" (sizeof (long )) ); \unreachable (); \ }while (0 )
@@ -51,27 +53,31 @@do { \ asmvolatile ("\n" \"1:\t" PARISC_BUG_BREAK_ASM "\n" \ -"\t.pushsection __bug_table,\"aw\"\n" \ +"\t.pushsection __bug_table,\"a\"\n" \ +"\t.align %4\n" \"2:\t" ASM_WORD_INSN "1b, %c0\n" \ -"\t.short %c1, %c2\n" \ -"\t.org 2b+%c3\n" \ +"\t.short %1, %2\n" \ +"\t.blockz %3-2*%4-2*2\n" \"\t.popsection" \ : :"i" (__FILE__),"i" (__LINE__), \"i" (BUGFLAG_WARNING |(flags)), \ -"i" (sizeof (struct bug_entry )) ); \ +"i" (sizeof (struct bug_entry )), \ +"i" (sizeof (long )) ); \ } while(0)#else #define __WARN_FLAGS (flags) \ do { \ asm volatile("\n" \ "1:\t" PARISC_BUG_BREAK_ASM "\n" \ - "\t.pushsection __bug_table,\"aw\"\n" \ + "\t.pushsection __bug_table,\"a\"\n" \ + "\t.align %2\n" \ "2:\t" ASM_WORD_INSN "1b\n" \ - "\t.short %c0\n" \ - "\t.org 2b+%c1\n" \ + "\t.short %0\n" \ + "\t.blockz %1-%2-2\n" \ "\t.popsection" \ : : "i" (BUGFLAG_WARNING|(flags)), \ - "i" (sizeof(struct bug_entry)) ); \ + "i" (sizeof(struct bug_entry)), \ + "i" (sizeof(long)) ); \ } while(0)#endif
Signature · 1 line
2.42.0
PATCH 7/8 parisc: Drop the HP-UX ENOSYM and EREMOTERELEASE error codes
In reply to [email protected]From: Helge Deller <[email protected]>
Those return codes are only defined for the parisc architecture and are leftovers from when we wanted to be HP-UX compatible.
They are not returned by any Linux kernel syscall but do trigger problems with the glibc strerrorname_np() and strerror() functions as reported in glibc issue #31080.
There is no need to keep them, so simply remove them.
--- arch/parisc/include/uapi/asm/errno.h | 2 -- lib/errname.c | 6 ------ tools/arch/parisc/include/uapi/asm/errno.h | 2 -- 3 files changed, 10 deletions(-)
arch/parisc/include/uapi/asm/errno.h +0 -2
@@ -75,7 +75,6 @@/* We now return you to your regularly scheduled HPUX. */ -#define ENOSYM 215/* symbol does not exist in executable */ #define ENOTSOCK 216/* Socket operation on non-socket */ #define EDESTADDRREQ 217/* Destination address required */ #define EMSGSIZE 218/* Message too long */
@@ -101,7 +100,6 @@#define ETIMEDOUT 238/* Connection timed out */ #define ECONNREFUSED 239/* Connection refused */ #define EREFUSED ECONNREFUSED/* for HP's NFS apparently */ -#define EREMOTERELEASE 240/* Remote peer released connection */ #define EHOSTDOWN 241/* Host is down */ #define EHOSTUNREACH 242/* No route to host */
lib/errname.c +0 -6
@@ -111,9 +111,6 @@ static const char *names_0[] = {E (ENOSPC ),E (ENOSR ),E (ENOSTR ), -#ifdef ENOSYM -E (ENOSYM ), -#endifE (ENOSYS ),E (ENOTBLK ), E(ENOTCONN),
@@ -144,9 +141,6 @@ static const char *names_0[] = {#endif E (EREMOTE ),E (EREMOTEIO ), -#ifdef EREMOTERELEASE -E (EREMOTERELEASE ), -#endifE (ERESTART ),E (ERFKILL ), E(EROFS),
tools/arch/parisc/include/uapi/asm/errno.h +0 -2
@@ -75,7 +75,6 @@/* We now return you to your regularly scheduled HPUX. */ -#define ENOSYM 215/* symbol does not exist in executable */ #define ENOTSOCK 216/* Socket operation on non-socket */ #define EDESTADDRREQ 217/* Destination address required */ #define EMSGSIZE 218/* Message too long */
@@ -101,7 +100,6 @@#define ETIMEDOUT 238/* Connection timed out */ #define ECONNREFUSED 239/* Connection refused */ #define EREFUSED ECONNREFUSED/* for HP's NFS apparently */ -#define EREMOTERELEASE 240/* Remote peer released connection */ #define EHOSTDOWN 241/* Host is down */ #define EHOSTUNREACH 242/* No route to host */
Signature · 1 line
2.42.0
PATCH 8/8 parisc: Reduce size of __bug_table[] on 64-bit kernel by half
In reply to [email protected]From: Helge Deller <[email protected]>
Enable GENERIC_BUG_RELATIVE_POINTERS which will store 32-bit relative offsets to the bug address and the source file name instead of 64-bit absolute addresses. This effectively reduces the size of the __bug_table[] array by half on 64-bit kernels.
--- arch/parisc/Kconfig | 7 +++++-- arch/parisc/include/asm/bug.h | 34 +++++++++++++++++----------------- 2 files changed, 22 insertions(+), 19 deletions(-)
arch/parisc/Kconfig +5 -2
@@ -115,9 +115,12 @@ config ARCH_HAS_ILOG2_U64 default n config GENERIC_BUG - bool - default y + def_bool y depends on BUG + select GENERIC_BUG_RELATIVE_POINTERS if 64BIT + +config GENERIC_BUG_RELATIVE_POINTERS + bool config GENERIC_HWEIGHT bool
arch/parisc/include/asm/bug.h +17 -17
@@ -17,26 +17,27 @@#define PARISC_BUG_BREAK_ASM "break 0x1f, 0x1fff"#define PARISC_BUG_BREAK_INSN 0x03ffe01f/* PARISC_BUG_BREAK_ASM */ -#if defined(CONFIG_64BIT ) -#define ASM_WORD_INSN ".dword\t" +#ifdef CONFIG_GENERIC_BUG_RELATIVE_POINTERS +# define __BUG_REL (val) ".word " __stringify(val) " - ."#else -#define ASM_WORD_INSN ".word\t" +# define __BUG_REL (val) ".word " __stringify(val)#endif +#ifdef CONFIG_DEBUG_BUGVERBOSE #define BUG () \ do { \ asm volatile("\n" \ "1:\t" PARISC_BUG_BREAK_ASM "\n" \ "\t.pushsection __bug_table,\"a\"\n" \ - "\t.align %4\n" \ - "2:\t" ASM_WORD_INSN "1b, %c0\n" \ + "\t.align 4\n" \ + "2:\t" __BUG_REL(1b) "\n" \ + "\t" __BUG_REL(%c0) "\n" \ "\t.short %1, %2\n" \ - "\t.blockz %3-2*%4-2*2\n" \ + "\t.blockz %3-2*4-2*2\n" \ "\t.popsection" \ : : "i" (__FILE__), "i" (__LINE__), \ - "i" (0), "i" (sizeof(struct bug_entry)), \ - "i" (sizeof(long)) ); \ + "i" (0), "i" (sizeof(struct bug_entry)) ); \ unreachable(); \ } while(0)
@@ -54,15 +55,15 @@ asmvolatile ("\n" \"1:\t" PARISC_BUG_BREAK_ASM "\n" \"\t.pushsection __bug_table,\"a\"\n" \ -"\t.align %4\n" \ -"2:\t" ASM_WORD_INSN "1b, %c0\n" \ +"\t.align 4\n" \ + "2:\t" __BUG_REL(1b) "\n" \ + "\t" __BUG_REL(%c0) "\n" \"\t.short %1, %2\n" \ -"\t.blockz %3-2*%4-2*2\n" \ +"\t.blockz %3-2*4-2*2\n" \"\t.popsection" \ : : "i" (__FILE__), "i" (__LINE__), \"i" (BUGFLAG_WARNING |(flags)), \ -"i" (sizeof (struct bug_entry )), \ -"i" (sizeof (long )) ); \ + "i" (sizeof(struct bug_entry)) ); \ } while(0) #else#define __WARN_FLAGS (flags) \
@@ -71,13 +72,12 @@"1:\t" PARISC_BUG_BREAK_ASM "\n" \"\t.pushsection __bug_table,\"a\"\n" \"\t.align %2\n" \ -"2:\t" ASM_WORD_INSN "1b\n" \ + "2:\t" __BUG_REL(1b) "\n" \"\t.short %0\n" \ -"\t.blockz %1-%2-2\n" \ +"\t.blockz %1-4-2\n" \"\t.popsection" \ : : "i" (BUGFLAG_WARNING|(flags)), \ -"i" (sizeof (struct bug_entry )), \ - "i" (sizeof(long)) ); \ + "i" (sizeof(struct bug_entry)) ); \ } while(0)#endif
Signature · 1 line
2.42.0
Re: [PATCH 8/8] parisc: Reduce size of __bug_table[] on 64-bit kernel by half
Quoted 8 lines · On Fri, Nov 24, 2023 at 03:41:13PM +0100, [email protected] wrote:
From: Helge Deller <[email protected]>
Enable
GENERIC_BUG_RELATIVE_POINTERSwhich will store 32-bit relative offsets to the bug address and the source file name instead of 64-bit absolute addresses. This effectively reduces the size of the __bug_table[] array by half on 64-bit kernels.Signed-off-by Helge Deller <[email protected]>
With this patch in mainline, parisc:tinyconfig fails to build.
ecurity/commoncap.c: In function 'cap_capset':arch/parisc/include/asm/bug.h:71:17: error: invalid 'asm': operand number out of range
71 | asm volatile("\n" \
| ^~~and many similar errors. Bisect log attached.
Guenter
---
# bad: [3b47bc037bd44f142ac09848e8d3ecccc726be99] Merge tag 'pinctrl-v6.7-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl
# good: [98b1cc82c4affc16f5598d4fa14b1858671b2263] Linux 6.7-rc2
git bisect start 'HEAD' 'v6.7-rc2'
# good: [f1a09972a45ae63efbd1587337c4be13b1893330] Merge tag 'ata-6.7-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/libata
git bisect good f1a09972a45ae63efbd1587337c4be13b1893330
# good: [090472ed9c922e699dc61dd601a9b376a64f4390] Merge tag 'usb-6.7-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
git bisect good 090472ed9c922e699dc61dd601a9b376a64f4390
# bad: [2cc14f52aeb78ce3f29677c2de1f06c0e91471ab] Linux 6.7-rc3
git bisect bad 2cc14f52aeb78ce3f29677c2de1f06c0e91471ab
# good: [4892711acee0915a8a4ae02e1af3dc70ce000024] Merge tag 'x86-urgent-2023-11-26' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
git bisect good 4892711acee0915a8a4ae02e1af3dc70ce000024
# bad: [43266838515d30dc0c45d5c7e6e7edacee6cce92] parisc: Reduce size of the bug_table on 64-bit kernel by half
git bisect bad 43266838515d30dc0c45d5c7e6e7edacee6cce92
# good: [07eecff8ae78df7f28800484d31337e1f9bfca3a] parisc: Mark jump_table naturally aligned
git bisect good 07eecff8ae78df7f28800484d31337e1f9bfca3a
# good: [c9fcb2b65c2849e8ff3be23fd8828312fb68dc19] parisc: Ensure 32-bit alignment on parisc unwind section
git bisect good c9fcb2b65c2849e8ff3be23fd8828312fb68dc19
# good: [e5f3e299a2b1e9c3ece24a38adfc089aef307e8a] parisc: Drop the HP-UX ENOSYM and EREMOTERELEASE error codes
git bisect good e5f3e299a2b1e9c3ece24a38adfc089aef307e8a
# first bad commit: [43266838515d30dc0c45d5c7e6e7edacee6cce92] parisc: Reduce size of the bug_table on 64-bit kernel by half
Helge Deller
maintainerRe: [PATCH 8/8] parisc: Reduce size of __bug_table[] on 64-bit kernel by half
Quoted 10 lines · Guenter Roeck
Quoted 8 lines · On Fri, Nov 24, 2023 at 03:41:13PM +0100, [email protected] wrote:
From: Helge Deller <[email protected]>
Enable
GENERIC_BUG_RELATIVE_POINTERSwhich will store 32-bit relative offsets to the bug address and the source file name instead of 64-bit absolute addresses. This effectively reduces the size of the __bug_table[] array by half on 64-bit kernels.Signed-off-by Helge Deller <[email protected]>
Quoted 8 lines
With this patch in mainline, parisc:tinyconfig fails to build.
ecurity/commoncap.c: In function 'cap_capset':arch/parisc/include/asm/bug.h:71:17: error: invalid 'asm': operand number out of range71 | asm volatile("\n" \ | ^~~and many similar errors. Bisect log attached.
Yes, problem was reported already and fix is in my for-next git tree:
Thanks!
Helge