On Feb 22, 2014, at 2:04 PM, Mindaugas Rasiukevicius <[email protected]> wrote:
> Matt Thomas <[email protected]> wrote: >> >> I've been wondering... >> >> Should pmap_kenter_pa overwrite an existing entry should it be operating >> on an unmapped VA. > > You mean already mapped VA? I do. >> I think that if you want to change a mapping, you >> should do a pmap_kremove first. > > I tend to agree. I have not seen a need for such re-mapping (overwriting), > but even if there is, it can be done efficiently by removing, entering and > then calling pmap_update(). With the deferred update, that would result in > a single TLB flush/invalidation. > > In x86 pmap, there is a printf() for overwriting case: > > http://nxr.netbsd.org/xref/src/sys/arch/x86/x86/pmap.c?r=1.181#1005 > > Having this converted to an assert might catch something interesting. My common page code has: KASSERT(!pte_valid_p(*ptep)); in this instance.
