Repository navigation
cpu: four fixes to the full R10000 cache model - #267
Merged
Merged
Conversation
On the R10000, Index_WB_Inv, Index_Load/Store_Tag and Index_Load/Store_Data take the index within one way from the low address bits and the way from bit 0. The full (data-carrying) R10000 model in mips_cache_v2 is direct-mapped at the full cache size and ignored bit 0, so a whole-cache flush -- every index of way 0, then of way 1 -- reached only the lower half of L1I, L1D and L2. Dirty lines in the upper half outlived the flush and were written back later, over pages that had been reused in the meantime. Map way 1 to the upper half of each cache, for the tag ops and the data ops alike, so the two still name the same line. Only R10000Cache is affected. IP28 machines use R10000ShadowCache, which is out of the data path and already decodes bit 0 as the way. Found running OpenBSD/sgi 6.9 on an emulated O2 (R10000) that used R10000Cache: forked ksh processes died with SIGBUS and "write after free" as stale lines landed on their copy-on-write pages. With the fix, 3 x 300 subshells run clean. Test: r10000_index_flush_reaches_both_ways (fails without the fix). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CpuCache took CpuModel's default of 40 for every model, while the shadow model says 44 for the R10000, as the part implements. XContext's fields are laid out around that width, so a 64-bit kernel's TLB refill handler on a full-model R10000 would find the wrong page-table entry. Latent: no machine runs the full R10000 model (IP28 uses the shadow). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The full R10000 model printed a line for every secondary-cache Index_Store_Tag: 32768 of them each time firmware initialises the cache. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… VCE Virtual coherency exceptions are an R4000/R4400 feature. The R10000 keeps the virtual index in its secondary tags but, on a hit under a different index, writes back and drops the primary copies made under the old one and records the new one. The full model raised the R4400's VCEI/VCED there, which an R10000 kernel never expects (OpenBSD dies on the first page it maps at two colours). Test: one line under two colours, VCE on the R4400, coherent on the R10000. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
cpu: four fixes to the full R10000 cache model
No machine runs the full R10000 model today (IP28 uses the shadow cache), so these are latent on
main; they matter to anything that runs the full model, as the O2 does through its PROM. One commit each.CpuCacheusedCpuModel's default of 40 for every model; the shadow model already says 44 for the R10000. XContext's fields are laid out around that width, so a 64-bit kernel's TLB refill handler on a full-model R10000 would find the wrong page-table entry.Tests
the_r10000_full_model_has_44_va_bits, andthe_r10000_resolves_a_colour_mismatch_where_the_r4400_raises_vce(one line under two colours: VCE on the R4400; on the R10000 the load succeeds and a store under one colour is what a load under the other sees).r10000_index_flush_reaches_both_waysfor the index ops (fails without the fix).cargo test --lib: all pass, apart from the two tests that fail the same way onmainhere. Built in the three CI configurations.🤖 Generated with Claude Code