Minor Alpha updates for 3.11
Subsystems (2)
cover Minor Alpha updates for 3.11
Here's a set of minor updates for arch/alpha that should not be controversial.
r~
The following changes since commit 47188d39b5deeebf41f87a02af1b3935866364cf:
Merge tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4 (2013-07-14 21:47:51 -0700)
are available in the git repository at:
git://github.com/rth7680/linux.git axp-next
for you to fetch changes up to fd60fe7052eceab1b1e7c8691263ec2b2634ace0:
alpha: Fix type compatibility warning for marvel_map_irq (2013-07-16 09:55:06 -0700)
----------------------------------------------------------------
Richard Henderson (7):
alpha: Add kcmp and finit_module syscalls
alpha: Eliminate compiler warning from memset macro
alpha: Modernize lib/mpi/longlong.h
alpha: Improve atomic_add_unless
alpha: Implement atomic64_dec_if_positive
alpha: Generate dwarf2 unwind info for various kernel entry points.
alpha: Fix type compatibility warning for marvel_map_irq
arch/alpha/Kconfig | 1 + arch/alpha/include/asm/atomic.h | 88 ++++++-- arch/alpha/include/asm/string.h | 18 +- arch/alpha/include/asm/unistd.h | 3 +- arch/alpha/include/uapi/asm/unistd.h | 2 + arch/alpha/kernel/entry.S | 399 +++++++++++++++++++++++++---------- arch/alpha/kernel/sys_marvel.c | 3 +- arch/alpha/kernel/systbls.S | 2 + lib/mpi/longlong.h | 17 +- 9 files changed, 380 insertions(+), 153 deletions(-)
PATCH 1/7 alpha: Add kcmp and finit_module syscalls
--- arch/alpha/include/asm/unistd.h | 3 +-- arch/alpha/include/uapi/asm/unistd.h | 2 ++ arch/alpha/kernel/systbls.S | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-)
arch/alpha/include/asm/unistd.h +1 -2
@@ -3,8 +3,7 @@#include <uapi/asm/unistd.h> - -#define NR_SYSCALLS 506 +#define NR_SYSCALLS 508#define __ARCH_WANT_OLD_READDIR#define __ARCH_WANT_STAT64
arch/alpha/include/uapi/asm/unistd.h +2 -0
@@ -467,5 +467,7 @@#define __NR_sendmmsg 503#define __NR_process_vm_readv 504#define __NR_process_vm_writev 505 +#define __NR_kcmp 506 +#define __NR_finit_module 507#endif /* _UAPI_ALPHA_UNISTD_H */
arch/alpha/kernel/systbls.S +2 -0
@@ -524,6 +524,8 @@ sys_call_table: .quad sys_sendmmsg .quad sys_process_vm_readv .quad sys_process_vm_writev /* 505 */ + .quad sys_kcmp + .quad sys_finit_module .size sys_call_table, . - sys_call_table .type sys_call_table, @object
Signature · 1 line
1.8.1.4
PATCH 2/7 alpha: Eliminate compiler warning from memset macro
In reply to Richard HendersonCompiling with GCC 4.8 yields several instances of
crypto/vmac.c: In function ‘vmac_final’:crypto/vmac.c:616:9: warning: value computed is not used [-Wunused-value]
memset(&mac, 0, sizeof(vmac_t));
^
arch/alpha/include/asm/string.h:31:25: note: in definition of macro ‘memset’
? __builtin_memset((s),0,(n)) \
^Converting the macro to an inline function eliminates this problem.
--- arch/alpha/include/asm/string.h | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
arch/alpha/include/asm/string.h +12 -6
@@ -25,12 +25,18 @@ extern void * __constant_c_memset(void *, unsigned long, size_t);extern void *__memset (void *,int ,size_t );extern void *memset (void *,int ,size_t ); -#define memset (s, c, n) \ -(__builtin_constant_p(c) \ - ? (__builtin_constant_p(n) && (c) == 0 \ - ? __builtin_memset((s),0,(n)) \ - : __constant_c_memset((s),0x0101010101010101UL*(unsigned char)(c),(n))) \ - : __memset((s),(c),(n))) +extern inline void *memset (void *s,int c,size_t n) +{ +if (__builtin_constant_p (c)) { +if (__builtin_constant_p (n)) { +return __builtin_memset (s, c, n); + }else { +unsigned long c8 = (c &0xff ) *0x0101010101010101UL ; +return __constant_c_memset (s, c8, n); + } + } +return __memset (s, c, n); +}#define __HAVE_ARCH_STRCPYextern char *strcpy (char *,const char *);
Signature · 1 line
1.8.1.4
Matt Turner
maintainerRe: [PATCH 2/7] alpha: Eliminate compiler warning from memset macro
Quoted 9 lines · Richard Henderson
Compiling with GCC 4.8 yields several instances of
crypto/vmac.c: In function ‘vmac_final’:crypto/vmac.c:616:9: warning: value computed is not used [-Wunused-value]memset(&mac, 0, sizeof(vmac_t)); ^ arch/alpha/include/asm/string.h:31:25: note: in definition of macro ‘memset’ ? __builtin_memset((s),0,(n)) \ ^
Quoted 4 lines
Converting the macro to an inline function eliminates this problem.
Signed-off-by Richard Henderson <[email protected]>---
On IRC we found out that this breaks the breaks kernel build with gcc-3.4 with "sorry, unimplemented: inlining failed in call to 'memset': recursive inlining" message on some file. I'll drop this patch for now.
PATCH 3/7 alpha: Modernize lib/mpi/longlong.h
In reply to Richard HendersonRemove the compile warning for __udiv_qrnnd not having a prototype. Use the __builtin_alpha_umulh introduced in gcc 4.0.
--- lib/mpi/longlong.h | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-)
lib/mpi/longlong.h +7 -10
@@ -151,15 +151,12 @@ do { \#endif /* __a29k__ */ #if defined(__alpha) &&W_TYPE_SIZE ==64 -#define umul_ppmm (ph, pl, m0, m1) \ -do { \ - UDItype __m0 = (m0), __m1 = (m1); \ - __asm__ ("umulh %r1,%2,%0" \ - : "=r" ((UDItype) ph) \ - : "%rJ" (__m0), \ - "rI" (__m1)); \ - (pl) = __m0 * __m1; \ - } while (0) +#define umul_ppmm (ph, pl, m0, m1) \ +do { \ + UDItype __m0 = (m0), __m1 = (m1); \ + (ph) = __builtin_alpha_umulh(__m0, __m1); \ + (pl) = __m0 * __m1; \ +} while (0)#define UMUL_TIME 46#ifndef LONGLONG_STANDALONE #define udiv_qrnnd (q, r, n1, n0, d) \
@@ -167,7 +164,7 @@ do { UDItype __r; \ (q) =__udiv_qrnnd (&__r, (n1), (n0), (d)); \ (r) = __r; \ } while (0) -extern UDItype __udiv_qrnnd(); +extern UDItype __udiv_qrnnd(UDItype *, UDItype, UDItype, UDItype);#define UDIV_TIME 220#endif /* LONGLONG_STANDALONE */ #endif /* __alpha */
Signature · 1 line
1.8.1.4
Re: [PATCH 3/7] alpha: Modernize lib/mpi/longlong.h
Quoted 2 lines · Richard Henderson
Remove the compile warning for
__udiv_qrnndnot having a prototype. Use the__builtin_alpha_umulhintroduced in gcc 4.0.
Isn't gcc 3.x still a supported compiler?
lib/mpi/longlong.h
Quoted 1 line
lib/mpi/longlong.h +0
-0
[]
Quoted 31 lines
lib/mpi/longlong.h +7
-10@@ -151,15 +151,12 @@ do { \#endif /* __a29k__ */ #if defined(__alpha) &&W_TYPE_SIZE ==64 -#define umul_ppmm (ph, pl, m0, m1) \ -do { \ - UDItype __m0 = (m0), __m1 = (m1); \ - __asm__ ("umulh %r1,%2,%0" \ - : "=r" ((UDItype) ph) \ - : "%rJ" (__m0), \ - "rI" (__m1)); \ - (pl) = __m0 * __m1; \ - } while (0) +#define umul_ppmm (ph, pl, m0, m1) \ +do { \ + UDItype __m0 = (m0), __m1 = (m1); \ + (ph) = __builtin_alpha_umulh(__m0, __m1); \ + (pl) = __m0 * __m1; \ +} while (0)#define UMUL_TIME 46#ifndef LONGLONG_STANDALONE #define udiv_qrnnd (q, r, n1, n0, d) \@@ -167,7 +164,7 @@ do { UDItype __r; \ (q) =__udiv_qrnnd (&__r, (n1), (n0), (d)); \ (r) = __r; \ } while (0) -extern UDItype __udiv_qrnnd(); +extern UDItype __udiv_qrnnd(UDItype *, UDItype, UDItype, UDItype);#define UDIV_TIME 220#endif /* LONGLONG_STANDALONE */ #endif /* __alpha */
Re: [PATCH 3/7] alpha: Modernize lib/mpi/longlong.h
Quoted 5 lines · Joe Perches
Quoted 2 lines · Richard Henderson
Remove the compile warning for
__udiv_qrnndnot having a prototype. Use the__builtin_alpha_umulhintroduced in gcc 4.0.Isn't gcc 3.x still a supported compiler?
Further investigation shows the builtin was added for gcc 3.2. I just failed to update gcc's own longlong.h til 3 years later.
r~
PATCH 4/7 alpha: Improve atomic_add_unless
In reply to Richard HendersonUse ll/sc loops instead of C loops around cmpxchg. Update the atomic64_add_unless block comment to match the code.
--- arch/alpha/include/asm/atomic.h | 60 +++++++++++++++++++++++++---------------- 1 file changed, 37 insertions(+), 23 deletions(-)
arch/alpha/include/asm/atomic.h +37 -23
@@ -186,17 +186,24 @@ static __inline__ long atomic64_sub_return(long i, atomic64_t * v)*/ static __inline__int __atomic_add_unless (atomic_t *v,int a,int u) { -int c, old; - c =atomic_read (v); -for (;;) { -if (unlikely (c == (u))) -break ; - old =atomic_cmpxchg ((v), c, c + (a)); -if (likely (old == c)) -break ; - c = old; - } -return c; +int c, new, old; +smp_mb (); + __asm__ __volatile__( +"1: ldl_l %[old],%[mem]\n" +" cmpeq %[old],%[u],%[c]\n" +" addl %[old],%[a],%[new]\n" +" bne %[c],2f\n" +" stl_c %[new],%[mem]\n" +" beq %[new],3f\n" +"2:\n" +".subsection 2\n" +"3: br 1b\n" +".previous" + : [old]"=&r" (old), [new]"=&r" (new), [c]"=&r" (c) + : [mem]"m" (*v), [a]"rI" (a), [u]"rI" ((long )u) + :"memory" ); +smp_mb (); +return old; }
@@ -207,21 +214,28 @@ static __inline__ int __atomic_add_unless(atomic_t *v, int a, int u)* @u: ...unless v is equal to u. * * Atomically adds @a to @v, so long as it was not @u. -* Returns the old value of @v. +* Returns true iff @v was not @u. */ static __inline__int atomic64_add_unless (atomic64_t *v,long a,long u) { -long c, old; - c =atomic64_read (v); -for (;;) { -if (unlikely (c == (u))) -break ; - old =atomic64_cmpxchg ((v), c, c + (a)); -if (likely (old == c)) -break ; - c = old; - } -return c != (u); +long c, tmp; +smp_mb (); + __asm__ __volatile__( +"1: ldq_l %[tmp],%[mem]\n" +" cmpeq %[tmp],%[u],%[c]\n" +" addq %[tmp],%[a],%[tmp]\n" +" bne %[c],2f\n" +" stq_c %[tmp],%[mem]\n" +" beq %[tmp],3f\n" +"2:\n" +".subsection 2\n" +"3: br 1b\n" +".previous" + : [tmp]"=&r" (tmp), [c]"=&r" (c) + : [mem]"m" (*v), [a]"rI" (a), [u]"rI" (u) + :"memory" ); +smp_mb (); +return !c; }#define atomic64_inc_not_zero (v) atomic64_add_unless((v), 1, 0)
Signature · 1 line
1.8.1.4
PATCH 5/7 alpha: Implement atomic64_dec_if_positive
In reply to Richard Henderson--- arch/alpha/Kconfig | 1 + arch/alpha/include/asm/atomic.h | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+)
arch/alpha/Kconfig +1 -0
@@ -15,6 +15,7 @@ config ALPHA select ARCH_WANT_OPTIONAL_GPIOLIB select ARCH_WANT_IPC_PARSE_VERSION select ARCH_HAVE_NMI_SAFE_CMPXCHG + select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE select GENERIC_SMP_IDLE_THREAD select GENERIC_CMOS_UPDATE select GENERIC_STRNCPY_FROM_USER
arch/alpha/include/asm/atomic.h +28 -0
@@ -238,6 +238,34 @@ static __inline__ int atomic64_add_unless(atomic64_t *v, long a, long u)return !c; } +/* +* atomic64_dec_if_positive - decrement by 1 if old value positive +* @v: pointer of type atomic_t +* +* The function returns the old value of *v minus 1, even if +* the atomic variable, v, was not decremented. +*/ +static inline long atomic64_dec_if_positive (atomic64_t *v) +{ +long old, tmp; +smp_mb (); + __asm__ __volatile__( +"1: ldq_l %[old],%[mem]\n" +" subq %[old],1,%[tmp]\n" +" ble %[old],2f\n" +" stq_c %[tmp],%[mem]\n" +" beq %[tmp],3f\n" +"2:\n" +".subsection 2\n" +"3: br 1b\n" +".previous" + : [old]"=&r" (old), [tmp]"=&r" (tmp) + : [mem]"m" (*v) + :"memory" ); +smp_mb (); +return old -1 ; +} +#define atomic64_inc_not_zero (v) atomic64_add_unless((v), 1, 0)#define atomic_add_negative (a, v) (atomic_add_return((a), (v)) < 0)
Signature · 1 line
1.8.1.4
PATCH 6/7 alpha: Generate dwarf2 unwind info for various kernel entry points.
In reply to Richard HendersonHaving unwind info past the PALcode generated stack frame makes debugging the kernel significantly easier.
--- arch/alpha/kernel/entry.S | 399 +++++++++++++++++++++++++++++++++------------- 1 file changed, 288 insertions(+), 111 deletions(-)
arch/alpha/kernel/entry.S +288 -111
@@ -12,11 +12,32 @@ .text .set noat + .cfi_sections .debug_frame /* Stack offsets. */ #define SP_OFF 184 #define SWITCH_STACK_SIZE 320 +.macro CFI_START_OSF_FRAME func + .align 4 + .globl \func + .type \func,@function +\func: + .cfi_startproc simple + .cfi_return_column 64 + .cfi_def_cfa $sp, 48 + .cfi_rel_offset 64, 8 + .cfi_rel_offset $gp, 16 + .cfi_rel_offset $16, 24 + .cfi_rel_offset $17, 32 + .cfi_rel_offset $18, 40 +.endm + +.macro CFI_END_OSF_FRAME func + .cfi_endproc + .size \func, . - \func +.endm + /* * This defines the normal kernel pt-regs layout. *
@@ -27,100 +48,158 @@ * the palcode-provided values are available to the signal handler. */ -#define SAVE_ALL \ - subq $sp, SP_OFF, $sp; \ - stq $0, 0($sp); \ - stq $1, 8($sp); \ - stq $2, 16($sp); \ - stq $3, 24($sp); \ - stq $4, 32($sp); \ - stq $28, 144($sp); \ - lda $2, alpha_mv; \ - stq $5, 40($sp); \ - stq $6, 48($sp); \ - stq $7, 56($sp); \ - stq $8, 64($sp); \ - stq $19, 72($sp); \ - stq $20, 80($sp); \ - stq $21, 88($sp); \ - ldq $2, HAE_CACHE($2); \ - stq $22, 96($sp); \ - stq $23, 104($sp); \ - stq $24, 112($sp); \ - stq $25, 120($sp); \ - stq $26, 128($sp); \ - stq $27, 136($sp); \ - stq $2, 152($sp); \ - stq $16, 160($sp); \ - stq $17, 168($sp); \ +.macro SAVE_ALL + subq $sp, SP_OFF, $sp + .cfi_adjust_cfa_offset SP_OFF + stq $0, 0($sp) + stq $1, 8($sp) + stq $2, 16($sp) + stq $3, 24($sp) + stq $4, 32($sp) + stq $28, 144($sp) + .cfi_rel_offset $0, 0 + .cfi_rel_offset $1, 8 + .cfi_rel_offset $2, 16 + .cfi_rel_offset $3, 24 + .cfi_rel_offset $4, 32 + .cfi_rel_offset $28, 144 + lda $2, alpha_mv + stq $5, 40($sp) + stq $6, 48($sp) + stq $7, 56($sp) + stq $8, 64($sp) + stq $19, 72($sp) + stq $20, 80($sp) + stq $21, 88($sp) + ldq $2, HAE_CACHE($2) + stq $22, 96($sp) + stq $23, 104($sp) + stq $24, 112($sp) + stq $25, 120($sp) + stq $26, 128($sp) + stq $27, 136($sp) + stq $2, 152($sp) + stq $16, 160($sp) + stq $17, 168($sp) stq $18, 176($sp) + .cfi_rel_offset $5, 40 + .cfi_rel_offset $6, 48 + .cfi_rel_offset $7, 56 + .cfi_rel_offset $8, 64 + .cfi_rel_offset $19, 72 + .cfi_rel_offset $20, 80 + .cfi_rel_offset $21, 88 + .cfi_rel_offset $22, 96 + .cfi_rel_offset $23, 104 + .cfi_rel_offset $24, 112 + .cfi_rel_offset $25, 120 + .cfi_rel_offset $26, 128 + .cfi_rel_offset $27, 136 +.endm -#define RESTORE_ALL \ - lda $19, alpha_mv; \ - ldq $0, 0($sp); \ - ldq $1, 8($sp); \ - ldq $2, 16($sp); \ - ldq $3, 24($sp); \ - ldq $21, 152($sp); \ - ldq $20, HAE_CACHE($19); \ - ldq $4, 32($sp); \ - ldq $5, 40($sp); \ - ldq $6, 48($sp); \ - ldq $7, 56($sp); \ - subq $20, $21, $20; \ - ldq $8, 64($sp); \ - beq $20, 99f; \ - ldq $20, HAE_REG($19); \ - stq $21, HAE_CACHE($19); \ - stq $21, 0($20); \ -99:; \ - ldq $19, 72($sp); \ - ldq $20, 80($sp); \ - ldq $21, 88($sp); \ - ldq $22, 96($sp); \ - ldq $23, 104($sp); \ - ldq $24, 112($sp); \ - ldq $25, 120($sp); \ - ldq $26, 128($sp); \ - ldq $27, 136($sp); \ - ldq $28, 144($sp); \ +.macro RESTORE_ALL + lda $19, alpha_mv + ldq $0, 0($sp) + ldq $1, 8($sp) + ldq $2, 16($sp) + ldq $3, 24($sp) + ldq $21, 152($sp) + ldq $20, HAE_CACHE($19) + ldq $4, 32($sp) + ldq $5, 40($sp) + ldq $6, 48($sp) + ldq $7, 56($sp) + subq $20, $21, $20 + ldq $8, 64($sp) + beq $20, 99f + ldq $20, HAE_REG($19) + stq $21, HAE_CACHE($19) + stq $21, 0($20) +99: ldq $19, 72($sp) + ldq $20, 80($sp) + ldq $21, 88($sp) + ldq $22, 96($sp) + ldq $23, 104($sp) + ldq $24, 112($sp) + ldq $25, 120($sp) + ldq $26, 128($sp) + ldq $27, 136($sp) + ldq $28, 144($sp) addq $sp, SP_OFF, $sp + .cfi_restore $0 + .cfi_restore $1 + .cfi_restore $2 + .cfi_restore $3 + .cfi_restore $4 + .cfi_restore $5 + .cfi_restore $6 + .cfi_restore $7 + .cfi_restore $8 + .cfi_restore $19 + .cfi_restore $20 + .cfi_restore $21 + .cfi_restore $22 + .cfi_restore $23 + .cfi_restore $24 + .cfi_restore $25 + .cfi_restore $26 + .cfi_restore $27 + .cfi_restore $28 + .cfi_adjust_cfa_offset -SP_OFF +.endm + +.macro DO_SWITCH_STACK + bsr $1, do_switch_stack + .cfi_adjust_cfa_offset SWITCH_STACK_SIZE + .cfi_rel_offset $9, 0 + .cfi_rel_offset $10, 8 + .cfi_rel_offset $11, 16 + .cfi_rel_offset $12, 24 + .cfi_rel_offset $13, 32 + .cfi_rel_offset $14, 40 + .cfi_rel_offset $15, 48 + /* We don't really care about the FP registers for debugging. */ +.endm + +.macro UNDO_SWITCH_STACK + bsr $1, undo_switch_stack + .cfi_restore $9 + .cfi_restore $10 + .cfi_restore $11 + .cfi_restore $12 + .cfi_restore $13 + .cfi_restore $14 + .cfi_restore $15 + .cfi_adjust_cfa_offset -SWITCH_STACK_SIZE +.endm /* * Non-syscall kernel entry points. */ - .align 4 - .globl entInt - .ent entInt -entInt: +CFI_START_OSF_FRAME entInt SAVE_ALL lda $8, 0x3fff lda $26, ret_from_sys_call bic $sp, $8, $8 mov $sp, $19 jsr $31, do_entInt -.end entInt +CFI_END_OSF_FRAME entInt - .align 4 - .globl entArith - .ent entArith -entArith: +CFI_START_OSF_FRAME entArith SAVE_ALL lda $8, 0x3fff lda $26, ret_from_sys_call bic $sp, $8, $8 mov $sp, $18 jsr $31, do_entArith -.end entArith +CFI_END_OSF_FRAME entArith - .align 4 - .globl entMM - .ent entMM -entMM: +CFI_START_OSF_FRAME entMM SAVE_ALL /* save $9 - $15 so the inline exception code can manipulate them. */ subq $sp, 56, $sp + .cfi_adjust_cfa_offset 56 stq $9, 0($sp) stq $10, 8($sp) stq $11, 16($sp)
@@ -128,6 +207,13 @@ entMM: stq $13, 32($sp) stq $14, 40($sp) stq $15, 48($sp) + .cfi_rel_offset $9, 0 + .cfi_rel_offset $10, 8 + .cfi_rel_offset $11, 16 + .cfi_rel_offset $12, 24 + .cfi_rel_offset $13, 32 + .cfi_rel_offset $14, 40 + .cfi_rel_offset $15, 48 addq $sp, 56, $19 /* handle the fault */ lda $8, 0x3fff
@@ -142,28 +228,33 @@ entMM: ldq $14, 40($sp) ldq $15, 48($sp) addq $sp, 56, $sp + .cfi_restore $9 + .cfi_restore $10 + .cfi_restore $11 + .cfi_restore $12 + .cfi_restore $13 + .cfi_restore $14 + .cfi_restore $15 + .cfi_adjust_cfa_offset -56 /* finish up the syscall as normal. */ br ret_from_sys_call -.end entMM +CFI_END_OSF_FRAME entMM - .align 4 - .globl entIF - .ent entIF -entIF: +CFI_START_OSF_FRAME entIF SAVE_ALL lda $8, 0x3fff lda $26, ret_from_sys_call bic $sp, $8, $8 mov $sp, $17 jsr $31, do_entIF -.end entIF +CFI_END_OSF_FRAME entIF - .align 4 - .globl entUna - .ent entUna -entUna: +CFI_START_OSF_FRAME entUna lda $sp, -256($sp) + .cfi_adjust_cfa_offset 256 stq $0, 0($sp) + .cfi_rel_offset $0, 0 + .cfi_remember_state ldq $0, 256($sp) /* get PS */ stq $1, 8($sp) stq $2, 16($sp)
@@ -195,6 +286,32 @@ entUna: stq $28, 224($sp) mov $sp, $19 stq $gp, 232($sp) + .cfi_rel_offset $1, 1*8 + .cfi_rel_offset $2, 2*8 + .cfi_rel_offset $3, 3*8 + .cfi_rel_offset $4, 4*8 + .cfi_rel_offset $5, 5*8 + .cfi_rel_offset $6, 6*8 + .cfi_rel_offset $7, 7*8 + .cfi_rel_offset $8, 8*8 + .cfi_rel_offset $9, 9*8 + .cfi_rel_offset $10, 10*8 + .cfi_rel_offset $11, 11*8 + .cfi_rel_offset $12, 12*8 + .cfi_rel_offset $13, 13*8 + .cfi_rel_offset $14, 14*8 + .cfi_rel_offset $15, 15*8 + .cfi_rel_offset $19, 19*8 + .cfi_rel_offset $20, 20*8 + .cfi_rel_offset $21, 21*8 + .cfi_rel_offset $22, 22*8 + .cfi_rel_offset $23, 23*8 + .cfi_rel_offset $24, 24*8 + .cfi_rel_offset $25, 25*8 + .cfi_rel_offset $26, 26*8 + .cfi_rel_offset $27, 27*8 + .cfi_rel_offset $28, 28*8 + .cfi_rel_offset $29, 29*8 lda $8, 0x3fff stq $31, 248($sp) bic $sp, $8, $8
@@ -228,16 +345,45 @@ entUna: ldq $28, 224($sp) ldq $gp, 232($sp) lda $sp, 256($sp) + .cfi_restore $1 + .cfi_restore $2 + .cfi_restore $3 + .cfi_restore $4 + .cfi_restore $5 + .cfi_restore $6 + .cfi_restore $7 + .cfi_restore $8 + .cfi_restore $9 + .cfi_restore $10 + .cfi_restore $11 + .cfi_restore $12 + .cfi_restore $13 + .cfi_restore $14 + .cfi_restore $15 + .cfi_restore $19 + .cfi_restore $20 + .cfi_restore $21 + .cfi_restore $22 + .cfi_restore $23 + .cfi_restore $24 + .cfi_restore $25 + .cfi_restore $26 + .cfi_restore $27 + .cfi_restore $28 + .cfi_restore $29 + .cfi_adjust_cfa_offset -256 call_pal PAL_rti -.end entUna .align 4 - .ent entUnaUser entUnaUser: + .cfi_restore_state ldq $0, 0($sp) /* restore original $0 */ lda $sp, 256($sp) /* pop entUna's stack frame */ + .cfi_restore $0 + .cfi_adjust_cfa_offset -256 SAVE_ALL /* setup normal kernel stack */ lda $sp, -56($sp) + .cfi_adjust_cfa_offset 56 stq $9, 0($sp) stq $10, 8($sp) stq $11, 16($sp)
@@ -245,6 +391,13 @@ entUnaUser: stq $13, 32($sp) stq $14, 40($sp) stq $15, 48($sp) + .cfi_rel_offset $9, 0 + .cfi_rel_offset $10, 8 + .cfi_rel_offset $11, 16 + .cfi_rel_offset $12, 24 + .cfi_rel_offset $13, 32 + .cfi_rel_offset $14, 40 + .cfi_rel_offset $15, 48 lda $8, 0x3fff addq $sp, 56, $19 bic $sp, $8, $8
@@ -257,20 +410,25 @@ entUnaUser: ldq $14, 40($sp) ldq $15, 48($sp) lda $sp, 56($sp) + .cfi_restore $9 + .cfi_restore $10 + .cfi_restore $11 + .cfi_restore $12 + .cfi_restore $13 + .cfi_restore $14 + .cfi_restore $15 + .cfi_adjust_cfa_offset -56 br ret_from_sys_call -.end entUnaUser +CFI_END_OSF_FRAME entUna - .align 4 - .globl entDbg - .ent entDbg -entDbg: +CFI_START_OSF_FRAME entDbg SAVE_ALL lda $8, 0x3fff lda $26, ret_from_sys_call bic $sp, $8, $8 mov $sp, $16 jsr $31, do_entDbg -.end entDbg +CFI_END_OSF_FRAME entDbg /* * The system call entry point is special. Most importantly, it looks
@@ -285,8 +443,12 @@ entDbg: .align 4 .globl entSys - .globl ret_from_sys_call - .ent entSys + .type entSys, @function + .cfi_startproc simple + .cfi_return_column 64 + .cfi_def_cfa $sp, 48 + .cfi_rel_offset 64, 8 + .cfi_rel_offset $gp, 16 entSys: SAVE_ALL lda $8, 0x3fff
@@ -300,6 +462,9 @@ entSys: stq $17, SP_OFF+32($sp) s8addq $0, $5, $5 stq $18, SP_OFF+40($sp) + .cfi_rel_offset $16, SP_OFF+24 + .cfi_rel_offset $17, SP_OFF+32 + .cfi_rel_offset $18, SP_OFF+40 blbs $3, strace beq $4, 1f ldq $27, 0($5)
@@ -310,6 +475,7 @@ entSys: stq $31, 72($sp) /* a3=0 => no error */ .align 4 + .globl ret_from_sys_call ret_from_sys_call: cmovne $26, 0, $18 /* $18 = 0 => non-restartable */ ldq $0, SP_OFF($sp)
@@ -324,10 +490,12 @@ ret_to_user: and $17, _TIF_WORK_MASK, $2 bne $2, work_pending restore_all: + .cfi_remember_state RESTORE_ALL call_pal PAL_rti ret_to_kernel: + .cfi_restore_state lda $16, 7 call_pal PAL_swpipl br restore_all
@@ -356,7 +524,6 @@ $ret_success: stq $0, 0($sp) stq $31, 72($sp) /* a3=0 => no error */ br ret_from_sys_call -.end entSys /* * Do all cleanup when returning from all interrupts and system calls.
@@ -370,7 +537,7 @@ $ret_success: */ .align 4 - .ent work_pending + .type work_pending, @function work_pending: and $17, _TIF_NOTIFY_RESUME | _TIF_SIGPENDING, $2 bne $2, $work_notifysig
@@ -387,23 +554,22 @@ $work_resched: $work_notifysig: mov $sp, $16 - bsr $1, do_switch_stack + DO_SWITCH_STACK jsr $26, do_work_pending - bsr $1, undo_switch_stack + UNDO_SWITCH_STACK br restore_all -.end work_pending /* * PTRACE syscall handler */ .align 4 - .ent strace + .type strace, @function strace: /* set up signal stack, call syscall_trace */ - bsr $1, do_switch_stack + DO_SWITCH_STACK jsr $26, syscall_trace_enter /* returns the syscall number */ - bsr $1, undo_switch_stack + UNDO_SWITCH_STACK /* get the arguments back.. */ ldq $16, SP_OFF+24($sp)
@@ -431,9 +597,9 @@ ret_from_straced: $strace_success: stq $0, 0($sp) /* save return value */ - bsr $1, do_switch_stack + DO_SWITCH_STACK jsr $26, syscall_trace_leave - bsr $1, undo_switch_stack + UNDO_SWITCH_STACK br $31, ret_from_sys_call .align 3
@@ -447,26 +613,31 @@ $strace_error: stq $0, 0($sp) stq $1, 72($sp) /* a3 for return */ - bsr $1, do_switch_stack + DO_SWITCH_STACK mov $18, $9 /* save old syscall number */ mov $19, $10 /* save old a3 */ jsr $26, syscall_trace_leave mov $9, $18 mov $10, $19 - bsr $1, undo_switch_stack + UNDO_SWITCH_STACK mov $31, $26 /* tell "ret_from_sys_call" we can restart */ br ret_from_sys_call -.end strace +CFI_END_OSF_FRAME entSys /* * Save and restore the switch stack -- aka the balance of the user context. */ .align 4 - .ent do_switch_stack + .type do_switch_stack, @function + .cfi_startproc simple + .cfi_return_column 64 + .cfi_def_cfa $sp, 0 + .cfi_register 64, $1 do_switch_stack: lda $sp, -SWITCH_STACK_SIZE($sp) + .cfi_adjust_cfa_offset SWITCH_STACK_SIZE stq $9, 0($sp) stq $10, 8($sp) stq $11, 16($sp)
@@ -510,10 +681,14 @@ do_switch_stack: stt $f0, 312($sp) # save fpcr in slot of $f31 ldt $f0, 64($sp) # dont let "do_switch_stack" change fp state. ret $31, ($1), 1 -.end do_switch_stack + .cfi_endproc + .size do_switch_stack, .-do_switch_stack .align 4 - .ent undo_switch_stack + .type undo_switch_stack, @function + .cfi_startproc simple + .cfi_def_cfa $sp, 0 + .cfi_register 64, $1 undo_switch_stack: ldq $9, 0($sp) ldq $10, 8($sp)
@@ -558,7 +733,8 @@ undo_switch_stack: ldt $f30, 304($sp) lda $sp, SWITCH_STACK_SIZE($sp) ret $31, ($1), 1 -.end undo_switch_stack + .cfi_endproc + .size undo_switch_stack, .-undo_switch_stack /* * The meat of the context switch code.
@@ -566,17 +742,18 @@ undo_switch_stack: .align 4 .globl alpha_switch_to - .ent alpha_switch_to + .type alpha_switch_to, @function + .cfi_startproc alpha_switch_to: - .prologue 0 - bsr $1, do_switch_stack + DO_SWITCH_STACK call_pal PAL_swpctx lda $8, 0x3fff - bsr $1, undo_switch_stack + UNDO_SWITCH_STACK bic $sp, $8, $8 mov $17, $0 ret -.end alpha_switch_to + .cfi_endproc + .size alpha_switch_to, .-alpha_switch_to /* * New processes begin life here.
Signature · 1 line
1.8.1.4
PATCH 7/7 alpha: Fix type compatibility warning for marvel_map_irq
In reply to Richard Henderson--- arch/alpha/kernel/sys_marvel.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/alpha/kernel/sys_marvel.c +2 -1
@@ -317,8 +317,9 @@ marvel_init_irq(void) }static int -marvel_map_irq (struct pci_dev *dev,u8 slot,u8 pin) +marvel_map_irq (const struct pci_dev *cdev,u8 slot,u8 pin) { +struct pci_dev *dev = (struct pci_dev *)dev;struct pci_controller *hose = dev->sysdata;struct io7_port *io7_port = hose->sysdata;struct io7 *io7 = io7_port->io7;
Signature · 1 line
1.8.1.4
Quoted 2 lines · Richard Henderson
Here's a set of minor updates for
arch/alphathat should not be controversial.
I also note that I had to do this to get busybox to build against uClibc:
arch/alpha/include/uapi/asm/unistd.h +2 -3
@@ -23,7 +23,7 @@#define __NR_lseek 19#define __NR_getxpid 20#define __NR_osf_mount 21 -#define __NR_umount 22 +#define __NR_umount2 22#define __NR_setuid 23#define __NR_getxuid 24#define __NR_exec_with_loader 25/* not implemented */
@@ -253,7 +253,6 @@#define __IGNORE_pause#define __IGNORE_time#define __IGNORE_utime -#define __IGNORE_umount2/* * Linux-specific system calls begin at 300
@@ -279,7 +278,7 @@#define __NR_sysinfo 318#define __NR__sysctl 319/* 320 was sys_idle. */ -#define __NR_oldumount 321 +#define __NR_umount 321#define __NR_swapon 322#define __NR_times 323#define __NR_personality 324
(Because busybox uses umount2() directly. There's a man page for it and everything.)
Rob
arch/alpha/include/uapi/asm/unistd.h
Quoted 10 lines · Rob Landley
Quoted 2 lines · Richard Henderson
Here's a set of minor updates for
arch/alphathat should not be controversial.I also note that I had to do this to get busybox to build against uClibc:
arch/alpha/include/uapi/asm/unistd.h +2
-2-#define __NR_umount 22 +#define __NR_umount2 22 -#define __NR_oldumount 321 +#define __NR_umount 321
I anticipate that this will likely break userspace.
busybox should be fixed to test for __NR_oldumount and then call the correct functions, namely oldumount and umount if __NR_oldumount is defined and umount and umount2 if it is not defined.
Cheers
Michael.
Quoted 5 lines · Michael Cree
Quoted 4 lines · Rob Landley
Quoted 2 lines · Richard Henderson
Here's a set of minor updates for
arch/alphathat should not be controversial.
Quoted 8 lines
arch/alpha/include/uapi/asm/unistd.h
Quoted 6 lines
I also note that I had to do this to get busybox to build against uClibc:
arch/alpha/include/uapi/asm/unistd.h +2
-2-#define __NR_umount 22 +#define __NR_umount2 22 -#define __NR_oldumount 321 +#define __NR_umount 321I anticipate that this will likely break userspace.
Haven't seen it so far. It's the same semantics all the other targets have. Haven't built the whole of linux from scratch against it yet though. (Most of my package builds are native and I'm still tweaking my build environment to get a native toolchain built.)
Quoted 3 lines
busybox should be fixed to test for
__NR_oldumountand then call the correct functions, namely oldumount and umount if__NR_oldumountis defined and umount and umount2 if it is not defined.
The man page for umount and umount2 doesn't mention "oldumount":
$ man 2 umount | grep old $
Only three kernel targets mention it, alpha, powerpc, and x86:
$ find arch/*/include -type f | xargs grep oldumount arch/alpha/include/uapi/asm/unistd.h:#define __NR_oldumount 321 arch/powerpc/include/asm/systbl.h:SYSX(sys_ni_syscall,sys_oldumount,sys_oldumount) arch/x86/include/generated/asm/syscalls_32.h:__SYSCALL_I386(22, sys_oldumount, sys_oldumount)
And the other two export umount2:
$ find arch/*/include -type f | xargs grep umount2 | egrep "powerpc|x86" arch/powerpc/include/uapi/asm/unistd.h:#define __NR_umount2 52 arch/x86/include/generated/asm/unistd_32_ia32.h:#define __NR_ia32_umount2 52 arch/x86/include/generated/uapi/asm/unistd_x32.h:#define __NR_umount2 (__X32_SYSCALL_BIT + 166) arch/x86/include/generated/uapi/asm/unistd_32.h:#define __NR_umount2 52 arch/x86/include/generated/uapi/asm/unistd_64.h:#define __NR_umount2 166
So really what you're saying is busybox should #ifdef alpha/workaround target-specific breakage/#unifdef, and what this says to _me_ is that nobody's tried to build busybox on Alpha since it started using umount2(). How long ago was that?
commit 6c5f2c602174c7fe0830a1fc4fe5b3dde5ed7068
Author: Erik Andersen <[email protected]>
Date: Fri May 5 19:49:33 2000 +0000
I.E. nobody's tried to build busybox umount for Alpha (except me) for thirteen years.
There are waaaaay more busybox installations out there than even _emulated_ alpha systems, and this is trivial to fix with a local patch to the kernel. So I'll just do that. Your idea of the "correct" thing to do to "fix" this seems entirely backwards to me.
Rob
Quoted 19 lines · Rob Landley
Quoted 5 lines · Michael Cree
Quoted 4 lines · Rob Landley
Quoted 2 lines · Richard Henderson
Here's a set of minor updates for
arch/alphathat should not be controversial.Quoted 8 lines
arch/alpha/include/uapi/asm/unistd.h
Quoted 6 lines
I also note that I had to do this to get busybox to build against uClibc:
arch/alpha/include/uapi/asm/unistd.h +2
-2-#define __NR_umount 22 +#define __NR_umount2 22 -#define __NR_oldumount 321 +#define __NR_umount 321I anticipate that this will likely break userspace.
Haven't seen it so far. It's the same semantics all the other targets have. Haven't built the whole of linux from scratch against it yet though. (Most of my package builds are native and I'm still tweaking my build environment to get a native toolchain built.)
[snip]
Quoted 2 lines
I.E. nobody's tried to build busybox umount for Alpha (except me) for thirteen years.
That appears false to me. Busybox builds OK on Debian-Ports [1], and it looks like in the build log that umount is built. A search in Debian busybox sources does not return any hits for __NR_umount or __NR_umount2, but does for umount2 which are library calls (admittedly ones that are just wrappers for the kernel syscall). I also don't see any Debian patches in busybox that change behaviour of busybox specifically for Alpha. But IIRC Debian links against glibc even for the installer where busybox is used.
So maybe the problem is in uClibc? Yes, a quick look at the source shows that uClibc does not test __NR_oldumount so presumably does not compile correct umount and umount2 library calls on Alpha.
Maybe it's the case noone has compiled uClibc on Alpha until now?
Quoted 4 lines
There are waaaaay more busybox installations out there than even _emulated_ alpha systems, and this is trivial to fix with a local patch to the kernel. So I'll just do that. Your idea of the "correct" thing to do to "fix" this seems entirely backwards to me.
I wondered if your proposal will break glibc as glibc checks for __NR_oldumount and does different things based on that. But maybe your fix will not adversely affect glibc (I did not look particularly closely to see if so), but even so, there is no guarantee that other software does not directly access the oldumount syscall when compiled on Alpha, and your change would likely break any such software.
Cheers
Michael
[1] http://buildd.debian-ports.org/status/package.php?p=busybox
Quoted 6 lines · Michael Cree
I wondered if your proposal will break glibc as glibc checks for
__NR_oldumountand does different things based on that. But maybe your fix will not adversely affect glibc (I did not look particularly closely to see if so), but even so, there is no guarantee that other software does not directly access the oldumount syscall when compiled on Alpha, and your change would likely break any such software.
It won't break glibc. While there are conditionals for oldumount, they do pretty much exactly the umount/umount2 dance you'd expect.
I'm for the patch, because anything that makes us match x86 more closely has got to be a good thing from a portability standpoint.
r~
Quoted 10 lines · Richard Henderson
Quoted 6 lines · Michael Cree
I wondered if your proposal will break glibc as glibc checks for
__NR_oldumountand does different things based on that. But maybe your fix will not adversely affect glibc (I did not look particularly closely to see if so), but even so, there is no guarantee that other software does not directly access the oldumount syscall when compiled on Alpha, and your change would likely break any such software.It won't break glibc. While there are conditionals for oldumount, they do pretty much exactly the umount/umount2 dance you'd expect.
That's good to hear.
Quoted 2 lines
I'm for the patch, because anything that makes us match x86 more closely has got to be a good thing from a portability standpoint.
OK, but I think that behoves us to make an effort to check user space applications are compliant with the change. Fortunately we can easily scheck the vast majority of opensource programs now that Debian provides a web interface for searching the source code of all their packages.
Searching for NR_umount finds the following packages that compile on Alpha:
eglibc
dietlibc
uclibc
qemu
radare
linux-tools
ns3
skyeye
(and a few others that are not buildable on Alpha and tons of hits for every version of the linux kernel that result from every arch directory therein...)
I'm happy to take a closer look at them and submit a patch to their upstreams if need be.
Cheers
Michael.
Quoted 4 lines · Michael Cree
Searching for
NR_umountfinds the following packages that compile on Alpha:eglibc
Fork of glibc, which I did examine; I'll assume it's the same code.
Quoted 2 lines
dietlibc
uclibc
Rob reports that uclibc is fixed by the rename. From what I see in the dietlibc source, the same is true of Alpha, since the only mention of "oldumount" is in alpha/syscalls.h.
Quoted 1 line
qemu
Definitely would be fixed by the rename.
Of course in both dietlibc and qemu, the packages need to be patched to match the kernel rename, as they don't use the kernel headers.
Quoted 1 line
radare
Repository has vanished? There's a radare2 that apparently superceeds it, but doesn't mention umount in any relevant context.
Quoted 3 lines
linux-tools
ns3
skyeye
I can't find source for these to browse.
r~
Quoted 2 lines · Richard Henderson
Here's a set of minor updates for
arch/alphathat should not be controversial.
Patches 1-5 and 7 (with the typo fixed) are
I don't know enough patch 6 to make any kind of meaningful review, so it's
I've got five patches in a for-linus branch on kernel.org that I was planning to send a pull request for soon. Would you like me to add these to that branch?
Thanks!
Matt
Quoted 3 lines · Matt Turner
I've got five patches in a for-linus branch on kernel.org that I was planning to send a pull request for soon. Would you like me to add these to that branch?
Yes, please.
r~