tech-kern archive

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

Re: pmap_kenter_pa & pmap_kremove



On Feb 22, 2014, at 2:04 PM, Mindaugas Rasiukevicius 
<rmind%netbsd.org@localhost> wrote:

> Matt Thomas <matt%3am-software.com@localhost> 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.


Home | Main Index | Thread Index | Old Index