On Wed, 19 Dec 2018 22:36:49 -0500
George Koehler wrote:

> On Wed, 19 Dec 2018 00:13:13 -0500
> George Koehler <[email protected]> wrote:
> 
> > By my guess, pmap_is_modified() is broken on powerpc.  It seems to
> > fail to return true, so uvm wouldn't know that the page is modified,
> > and then uvm wouldn't write the modified page to swap.
> 
> Turns out that pmap_page_protect(pg, PROT_NONE) forgot to check if
> the page was modified.  The below diff seems to fix it.
> 
> pmap_is_modified(pg) calls pmap_test_attrs(pg, PG_PMAP_MOD), which
> iterates pg->mdpage.pv_list to check if the hardware had set
> PTE_CHG_32 on any mapping of this physical page.  The list is empty
> because uvm seems to remove all the mappings before it asks if the
> page is modified, then swaps out the page.
> 
> A function that does LIST_REMOVE a mapping with PTE_CHG_32 must set
> PG_PMAP_MOD in pg->pg_flags, but pmap_page_protect(pg, PROT_NONE)
> fails to do so.  This function does
>                       pted->pted_va &= ~PTED_VA_MANAGED_M;
>                       LIST_REMOVE(pted, pted_pv_list);
> before
>                       pmap_remove_pted(pm, pted);
> Then pmap_remove_pted() calls pte_zap(), which would check PTE_CHG_32
> if PTED_MANAGED(pted) is true.  The check is skipped because we had
> unset PTED_VA_MANAGED_M.
> 
> The following diff fixes my test program on my single G4 processor
> (MPC7447A), where ppc_proc_is_64b is false.  I will use this diff
> until someone gives me a better diff.
> 

Hi, 

On my Powerbook5,8 [1] with 2 gigabytes of RAM, your (adjusted) check64
code shows the same memory corruption issues, and the diff you're
providing fixes it. 

Thanks a lot! 

Charlène. 


[1] https://dmesgd.nycbug.org/index.cgi?do=view&id=4574

> -- 
> George Koehler <[email protected]>
> 

Reply via email to