Port-powerpc archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: G4, 2GB RAM report (fwd)
On Wed, 9 Aug 2000, Jason R Thorpe wrote:
Oh. Ok, now I see what's going on. I'm still a little worried that we
still are calculating the number of bytes of memory in the system, which
will overflow an int and might do weird sign-extended goofyness. How about
the patch below?
For folks only on port-powerpc, the current powerpc pmap doesn't size
things well when the machine has 2GB of memory. It calculates the number
of bytes in the system in an integer quantity. 2GB > INT_MAX, so bad
things happen.
Tsubai? WS?
Take care,
Bill
> > 1. int physmem:
> >
> > the page hash table is auto-sized in pmap_bootstrap()\pmap.c:
> >
> > #ifdef HTABENTS
> > ptab_cnt = HTABENTS;
> > #else /* HTABENTS */
> > ptab_cnt = 1024;
> > while ((HTABSIZE << 7) < ctob(physmem))
> > ptab_cnt <<= 1;
> > #endif /* HTABENTS */
> >
> > with >= 2GB RAM, ctob(physmem) as a signed quantity
> > will evaluate negative right off so ptab_cnt never gets
> > adjusted upwards. The result is overflow of the (puny)
> > page table during startup before VM is initialized
> > which results in panic("poalloc").
Index: pmap.c
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/powerpc/powerpc/pmap.c,v
retrieving revision 1.30
diff -u -r1.30 pmap.c
--- pmap.c 2000/06/29 07:48:18 1.30
+++ pmap.c 2000/08/09 20:37:04
@@ -47,6 +47,12 @@
int ptab_cnt;
u_int ptab_mask;
#define HTABSIZE (ptab_cnt * 64)
+#define HTABTOPAGES (ptab_cnt << (6 + 7 - PGSHIFT))
+/*
+ * above calculates btoc(HTABSIZE << 7) without overflow. Assumes PGSHIFT
+ * is not greater than 13, which means that our physical pages aren't
+ * larger than 16k. They are 8k at present.
+ */
struct pte_ovfl {
LIST_ENTRY(pte_ovfl) po_list; /* Linked list of overflow entries */
@@ -401,7 +407,7 @@
ptab_cnt = HTABENTS;
#else /* HTABENTS */
ptab_cnt = 1024;
- while ((HTABSIZE << 7) < ctob(physmem))
+ while (HTABTOPAGES < physmem)
ptab_cnt <<= 1;
#endif /* HTABENTS */
Home |
Main Index |
Thread Index |
Old Index