|
From: Dave A. <ai...@us...> - 2003-06-10 01:14:53
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/sparc64/lib
In directory sc8-pr-cvs1:/tmp/cvs-serv7538/arch/sparc64/lib
Modified Files:
atomic.S bitops.S blockops.S debuglocks.c dec_and_lock.S
Log Message:
DA: sync with Marcelo 2.4.17
Index: atomic.S
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/arch/sparc64/lib/atomic.S,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- atomic.S 10 Apr 2002 15:21:24 -0000 1.2
+++ atomic.S 10 Jun 2003 01:13:19 -0000 1.3
@@ -19,7 +19,7 @@
cas [%o1], %g5, %g7
cmp %g5, %g7
bne,pn %icc, __atomic_add
- nop
+ membar #StoreLoad | #StoreStore
retl
add %g7, %o0, %o0
@@ -30,7 +30,7 @@
cas [%o1], %g5, %g7
cmp %g5, %g7
bne,pn %icc, __atomic_sub
- nop
+ membar #StoreLoad | #StoreStore
retl
sub %g7, %o0, %o0
atomic_impl_end:
Index: bitops.S
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/arch/sparc64/lib/bitops.S,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- bitops.S 10 Apr 2002 15:21:24 -0000 1.2
+++ bitops.S 10 Jun 2003 01:13:19 -0000 1.3
@@ -28,7 +28,7 @@
bne,a,pn %xcc, 1b
ldx [%o1], %g7
2: retl
- nop
+ membar #StoreLoad | #StoreStore
.globl ___test_and_clear_bit
___test_and_clear_bit: /* %o0=nr, %o1=addr */
@@ -47,7 +47,7 @@
bne,a,pn %xcc, 1b
ldx [%o1], %g7
2: retl
- nop
+ membar #StoreLoad | #StoreStore
.globl ___test_and_change_bit
___test_and_change_bit: /* %o0=nr, %o1=addr */
@@ -65,7 +65,7 @@
bne,a,pn %xcc, 1b
ldx [%o1], %g7
2: retl
- nop
+ membar #StoreLoad | #StoreStore
nop
.globl ___test_and_set_le_bit
@@ -85,7 +85,7 @@
bne,a,pn %icc, 1b
lduwa [%o1] ASI_PL, %g7
2: retl
- nop
+ membar #StoreLoad | #StoreStore
.globl ___test_and_clear_le_bit
___test_and_clear_le_bit: /* %o0=nr, %o1=addr */
@@ -104,7 +104,7 @@
bne,a,pn %icc, 1b
lduwa [%o1] ASI_PL, %g7
2: retl
- nop
+ membar #StoreLoad | #StoreStore
.globl __bitops_end
__bitops_end:
Index: blockops.S
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/arch/sparc64/lib/blockops.S,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- blockops.S 10 Apr 2002 15:21:24 -0000 1.2
+++ blockops.S 10 Jun 2003 01:13:19 -0000 1.3
@@ -17,10 +17,9 @@
fmovd %reg4, %f56; fmovd %reg5, %f58; \
fmovd %reg6, %f60; fmovd %reg7, %f62;
-#define TLBTEMP_BASE (8 * 1024 * 1024)
#define DCACHE_SIZE (PAGE_SIZE * 2)
-#define TLBTEMP_ENT1 (61 << 3)
-#define TLBTEMP_ENT2 (62 << 3)
+#define TLBTEMP_ENT1 (60 << 3)
+#define TLBTEMP_ENT2 (61 << 3)
#define TLBTEMP_ENTSZ (1 << 3)
#if (PAGE_SHIFT == 13) || (PAGE_SHIFT == 19)
@@ -34,64 +33,6 @@
.text
.align 32
- .globl _copy_page
- .type _copy_page,@function
-_copy_page: /* %o0=dest, %o1=src */
- VISEntry
- membar #LoadStore | #StoreStore | #StoreLoad
- ldda [%o1] ASI_BLK_P, %f0
- add %o1, 0x40, %o1
- ldda [%o1] ASI_BLK_P, %f16
- add %o1, 0x40, %o1
- sethi %hi(PAGE_SIZE), %o2
-1: TOUCH(f0, f2, f4, f6, f8, f10, f12, f14)
- ldda [%o1] ASI_BLK_P, %f32
- stda %f48, [%o0] ASI_BLK_P
- add %o1, 0x40, %o1
- sub %o2, 0x40, %o2
- add %o0, 0x40, %o0
- TOUCH(f16, f18, f20, f22, f24, f26, f28, f30)
- ldda [%o1] ASI_BLK_P, %f0
- stda %f48, [%o0] ASI_BLK_P
- add %o1, 0x40, %o1
- sub %o2, 0x40, %o2
- add %o0, 0x40, %o0
- TOUCH(f32, f34, f36, f38, f40, f42, f44, f46)
- ldda [%o1] ASI_BLK_P, %f16
- stda %f48, [%o0] ASI_BLK_P
- sub %o2, 0x40, %o2
- add %o1, 0x40, %o1
- cmp %o2, PAGE_SIZE_REM
- bne,pt %xcc, 1b
- add %o0, 0x40, %o0
-#if (PAGE_SHIFT == 16) || (PAGE_SHIFT == 22)
- TOUCH(f0, f2, f4, f6, f8, f10, f12, f14)
- ldda [%o1] ASI_BLK_P, %f32
- stda %f48, [%o0] ASI_BLK_P
- add %o1, 0x40, %o1
- sub %o2, 0x40, %o2
- add %o0, 0x40, %o0
- TOUCH(f16, f18, f20, f22, f24, f26, f28, f30)
- ldda [%o1] ASI_BLK_P, %f0
- stda %f48, [%o0] ASI_BLK_P
- add %o1, 0x40, %o1
- sub %o2, 0x40, %o2
- add %o0, 0x40, %o0
- membar #Sync
- stda %f32, [%o0] ASI_BLK_P
- add %o0, 0x40, %o0
- stda %f0, [%o0] ASI_BLK_P
-#else
- membar #Sync
- stda %f0, [%o0] ASI_BLK_P
- add %o0, 0x40, %o0
- stda %f16, [%o0] ASI_BLK_P
-#endif
- membar #Sync
- VISExit
- retl
- nop
-
.globl copy_user_page
.type copy_user_page,@function
copy_user_page: /* %o0=dest, %o1=src, %o2=vaddr */
@@ -110,7 +51,7 @@
or %g2, %g3, %g2
add %o0, %o3, %o0
add %o0, %o1, %o1
-#define FIX_INSN_1 0x96102068 /* mov (13 << 3), %o3 */
+#define FIX_INSN_1 0x96102060 /* mov (12 << 3), %o3 */
cheetah_patch_1:
mov TLBTEMP_ENT1, %o3
rdpr %pstate, %g3
@@ -134,6 +75,7 @@
stxa %g0, [%o5] ASI_DMMU
membar #Sync
+ ldxa [%o3] ASI_DTLB_DATA_ACCESS, %g0
ldxa [%o3] ASI_DTLB_DATA_ACCESS, %o5
stxa %o0, [%o2] ASI_DMMU
stxa %g1, [%o3] ASI_DTLB_DATA_ACCESS
@@ -152,6 +94,7 @@
stxa %g0, [%g7] ASI_DMMU
membar #Sync
+ ldxa [%o3] ASI_DTLB_DATA_ACCESS, %g0
ldxa [%o3] ASI_DTLB_DATA_ACCESS, %g7
stxa %o1, [%o2] ASI_DMMU
stxa %g2, [%o3] ASI_DTLB_DATA_ACCESS
@@ -169,9 +112,10 @@
nop
cheetah_copy_user_page:
- mov 121, %o2 ! A0 Group
+ sethi %hi((PAGE_SIZE/64)-7), %o2 ! A0 Group
prefetch [%o1 + 0x000], #one_read ! MS
- prefetch [%o1 + 0x040], #one_read ! MS Group
+ or %o2, %lo((PAGE_SIZE/64)-7), %o2 ! A1 Group
+ prefetch [%o1 + 0x040], #one_read ! MS
prefetch [%o1 + 0x080], #one_read ! MS Group
prefetch [%o1 + 0x0c0], #one_read ! MS Group
ldd [%o1 + 0x000], %f0 ! MS Group
@@ -402,7 +346,7 @@
or %g3, (_PAGE_CP | _PAGE_CV | _PAGE_P | _PAGE_L | _PAGE_W), %g3
or %g1, %g3, %g1
add %o0, %o3, %o0
-#define FIX_INSN_2 0x96102070 /* mov (14 << 3), %o3 */
+#define FIX_INSN_2 0x96102068 /* mov (13 << 3), %o3 */
cheetah_patch_2:
mov TLBTEMP_ENT2, %o3
rdpr %pstate, %g3
@@ -420,6 +364,7 @@
stxa %g0, [%g7] ASI_DMMU
membar #Sync
+ ldxa [%o3] ASI_DTLB_DATA_ACCESS, %g0
ldxa [%o3] ASI_DTLB_DATA_ACCESS, %g7
stxa %o0, [%o2] ASI_DMMU
stxa %g1, [%o3] ASI_DTLB_DATA_ACCESS
@@ -430,8 +375,9 @@
clear_page_common:
membar #StoreLoad | #StoreStore | #LoadStore ! LSU Group
fzero %f0 ! FPA Group
- mov PAGE_SIZE/256, %o1 ! IEU0
+ sethi %hi(PAGE_SIZE/256), %o1 ! IEU0
fzero %f2 ! FPA Group
+ or %o1, %lo(PAGE_SIZE/256), %o1 ! IEU0
faddd %f0, %f2, %f4 ! FPA Group
fmuld %f0, %f2, %f6 ! FPM
faddd %f0, %f2, %f8 ! FPA Group
Index: debuglocks.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/arch/sparc64/lib/debuglocks.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- debuglocks.c 10 Apr 2002 15:21:24 -0000 1.2
+++ debuglocks.c 10 Jun 2003 01:13:19 -0000 1.3
@@ -10,10 +10,7 @@
#include <linux/spinlock.h>
#include <asm/system.h>
-#ifdef CONFIG_SMP
-
-/* To enable this code, just define SPIN_LOCK_DEBUG in asm/spinlock.h */
-#ifdef SPIN_LOCK_DEBUG
+#if defined(CONFIG_SMP) && defined(CONFIG_DEBUG_SPINLOCK)
#define GET_CALLER(PC) __asm__ __volatile__("mov %%i7, %0" : "=r" (PC))
@@ -56,6 +53,7 @@
unsigned long caller, val;
int stuck = INIT_STUCK;
int cpu = smp_processor_id();
+ int shown = 0;
GET_CALLER(caller);
again:
@@ -67,7 +65,8 @@
if (val) {
while (lock->lock) {
if (!--stuck) {
- show(str, lock, caller);
+ if (shown++ <= 2)
+ show(str, lock, caller);
stuck = INIT_STUCK;
}
membar("#LoadLoad");
@@ -76,6 +75,8 @@
}
lock->owner_pc = ((unsigned int)caller);
lock->owner_cpu = cpu;
+ current->thread.smp_lock_count++;
+ current->thread.smp_lock_pc = ((unsigned int)caller);
}
int _spin_trylock(spinlock_t *lock)
@@ -92,6 +93,8 @@
if (!val) {
lock->owner_pc = ((unsigned int)caller);
lock->owner_cpu = cpu;
+ current->thread.smp_lock_count++;
+ current->thread.smp_lock_pc = ((unsigned int)caller);
}
return val == 0;
}
@@ -102,6 +105,7 @@
lock->owner_cpu = NO_PROC_ID;
membar("#StoreStore | #LoadStore");
lock->lock = 0;
+ current->thread.smp_lock_count--;
}
/* Keep INIT_STUCK the same... */
@@ -111,13 +115,15 @@
unsigned long caller, val;
int stuck = INIT_STUCK;
int cpu = smp_processor_id();
+ int shown = 0;
GET_CALLER(caller);
wlock_again:
/* Wait for any writer to go away. */
while (((long)(rw->lock)) < 0) {
if (!--stuck) {
- show_read(str, rw, caller);
+ if (shown++ <= 2)
+ show_read(str, rw, caller);
stuck = INIT_STUCK;
}
membar("#LoadLoad");
@@ -137,6 +143,8 @@
if (val)
goto wlock_again;
rw->reader_pc[cpu] = ((unsigned int)caller);
+ current->thread.smp_lock_count++;
+ current->thread.smp_lock_pc = ((unsigned int)caller);
}
void _do_read_unlock (rwlock_t *rw, char *str)
@@ -144,11 +152,13 @@
unsigned long caller, val;
int stuck = INIT_STUCK;
int cpu = smp_processor_id();
+ int shown = 0;
GET_CALLER(caller);
/* Drop our identity _first_. */
rw->reader_pc[cpu] = 0;
+ current->thread.smp_lock_count--;
runlock_again:
/* Spin trying to decrement the counter using casx. */
__asm__ __volatile__(
@@ -162,7 +172,8 @@
: "g5", "g7", "memory");
if (val) {
if (!--stuck) {
- show_read(str, rw, caller);
+ if (shown++ <= 2)
+ show_read(str, rw, caller);
stuck = INIT_STUCK;
}
goto runlock_again;
@@ -174,13 +185,15 @@
unsigned long caller, val;
int stuck = INIT_STUCK;
int cpu = smp_processor_id();
+ int shown = 0;
GET_CALLER(caller);
wlock_again:
/* Spin while there is another writer. */
while (((long)rw->lock) < 0) {
if (!--stuck) {
- show_write(str, rw, caller);
+ if (shown++ <= 2)
+ show_write(str, rw, caller);
stuck = INIT_STUCK;
}
membar("#LoadLoad");
@@ -204,7 +217,8 @@
if (val) {
/* We couldn't get the write bit. */
if (!--stuck) {
- show_write(str, rw, caller);
+ if (shown++ <= 2)
+ show_write(str, rw, caller);
stuck = INIT_STUCK;
}
goto wlock_again;
@@ -214,7 +228,8 @@
* lock, spin, and try again.
*/
if (!--stuck) {
- show_write(str, rw, caller);
+ if (shown++ <= 2)
+ show_write(str, rw, caller);
stuck = INIT_STUCK;
}
__asm__ __volatile__(
@@ -231,7 +246,8 @@
: "g3", "g5", "g7", "cc", "memory");
while(rw->lock != 0) {
if (!--stuck) {
- show_write(str, rw, caller);
+ if (shown++ <= 2)
+ show_write(str, rw, caller);
stuck = INIT_STUCK;
}
membar("#LoadLoad");
@@ -242,18 +258,22 @@
/* We have it, say who we are. */
rw->writer_pc = ((unsigned int)caller);
rw->writer_cpu = cpu;
+ current->thread.smp_lock_count++;
+ current->thread.smp_lock_pc = ((unsigned int)caller);
}
void _do_write_unlock(rwlock_t *rw)
{
unsigned long caller, val;
int stuck = INIT_STUCK;
+ int shown = 0;
GET_CALLER(caller);
/* Drop our identity _first_ */
rw->writer_pc = 0;
rw->writer_cpu = NO_PROC_ID;
+ current->thread.smp_lock_count--;
wlock_again:
__asm__ __volatile__(
" mov 1, %%g3\n"
@@ -268,12 +288,21 @@
: "g3", "g5", "g7", "memory");
if (val) {
if (!--stuck) {
- show_write("write_unlock", rw, caller);
+ if (shown++ <= 2)
+ show_write("write_unlock", rw, caller);
stuck = INIT_STUCK;
}
goto wlock_again;
}
}
-#endif /* SPIN_LOCK_DEBUG */
-#endif /* CONFIG_SMP */
+int atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock)
+{
+ spin_lock(lock);
+ if (atomic_dec_and_test(atomic))
+ return 1;
+ spin_unlock(lock);
+ return 0;
+}
+
+#endif /* CONFIG_SMP && CONFIG_DEBUG_SPINLOCK */
Index: dec_and_lock.S
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/arch/sparc64/lib/dec_and_lock.S,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- dec_and_lock.S 10 Apr 2002 15:21:24 -0000 1.2
+++ dec_and_lock.S 10 Jun 2003 01:13:19 -0000 1.3
@@ -4,7 +4,9 @@
*
* Copyright (C) 2000 David S. Miller (da...@re...)
*/
+#include <linux/config.h>
+#ifndef CONFIG_DEBUG_SPINLOCK
.text
.align 64
@@ -34,13 +36,15 @@
bne,pn %icc, loop1
mov 0, %g1
-out: retl
+out:
+ membar #StoreLoad | #StoreStore
+ retl
mov %g1, %o0
-to_zero:ldstub [%o1], %g3
+to_zero:
+ ldstub [%o1], %g3
brnz,pn %g3, spin_on_lock
membar #StoreLoad | #StoreStore
loop2: cas [%o0], %g5, %g7 /* ASSERT(g7 == 0) */
- nop
cmp %g5, %g7
be,pt %icc, out
@@ -61,3 +65,5 @@
ba,pt %xcc, to_zero
nop
nop
+
+#endif /* !(CONFIG_DEBUG_SPINLOCK) */
|