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(exception): check high address bits of jump target #3003

Merged
merged 27 commits into from
Sep 9, 2024

Conversation

Tang-Haojin
Copy link
Member

@Tang-Haojin Tang-Haojin commented May 23, 2024

This commit contains high address bits checking of jump target. In previous implementation, we simply truncated the higher bits of jump target address, which made it impossible to raise exceptions in such cases.

To resolve this problem, we detect the invalid jump target in jump/branch/CSR and, this information to frontend and store the complete invalid target in a single register in backend. The frontend will then raise an exception to backend and backend will also use the invalid target in the register to write xtval and mepc.

@XiangShanRobot
Copy link

[Generated by IPC robot]
commit: bbb9f04

commit astar copy_and_run coremark gcc gromacs lbm linux mcf microbench milc namd povray wrf xalancbmk
bbb9f04 1.866 0.448 2.096 1.179 2.491 2.595 2.374 0.957 1.377 1.408 3.124 2.650 2.442 2.957

master branch:

commit astar copy_and_run coremark gcc gromacs lbm linux mcf microbench milc namd povray wrf xalancbmk
1fb367e 1.861 2.096 1.190 2.490 2.598 0.954 1.377 1.356 3.124 2.442 2.943
2b16f0c 1.856 0.448 2.096 1.183 2.487 2.594 2.333 0.957 1.377 1.408 3.124 2.650 2.442 2.957
9c1b710 1.863 0.448 2.096 1.187 2.493 2.595 2.337 0.956 1.377 1.355 3.124 2.650 2.442 2.957
c8cff56 1.867 0.448 2.096 1.180 2.492 2.595 2.335 0.962 1.377 1.367 3.124 2.650 2.442 2.957
90ae5a7 1.865 0.449 2.096 1.188 2.483 2.581 2.333 0.954 1.377 1.421 3.118 2.666 2.439 2.955
60311af 1.862 0.449 2.096 1.176 2.481 2.581 2.333 0.956 1.377 1.394 3.118 2.666 2.439 2.955
3adc700 1.858 0.449 2.106 1.182 2.483 2.586 2.328 0.950 1.387 1.282 3.127 2.639 2.432 2.946
c2bbba9 1.852 0.449 2.106 1.188 2.483 2.586 2.328 0.949 1.387 1.412 3.127 2.639 2.432 2.946
175dc3e 1.853 0.449 2.103 1.188 2.482 2.597 2.329 0.952 1.389 1.365 3.123 2.636 2.431 2.953
9f2c7f7 1.857 0.449 2.091 1.188 2.476 2.588 2.331 0.956 1.392 1.365 3.124 2.630 2.432 2.954

@XiangShanRobot
Copy link

[Generated by IPC robot]
commit: fa51ce4

commit astar copy_and_run coremark gcc gromacs lbm linux mcf microbench milc namd povray wrf xalancbmk
fa51ce4 1.861 0.448 2.096 1.190 2.933 2.600 2.374 0.954 1.377 1.353 3.437 2.667 2.467 2.943

master branch:

commit astar copy_and_run coremark gcc gromacs lbm linux mcf microbench milc namd povray wrf xalancbmk
4ccb2e8 2.096 1.166 2.945 2.603 0.951 1.377 1.298 3.424 2.945
453674e 1.861 0.448 2.096 1.190 2.933 2.600 2.335 0.954 1.377 1.353 3.437 2.667 2.467 2.943
f6458cc 1.861 0.448 2.096 1.190 2.933 2.600 2.335 0.954 1.377 1.353 3.437 2.667 2.467 2.943
adf98a9 1.861 0.448 2.096 1.190 2.933 2.600 2.335 0.954 1.377 1.353 3.437 2.667 2.467 2.943
fcd66f1 1.861 2.096 1.190 2.933 2.600 2.335 0.954 1.377 1.353 3.437 2.667 2.467 2.943
8702944 2.096 1.190 2.933 2.600 2.335 0.954 1.377 1.353 3.437 2.667 2.467 2.943
cf34363 1.861 2.096 1.190 2.490 2.598 2.335 0.954 1.377 1.356 3.124 2.442 2.943
94e6af6 1.861 0.448 2.096 1.190 2.490 2.598 2.335 0.954 1.377 1.356 3.124 2.651 2.442 2.943
1fb367e 1.861 0.448 2.096 1.190 2.490 2.598 2.335 0.954 1.377 1.356 3.124 2.651 2.442 2.943
2b16f0c 1.856 0.448 2.096 1.183 2.487 2.594 2.333 0.957 1.377 1.408 3.124 2.650 2.442 2.957

