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

fix(ICache): block waylookup if there is a pending gpf #3719

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ngc7331
Copy link
Collaborator

@ngc7331 ngc7331 commented Oct 11, 2024

In the existing design, ICache assumes that once a gpf occurs, it works on the wrong path until a flush (redirect) arrives, so it can discard redundant gpf/gpaddr data to reduce power/area.

As shown below, the 2nd(orange) and 3rd(blue) gpaddr write to wayLookup is discarded.
241011-wave-old

This assumption is mostly true, except:

  1. Consider a 34B fetch block in which the first 32B have no exceptions and consist entirely of RVC instructions, and the last 2B cross a page boundary and a gpf occurs.
  2. The IFU sends at most 16 instructions to the ibuffer, and therefore discards the last 2B. This way, none of the instructions received by the backend have exceptions and no flush (redirect) is generated.
  3. The next fetch block again has a gpf, which ICache (wayLookup) considers redundant and discards the gpaddr data.
  4. When the instruction with gpf is sent to the backend, the backend does not get the correct gpaddr and caused an error.

Fix: block writes when there is gpf/gpaddr data in wayLookup that is not read by mainPipe (i.e. is pending).

As shown below, the 1st(yellow) gpaddr write is bypassed to read port, the 2nd is stored in gpf entry, and the 3rd is stalled until the 2nd is read. So all 3 gpaddr data are sent to backend(gpaMem).
241011-wave-new

@XiangShanRobot
Copy link

[Generated by IPC robot]
commit: f7dd8ff

commit astar copy_and_run coremark gcc gromacs lbm linux mcf microbench milc namd povray wrf xalancbmk
f7dd8ff 1.926 0.451 2.705 1.192 2.824 2.464 2.401 0.920 1.394 1.616 3.413 2.734 2.419 3.275

master branch:

commit astar copy_and_run coremark gcc gromacs lbm linux mcf microbench milc namd povray wrf xalancbmk
ecac006 1.926 0.451 2.705 1.192 2.824 2.464 2.401 0.920 1.394 1.616 3.413 2.734 2.419 3.275
9acb8f9 1.926 0.451 2.705 1.192 2.824 2.464 2.401 0.920 1.394 1.616 3.413 2.734 2.419 3.275
d904dcf 1.926 0.451 2.705 1.192 2.824 2.464 2.401 0.920 1.394 1.616 3.413 2.734 2.419 3.275
9d3877d 1.928 0.450 2.703 1.192 2.812 2.465 2.400 0.915 1.395 1.626 3.420 2.755 2.428 3.271
2b20b83 1.928 0.450 2.703 1.192 2.812 2.465 2.400 0.915 1.395 1.626 3.420 2.755 2.428 3.271
8bb30a5 1.928 0.450 2.703 1.192 2.812 2.465 2.400 0.915 1.395 1.626 3.420 2.755 2.428 3.271
7a59a48 1.935 0.450 2.703 1.192 2.812 2.465 2.400 0.915 1.395 1.626 3.420 2.755 2.428 3.271
676ddb7 1.936 0.450 2.701 1.198 2.812 2.465 2.403 0.914 1.394 1.626 3.424 2.745 2.428 3.271
0861ab0 1.936 0.450 2.701 1.198 2.812 2.465 2.403 0.914 1.394 1.626 3.424 2.745 2.428 3.271
ea2894c 1.924 0.450 2.701 1.198 2.812 2.465 2.403 0.914 1.394 1.626 3.424 2.745 2.428 3.271

@good-circle
Copy link
Contributor

Has already tested with KVM in palladium

@ngc7331 ngc7331 marked this pull request as ready for review October 12, 2024 02:43
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.

3 participants