From owner-freebsd-sparc64@FreeBSD.ORG Tue Jan 18 18:36:35 2005 Return-Path: Delivered-To: freebsd-sparc64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7D25516A4CE; Tue, 18 Jan 2005 18:36:35 +0000 (GMT) Received: from ms-smtp-02-eri0.socal.rr.com (ms-smtp-02-qfe0.socal.rr.com [66.75.162.134]) by mx1.FreeBSD.org (Postfix) with ESMTP id E6F5043D53; Tue, 18 Jan 2005 18:36:34 +0000 (GMT) (envelope-from dave@dogwood.com) Received: from white.dogwood.com (white.dogwood.com [66.91.140.178]) j0IIaV6V026326; Tue, 18 Jan 2005 10:36:31 -0800 (PST) Received: from keiki.dogwood.com (rrcs-67-52-72-226.west.biz.rr.com [67.52.72.226]) by white.dogwood.com (8.13.1/8.13.1) with SMTP id j0IIaHmK094501; Tue, 18 Jan 2005 08:36:28 -1000 (HST) (envelope-from dave@dogwood.com) Message-Id: <6.2.0.14.2.20050118083043.03181358@white.dogwood.com> X-Mailer: QUALCOMM Windows Eudora Version 6.2.0.14 Date: Tue, 18 Jan 2005 08:36:15 -1000 To: Kris Kennaway From: David Cornejo 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> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-Virus-Scanned: Symantec AntiVirus Scan Engine cc: bmilekic@technocratis.com cc: freebsd-sparc@freebsd.org cc: Kris Kennaway Subject: Re: Fast Data Access MMU Miss problem X-BeenThere: freebsd-sparc64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting FreeBSD to the Sparc List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Jan 2005 18:36:35 -0000 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 > #include > >+#include > #include > #include > >@@ -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;