Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libpthread Remove possible race condition in upcall recy...



details:   https://anonhg.NetBSD.org/src/rev/0f99a7fc8858
branches:  trunk
changeset: 551511:0f99a7fc8858
user:      cl <cl%NetBSD.org@localhost>
date:      Sun Sep 07 14:47:44 2003 +0000

description:
Remove possible race condition in upcall recycling.

diffstat:

 lib/libpthread/arch/alpha/genassym.cf        |  4 +---
 lib/libpthread/arch/alpha/pthread_switch.S   |  4 +---
 lib/libpthread/arch/arm/genassym.cf          |  4 +---
 lib/libpthread/arch/arm/pthread_switch.S     |  4 +---
 lib/libpthread/arch/i386/genassym.cf         |  4 +---
 lib/libpthread/arch/i386/pthread_switch.S    |  3 +--
 lib/libpthread/arch/m68k/genassym.cf         |  4 +---
 lib/libpthread/arch/m68k/pthread_switch.S    |  4 +---
 lib/libpthread/arch/mips/genassym.cf         |  4 +---
 lib/libpthread/arch/mips/pthread_switch.S    |  4 +---
 lib/libpthread/arch/powerpc/genassym.cf      |  4 +---
 lib/libpthread/arch/powerpc/pthread_switch.S |  4 +---
 lib/libpthread/arch/sh3/genassym.cf          |  3 +--
 lib/libpthread/arch/sh5/genassym.cf          |  4 +---
 lib/libpthread/arch/sh5/pthread_switch.S     |  4 +---
 lib/libpthread/arch/sparc/genassym.cf        |  4 +---
 lib/libpthread/arch/sparc/pthread_switch.S   |  4 +---
 lib/libpthread/arch/sparc64/genassym.cf      |  4 +---
 lib/libpthread/arch/sparc64/pthread_switch.S |  4 +---
 lib/libpthread/arch/vax/genassym.cf          |  4 +---
 lib/libpthread/arch/vax/pthread_switch.S     |  3 +--
 lib/libpthread/arch/x86_64/genassym.cf       |  4 +---
 lib/libpthread/arch/x86_64/pthread_switch.S  |  3 +--
 lib/libpthread/pthread_int.h                 |  3 +--
 lib/libpthread/pthread_sa.c                  |  6 +++---
 25 files changed, 27 insertions(+), 70 deletions(-)

diffs (truncated from 520 to 300 lines):

diff -r 14e4408a9754 -r 0f99a7fc8858 lib/libpthread/arch/alpha/genassym.cf
--- a/lib/libpthread/arch/alpha/genassym.cf     Sun Sep 07 14:24:08 2003 +0000
+++ b/lib/libpthread/arch/alpha/genassym.cf     Sun Sep 07 14:47:44 2003 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: genassym.cf,v 1.4 2003/07/17 20:55:25 nathanw Exp $
+#      $NetBSD: genassym.cf,v 1.5 2003/09/07 14:47:46 cl Exp $
 
 #
 # Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -45,7 +45,6 @@
 include "pthread_md.h"
 
 define PT_NEXT          offsetof(struct __pthread_st, pt_next)
-define PT_STATE         offsetof(struct __pthread_st, pt_state)
 define PT_SWITCHTO      offsetof(struct __pthread_st, pt_switchto)
 define PT_SWITCHTOUC    offsetof(struct __pthread_st, pt_switchtouc)
 define PT_SPINLOCKS     offsetof(struct __pthread_st, pt_spinlocks)
@@ -56,7 +55,6 @@
 define UC_FLAGS                offsetof(ucontext_t, uc_flags)
 define UC_GREGS                offsetof(ucontext_t, uc_mcontext.__gregs)
 define UC_FPREGS       offsetof(ucontext_t, uc_mcontext.__fpregs)
-define PT_STATE_RECYCLABLE      PT_STATE_RECYCLABLE
 define STACKSPACE       STACKSPACE
 define _UC_USER_BIT    _UC_USER_BIT
 define _UC_CPU         _UC_CPU
