From owner-freebsd-mips@FreeBSD.ORG Tue Feb 18 16:49:06 2014 Return-Path: Delivered-To: freebsd-mips@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2627A5C4 for ; Tue, 18 Feb 2014 16:49:06 +0000 (UTC) Received: from cdptpa-omtalb.mail.rr.com (cdptpa-omtalb.mail.rr.com [75.180.132.120]) by mx1.freebsd.org (Postfix) with ESMTP id DD3481A20 for ; Tue, 18 Feb 2014 16:49:05 +0000 (UTC) X-Authority-Analysis: v=2.0 cv=H69ZMpki c=1 sm=0 a=Hbpc8ax9VmIgqBixU/K2CA==:17 a=NShc9bz0yIYA:10 a=dBRESv0yCI8A:10 a=ozSPa0bqj5AA:10 a=kj9zAlcOel0A:10 a=6I5d2MoRAAAA:8 a=KGjhK52YXX0A:10 a=ucAviZgh4VwA:10 a=9I5xiGouAAAA:8 a=IzmlmZELTEyDCMUDgFoA:9 a=CjuIK1q_8ugA:10 a=41mBHD54zsYA:10 a=Hbpc8ax9VmIgqBixU/K2CA==:117 X-Cloudmark-Score: 0 X-Authenticated-User: X-Originating-IP: 76.187.139.93 Received: from [76.187.139.93] ([76.187.139.93:62864] helo=[192.168.0.22]) by cdptpa-oedge04.mail.rr.com (envelope-from ) (ecelerity 2.2.3.46 r()) with ESMTP id CE/0B-11872-AFE83035; Tue, 18 Feb 2014 16:48:58 +0000 From: Stacey Son Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Subject: [RFC] 16K page size for kernel thread stack (patch) Message-Id: Date: Tue, 18 Feb 2014 10:48:58 -0600 To: "freebsd-mips@freebsd.org" Mime-Version: 1.0 (Mac OS X Mail 6.6 \(1510\)) X-Mailer: Apple Mail (2.1510) X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Feb 2014 16:49:06 -0000 Hi all: For mips64 the current size of 8K is not enough for the kernel thread = stack. For more information, see: http://www.freebsd.org/cgi/query-pr.cgi?pr=3D177876 The following patch increases the size of the kernel thread stack to 16K = by using a single 16K sized page. See the patch at: http://people.freebsd.org/~sson/mips/kstack/kstack_large_page.diff Here is what it looks like doing a 'show tlb' in the kernel debugger = (SMP build): db> show tlb Beginning TLB dump for CPU 0... #0 =3D> c000000010d20000 (pagemask 6000) Lo0 12c41f (0x4b10000) Lo1 1 (0) #1 =3D> c000000000000000 (pagemask 0) Lo0 3999f (0xe66000) Lo1 399df (0xe67000) ^^^ WIRED ENTRIES ^^^ #2 =3D> 16010206e (pagemask 0) Lo0 91c9a (0x2472000) Lo1 91c5a (0x2471000) [...] This keeps the wired TLB entries down to one (or two, in the case of = SMP) unlike the previous fix that uses a second TLB entry to increase = the kstack size. See: = http://freebsd.1045724.n5.nabble.com/More-trapframe-panics-tp5879903p58805= 65.html To use a single 16K page, however, it requires that the physical (4K) = pages for the kstacks to be contiguous when they are allocated in = vm_thread_new(). To do this vm_page_alloc_contig() is used instead of = vm_page_grab(). This adds a bit more mips arch dependent code to = sys/vm/vm_glue.c. Currently, the second half of the kstack tlb entry is not used for = anything. It could be used to increase the kstack to 32K or maybe for = the struct pcpu entry (which would reduce the wired TLB entries to just = one in the case of SMP). Using it for the struct pcpu is a bit tricky, = however, given that the virtual address space needs to be contiguous. Best Regards, -stacey.