OpenXiangShan / XiangShan

Open-source high-performance RISC-V processor
Other
4.45k stars 618 forks source link

HPTW, RVH: fix the bug that non-leaf and level >= 2 pte doesn't raise pagefault. #3078

Closed pxk27 closed 1 week ago

pxk27 commented 2 weeks ago

HPTW can translate three levels page. This bug is about non-leaf pte that pte level >= 2. When HPTW gets a level 2 pte and the pte is valid but RWX are zero, it does't raise pagefault. That's wrong.

good-circle commented 2 weeks ago

Why level >= 2 rather than level == 2, for future sv48 extension, or ...?

pxk27 commented 2 weeks ago

Why level >= 2 rather than level == 2, for future sv48 extension, or ...?

No,it is not for sv48. 'level >=2' is same as 'level ==2' in this case. I just chose the first.

XiangShanRobot commented 2 weeks ago
[Generated by IPC robot] commit: 790aae4502e5df31b7816c5326eaf2e2317d8cbf commit astar copy_and_run coremark gcc gromacs lbm linux mcf microbench milc namd povray wrf xalancbmk
790aae4 1.808 0.447 2.043 1.187 2.938 2.508 2.197 0.921 1.369 1.441 3.454 2.658 2.399 2.932
master branch: commit astar copy_and_run coremark gcc gromacs lbm linux mcf microbench milc namd povray wrf xalancbmk
26c1abd 1.803 0.448 2.039 1.187 2.936 2.508 2.197 0.930 1.378 1.441 3.428 2.669 2.399 2.932
fd3aa05 1.803 0.448 2.040 1.187 2.936 2.508 2.197 0.930 1.378 1.441 3.428 2.669 2.399 2.932
1b0de92 1.808 0.447 2.043 1.187 2.938 2.508 2.197 0.921 1.369 1.441 3.454 2.658 2.399 2.932
d8a998b 1.808 0.447 2.043 1.187 2.938 2.508 2.197 0.921 1.369 1.441 3.454 2.658 2.399 2.932
ee8d1f1 1.808 0.447 2.043 1.187 2.938 2.508 2.197 0.921 1.369 1.441 3.454 2.658 2.399 2.932
fcec058 1.808 0.447 2.043 1.187 2.938 2.508 2.197 0.921 1.369 1.441 3.454 2.658 2.399 2.932
0fbf39a 1.808 0.447 2.043 1.187 2.938 2.508 2.197 0.921 1.369 1.441 3.454 2.658 2.399 2.932
Lemover commented 2 weeks ago

Why level >= 2 rather than level == 2, for future sv48 extension, or ...?

No,it is not for sv48. 'level >=2' is same as 'level ==2' in this case. I just chose the first.

when we support sv48, is it forward compatible for sv48? Which one will be better?

Lemover commented 2 weeks ago

Maybe, we need Parameterize the level(0/1/2) for future sv48 or others sv-type one day.

pxk27 commented 1 week ago

Maybe, we need Parameterize the level(0/1/2) for future sv48 or others sv-type one day.

if we parameterize the level for sv48/sv39, I advise level to decrease from a parameter, such as 2 for sv39 and 3 for sv48. HPTW and PTW need to change a little big. Now we increase level from zero. I suggest to change the page level to decrease when we realize sv48. @good-circle