vm_page_startup()

Andrew Duane aduane at juniper.net
Thu Dec 2 14:59:47 UTC 2010


I much prefer the latter suggestion: making the code #ifdef'd on a feature, and having each platform define (or not) the feature. I've seen what happens when code in this space grows too many architecture ifdef's.....

--
Andrew Duane             Juniper Networks
978-589-0551              10 Technology Park Dr
aduane at juniper.net      Westford, MA  01886-3418

________________________________________
From: owner-freebsd-mips at freebsd.org [owner-freebsd-mips at freebsd.org] On Behalf Of Warner Losh [imp at bsdimp.com]
Sent: Wednesday, December 01, 2010 11:24 PM
To: freebsd-mips at freebsd.org; Alan Cox
Subject: Re: vm_page_startup()

On 11/30/2010 23:03, Alan Cox wrote:
> Given this bit of code in the MIPS pmap:
>
> vm_offset_t
> pmap_map(vm_offset_t *virt, vm_offset_t start, vm_offset_t end, int prot)
> {
>    vm_offset_t va, sva;
>
>    if (MIPS_DIRECT_MAPPABLE(end))
>        return (MIPS_PHYS_TO_DIRECT(start));
All mips architectures have at least a small direct map...

> The following in vm_page_startup() can apply to MIPS (as well as amd64):
>
> #ifdef __amd64__
>    /*
>     * pmap_map on amd64 comes out of the direct-map, not kvm like i386,
>     * so the pages must be tracked for a crashdump to include this data.
>     * This includes the vm_page_array and the early UMA bootstrap pages.
>     */
>    for (pa = new_end; pa < phys_avail[biggestone + 1]; pa += PAGE_SIZE)
>        dump_add_page(pa);
> #endif
>
> Even if a particular MIPS-based machine didn't wind up using the
> direct map for the pmap_map calls in vm_page_startup() there would be
> no harm in having called dump_add_page().  On the other hand, if you
> don't call dump_add_page() when the direct map is used, you're crash
> dump will be missing some kernel data structures.
So would you suggest having:

#if defined(__mips__) || defined(__amd64__)

or

#if __VM_HAS_DIRECT_MAP

and adding that define to pmap.h for mips and amd64?  I'm leaning to the
latter, since I don't like #ifdef arch in vm/* code on general
principles, but you're the maintainer...

Warner
_______________________________________________
freebsd-mips at freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-mips
To unsubscribe, send any mail to "freebsd-mips-unsubscribe at freebsd.org"


More information about the freebsd-mips mailing list