-
Notifications
You must be signed in to change notification settings - Fork 152
feat(mapper): add MappedPageTable::display
#574
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
Conversation
b340a21 to
3f25b46
Compare
Freax13
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution!
I like the idea of adding a display impl for the page table types to print mapped ranges.
That said, I'm a bit wary of exposing too many implementation details as public APIs. I think there are probably good use-cases for MappedPageTableRangeInclusiveIter, but I'm not too sure about some of the trait impls for the new types.
|
I appreciate the separate commits and the short explanation for each of them! |
|
Thanks for the quick review! :) I'll split off the I remembered one more thing to discuss:
What's your opinion on this? Is this table the single most obvious way of formatting the whole page table as text, or should we stick with the display adapter? If the latter, is |
I think the whole concept of formatting a set of page tables is a bit unusual, so it's probably warranted to use a inherent |
|
Another idea would be to pretty print the table when alternate ( |
|
Alternate formatting also affects the derived |
3f25b46 to
091b45d
Compare
|
After you confirmed this is generally suitable for upstreaming, I have reworked the code to make it upstreamable. All comments from your last review should be addressed. You are welcome to mark any comments as resolved as you see fit. I split the code into different modules to make it easier to understand. I also added doc comments to all items and have any not-straightforward code. Furthermore, I reworked the formatting of the table and have updated the PR description accordingly. Thanks again for your reviews! They are very valuable. :) |
fb3610b to
142b61c
Compare
|
I rebased on |
Freax13
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking great, I have just a few minor comments.
142b61c to
db0b93a
Compare
Freax13
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
Are there any more changes you want to make to this PR, or can I merge this?
db0b93a to
d944b9e
Compare
I just added one more notice to the docs that might be useful. This should be good to go now. Thanks a lot! :) |
d944b9e to
a652bf3
Compare
|
Rebased to resolve the changelog conflict. |
|
Thanks! |
In Hermit, we found it useful to be able to print our page tables for debugging. We've had several iterations of such debugging functions but are now happy with the current compact range-based table formatting introduced in hermit-os/kernel#1818.
This PR upstreams this page table printing functionality. It can be used as follows:
This is how a formatted table looks like:
This is how a table formatted with the alternate (
#) flag looks like:While this PR is technically non-breaking and could target
master, it becomes much easier to use with #576.The first two commits prepare a directory structure for the
mapped_page_tablemodule. The third commit adds three new modules tomapped_page_table:iter,range_iter, anddisplay. The former two are private for now. They allow iterating over page mappings and contiguous ranges of page mappings, respectively. The third module adds the display adapter forMappedPageTable.Thanks as always for your great work! :)