Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Feb 2014 10:48:58 -0600
From:      Stacey Son <sson@FreeBSD.org>
To:        "freebsd-mips@freebsd.org" <freebsd-mips@freebsd.org>
Subject:   [RFC] 16K page size for kernel thread stack (patch)
Message-ID:  <FAC31FA0-26B0-468E-826F-1A17ECA6DA65@FreeBSD.org>

next in thread | raw e-mail | index | archive | help
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.





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?FAC31FA0-26B0-468E-826F-1A17ECA6DA65>