diff -r 14e4408a9754 -r 0f99a7fc8858 lib/libpthread/arch/alpha/pthread_switch.S
--- a/lib/libpthread/arch/alpha/pthread_switch.S        Sun Sep 07 14:24:08 2003 +0000
+++ b/lib/libpthread/arch/alpha/pthread_switch.S        Sun Sep 07 14:47:44 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pthread_switch.S,v 1.4 2003/06/26 01:45:31 nathanw Exp $       */
+/*     $NetBSD: pthread_switch.S,v 1.5 2003/09/07 14:47:47 cl Exp $    */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -247,8 +247,6 @@
        /* Yes, it was. Stash the thread we were going to switch to,
         * and switch to the next thread in the continuation chain.
         */
-       mov     PT_STATE_RECYCLABLE, t1
-       stl     t1, PT_STATE(a0)
        stq     s2, PT_SWITCHTOUC(a0)
        stq     a1, PT_SWITCHTO(a0)
        mov     a1, a0
diff -r 14e4408a9754 -r 0f99a7fc8858 lib/libpthread/arch/arm/genassym.cf
--- a/lib/libpthread/arch/arm/genassym.cf       Sun Sep 07 14:24:08 2003 +0000
+++ b/lib/libpthread/arch/arm/genassym.cf       Sun Sep 07 14:47:44 2003 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: genassym.cf,v 1.5 2003/07/17 20:55:26 nathanw Exp $
+#      $NetBSD: genassym.cf,v 1.6 2003/09/07 14:47:47 cl Exp $
 
 # Copyright (c) 2001 Wasabi Systems, Inc.
 # All rights reserved.
@@ -61,10 +61,8 @@
 define PT_SPINLOCKS    offsetof(struct __pthread_st, pt_spinlocks)
 define PT_SWITCHTO     offsetof(struct __pthread_st, pt_switchto)
 define PT_SWITCHTOUC   offsetof(struct __pthread_st, pt_switchtouc)
-define PT_STATE                offsetof(struct __pthread_st, pt_state)
 define PT_HELDLOCK     offsetof(struct __pthread_st, pt_heldlock)
 
-define PT_STATE_RECYCLABLE PT_STATE_RECYCLABLE
 define RND_CTXSIZE     ((sizeof(ucontext_t) + 7) & ~7)
 define STACKSPACE      STACKSPACE
 define __SIMPLELOCK_UNLOCKED __SIMPLELOCK_UNLOCKED
diff -r 14e4408a9754 -r 0f99a7fc8858 lib/libpthread/arch/arm/pthread_switch.S
--- a/lib/libpthread/arch/arm/pthread_switch.S  Sun Sep 07 14:24:08 2003 +0000
+++ b/lib/libpthread/arch/arm/pthread_switch.S  Sun Sep 07 14:47:44 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pthread_switch.S,v 1.6 2003/07/24 08:03:44 skrll Exp $ */
+/*     $NetBSD: pthread_switch.S,v 1.7 2003/09/07 14:47:48 cl Exp $    */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -193,8 +193,6 @@
         * Yes, it was.  Stash the tread we were going to switch to,
         * and switch to the next thread in the continuation chain.
         */
