Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Nov 2004 19:07:27 +1000
From:      Peter Grehan <grehan@freebsd.org>
To:        John Baldwin <jhb@freebsd.org>
Cc:        powerpc@freebsd.org
Subject:   Re: Patch to optimize "bare" critical sections
Message-ID:  <41AC384F.6000901@freebsd.org>
In-Reply-To: <0F35A925-3FF3-11D9-8DD8-000D93C47836@xcllnt.net>
References:  <200411231500.55841.jhb@FreeBSD.org> <200411231631.00945.jhb@FreeBSD.org> <0F35A925-3FF3-11D9-8DD8-000D93C47836@xcllnt.net>

next in thread | previous in thread | raw e-mail | index | archive | help
 > Ahem, http://www.FreeBSD.org/~jhb/patches/spinlock.patch

  Seems to work OK on PowerPC. I left cpufunc.h unchanged - I don't
think the mod to intr_restore() is required, and with the following
slight mods. The saved msr was incorrect: the forked process would
be resumed without address translation enabled :)

later,

Peter.

 > lcvs diff -u powerpc/vm_machdep.c include/psl.h
Index: powerpc/vm_machdep.c
===================================================================
RCS file: /home/ncvs/src/sys/powerpc/powerpc/vm_machdep.c,v
retrieving revision 1.105
diff -u -r1.105 vm_machdep.c
--- powerpc/vm_machdep.c        27 Nov 2004 06:51:38 -0000      1.105
+++ powerpc/vm_machdep.c        30 Nov 2004 08:08:10 -0000
@@ -154,6 +154,10 @@
         pcb->pcb_lr = (register_t)fork_trampoline;
         pcb->pcb_usr = kernel_pmap->pm_sr[USER_SR];

+       /* Setup to release sched_lock in fork_exit(). */
+       td2->td_md.md_spinlock_count = 1;
+       td2->td_md.md_saved_msr = PSL_KERNSET;
+
         /*
          * Now cpu_switch() can schedule the new process.
          */
@@ -329,6 +333,10 @@
         pcb2->pcb_sp = (register_t)cf;
         pcb2->pcb_lr = (register_t)fork_trampoline;
         pcb2->pcb_usr = kernel_pmap->pm_sr[USER_SR];
+
+       /* Setup to release sched_lock in fork_exit(). */
+       td->td_md.md_spinlock_count = 1;
+       td->td_md.md_saved_msr = PSL_KERNSET;
  }

  void
Index: include/psl.h
===================================================================
RCS file: /home/ncvs/src/sys/powerpc/include/psl.h,v
retrieving revision 1.2
diff -u -r1.2 psl.h
--- include/psl.h       19 May 2002 04:03:11 -0000      1.2
+++ include/psl.h       30 Nov 2004 09:03:56 -0000
@@ -78,7 +78,8 @@
  #define        PSL_MBO         0
  #define        PSL_MBZ         0

-#define        PSL_USERSET     (PSL_EE | PSL_PR | PSL_ME | PSL_IR | 
PSL_DR | PSL_RI)
+#define        PSL_KERNSET     (PSL_EE | PSL_ME | PSL_IR | PSL_DR | PSL_RI)
+#define        PSL_USERSET     (PSL_KERNSET | PSL_PR)

  #define        PSL_USERSTATIC  (PSL_USERSET | PSL_IP | 0x87c0008c)





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?41AC384F.6000901>