@Tang-Haojin Tang-Haojin marked this pull request as ready for review May 30, 2024 03:23
Copy link
Member

@eastonman eastonman left a comment

Choose a reason for hiding this comment

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

Frontend part is LGTM.

@XiangShanRobot
Copy link

[Generated by IPC robot]
commit: 01c2dcf

commit astar copy_and_run coremark gcc gromacs lbm linux mcf microbench milc namd povray wrf xalancbmk
01c2dcf 1.821 0.448 2.054 1.173 2.950 2.500 2.330 0.923 1.376 1.265 3.448 2.667 2.398 2.940

master branch:

commit astar copy_and_run coremark gcc gromacs lbm linux mcf microbench milc namd povray wrf xalancbmk
cd467f7 1.821 0.448 2.054 1.173 2.950 2.500 2.291 0.923 1.376 1.265 3.448 2.667 2.398 2.940
75b44a5 1.821 0.448 2.054 1.173 2.950 2.500 2.291 0.923 1.376 1.265 3.448 2.667 2.398 2.940
321866f 1.821 0.448 2.054 1.173 2.950 2.500 2.291 0.924 1.376 1.265 3.448 2.667 2.398 2.940
082b30d 1.821 0.448 2.054 1.173 2.950 2.500 2.291 0.923 1.376 1.265 3.448 2.667 2.398 2.940
0e28018 1.823 0.448 2.054 1.172 2.950 2.500 2.292 0.923 1.376 1.265 3.449 2.656 2.398 2.943
df7130a 1.823 0.448 2.054 1.172 2.950 2.500 2.292 0.923 1.376 1.265 3.449 2.656 2.398 2.943
b51ac1c 1.823 0.448 2.054 1.172 2.950 2.500 2.292 0.923 1.376 1.265 3.449 2.656 2.398 2.943
79fadd7 1.868 0.448 2.096 1.166 2.945 2.603 2.333 0.952 1.377 1.298 3.424 2.659 2.468 2.945
f48d8a2 1.868 0.448 2.096 1.166 2.945 2.603 2.333 0.952 1.377 1.298 3.424 2.659 2.468 2.945
4ccb2e8 1.868 0.448 2.096 1.166 2.945 2.603 2.333 0.951 1.377 1.298 3.424 2.659 2.468 2.945

@XiangShanRobot
Copy link

[Generated by IPC robot]
commit: bea09e1

commit astar copy_and_run coremark gcc gromacs lbm linux mcf microbench milc namd povray wrf xalancbmk
bea09e1 1.809 0.451 2.043 1.190 2.940 2.496 2.248 0.932 1.373 1.411 3.181 2.669 2.403 2.948

master branch:

commit astar copy_and_run coremark gcc gromacs lbm linux mcf microbench milc namd povray wrf xalancbmk
9134676 1.809 0.451 2.047 1.190 2.940 2.496 2.197 0.932 1.373 1.411 3.181 2.669 2.403 2.948
7ffbf5f 1.809 0.452 2.052 1.196 2.951 2.499 2.199 0.930 1.377 1.407 3.436 2.653 2.398 2.941
d1da158 1.805 0.452 2.052 1.196 2.951 2.499 2.199 0.930 1.377 1.407 3.436 2.653 2.398 2.941
dd40a82 1.809 0.452 2.052 1.196 2.951 2.499 2.199 0.930 1.377 1.407 3.436 2.653 2.398 2.941
2a1dcaf 1.805 0.452 2.052 1.196 2.951 2.499 2.197 0.930 1.377 1.407 3.436 2.653 2.398 2.941
c08d352 1.809 0.452 2.052 1.196 2.951 2.499 2.197 0.930 1.377 1.407 3.436 2.653 2.398 2.941
87c5d21 1.805 0.452 2.052 1.196 2.951 2.499 2.199 0.930 1.377 1.407 3.436 2.653 2.398 2.941
864480f 1.809 0.452 2.052 1.196 2.951 2.499 2.199 0.930 1.377 1.407 3.436 2.653 2.398 2.941
69a3c27 1.805 0.452 2.052 1.196 2.951 2.499 2.197 0.930 1.377 1.407 3.436 2.653 2.398 2.941
a31db3f 1.805 0.452 2.052 1.196 2.951 2.499 2.197 0.930 1.377 1.407 3.436 2.653 2.398 2.941