-       mov     r4, #(PT_STATE_RECYCLABLE)
-       str     r4, [r0, #(PT_STATE)]
        str     r7, [r0, #(PT_SWITCHTOUC)]
        str     r1, [r0, #(PT_SWITCHTO)]
        mov     r0, r1          /* from = next */
diff -r 14e4408a9754 -r 0f99a7fc8858 lib/libpthread/arch/i386/genassym.cf
--- a/lib/libpthread/arch/i386/genassym.cf      Sun Sep 07 14:24:08 2003 +0000
+++ b/lib/libpthread/arch/i386/genassym.cf      Sun Sep 07 14:47:44 2003 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: genassym.cf,v 1.4 2003/07/17 20:55:27 nathanw Exp $
+#      $NetBSD: genassym.cf,v 1.5 2003/09/07 14:47:48 cl Exp $
 
 # Copyright (c) 2001 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -43,7 +43,6 @@
 include "pthread_md.h"
 
 define PT_NEXT         offsetof(struct __pthread_st, pt_next)
-define PT_STATE                offsetof(struct __pthread_st, pt_state)
 define PT_SWITCHTO     offsetof(struct __pthread_st, pt_switchto)
 define PT_SWITCHTOUC   offsetof(struct __pthread_st, pt_switchtouc)
 define PT_SPINLOCKS    offsetof(struct __pthread_st, pt_spinlocks)
@@ -57,7 +56,6 @@
 define UC_FPREGS       offsetof(ucontext_t, uc_mcontext.__fpregs.__fp_reg_set.__fpchip_state.__fp_state)
 define UC_FXSAVEREGS   offsetof(ucontext_t, uc_mcontext.__fpregs.__fp_reg_set.__fp_xmm_state.__fp_xmm)
 
-define PT_STATE_RECYCLABLE     PT_STATE_RECYCLABLE
 define STACKSPACE              STACKSPACE
 
 define _UC_CPU         _UC_CPU
diff -r 14e4408a9754 -r 0f99a7fc8858 lib/libpthread/arch/i386/pthread_switch.S
--- a/lib/libpthread/arch/i386/pthread_switch.S Sun Sep 07 14:24:08 2003 +0000
+++ b/lib/libpthread/arch/i386/pthread_switch.S Sun Sep 07 14:47:44 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pthread_switch.S,v 1.5 2003/06/26 01:45:32 nathanw Exp $       */
+/*     $NetBSD: pthread_switch.S,v 1.6 2003/09/07 14:47:48 cl Exp $    */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -325,7 +325,6 @@
         * Yes, it was. Stash the thread we were going to
         * switch to, and go to the next thread in the chain.
         */
-       movl    $PT_STATE_RECYCLABLE, PT_STATE(%eax)
        movl    %esi, PT_SWITCHTOUC(%eax)
        movl    %ecx, PT_SWITCHTO(%eax)
        movl    PT_NEXT(%eax), %edx
diff -r 14e4408a9754 -r 0f99a7fc8858 lib/libpthread/arch/m68k/genassym.cf
--- a/lib/libpthread/arch/m68k/genassym.cf      Sun Sep 07 14:24:08 2003 +0000
+++ b/lib/libpthread/arch/m68k/genassym.cf      Sun Sep 07 14:47:44 2003 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: genassym.cf,v 1.4 2003/07/17 20:55:27 nathanw Exp $
+#      $NetBSD: genassym.cf,v 1.5 2003/09/07 14:47:49 cl Exp $
 
 # Copyright (c) 2001 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -43,7 +43,6 @@
 include "pthread_md.h"
 
 define PT_NEXT         offsetof(struct __pthread_st, pt_next)
-define PT_STATE                offsetof(struct __pthread_st, pt_state)
 define PT_SWITCHTO     offsetof(struct __pthread_st, pt_switchto)
 define PT_SWITCHTOUC   offsetof(struct __pthread_st, pt_switchtouc)
 define PT_SPINLOCKS    offsetof(struct __pthread_st, pt_spinlocks)
@@ -55,7 +54,6 @@
 define UC_FPREGS       offsetof(ucontext_t, uc_mcontext.__fpregs)
 define UC_PC           offsetof(ucontext_t, uc_mcontext.__gregs[_REG_PC])
 
-define PT_STATE_RECYCLABLE     PT_STATE_RECYCLABLE
 define RND_CTXSIZE     ((sizeof(ucontext_t) + 3) & ~3)
 define STACKSPACE      STACKSPACE
 
diff -r 14e4408a9754 -r 0f99a7fc8858 lib/libpthread/arch/m68k/pthread_switch.S
--- a/lib/libpthread/arch/m68k/pthread_switch.S Sun Sep 07 14:24:08 2003 +0000
+++ b/lib/libpthread/arch/m68k/pthread_switch.S Sun Sep 07 14:47:44 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pthread_switch.S,v 1.4 2003/06/26 01:45:32 nathanw Exp $       */
+/*     $NetBSD: pthread_switch.S,v 1.5 2003/09/07 14:47:49 cl Exp $    */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -311,8 +311,6 @@
        /* Yes, it was. Stash the thread we were going to
         * switch to, and go to the next thread in the chain.
         */
-       moveql  #PT_STATE_RECYCLABLE,%d1
-       movl    %d1,%a2@(PT_STATE)
        movl    %a4,%a2@(PT_SWITCHTOUC)
        movl    %a3,%a2@(PT_SWITCHTO)
        movl    %a3,%a1                 /* from(a1) = next */
diff -r 14e4408a9754 -r 0f99a7fc8858 lib/libpthread/arch/mips/genassym.cf
--- a/lib/libpthread/arch/mips/genassym.cf      Sun Sep 07 14:24:08 2003 +0000
+++ b/lib/libpthread/arch/mips/genassym.cf      Sun Sep 07 14:47:44 2003 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: genassym.cf,v 1.4 2003/07/17 20:55:28 nathanw Exp $
+#      $NetBSD: genassym.cf,v 1.5 2003/09/07 14:47:50 cl Exp $
 
 # Copyright (c) 2001 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -43,7 +43,6 @@
 include "pthread_md.h"
 
 define PT_NEXT         offsetof(struct __pthread_st, pt_next)
-define PT_STATE                offsetof(struct __pthread_st, pt_state)
 define PT_SWITCHTO     offsetof(struct __pthread_st, pt_switchto)
 define PT_SWITCHTOUC   offsetof(struct __pthread_st, pt_switchtouc)
 define PT_SPINLOCKS    offsetof(struct __pthread_st, pt_spinlocks)
@@ -54,7 +53,6 @@
 define UC_FLAGS                offsetof(ucontext_t, uc_flags)
 define UC_REGS         offsetof(ucontext_t, uc_mcontext.__gregs)
 define UC_EPC          offsetof(ucontext_t, uc_mcontext.__gregs[_REG_EPC])
-define PT_STATE_RECYCLABLE     PT_STATE_RECYCLABLE
 define STACKSPACE              STACKSPACE
 
 # uc_flags
diff -r 14e4408a9754 -r 0f99a7fc8858 lib/libpthread/arch/mips/pthread_switch.S
--- a/lib/libpthread/arch/mips/pthread_switch.S Sun Sep 07 14:24:08 2003 +0000
+++ b/lib/libpthread/arch/mips/pthread_switch.S Sun Sep 07 14:47:44 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pthread_switch.S,v 1.5 2003/06/26 01:45:32 nathanw Exp $       */
+/*     $NetBSD: pthread_switch.S,v 1.6 2003/09/07 14:47:51 cl Exp $    */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -270,8 +270,6 @@
        /* Yes, it was. Stash the thread we were going to switch to,
         * and switch to the next thread in the continuation chain.
         */
-       li      t1, PT_STATE_RECYCLABLE
-       sw      t1, PT_STATE(a0)
        sw      s2, PT_SWITCHTOUC(a0)
        sw      a1, PT_SWITCHTO(a0)
        move    a0, a1
diff -r 14e4408a9754 -r 0f99a7fc8858 lib/libpthread/arch/powerpc/genassym.cf
--- a/lib/libpthread/arch/powerpc/genassym.cf   Sun Sep 07 14:24:08 2003 +0000
+++ b/lib/libpthread/arch/powerpc/genassym.cf   Sun Sep 07 14:47:44 2003 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: genassym.cf,v 1.5 2003/07/17 20:55:28 nathanw Exp $
+#      $NetBSD: genassym.cf,v 1.6 2003/09/07 14:47:51 cl Exp $
 
 # Copyright (c) 2001 Wasabi Systems, Inc.
 # All rights reserved.
@@ -66,9 +66,7 @@
 define PT_SPINLOCKS    offsetof(struct __pthread_st, pt_spinlocks)
 define PT_SWITCHTO     offsetof(struct __pthread_st, pt_switchto)
 define PT_SWITCHTOUC   offsetof(struct __pthread_st, pt_switchtouc)
-define PT_STATE                offsetof(struct __pthread_st, pt_state)
 define PT_HELDLOCK     offsetof(struct __pthread_st, pt_heldlock)
 
-define PT_STATE_RECYCLABLE PT_STATE_RECYCLABLE
 define CONTEXTSIZE     sizeof(ucontext_t)
 define STACKSPACE      STACKSPACE
diff -r 14e4408a9754 -r 0f99a7fc8858 lib/libpthread/arch/powerpc/pthread_switch.S
--- a/lib/libpthread/arch/powerpc/pthread_switch.S      Sun Sep 07 14:24:08 2003 +0000
+++ b/lib/libpthread/arch/powerpc/pthread_switch.S      Sun Sep 07 14:47:44 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pthread_switch.S,v 1.7 2003/06/26 01:45:32 nathanw Exp $       */
+/*     $NetBSD: pthread_switch.S,v 1.8 2003/09/07 14:47:52 cl Exp $    */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -164,8 +164,6 @@
        or.     %r7, %r7, %r7
        beq     1f
 
-       li      %r6, PT_STATE_RECYCLABLE
-       stw     %r6, PT_STATE(%r3)
        stw     %r5, PT_SWITCHTOUC(%r3)
        stw     %r4, PT_SWITCHTO(%r3)
        mr      %r3, %r4
diff -r 14e4408a9754 -r 0f99a7fc8858 lib/libpthread/arch/sh3/genassym.cf
--- a/lib/libpthread/arch/sh3/genassym.cf       Sun Sep 07 14:24:08 2003 +0000
+++ b/lib/libpthread/arch/sh3/genassym.cf       Sun Sep 07 14:47:44 2003 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: genassym.cf,v 1.3 2003/07/17 20:55:29 nathanw Exp $
+#      $NetBSD: genassym.cf,v 1.4 2003/09/07 14:47:52 cl Exp $
 
 # Copyright (c) 2001 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -41,7 +41,6 @@
 include "pthread_md.h"
 
 define PT_NEXT         offsetof(struct __pthread_st, pt_next)
-define PT_STATE                offsetof(struct __pthread_st, pt_state)
 define PT_SWITCHTO     offsetof(struct __pthread_st, pt_switchto)
 define PT_SWITCHTOUC   offsetof(struct __pthread_st, pt_switchtouc)
 define PT_SPINLOCKS    offsetof(struct __pthread_st, pt_spinlocks)
diff -r 14e4408a9754 -r 0f99a7fc8858 lib/libpthread/arch/sh5/genassym.cf
--- a/lib/libpthread/arch/sh5/genassym.cf       Sun Sep 07 14:24:08 2003 +0000
+++ b/lib/libpthread/arch/sh5/genassym.cf       Sun Sep 07 14:47:44 2003 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: genassym.cf,v 1.5 2003/08/12 14:01:08 scw Exp $
+#      $NetBSD: genassym.cf,v 1.6 2003/09/07 14:47:53 cl Exp $
 
 # Copyright (c) 2001 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -44,7 +44,6 @@
 include "pthread_md.h"
 
 define PT_NEXT         offsetof(struct __pthread_st, pt_next)
-define PT_STATE                offsetof(struct __pthread_st, pt_state)
 define PT_SWITCHTO     offsetof(struct __pthread_st, pt_switchto)
 define PT_SWITCHTOUC   offsetof(struct __pthread_st, pt_switchtouc)
 define PT_SPINLOCKS    offsetof(struct __pthread_st, pt_spinlocks)
@@ -110,7 +109,6 @@
 define UC_FPREGS_DR60 offsetof(ucontext_t, uc_mcontext.__fpregs.__fp_double[30])
 define UC_FPREGS_DR62 offsetof(ucontext_t, uc_mcontext.__fpregs.__fp_double[31])
 
-define PT_STATE_RECYCLABLE             PT_STATE_RECYCLABLE
 define RND_CTXSIZE                     ((sizeof(ucontext_t) + 7) & ~7)
 define STACKSPACE                      STACKSPACE
 
diff -r 14e4408a9754 -r 0f99a7fc8858 lib/libpthread/arch/sh5/pthread_switch.S
--- a/lib/libpthread/arch/sh5/pthread_switch.S  Sun Sep 07 14:24:08 2003 +0000
+++ b/lib/libpthread/arch/sh5/pthread_switch.S  Sun Sep 07 14:47:44 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pthread_switch.S,v 1.7 2003/08/12 14:01:08 scw Exp $   */
+/*     $NetBSD: pthread_switch.S,v 1.8 2003/09/07 14:47:53 cl Exp $    */
 
 /*-
  * Copyright (c) 2001, 2003 The NetBSD Foundation, Inc.
@@ -271,8 +271,6 @@
        /* Yes, it was. Stash the thread we were going to
         * switch to, and go to the next thread in the chain.



Home | Main Index | Thread Index | Old Index