Port-alpha archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: NetBSD 10.0_RC1 on AlphaServer DS25... no boot




> On Dec 30, 2023, at 2:12 PM, Jason Thorpe <thorpej%me.com@localhost> wrote:
> 
> Ok, I think I’ve narrowed it down to what appears to be some sort of overflow problem when setting up the kernel L2 PTEs.  What puzzles me is that this code hasn’t changed in a long time, and obviously worked for you before… but the compiler is now different perhaps?
> 
> Anyway… I should have it fixed shortly, and hopefully the gods will look upon me favorably and I can sneak the fix into -10.

Ok, found it.  Somehow before we were just getting lucky I guess that large memory configs weren’t pushing us past a single L2 kernel page table.  The kernel *thought* it was all set for a large kernel VA space, but the page tables initialized incorrectly.  

The macro used to index the kernel L2 PTs to poke the value in them to point to the L3 PTs was overflowing from 1023->0 because it was designed to, and it probably just shouldn’t have been used in this one particular spot.  The fix is quite simple, and the comment explaining it is more complicated than the change :-)


<quote>
@@ -1358,8 +1360,19 @@ pmap_bootstrap(paddr_t ptaddr, u_int max
  pte = (ALPHA_K0SEG_TO_PHYS(((vaddr_t)lev3map) +
      (i*PAGE_SIZE)) >> PGSHIFT) << PG_SHIFT;
  pte |= PG_V | PG_ASM | PG_KRE | PG_KWE | PG_WIRED;
- lev2map[l2pte_index(VM_MIN_KERNEL_ADDRESS+
-     (i*PAGE_SIZE*NPTEPG))] = pte;
+ /*
+ * No need to use l2pte_index() here; it's equivalent
+ * to just indexing with our loop variable i, but will
+ * fall over if we end up with more than 1 L2 PT page.
+ *
+ * In other words:
+ *
+ * l2pte_index(VM_MIN_KERNEL_ADDRESS +
+ *             (i*PAGE_SIZE*NPTEPG))
+ *
+ * ...is the same as 'i' so long as i stays below 1024.
+ */
+ lev2map[i] = pte;
  }
    /* Initialize the pmap_growkernel_lock. */
</quote>

> 
> -- thorpej
> 

-- thorpej



Home | Main Index | Thread Index | Old Index