Skip to content

Improve guest TLB invalidation #721

Open
Open

Description

@syntactically

Because we support rolling back/restoring a different snapshot within the same sandbox, we need to invalidate the guest TLB on occasion to ensure that no cached mappings that are no longer valid are around.

Currently, the guest itself executes tlb flush instructions on the entry path, which largely works for the rollback case, since that code itself has been present since the beginning. Unfortunately, it's not clear that this will always work as we move towards a model in which that code page may itself not always be at the same place. Ideally, the hypervisor would architecturally trigger a TLB flush itself, but it's unclear if APIs to do so are available on all platforms.

It would also be good to ensure that this forced TLB invalidation happens only on events (e.g. snapshot restore) where the host has in fact messed with the guest page tables. This would be much easier if the host controlled TLB invalidation.

Relatedly, in the future, for guests which do happen to share some amount of state (e.g. multiple different snapshots of a wasm engine loaded with a module, which all share the mappings for the wasm engine), it would be interesting to try to use ASIDs to avoid invalidating the common code page mappings when restoring a snapshot.

Activity

  1. added this to the v0.9.0 milestone on Jul 23, 2025
  2. modified the milestones: v0.9.0, v0.10.0 on Aug 27, 2025
  3. modified the milestones: v0.10.0, v0.11.0 on Oct 1, 2025
  4. modified the milestones: v0.11.0, v0.12.0 on Oct 22, 2025
  5. jsturtevant commented on Nov 6, 2025

    @jsturtevant
    Contributor

    Removing from the milestone, it was determined that what we do to reset the TLB currently is acceptable. We might need to revisit this later or improve upon the current model

  6. modified the milestones: v0.12.0, Backlog on Nov 6, 2025
  7. modified the milestones: Backlog, 1.0 on Aug 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

lifecycle/confirmedBug is verified or proposal seems reasonable

Type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions