Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only perform a single TLB flush after identity mapping #265

Merged
merged 2 commits into from
Sep 25, 2022

Conversation

hawkw
Copy link
Contributor

@hawkw hawkw commented Sep 23, 2022

This commit changes the BIOS bootloader to only flush the TLB once, after it has identity-mapped every physical memory frame. This should be a bit more efficient, as we don't perform a separate invlpg for every page table entry we create, and instead only flush the entire thing by reloading CR3 when we're actually ready to use it.

This is based on a suggestion by @phil-opp, here:
#260 (comment)

This change doesn't actually seem to make all that big an impact in boot times on QEMU v7.1 on its own, relative to PR #260, but it might make an additional improvement on top of that PR.

This commit changes the BIOS bootloader to only flush the TLB once,
after it has identity-mapped every physical memory frame. This should be
a bit more efficient, as we don't perform a separate `invlpg` for every
page table entry we create, and instead only flush the entire thing by
reloading `CR3` when we're actually ready to use it.

This is based on a suggestion by @phil-opp, here:
rust-osdev#260 (comment)

This change doesn't actually seem to make all that big an impact in boot
times on QEMU v7.1 on its own, relative to PR rust-osdev#260, but it might make an
additional improvement on top of that PR.
Copy link
Member

@phil-opp phil-opp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

@phil-opp phil-opp merged commit 9d733ab into rust-osdev:main Sep 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants