Subject: Re: Non-optimial "access type" handing in pmap_enter()?
To: None <>
From: Jason R Thorpe <>
List: port-arm
Date: 01/31/2002 11:04:31
On Thu, Jan 31, 2002 at 06:54:30PM +0000, Richard Earnshaw wrote:

 > I suspect this will be a side-effect of having to emulate the read/modify 
 > bits.  The only way of doing these is to trap accesses to the page and 
 > enable access.
 > What are you suggesting the algorithm should be.  Certainly I don't think 
 > we should grant write permission anywhere that isn't required.

Actually, we are currently not granting read/write permissions in situations
where we safely could (i.e. when we set up the emulation fault stuff, we
are ignoring if the page is already known to be modified or referenced).

Consider the Alpha algorithm:

                if ((flags & VM_PROT_ALL) & ~prot) 
                        panic("pmap_enter: access type exceeds prot");
                if (flags & VM_PROT_WRITE)
                        pg->mdpage.pvh_attrs |= (PGA_REFERENCED|PGA_MODIFIED);
                else if (flags & VM_PROT_ALL)
                        pg->mdpage.pvh_attrs |= PGA_REFERENCED;
                attrs = pg->mdpage.pvh_attrs;
                 * Set up referenced/modified emulation for new mapping.  
                if ((attrs & PGA_REFERENCED) == 0)
                        npte |= PG_FOR | PG_FOW | PG_FOE;
                else if ((attrs & PGA_MODIFIED) == 0)
                        npte |= PG_FOW;

That is, if the page is already referenced, fault-on-{read,exec} isn't
set in the PTE, since we already know the page is referenced, and thus
don't need to take a (unnecessary) fault to know that.  Same with modified.

        -- Jason R. Thorpe <>