summaryrefslogtreecommitdiffstats
path: root/sys/powerpc
diff options
context:
space:
mode:
authorscottl <scottl@FreeBSD.org>2002-10-02 07:44:29 +0000
committerscottl <scottl@FreeBSD.org>2002-10-02 07:44:29 +0000
commit3a150bca9cc1b9ca767ca73d95fd54081237210b (patch)
tree0a9cc28f7570a42ae4e5df4cfc55dee42c36d9d8 /sys/powerpc
parent734ef490b8cfe3acc5f45425a63fac5e7c5173a3 (diff)
downloadFreeBSD-src-3a150bca9cc1b9ca767ca73d95fd54081237210b.zip
FreeBSD-src-3a150bca9cc1b9ca767ca73d95fd54081237210b.tar.gz
Some kernel threads try to do significant work, and the default KSTACK_PAGES
doesn't give them enough stack to do much before blowing away the pcb. This adds MI and MD code to allow the allocation of an alternate kstack who's size can be speficied when calling kthread_create. Passing the value 0 prevents the alternate kstack from being created. Note that the ia64 MD code is missing for now, and PowerPC was only partially written due to the pmap.c being incomplete there. Though this patch does not modify anything to make use of the alternate kstack, acpi and usb are good candidates. Reviewed by: jake, peter, jhb
Diffstat (limited to 'sys/powerpc')
-rw-r--r--sys/powerpc/aim/mmu_oea.c30
-rw-r--r--sys/powerpc/powerpc/mmu_oea.c30
-rw-r--r--sys/powerpc/powerpc/pmap.c30
3 files changed, 78 insertions, 12 deletions
diff --git a/sys/powerpc/aim/mmu_oea.c b/sys/powerpc/aim/mmu_oea.c
index bd15689..8802cfb 100644
--- a/sys/powerpc/aim/mmu_oea.c
+++ b/sys/powerpc/aim/mmu_oea.c
@@ -1532,13 +1532,17 @@ pmap_remove_pages(pmap_t pm, vm_offset_t sva, vm_offset_t eva)
pmap_remove(pm, sva, eva);
}
+#ifndef KSTACK_MAX_PAGES
+#define KSTACK_MAX_PAGES 32
+#endif
+
/*
* Create the kernel stack and pcb for a new thread.
* This routine directly affects the fork perf for a process and
* create performance for a thread.
*/
void
-pmap_new_thread(struct thread *td)
+pmap_new_thread(struct thread *td, int pages)
{
vm_object_t ksobj;
vm_offset_t ks;
@@ -1548,21 +1552,27 @@ pmap_new_thread(struct thread *td)
/*
* Allocate object for the kstack.
*/
- ksobj = vm_object_allocate(OBJT_DEFAULT, KSTACK_PAGES);
+ ksobj = vm_object_allocate(OBJT_DEFAULT, pages);
td->td_kstack_obj = ksobj;
/*
* Get a kernel virtual address for the kstack for this thread.
*/
ks = kmem_alloc_nofault(kernel_map,
- (KSTACK_PAGES + KSTACK_GUARD_PAGES) * PAGE_SIZE);
+ (pages + KSTACK_GUARD_PAGES) * PAGE_SIZE);
if (ks == 0)
panic("pmap_new_thread: kstack allocation failed");
TLBIE(ks);
ks += KSTACK_GUARD_PAGES * PAGE_SIZE;
td->td_kstack = ks;
- for (i = 0; i < KSTACK_PAGES; i++) {
+ /*
+ * Knowing the number of pages allocated is useful when you
+ * want to deallocate them.
+ */
+ td->td_kstack_pages = pages;
+
+ for (i = 0; i < pages; i++) {
/*
* Get a kernel stack page.
*/
@@ -1587,6 +1597,18 @@ pmap_dispose_thread(struct thread *td)
}
void
+pmap_new_altkstack(struct thread *td, int pages)
+{
+ TODO;
+}
+
+void
+pmap_dispose_altkstack(struct thread *td)
+{
+ TODO;
+}
+
+void
pmap_swapin_thread(struct thread *td)
{
TODO;
diff --git a/sys/powerpc/powerpc/mmu_oea.c b/sys/powerpc/powerpc/mmu_oea.c
index bd15689..8802cfb 100644
--- a/sys/powerpc/powerpc/mmu_oea.c
+++ b/sys/powerpc/powerpc/mmu_oea.c
@@ -1532,13 +1532,17 @@ pmap_remove_pages(pmap_t pm, vm_offset_t sva, vm_offset_t eva)
pmap_remove(pm, sva, eva);
}
+#ifndef KSTACK_MAX_PAGES
+#define KSTACK_MAX_PAGES 32
+#endif
+
/*
* Create the kernel stack and pcb for a new thread.
* This routine directly affects the fork perf for a process and
* create performance for a thread.
*/
void
-pmap_new_thread(struct thread *td)
+pmap_new_thread(struct thread *td, int pages)
{
vm_object_t ksobj;
vm_offset_t ks;
@@ -1548,21 +1552,27 @@ pmap_new_thread(struct thread *td)
/*
* Allocate object for the kstack.
*/
- ksobj = vm_object_allocate(OBJT_DEFAULT, KSTACK_PAGES);
+ ksobj = vm_object_allocate(OBJT_DEFAULT, pages);
td->td_kstack_obj = ksobj;
/*
* Get a kernel virtual address for the kstack for this thread.
*/
ks = kmem_alloc_nofault(kernel_map,
- (KSTACK_PAGES + KSTACK_GUARD_PAGES) * PAGE_SIZE);
+ (pages + KSTACK_GUARD_PAGES) * PAGE_SIZE);
if (ks == 0)
panic("pmap_new_thread: kstack allocation failed");
TLBIE(ks);
ks += KSTACK_GUARD_PAGES * PAGE_SIZE;
td->td_kstack = ks;
- for (i = 0; i < KSTACK_PAGES; i++) {
+ /*
+ * Knowing the number of pages allocated is useful when you
+ * want to deallocate them.
+ */
+ td->td_kstack_pages = pages;
+
+ for (i = 0; i < pages; i++) {
/*
* Get a kernel stack page.
*/
@@ -1587,6 +1597,18 @@ pmap_dispose_thread(struct thread *td)
}
void
+pmap_new_altkstack(struct thread *td, int pages)
+{
+ TODO;
+}
+
+void
+pmap_dispose_altkstack(struct thread *td)
+{
+ TODO;
+}
+
+void
pmap_swapin_thread(struct thread *td)
{
TODO;
diff --git a/sys/powerpc/powerpc/pmap.c b/sys/powerpc/powerpc/pmap.c
index bd15689..8802cfb 100644
--- a/sys/powerpc/powerpc/pmap.c
+++ b/sys/powerpc/powerpc/pmap.c
@@ -1532,13 +1532,17 @@ pmap_remove_pages(pmap_t pm, vm_offset_t sva, vm_offset_t eva)
pmap_remove(pm, sva, eva);
}
+#ifndef KSTACK_MAX_PAGES
+#define KSTACK_MAX_PAGES 32
+#endif
+
/*
* Create the kernel stack and pcb for a new thread.
* This routine directly affects the fork perf for a process and
* create performance for a thread.
*/
void
-pmap_new_thread(struct thread *td)
+pmap_new_thread(struct thread *td, int pages)
{
vm_object_t ksobj;
vm_offset_t ks;
@@ -1548,21 +1552,27 @@ pmap_new_thread(struct thread *td)
/*
* Allocate object for the kstack.
*/
- ksobj = vm_object_allocate(OBJT_DEFAULT, KSTACK_PAGES);
+ ksobj = vm_object_allocate(OBJT_DEFAULT, pages);
td->td_kstack_obj = ksobj;
/*
* Get a kernel virtual address for the kstack for this thread.
*/
ks = kmem_alloc_nofault(kernel_map,
- (KSTACK_PAGES + KSTACK_GUARD_PAGES) * PAGE_SIZE);
+ (pages + KSTACK_GUARD_PAGES) * PAGE_SIZE);
if (ks == 0)
panic("pmap_new_thread: kstack allocation failed");
TLBIE(ks);
ks += KSTACK_GUARD_PAGES * PAGE_SIZE;
td->td_kstack = ks;
- for (i = 0; i < KSTACK_PAGES; i++) {
+ /*
+ * Knowing the number of pages allocated is useful when you
+ * want to deallocate them.
+ */
+ td->td_kstack_pages = pages;
+
+ for (i = 0; i < pages; i++) {
/*
* Get a kernel stack page.
*/
@@ -1587,6 +1597,18 @@ pmap_dispose_thread(struct thread *td)
}
void
+pmap_new_altkstack(struct thread *td, int pages)
+{
+ TODO;
+}
+
+void
+pmap_dispose_altkstack(struct thread *td)
+{
+ TODO;
+}
+
+void
pmap_swapin_thread(struct thread *td)
{
TODO;
OpenPOWER on IntegriCloud