-
Notifications
You must be signed in to change notification settings - Fork 40
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
Nax not trap on store fault #116
Comments
Depend what you mean by pass through the cache. In any privilege mode, all none-io memory store will to the cache. Just that cache line had a fault when it was loaded in the l1 cache, it is ignored (will not raise a CPU store access fault exception)
Yes
Right XD
I don't know.
Hmm yes and no it depends.
Ahh right, a bit like vexii ^^ But the idea is to not integrate it into the MMU to allow things to stay decoupled. I know i integrated it into the MMU, but this isn't realy right. Overall, i would say as a workaround, just setting the ioRegion to everything which is not cached should be good.
I'm not sure to understand the relation between the two ? |
Thank you for your detailed reply !
Normally not, the faulty line will not be written in memory.
I agree that the faulty store will not impact the memory, and its value cannot be loaded in registers afterwards (trigger a load access fault). In cache memory, I see as a side effect the eviction of legal cache lines to fill the cache with faulty cache lines that will be unused. So it's more of a performance concern than a functional one. There are also, all the coherence transactions added.
Glad to hear that Vexi is already incorporating this differentiation !
I'm not sure to understand why integrating it into the MMU poses a problem. Is it a performance issue (critical path)? Or is it more conceptual ? As it is already done in the MMU, even if isn't realy right for you. If we use this memRegion only in the baremetal section of MMU (requireMmuLockup = false), does it still not decoupled for you ?
We've tried, but unfortunately there are problems with the riscv tests (machine), as you saw it in the pull request.
By adding this address verification, we don't have to wait to be denied by the memory interconnect. We tested the addition of memRegion, and it passed all the NaxRiscvRegression tests, and the same tests with SocSim. |
As much as i have seen, other CPU do have the same behaviour (no store access fault trap), but instead they will rise some non maskable interrupts (imprecise exception)
Ahhh that is curious. Can you provide a way for me to reproduce (exactly) via a git branch to clone and run your commands ?
Why would the CPU need to wait on the store success before bypassing the data to a future load ? As anyway store fault aren't catched and things are already bad (when things are bad, more bad things doesn't realy matter)
Nice :D
Hmm in what way it is a problem ? |
(Note i will be in travel / holiday from tomorrow until end of next week) |
Oh right, thank you for that information, it's true that I didn't look at how it worked on the other cores. And perhaps it's also catched by the PMP when they use it.
The problem is here #115. The machine test fails because it want to test a store access fault on memory, so Nax and RVLS trigger a trap for this access, as wanted. However as we modify the ioRange, the address tested 0x1230 is pushed by Nax into the RVLS ioQueue, but it's not popped out by RVLS, as for RVLS it's not an IO address. The RVLS IO mapping is defined from the SocDemo mapping and not from ioRange, and it's difficult to change this. With memRegion enabled, we don't have this problem. Because storing at 0x1230 triggers a trap as expected, and the address is not pushed into ioQueue. The queue misalignment therefore disappears.
That's what I understood from your previous answer #43 (comment).
It's not really a problem, I think we just need a different memRegion in NaxSoc. Enjoy your holidays ! |
Hi Charles,
To follow up on the discussion in this pull request #115
As I understand it, when the processor is in baremetal mode, and makes a store to a non-peripheral address, the request will pass through the cache.
If this address is not mapped in memory, the tilelink bus will send an error to the cache during refill.
The cache will store the line loaded with the fault tag set to true.
But during the refill, the LSU does not trigger a trap and the store instruction is committed.
Moreover, the store will be cached, even if the line is faulty.
In your opinion, isn't this behaviour a functional bug ?
Even if I understand that the store instruction won't have any effect architecturally, because of the faulty cache line.
But the fact of committing a store instruction to a non-existent address troubles me, and impacts cache performance by loading a line for nothing.
Would it be possible to solve this by adding a memRegion argument to the MMU ?
This argument could be used to trigger a trap when the address is outside the range, if translation is not active, and also to abort the cache request with the translated.abort signal.
We could use this line, which already exists in the code :
NaxRiscv/src/main/scala/naxriscv/misc/MmuPlugin.scala
Line 327 in ba63ee6
Moreover, would this change make store-to-load forwarding possible ? #43
Perhaps I didn't see a corner case that would make this modification impossible, thank you in advance for your feedback !
The text was updated successfully, but these errors were encountered: