Date: Tue, 18 Jan 2005 08:36:15 -1000 From: David Cornejo <dave@dogwood.com> To: Kris Kennaway <kris@obsecurity.org> Cc: Kris Kennaway <kris@obsecurity.org> Subject: Re: Fast Data Access MMU Miss problem Message-ID: <6.2.0.14.2.20050118083043.03181358@white.dogwood.com> In-Reply-To: <20050113215049.GA87457@xor.obsecurity.org> References: <20050103104025.A6665@carver.gumbysoft.com> <20050104014112.23160.qmail@web17309.mail.tpe.yahoo.com> <6.2.0.14.2.20050104102555.049faa18@white.dogwood.com> <20050104222258.GB79661@xor.obsecurity.org> <6.2.0.14.2.20050104155036.04b3bd68@white.dogwood.com> <20050105055845.GA92720@xor.obsecurity.org> <20050112234108.GA17895@xor.obsecurity.org> <6.2.0.14.2.20050112134405.04cfa580@white.dogwood.com> <20050113215049.GA87457@xor.obsecurity.org>
next in thread | previous in thread | raw e-mail | index | archive | help
After the fix in rev 1.566 of vfs_subr.c, I managed to apply this patch to an Ultra60 - it has run rock solid for 48hrs now under a variety of loads that would have yielded a panic within an hour or two before. So from my perspective it looks good, thanks, dave c At 11:50 1/13/2005, Kris Kennaway wrote: >On Wed, Jan 12, 2005 at 01:45:21PM -1000, David Cornejo wrote: > > If I can help out by running the patch or anything, let me know... > >Here is a patch from jhb@ that might fix this. > >Kris > >Index: sparc64/include/md_var.h >=================================================================== >RCS file: /home/ncvs/src/sys/sparc64/include/md_var.h,v >retrieving revision 1.15 >diff -u -r1.15 md_var.h >--- sparc64/include/md_var.h 16 Aug 2003 16:57:57 -0000 1.15 >+++ sparc64/include/md_var.h 13 Jan 2005 21:32:48 -0000 >@@ -45,10 +45,14 @@ > extern vm_paddr_t kstack0_phys; > > struct pcpu; >+struct md_utrap; > > void cpu_identify(u_long vers, u_int clock, u_int id); > void cpu_setregs(struct pcpu *pc); > int is_physical_memory(vm_paddr_t addr); >+struct md_utrap *utrap_alloc(void); >+void utrap_free(struct md_utrap *ut); >+struct md_utrap *utrap_hold(struct md_utrap *ut); > > cpu_block_copy_t spitfire_block_copy; > cpu_block_zero_t spitfire_block_zero; >Index: sparc64/sparc64/machdep.c >=================================================================== >RCS file: /home/ncvs/src/sys/sparc64/sparc64/machdep.c,v >retrieving revision 1.112.2.3 >diff -u -r1.112.2.3 machdep.c >--- sparc64/sparc64/machdep.c 17 Nov 2004 05:17:08 -0000 1.112.2.3 >+++ sparc64/sparc64/machdep.c 13 Jan 2005 21:32:48 -0000 >@@ -748,7 +748,6 @@ > exec_setregs(struct thread *td, u_long entry, u_long stack, u_long > ps_strings) > { > struct trapframe *tf; >- struct md_utrap *ut; > struct pcb *pcb; > struct proc *p; > u_long sp; >@@ -756,10 +755,8 @@ > /* XXX no cpu_exec */ > p = td->td_proc; > p->p_md.md_sigtramp = NULL; >- if ((ut = p->p_md.md_utrap) != NULL) { >- ut->ut_refcnt--; >- if (ut->ut_refcnt == 0) >- free(ut, M_SUBPROC); >+ if (p->p_md.md_utrap != NULL) { >+ utrap_free(p->p_md.md_utrap); > p->p_md.md_utrap = NULL; > } > >@@ -842,3 +839,40 @@ > tf->tf_gsr = fpregs->fr_gsr; > return (0); > } >+ >+struct md_utrap * >+utrap_alloc(void) >+{ >+ struct md_utrap *ut; >+ >+ ut = malloc(sizeof(struct md_utrap), M_SUBPROC, M_WAITOK | M_ZERO); >+ ut->ut_refcnt = 1; >+ return (ut); >+} >+ >+void >+utrap_free(struct md_utrap *ut) >+{ >+ int refcnt; >+ >+ if (ut == NULL) >+ return; >+ mtx_pool_lock(mtxpool_sleep, ut); >+ ut->ut_refcnt--; >+ refcnt = ut->ut_refcnt; >+ mtx_pool_unlock(mtxpool_sleep, ut); >+ if (refcnt == 0) >+ free(ut, M_SUBPROC); >+} >+ >+struct md_utrap * >+utrap_hold(struct md_utrap *ut) >+{ >+ >+ if (ut == NULL) >+ return (NULL); >+ mtx_pool_lock(mtxpool_sleep, ut); >+ ut->ut_refcnt++; >+ mtx_pool_unlock(mtxpool_sleep, ut); >+ return (ut); >+} >Index: sparc64/sparc64/sys_machdep.c >=================================================================== >RCS file: /home/ncvs/src/sys/sparc64/sparc64/sys_machdep.c,v >retrieving revision 1.13 >diff -u -r1.13 sys_machdep.c >--- sparc64/sparc64/sys_machdep.c 22 Aug 2003 07:38:08 -0000 1.13 >+++ sparc64/sparc64/sys_machdep.c 13 Jan 2005 21:35:16 -0000 >@@ -34,6 +34,7 @@ > #include <sys/proc.h> > #include <sys/sysproto.h> > >+#include <machine/md_var.h> > #include <machine/utrap.h> > #include <machine/sysarch.h> > >@@ -119,9 +120,7 @@ > } > if (ua.type != UTH_NOCHANGE) { > if (ut == NULL) { >- ut = malloc(sizeof *ut, M_SUBPROC, >- M_WAITOK | M_ZERO); >- ut->ut_refcnt = 1; >+ ut = utrap_alloc(); > td->td_proc->p_md.md_utrap = ut; > } > ut->ut_precise[ua.type] = ua.new_precise; >Index: sparc64/sparc64/vm_machdep.c >=================================================================== >RCS file: /home/ncvs/src/sys/sparc64/sparc64/vm_machdep.c,v >retrieving revision 1.66.2.1 >diff -u -r1.66.2.1 vm_machdep.c >--- sparc64/sparc64/vm_machdep.c 30 Sep 2004 17:26:51 >-0000 1.66.2.1 >+++ sparc64/sparc64/vm_machdep.c 13 Jan 2005 21:35:53 -0000 >@@ -111,15 +111,12 @@ > void > cpu_exit(struct thread *td) > { >- struct md_utrap *ut; > struct proc *p; > > p = td->td_proc; > p->p_md.md_sigtramp = NULL; >- if ((ut = p->p_md.md_utrap) != NULL) { >- ut->ut_refcnt--; >- if (ut->ut_refcnt == 0) >- free(ut, M_SUBPROC); >+ if (p->p_md.md_utrap != NULL) { >+ utrap_free(p->p_md.md_utrap); > p->p_md.md_utrap = NULL; > } > } >@@ -200,7 +197,6 @@ > void > cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) > { >- struct md_utrap *ut; > struct trapframe *tf; > struct frame *fp; > struct pcb *pcb1; >@@ -216,9 +212,7 @@ > return; > > p2->p_md.md_sigtramp = td1->td_proc->p_md.md_sigtramp; >- if ((ut = td1->td_proc->p_md.md_utrap) != NULL) >- ut->ut_refcnt++; >- p2->p_md.md_utrap = ut; >+ p2->p_md.md_utrap = utrap_hold(td1->td_proc->p_md.md_utrap); > > /* The pcb must be aligned on a 64-byte boundary. */ > pcb1 = td1->td_pcb;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6.2.0.14.2.20050118083043.03181358>