@Tang-Haojin
Copy link
Member Author

Some other changes should be made. Frontend may tell backend if an IPF/IAF exception is requested by backend so that backend can correctly write mtval/stval.

@XiangShanRobot
Copy link

[Generated by IPC robot]
commit: b5a9fef

commit astar copy_and_run coremark gcc gromacs lbm linux mcf microbench milc namd povray wrf xalancbmk
b5a9fef 1.809 0.451 2.047 1.190 2.940 2.496 2.248 0.932 1.373 1.411 3.181 2.669 2.403 2.948

master branch:

commit astar copy_and_run coremark gcc gromacs lbm linux mcf microbench milc namd povray wrf xalancbmk
7c26eb0 1.809 0.451 2.043 1.190 2.940 2.496 2.197 0.932 1.373 1.411 3.181 2.669 2.403 2.948
1436b76 1.811 0.451 2.047 1.190 2.940 2.496 2.197 0.932 1.373 1.411 3.181 2.669 2.403 2.948
84c44d2 1.809 0.451 2.047 1.190 2.940 2.496 2.197 0.932 1.373 1.411 3.181 2.669 2.403 2.948
9134676 1.809 0.451 2.047 1.190 2.940 2.496 2.197 0.932 1.373 1.411 3.181 2.669 2.403 2.948
7ffbf5f 1.809 0.452 2.052 1.196 2.951 2.499 2.199 0.930 1.377 1.407 3.436 2.653 2.398 2.941
d1da158 1.805 0.452 2.052 1.196 2.951 2.499 2.199 0.930 1.377 1.407 3.436 2.653 2.398 2.941
dd40a82 1.809 0.452 2.052 1.196 2.951 2.499 2.199 0.930 1.377 1.407 3.436 2.653 2.398 2.941
2a1dcaf 1.805 0.452 2.052 1.196 2.951 2.499 2.197 0.930 1.377 1.407 3.436 2.653 2.398 2.941
c08d352 1.809 0.452 2.052 1.196 2.951 2.499 2.197 0.930 1.377 1.407 3.436 2.653 2.398 2.941
87c5d21 1.805 0.452 2.052 1.196 2.951 2.499 2.199 0.930 1.377 1.407 3.436 2.653 2.398 2.941

@Yan-Muzi Yan-Muzi requested a review from ngc7331 July 9, 2024 14:21
@XiangShanRobot
Copy link

[Generated by IPC robot]
commit: 3f873c8

commit astar copy_and_run coremark gcc gromacs lbm linux mcf microbench milc namd povray wrf xalancbmk
3f873c8 1.784 0.458 2.003 1.199 2.920 2.498 2.248 0.928 1.374 1.441 3.153 2.600 2.385 2.956

master branch:

commit astar copy_and_run coremark gcc gromacs lbm linux mcf microbench milc namd povray wrf xalancbmk
c6655c9 1.784 0.458 2.003 1.199 2.920 2.498 2.207 0.928 1.374 1.441 3.153 2.600 2.385 2.956
340ef6e 1.784 0.458 2.003 1.199 2.920 2.498 2.207 0.928 1.374 1.441 3.153 2.600 2.385 2.956
571677c 1.784 0.458 2.003 1.199 2.920 2.498 2.207 0.928 1.374 1.441 3.153 2.600 2.385 2.956
6bb8be2 1.784 0.458 2.003 1.199 2.920 2.498 2.197 0.927 1.374 1.441 3.153 2.600 2.385 2.956
854ed34 1.784 0.458 2.003 1.199 2.920 2.498 2.198 0.928 1.374 1.441 3.153 2.600 2.385 2.956
27d7dfe 1.784 0.458 2.003 1.199 2.920 2.498 2.197 0.928 1.374 1.441 3.153 2.600 2.385 2.956
9194610 1.784 0.458 2.003 1.199 2.920 2.498 2.197 0.928 1.374 1.441 3.153 2.600 2.385 2.956
1e2f098 1.784 0.458 2.003 1.199 2.920 2.498 2.197 0.928 1.374 1.441 3.153 2.600 2.385 2.956
828a8a4 1.784 0.458 2.003 1.199 2.920 2.498 2.197 0.928 1.374 1.441 3.153 2.600 2.385 2.956
7cbc3b4 1.784 0.458 2.003 1.199 2.920 2.498 2.197 0.928 1.374 1.441 3.153 2.600 2.385 2.956

