Mem: adding a multi-level page table class
Review Request #2312 - Created July 11, 2014 and submitted
| Information | |
|---|---|
| Alexandru Dutu | |
| gem5 | |
| default | |
| Reviewers | |
| Default | |
Changeset 10264:5cf3d07a2e8b --------------------------- Mem: adding a multi-level page table class This patch defines a multi-level page table class that stores the page table in system memory, consistent with ISA specifications. In this way, cpu models that use the actual hardware to execute (e.g. KvmCPU), are able to traverse the page table.
Regressions passed.
Issue Summary
10
4
5
1
| Description | From | Last Updated | Status |
|---|---|---|---|
| Please focus on what the class does instead of where it is intended to be used. I'd write the description ... | Andreas Sandberg | July 14, 2014, 10:36 a.m. | Open |
| This method is identical to map() with the exception of the parameter to setPTEFields. Please create a separate helper method ... | Andreas Sandberg | July 14, 2014, 10:36 a.m. | Open |
| Since you need to make the PageTable class a base class, could you also take the opportunity to redesign it ... | Andreas Sandberg | July 14, 2014, 10:36 a.m. | Open |
| Re-phrase this, I hardly get what this means even after reading the rest of the patch. What your patch is ... | Andreas Sandberg | July 14, 2014, 10:36 a.m. | Open |
Posted (July 14, 2014, 10:36 a.m.)
In general, I like the idea of having a proper, architected, page table in SE-mode. Long-term, this could hopefully mean that we can get rid of many of the differences between SE- and FS-mode. High-level comments: * Write a proper commit message (see http://www.m5sim.org/Commit_Access). Specifically, include a short one-line summary and a longer description of what the patch does and why. There is currently now way of telling what this patch intends to accomplish. * Don't set the execute bit on src/sim/SConscript. * Split into an architecture-agnostic patch and an x86-specific patch.
-
src/mem/multi_level_page_table.hh (Diff revision 1) -
Please focus on what the class does instead of where it is intended to be used. I'd write the description along these lines: "This class implements an in-memory page table that follows the x86 page table specification. This can used instead of the PageTable class in SE mode to allow CPU models (mainly the X86KvmCPU) to do a normal page table walk. @see Link to suitable documentation "
-
src/mem/multi_level_page_table_impl.hh (Diff revision 1) -
This method is identical to map() with the exception of the parameter to setPTEFields. Please create a separate helper method that is used by moth map() and mapNotPresent().
-
src/mem/page_table.hh (Diff revision 1) -
Since you need to make the PageTable class a base class, could you also take the opportunity to redesign it slightly to make it more obvious what's going on here? Specifically, I'd like to see a design with these classes: PageTableBase - Should declare the interface used by all page table implementations. Methods like map/remap/unmap/etc. should be purely virtual. This might be a good place to document what the arch-specific page tables are meant to do SEPageTable (or some other sensible name) - Inherits from PageTableBase and implements the page table functionality currently in PageTable. NoArchPageTable (& and arch-specific ones) - Inherit from PageTableBase.
-
src/sim/Process.py (Diff revision 1) -
Re-phrase this, I hardly get what this means even after reading the rest of the patch. What your patch is doing is really to maintain an in-memory version of the page table in the architecture-specific format. Make sure that's clear from the description. You could use something like this: "maintain an in-memory version of the page table in an architecture-specific format"
Review request changed
Updated (July 28, 2014, 3:29 p.m.)
Change Summary:
Created PageTableBase, FuncPageTable and MultiLevelPageTable. Given that PageTableBase has a lot of pure virtual methods I left the declaration and definition of PageTableBase and FuncPageTable in page_table.hh and page_table.cc respectively. In addition, I've added more comments.
Summary: |
|
||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description: |
|
||||||||||||||||||||||||||||||
Diff: |
Revision 2 (+567 -41) |
Posted (Aug. 14, 2014, 2:28 a.m.)
-
src/mem/multi_level_page_table.hh (Diff revision 2) -
It'd be great if you could write a short description of how the page table works. I know that this is sort of obvious from how page tables are usually implemented, but having it documented means that it is easier to reuse the code. Pseudo code would be nice... :)
-
src/mem/multi_level_page_table.hh (Diff revision 2) -
In general, I prefer having a abstract base classes for interfaces since that makes documentation and compile-time testing easier and the code becomes more self-documenting. I don't think the performance impact in this case would be noticeable. Could you either refactor the code so that the ISA code inherits from MultiLevelPageTable instead of using the template? (Or at the very least document the ISAOps interface.)
-
src/mem/multi_level_page_table.hh (Diff revision 2) -
Constant?
-
src/mem/multi_level_page_table.hh (Diff revision 2) -
Constant?
-
src/mem/multi_level_page_table_impl.hh (Diff revision 2) -
These should probably go into the initialization list.
-
src/mem/page_table.hh (Diff revision 2) -
Any particular reason why these aren't const any more? I kinda like having constants declared as such since that means the compiler brings out the stick when I screw up...
The issues above are really minor issues. The only major thing is that I'd like you to consider refactoring the code slightly to get rid of the template. Keep up the good work!
Review request changed
Updated (Aug. 25, 2014, 2:08 p.m.)
Change Summary:
Addressed the opened issues. It turns out refactoring with a base abstract class for the page table is even more complicated than I thought initially, so the class hierarchy is remains the same.
Description: |
|
||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 3 (+610 -37) |
Looks good. Thanks for addressing the issues I raised earlier! Please make sure that "Mem:" is all lower case when you commit so it complies with the commit guidelines.
