Subject: Re: Ultra 10, anyone?
To: Jason R Thorpe <thorpej@wasabisystems.com>
From: Jake Burkholder <jake@locore.ca>
List: port-sparc64
Date: 08/22/2002 14:06:18
Apparently, On Thu, Aug 22, 2002 at 10:27:38AM -0700,
	Jason R Thorpe said words to the effect of;

> On Thu, Aug 22, 2002 at 10:23:16AM -0700, Andrey Petrov wrote:
> 
>  > I'm not sure if that hme or not but the following patch fixed
>  > 'signal 11' during NFS build for me. I have some theory about
>  > aliased shared pages, but it's just guess with no prove at this 
>  > point.
> 
> Please check this patch in.  For a write-back cache, when MOD is cleared,
> the cache *must* be written-back, otherwise it is possible for data to
> be lost.

I think you may need this in pmap_enter as well; I notice that the cache
flushes that used to be there have been removed.  The dcache is write
through on ultra sparc, it doesn't contain modified data.  The problem is
that the pmap doesn't handle illegal dcache aliases properly.  The data
cache is virtually indexed, so mappings of the same page with different
virtual color create illegal aliases and need to be marked uncacheable.
Using the pv entry alias chains to detect illegal aliases is not sufficient
because IIRC the mappings created by pmap_kenter_pa are not on the pv entry
chains.  The double mappings used by pipes, for example, may create illegal
aliases if the kernel address doesn't have the same color as the user address.
The way I fixed this in FreeBSD/sparc64 is to merge the pv entries and the
page table entries and to put all mappings on the pv entry chains, which
allows the aliases to be detected (actually tsb entries, we don't use page
tables).

Please correct me if I'm wrong; OpenBSD may have picked up these changes
and have the same problem.

Jake

> 
>  > 
>  > 	Andrey
>  > 
>  > Index: pmap.c
>  > ===================================================================
>  > RCS file: /cvsroot/syssrc/sys/arch/sparc64/sparc64/pmap.c,v
>  > retrieving revision 1.125
>  > diff -u -p -r1.125 pmap.c
>  > --- pmap.c      2002/08/12 12:04:31     1.125
>  > +++ pmap.c      2002/08/22 17:14:52
>  > @@ -2805,6 +2805,7 @@ pmap_clear_modify(pg)
>  >                                 changed |= 1;
>  >                         pv->pv_va &= ~(PV_MOD);
>  >                         simple_unlock(&pv->pv_pmap->pm_lock);
>  > +                       dcache_flush_page(pa);
>  >                 }
>  >         splx(s);
>  >         pv_check();
> 
> -- 
>         -- Jason R. Thorpe <thorpej@wasabisystems.com>