Re: pmap prefer diff
Date: Tue, 5 Apr 2011 18:42:47 +0200 From: Ariane van der Steldt ari...@stack.nl Hi, So it turns out that my allocator is not capable of handling the pmap_prefer horror. This diff exports the actual parameters of pmap_prefer, so I can make the allocator deal with this intelligently. I need compile tests on: - arm - hppa - hppa64 - m68k - mips64 - sh - sparc - sparc64 Since the code is not actually called, it should not affect running of kernels. Ok? Fine with me. With this, can't we completely get rid of the PMAP_PREFER? Index: arch//arm/include/pmap.h === RCS file: /cvs/src/sys/arch/arm/include/pmap.h,v retrieving revision 1.17 diff -u -d -p -r1.17 pmap.h --- arch//arm/include/pmap.h 23 Mar 2011 16:54:34 - 1.17 +++ arch//arm/include/pmap.h 5 Apr 2011 16:30:58 - @@ -620,6 +620,14 @@ vaddr_t pmap_prefer(vaddr_t, vaddr_t); extern uint32_t pmap_alias_dist; extern uint32_t pmap_alias_bits; + +/* pmap prefer alias alignment. */ +#define PMAP_PREFER_ALIGN() (pmap_alias_dist) +/* pmap prefer offset withing alignment. */ +#define PMAP_PREFER_OFFSET(of) \ +(PMAP_PREFER_ALIGN() == 0 ? 0 : ((of) (PMAP_PREFER_ALIGN() - 1))) + + #endif /* _LOCORE */ #endif /* _KERNEL */ Index: arch//hppa/include/pmap.h === RCS file: /cvs/src/sys/arch/hppa/include/pmap.h,v retrieving revision 1.40 diff -u -d -p -r1.40 pmap.h --- arch//hppa/include/pmap.h 26 Dec 2010 15:40:59 - 1.40 +++ arch//hppa/include/pmap.h 5 Apr 2011 16:30:59 - @@ -101,6 +101,11 @@ pmap_prefer(vaddr_t offs, vaddr_t hint) return pmap_prefer_hint; } +/* pmap prefer alignment */ +#define PMAP_PREFER_ALIGN() (HPPA_PGALIAS) +/* pmap prefer offset within alignment */ +#define PMAP_PREFER_OFFSET(of) ((of) HPPA_PGAOFF) + #define pmap_sid2pid(s) (((s) + 1) 1) #define pmap_kernel()(kernel_pmap_store) #define pmap_resident_count(pmap) ((pmap)-pm_stats.resident_count) Index: arch//hppa64/include/pmap.h === RCS file: /cvs/src/sys/arch/hppa64/include/pmap.h,v retrieving revision 1.4 diff -u -d -p -r1.4 pmap.h --- arch//hppa64/include/pmap.h 26 Dec 2010 15:40:59 - 1.4 +++ arch//hppa64/include/pmap.h 5 Apr 2011 16:30:59 - @@ -68,6 +68,11 @@ pmap_prefer(vaddr_t offs, vaddr_t hint) return pmap_prefer_hint; } +/* pmap prefer alignment */ +#define PMAP_PREFER_ALIGN() (HPPA_PGALIAS) +/* pmap prefer offset within alignment */ +#define PMAP_PREFER_OFFSET(of) ((of) HPPA_PGAOFF) + #define PMAP_GROWKERNEL #define PMAP_STEAL_MEMORY Index: arch//m68k/include/pmap_motorola.h === RCS file: /cvs/src/sys/arch/m68k/include/pmap_motorola.h,v retrieving revision 1.22 diff -u -d -p -r1.22 pmap_motorola.h --- arch//m68k/include/pmap_motorola.h23 Mar 2011 16:54:35 - 1.22 +++ arch//m68k/include/pmap_motorola.h5 Apr 2011 16:30:59 - @@ -139,6 +139,12 @@ void pmap_kenter_cache(vaddr_t, paddr_t, #ifdef M68K_MMU_HP vaddr_t pmap_prefer(vaddr_t, vaddr_t); #define PMAP_PREFER(foff, va) pmap_prefer((foff), (va)) + +extern int pmap_aliasmask; /* separation at which VA aliasing is ok */ +/* pmap prefer alignment */ +#define PMAP_PREFER_ALIGN() (pmap_aliasmask ? pmap_aliasmask + 1 : 0) +/* pmap prefer offset */ +#define PMAP_PREFER_OFFSET(of) ((of) pmap_aliasmask) #endif #endif /* _KERNEL */ Index: arch//m68k/m68k/pmap_motorola.c === RCS file: /cvs/src/sys/arch/m68k/m68k/pmap_motorola.c,v retrieving revision 1.59 diff -u -d -p -r1.59 pmap_motorola.c --- arch//m68k/m68k/pmap_motorola.c 6 Dec 2010 20:57:16 - 1.59 +++ arch//m68k/m68k/pmap_motorola.c 5 Apr 2011 16:30:59 - @@ -276,9 +276,6 @@ vaddr_t virtual_end;/* VA of last avai TAILQ_HEAD(pv_page_list, pv_page) pv_page_freelist; int pv_nfree; -#if defined(M68K_MMU_HP) -extern int pmap_aliasmask; /* separation at which VA aliasing is ok */ -#endif #if defined(M68040) || defined(M68060) int protostfree;/* prototype (default) free ST map */ #endif Index: arch//mips64/include/pmap.h === RCS file: /cvs/src/sys/arch/mips64/include/pmap.h,v retrieving revision 1.25 diff -u -d -p -r1.25 pmap.h --- arch//mips64/include/pmap.h 23 Mar 2011 16:54:36 - 1.25 +++ arch//mips64/include/pmap.h 5 Apr 2011 16:30:59 - @@ -125,6 +125,13 @@ extern struct pmap *const kernel_pmap_pt #define
Re: pmap prefer diff
On Tue, Apr 05, 2011 at 06:42:47PM +0200, Ariane van der Steldt wrote: Hi, So it turns out that my allocator is not capable of handling the pmap_prefer horror. This diff exports the actual parameters of pmap_prefer, so I can make the allocator deal with this intelligently. I need compile tests on: - arm - hppa - hppa64 - m68k - mips64 - sh - sparc - sparc64 Since the code is not actually called, it should not affect running of kernels. Ok? -- Ariane Compiles fine on sh with a small tweak of using vaddr_t pmap_prefer_align(void); instead of vaddr_t pmap_prefer_align(); Index: arch//arm/include/pmap.h === RCS file: /cvs/src/sys/arch/arm/include/pmap.h,v retrieving revision 1.17 diff -u -d -p -r1.17 pmap.h --- arch//arm/include/pmap.h 23 Mar 2011 16:54:34 - 1.17 +++ arch//arm/include/pmap.h 5 Apr 2011 16:30:58 - @@ -620,6 +620,14 @@ vaddr_t pmap_prefer(vaddr_t, vaddr_t); extern uint32_t pmap_alias_dist; extern uint32_t pmap_alias_bits; + +/* pmap prefer alias alignment. */ +#define PMAP_PREFER_ALIGN() (pmap_alias_dist) +/* pmap prefer offset withing alignment. */ +#define PMAP_PREFER_OFFSET(of) \ +(PMAP_PREFER_ALIGN() == 0 ? 0 : ((of) (PMAP_PREFER_ALIGN() - 1))) + + #endif /* _LOCORE */ #endif /* _KERNEL */ Index: arch//hppa/include/pmap.h === RCS file: /cvs/src/sys/arch/hppa/include/pmap.h,v retrieving revision 1.40 diff -u -d -p -r1.40 pmap.h --- arch//hppa/include/pmap.h 26 Dec 2010 15:40:59 - 1.40 +++ arch//hppa/include/pmap.h 5 Apr 2011 16:30:59 - @@ -101,6 +101,11 @@ pmap_prefer(vaddr_t offs, vaddr_t hint) return pmap_prefer_hint; } +/* pmap prefer alignment */ +#define PMAP_PREFER_ALIGN() (HPPA_PGALIAS) +/* pmap prefer offset within alignment */ +#define PMAP_PREFER_OFFSET(of) ((of) HPPA_PGAOFF) + #define pmap_sid2pid(s) (((s) + 1) 1) #define pmap_kernel()(kernel_pmap_store) #define pmap_resident_count(pmap) ((pmap)-pm_stats.resident_count) Index: arch//hppa64/include/pmap.h === RCS file: /cvs/src/sys/arch/hppa64/include/pmap.h,v retrieving revision 1.4 diff -u -d -p -r1.4 pmap.h --- arch//hppa64/include/pmap.h 26 Dec 2010 15:40:59 - 1.4 +++ arch//hppa64/include/pmap.h 5 Apr 2011 16:30:59 - @@ -68,6 +68,11 @@ pmap_prefer(vaddr_t offs, vaddr_t hint) return pmap_prefer_hint; } +/* pmap prefer alignment */ +#define PMAP_PREFER_ALIGN() (HPPA_PGALIAS) +/* pmap prefer offset within alignment */ +#define PMAP_PREFER_OFFSET(of) ((of) HPPA_PGAOFF) + #define PMAP_GROWKERNEL #define PMAP_STEAL_MEMORY Index: arch//m68k/include/pmap_motorola.h === RCS file: /cvs/src/sys/arch/m68k/include/pmap_motorola.h,v retrieving revision 1.22 diff -u -d -p -r1.22 pmap_motorola.h --- arch//m68k/include/pmap_motorola.h23 Mar 2011 16:54:35 - 1.22 +++ arch//m68k/include/pmap_motorola.h5 Apr 2011 16:30:59 - @@ -139,6 +139,12 @@ void pmap_kenter_cache(vaddr_t, paddr_t, #ifdef M68K_MMU_HP vaddr_t pmap_prefer(vaddr_t, vaddr_t); #define PMAP_PREFER(foff, va) pmap_prefer((foff), (va)) + +extern int pmap_aliasmask; /* separation at which VA aliasing is ok */ +/* pmap prefer alignment */ +#define PMAP_PREFER_ALIGN() (pmap_aliasmask ? pmap_aliasmask + 1 : 0) +/* pmap prefer offset */ +#define PMAP_PREFER_OFFSET(of) ((of) pmap_aliasmask) #endif #endif /* _KERNEL */ Index: arch//m68k/m68k/pmap_motorola.c === RCS file: /cvs/src/sys/arch/m68k/m68k/pmap_motorola.c,v retrieving revision 1.59 diff -u -d -p -r1.59 pmap_motorola.c --- arch//m68k/m68k/pmap_motorola.c 6 Dec 2010 20:57:16 - 1.59 +++ arch//m68k/m68k/pmap_motorola.c 5 Apr 2011 16:30:59 - @@ -276,9 +276,6 @@ vaddr_t virtual_end;/* VA of last avai TAILQ_HEAD(pv_page_list, pv_page) pv_page_freelist; int pv_nfree; -#if defined(M68K_MMU_HP) -extern int pmap_aliasmask; /* separation at which VA aliasing is ok */ -#endif #if defined(M68040) || defined(M68060) int protostfree;/* prototype (default) free ST map */ #endif Index: arch//mips64/include/pmap.h === RCS file: /cvs/src/sys/arch/mips64/include/pmap.h,v retrieving revision 1.25 diff -u -d -p -r1.25 pmap.h --- arch//mips64/include/pmap.h 23 Mar 2011 16:54:36 - 1.25 +++ arch//mips64/include/pmap.h 5 Apr 2011 16:30:59 - @@ -125,6 +125,13 @@ extern
Re: pmap prefer diff
On Wed, Apr 06, 2011 at 10:31:14AM +0200, Mark Kettenis wrote: Date: Tue, 5 Apr 2011 18:42:47 +0200 From: Ariane van der Steldt ari...@stack.nl So it turns out that my allocator is not capable of handling the pmap_prefer horror. This diff exports the actual parameters of pmap_prefer, so I can make the allocator deal with this intelligently. Fine with me. With this, can't we completely get rid of the PMAP_PREFER? You are right. Should I adapt the diff for that? -- Ariane
Re: pmap prefer diff
Date: Wed, 6 Apr 2011 14:15:50 +0200 From: Ariane van der Steldt ari...@stack.nl On Wed, Apr 06, 2011 at 10:31:14AM +0200, Mark Kettenis wrote: Date: Tue, 5 Apr 2011 18:42:47 +0200 From: Ariane van der Steldt ari...@stack.nl So it turns out that my allocator is not capable of handling the pmap_prefer horror. This diff exports the actual parameters of pmap_prefer, so I can make the allocator deal with this intelligently. Fine with me. With this, can't we completely get rid of the PMAP_PREFER? You are right. Should I adapt the diff for that? We can clean that up later.
pmap prefer diff
Hi, So it turns out that my allocator is not capable of handling the pmap_prefer horror. This diff exports the actual parameters of pmap_prefer, so I can make the allocator deal with this intelligently. I need compile tests on: - arm - hppa - hppa64 - m68k - mips64 - sh - sparc - sparc64 Since the code is not actually called, it should not affect running of kernels. Ok? -- Ariane Index: arch//arm/include/pmap.h === RCS file: /cvs/src/sys/arch/arm/include/pmap.h,v retrieving revision 1.17 diff -u -d -p -r1.17 pmap.h --- arch//arm/include/pmap.h23 Mar 2011 16:54:34 - 1.17 +++ arch//arm/include/pmap.h5 Apr 2011 16:30:58 - @@ -620,6 +620,14 @@ vaddr_tpmap_prefer(vaddr_t, vaddr_t); extern uint32_t pmap_alias_dist; extern uint32_t pmap_alias_bits; + +/* pmap prefer alias alignment. */ +#define PMAP_PREFER_ALIGN()(pmap_alias_dist) +/* pmap prefer offset withing alignment. */ +#define PMAP_PREFER_OFFSET(of) \ +(PMAP_PREFER_ALIGN() == 0 ? 0 : ((of) (PMAP_PREFER_ALIGN() - 1))) + + #endif /* _LOCORE */ #endif /* _KERNEL */ Index: arch//hppa/include/pmap.h === RCS file: /cvs/src/sys/arch/hppa/include/pmap.h,v retrieving revision 1.40 diff -u -d -p -r1.40 pmap.h --- arch//hppa/include/pmap.h 26 Dec 2010 15:40:59 - 1.40 +++ arch//hppa/include/pmap.h 5 Apr 2011 16:30:59 - @@ -101,6 +101,11 @@ pmap_prefer(vaddr_t offs, vaddr_t hint) return pmap_prefer_hint; } +/* pmap prefer alignment */ +#define PMAP_PREFER_ALIGN()(HPPA_PGALIAS) +/* pmap prefer offset within alignment */ +#define PMAP_PREFER_OFFSET(of) ((of) HPPA_PGAOFF) + #definepmap_sid2pid(s) (((s) + 1) 1) #define pmap_kernel() (kernel_pmap_store) #definepmap_resident_count(pmap) ((pmap)-pm_stats.resident_count) Index: arch//hppa64/include/pmap.h === RCS file: /cvs/src/sys/arch/hppa64/include/pmap.h,v retrieving revision 1.4 diff -u -d -p -r1.4 pmap.h --- arch//hppa64/include/pmap.h 26 Dec 2010 15:40:59 - 1.4 +++ arch//hppa64/include/pmap.h 5 Apr 2011 16:30:59 - @@ -68,6 +68,11 @@ pmap_prefer(vaddr_t offs, vaddr_t hint) return pmap_prefer_hint; } +/* pmap prefer alignment */ +#define PMAP_PREFER_ALIGN()(HPPA_PGALIAS) +/* pmap prefer offset within alignment */ +#define PMAP_PREFER_OFFSET(of) ((of) HPPA_PGAOFF) + #definePMAP_GROWKERNEL #definePMAP_STEAL_MEMORY Index: arch//m68k/include/pmap_motorola.h === RCS file: /cvs/src/sys/arch/m68k/include/pmap_motorola.h,v retrieving revision 1.22 diff -u -d -p -r1.22 pmap_motorola.h --- arch//m68k/include/pmap_motorola.h 23 Mar 2011 16:54:35 - 1.22 +++ arch//m68k/include/pmap_motorola.h 5 Apr 2011 16:30:59 - @@ -139,6 +139,12 @@ void pmap_kenter_cache(vaddr_t, paddr_t, #ifdef M68K_MMU_HP vaddr_tpmap_prefer(vaddr_t, vaddr_t); #definePMAP_PREFER(foff, va) pmap_prefer((foff), (va)) + +extern int pmap_aliasmask; /* separation at which VA aliasing is ok */ +/* pmap prefer alignment */ +#define PMAP_PREFER_ALIGN()(pmap_aliasmask ? pmap_aliasmask + 1 : 0) +/* pmap prefer offset */ +#define PMAP_PREFER_OFFSET(of) ((of) pmap_aliasmask) #endif #endif /* _KERNEL */ Index: arch//m68k/m68k/pmap_motorola.c === RCS file: /cvs/src/sys/arch/m68k/m68k/pmap_motorola.c,v retrieving revision 1.59 diff -u -d -p -r1.59 pmap_motorola.c --- arch//m68k/m68k/pmap_motorola.c 6 Dec 2010 20:57:16 - 1.59 +++ arch//m68k/m68k/pmap_motorola.c 5 Apr 2011 16:30:59 - @@ -276,9 +276,6 @@ vaddr_t virtual_end;/* VA of last avai TAILQ_HEAD(pv_page_list, pv_page) pv_page_freelist; intpv_nfree; -#if defined(M68K_MMU_HP) -extern int pmap_aliasmask; /* separation at which VA aliasing is ok */ -#endif #if defined(M68040) || defined(M68060) intprotostfree;/* prototype (default) free ST map */ #endif Index: arch//mips64/include/pmap.h === RCS file: /cvs/src/sys/arch/mips64/include/pmap.h,v retrieving revision 1.25 diff -u -d -p -r1.25 pmap.h --- arch//mips64/include/pmap.h 23 Mar 2011 16:54:36 - 1.25 +++ arch//mips64/include/pmap.h 5 Apr 2011 16:30:59 - @@ -125,6 +125,13 @@ extern struct pmap *const kernel_pmap_pt #define PMAP_PREFER(pa, va)pmap_prefer(pa, va) +extern vaddr_t CpuCacheAliasMask; /* from mips64/mips64/cpu.c */ +/* pmap prefer alignment */ +#define PMAP_PREFER_ALIGN()\ + (CpuCacheAliasMask ? CpuCacheAliasMask + 1 : 0) +/* pmap prefer offset