Skip to content

ppcmu: Use generational flush for PAT entries - #199

Merged
dingusdev merged 2 commits into
dingusdev:masterfrom
mihaip:upstream-pat-sequence
Aug 6, 2026
Merged

ppcmu: Use generational flush for PAT entries#199
dingusdev merged 2 commits into
dingusdev:masterfrom
mihaip:upstream-pat-sequence

Conversation

@mihaip

@mihaip mihaip commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

We end up flushing all entries very frequently (hundreds of thousands of times during Mac OS X boot), and were spending a lot of time in tlb_flush_entries walking through the array. We can instead store a generation counter and make invalidation be a simple increment. This does make validity checks slightly more expensive, but it appears to be a net win. On my machine it takes booting the Mac OS X public meta to the Finder from ~58 seconds to ~35 seconds.

To hide these implemetation details we first do a preparatory refactor to move TLBEntry and related code into ppcmmu.cpp - it didn't actually need to be in the header file.

mihaip added 2 commits August 5, 2026 23:00
`TLBEntry` and its cache constants and flags are used exclusively by
ppcmmu.cpp. Keep them out of the public MMU header so future TLB changes
do not expand its interface.

This required a small fix in dbdma.cpp since it was implicitly relying on
an include that we removed.

Also declare `gTLBFlush*` variables as static to make it explicit that we
don't expect them to be accessed outside of ppcmmu.cpp.
We end up flushing all entries very frequently (hundreds of thousands of times
during Mac OS X boot), and were spending a lot of time in `tlb_flush_entries`
walking through the array. We can instead store a generation counter and
make invalidation be a simple increment. This does make validity checks slightly
more expensive, but it appears to be a net win. On my machine it takes booting
the Mac OS X public meta to the Finder from ~58 seconds to ~35 seconds.
@dingusdev
dingusdev merged commit 2c7a7c5 into dingusdev:master Aug 6, 2026
7 checks passed
@mihaip
mihaip deleted the upstream-pat-sequence branch August 6, 2026 18:16
mihaip added a commit to mihaip/infinite-mac that referenced this pull request Aug 6, 2026
Includes dingusdev/dingusppc#199 which significantly speeds up Mac OS X
boot time.

For #219
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.

2 participants