Skip to content

Adding new mappings in pagetable doesn't require TLB flushes #587

@TSnake41

Description

@TSnake41

Currently, MappedPageTable and similar facilities always return MapperFlush when mapping a new page, and return a error is a mapping already exist.

According to Intel specifications, adding new mappings to a pagetable doesn't require a TLB flush.

If a paging-structure entry is modified to change the P flag from 0 to 1, no invalidation is necessary. This is
because no TLB entry or paging-structure cache entry is created with information from a paging-structure entry
in which the P flag is 0.

Although, for that to be correct, we still need to ensure that the pagetable entry is actually written at the end of the mapping function (currently, this is somehow enforced by the expected tlb flush that does inline asm invlpg without the nomem attribute), otherwise the compiler is allowed to do surprising reordering of the pagetable modification to e.g after the use of the mapping we're looking to make.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions