From owner-p4-projects Fri Sep 27 19:27:56 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id AC2C237B404; Fri, 27 Sep 2002 19:27:51 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5A6B437B401 for ; Fri, 27 Sep 2002 19:27:51 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0A29A43E6E for ; Fri, 27 Sep 2002 19:27:51 -0700 (PDT) (envelope-from peter@freebsd.org) Received: from freefall.freebsd.org (perforce@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id g8S2RoCo036125 for ; Fri, 27 Sep 2002 19:27:50 -0700 (PDT) (envelope-from peter@freebsd.org) Received: (from perforce@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id g8S2RoH5036122 for perforce@freebsd.org; Fri, 27 Sep 2002 19:27:50 -0700 (PDT) Date: Fri, 27 Sep 2002 19:27:50 -0700 (PDT) Message-Id: <200209280227.g8S2RoH5036122@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: perforce set sender to peter@freebsd.org using -f From: Peter Wemm Subject: PERFORCE change 18253 for review To: Perforce Change Reviews Sender: owner-p4-projects@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG http://people.freebsd.org/~peter/p4db/chv.cgi?CH=18253 Change 18253 by peter@peter_ia64 on 2002/09/27 19:27:09 unleash great evil. Provide an alternative version of the uma obj_alloc fuction and do great evil to compile and activate it. There is mileage to be had by providing an MD implementation page_alloc/free and obj_alloc. eg: to return everything via the RR7 region using the 256MB page tlb's. Other platforms with direct mapped regions would like this a lot too. Affected files ... .. //depot/projects/ia64/sys/ia64/ia64/pmap.c#35 edit Differences ... ==== //depot/projects/ia64/sys/ia64/ia64/pmap.c#35 (text+ko) ==== @@ -117,6 +117,7 @@ #include #include #include +#include /* XXX for obj_alloc clone */ #include @@ -226,9 +227,7 @@ * Data for the pv entry allocation mechanism */ static uma_zone_t pvzone; -#if 0 static struct vm_object pvzone_obj; -#endif static int pv_entry_count = 0, pv_entry_max = 0, pv_entry_high_water = 0; static int pmap_pagedaemon_waken = 0; static struct pv_entry *pvbootentries; @@ -238,9 +237,7 @@ * Data for allocating PTEs for user processes. */ static uma_zone_t ptezone; -#if 0 static struct vm_object ptezone_obj; -#endif /* * VHPT instrumentation. @@ -265,6 +262,7 @@ static void pmap_remove_all(vm_page_t m); static void pmap_enter_quick(pmap_t pmap, vm_offset_t va, vm_page_t m); static void *pmap_allocf(uma_zone_t zone, int bytes, u_int8_t *flags, int wait); +static void *pmap_allocf_r7(uma_zone_t zone, int bytes, u_int8_t *flags, int wait); vm_offset_t pmap_steal_memory(vm_size_t size) @@ -488,9 +486,54 @@ pmap_allocf(uma_zone_t zone, int bytes, u_int8_t *flags, int wait) { *flags = UMA_SLAB_PRIV; + return (void *)kmem_alloc(kernel_map, bytes); +} + +static void * +pmap_allocf_r7(uma_zone_t zone, int bytes, u_int8_t *flags, int wait) +{ + *flags = UMA_SLAB_PRIV; return (void *)IA64_PHYS_TO_RR7(ia64_tpa(kmem_alloc(kernel_map, bytes))); } +/* Clone of obj_alloc from uma_core.c, but using RR7 */ +static void * +pmap_allocf_obj_r7(uma_zone_t zone, int bytes, u_int8_t *flags, int wait) +{ + vm_offset_t zkva; + vm_offset_t retkva; + vm_page_t p; + int pages; + + retkva = 0; + pages = zone->uz_pages; + if (bytes > PAGE_SIZE) + panic("pmap_allocf_obj_r7: indigestion: %d\n", bytes); + + /* + * This looks a little weird since we're getting one page at a time + */ + while (bytes > 0) { + p = vm_page_alloc(zone->uz_obj, pages, + VM_ALLOC_INTERRUPT); + if (p == NULL) + return (NULL); + + zkva = zone->uz_kva + pages * PAGE_SIZE; + if (retkva == 0) + retkva = zkva; + pmap_qenter(zkva, &p, 1); + bytes -= PAGE_SIZE; + pages += 1; + } + + *flags = UMA_SLAB_PRIV; + + /* This is a large chunk of duplicated code for this one special hack */ + /* XXX optimize so that we use VM_PAGE_TO_PHYS(p) instead of pmap_qenter */ + return ((void *)IA64_PHYS_TO_RR7(ia64_tpa(retkva))); +} + /* * Initialize the pmap module. * Called by vm_init, to initialize any structures that the pmap @@ -532,7 +575,7 @@ ptezone = uma_zcreate("PT ENTRY", sizeof (struct ia64_lpte), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_VM); - uma_zone_set_allocf(ptezone, pmap_allocf); + uma_zone_set_allocf(ptezone, pmap_allocf_r7); uma_prealloc(ptezone, initial_pvs); /* @@ -559,10 +602,12 @@ TUNABLE_INT_FETCH("vm.pmap.shpgperproc", &shpgperproc); pv_entry_max = shpgperproc * maxproc + vm_page_array_size; pv_entry_high_water = 9 * (pv_entry_max / 10); -#if 0 /* incompatable with pmap_allocf above */ uma_zone_set_obj(pvzone, &pvzone_obj, pv_entry_max); uma_zone_set_obj(ptezone, &ptezone_obj, pv_entry_max); -#endif + /* XXX override uma_zone_set_obj above */ + ZONE_LOCK(ptezone); + ptezone->uz_allocf = pmap_allocf_obj_r7; + ZONE_UNLOCK(ptezone); } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message