@ngc7331
Copy link
Member

ngc7331 commented Aug 12, 2024

Just resolved conflicts introduced by #3354, please check. @Yan-Muzi

Also found a possibly incorrect design: the backend exceptions are now sent directly to ICacheMainPipe, not to the IPrefetchPipe. Possibly prefetching addresses with backend exceptions?

@Yan-Muzi
Copy link
Collaborator

New modifications look good to me.

@Tang-Haojin Tang-Haojin changed the title exception: check high bits of target in brh and jmp fix(exception): check high bits of jump target Sep 6, 2024
@Tang-Haojin Tang-Haojin changed the title fix(exception): check high bits of jump target fix(exception): check high address bits of jump target Sep 6, 2024
@XiangShanRobot
Copy link

[Generated by IPC robot]
commit: 9bc7d32

commit copy_and_run coremark linux microbench povray
9bc7d32 0.459 2.020 2.397 1.387 2.711

master branch:

commit astar copy_and_run coremark gcc gromacs lbm linux mcf microbench milc namd povray wrf xalancbmk
e1e27da 1.854 0.459 2.020 1.194 2.822 2.490 2.397 0.920 1.387 1.447 3.353 2.711 2.420 3.193
e1d5ffc 0.459 2.020 2.397 1.387 2.711
f422188 1.866 0.459 2.020 1.196 2.827 2.491 2.397 0.917 1.387 1.444 3.353 2.711 2.420 3.197
7bd3dbd 0.459 2.024 2.397 1.386 2.696
5ce9470 0.459 2.031 2.397 1.386 2.711
3adbf90
bb946e2 0.459 2.031 2.397 1.386 2.711
20dd904 1.855 0.459 2.022 1.188 2.832 2.478 2.397 0.917 1.386 1.426 3.351 2.711 2.421 3.211
98451f8 1.855 0.459 2.022 1.188 2.832 2.478 2.397 0.917 1.386 1.426 3.351 2.711 2.421 3.211
d4078d6 1.855 0.459 2.024 1.188 2.832 2.478 2.396 0.917 1.386 1.426 3.351 2.708 2.421 3.211

Copy link
Contributor

@huxuan0307 huxuan0307 left a comment

Choose a reason for hiding this comment

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

LGTM

@XiangShanRobot
Copy link

[Generated by IPC robot]
commit: 0b37b5a

commit copy_and_run coremark linux microbench povray
0b37b5a 0.459 2.015 2.396 1.353 2.706

master branch:

commit astar copy_and_run coremark gcc gromacs lbm linux mcf microbench milc namd povray wrf xalancbmk
69652e6 0.459 2.015 1.194 2.400 0.918 1.353 3.362 2.706 3.210
60b1c08 1.194 0.918 1.454 3.362 3.210
253db1a
abc4432 1.194 0.918 1.454 3.362 3.210
c8581ad 1.848 0.459 2.015 1.194 2.822 2.490 2.396 0.918 1.353 1.454 3.362 2.706 2.422 3.210
7ab4517 1.848 1.194 2.822 2.490 0.918 1.454 3.362 2.422 3.210
fffcb38 0.459 2.020 2.397 1.387 2.711
f0a51eb 0.459 2.020 2.397 1.387 2.711
c5561be 1.854 0.459 2.020 1.194 2.822 2.490 2.397 0.920 1.387 1.447 3.353 2.711 2.420 3.193
f284fbf 0.459 2.020 2.397 1.387 2.711

@Tang-Haojin Tang-Haojin merged commit c1b28b6 into master Sep 9, 2024
8 checks passed
@Tang-Haojin Tang-Haojin deleted the high-address-check branch September 9, 2024 16:40
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.

8 participants