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

UVM: basic implementation of amap #1072

Closed
wants to merge 8 commits into from

Conversation

pj1031999
Copy link
Collaborator

@pj1031999 pj1031999 commented Apr 3, 2021

It's a first step for new virtual memory subsystem [1] in Mimiker.

amap describes an area of anonymous memory. It 's a upper layer of UVM’s two-layer mapping scheme.

  • Add missing PAGE_SHIFT definition in vm_param for AArch64 & mips.
  • Add definition of uvm_amap.
  • Add interface for uvm_amap.
  • Add definition of uvm_aref.
  • Add simple test for uvm_amap.

It's based on NetBSD implementation [2] described by Cranor [3].

[1] #1073
[2] https://nxr.netbsd.org/xref/src/sys/uvm/uvm_amap.c
[3] https://chuck.cranor.org/p/diss.pdf

* Add missing PAGE_SHIFT definition in vm_param for AArch64 & mips.
* Add definition of uvm_amap.
* Add interface for uvm_amap.
* Add definition of uvm_aref.
* Add simple test for uvm_amap.

It's based on NetBSD implementation [1] described by Cranor [2].

[1] https://nxr.netbsd.org/xref/src/sys/uvm/uvm_amap.c
[2] https://chuck.cranor.org/p/diss.pdf
@pj1031999 pj1031999 added the proposal should we spend time on it? label Apr 3, 2021
Copy link
Collaborator

@franciscozdo franciscozdo left a comment

Choose a reason for hiding this comment

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

I would be happy to see assertions about held lock in functions that require it (at least in functions *_nolock). It could help in future.

sys/kern/uvm_amap.c Outdated Show resolved Hide resolved
@franciscozdo
Copy link
Collaborator

What do you think about moving tests into sys/tests/uvm.c. Then we will have all tests in one place.

@pj1031999
Copy link
Collaborator Author

What do you think about moving tests into sys/tests/uvm.c. Then we will have all tests in one place.

I'm not sure. From my point of view amap is a separate structure that can live without rest of UVM. But if you thing that one place for all tests is a better idea you can push that directly here. It's not a a big thing for me.

@pj1031999
Copy link
Collaborator Author

I would be happy to see assertions about held lock in functions that require it (at least in functions *_nolock). It could help in future.

Hm... I'm not sure if it's necessary. That functions are private for amap and called only from their locked brothers now.
I've checked that and we have 5 _nolock functions in our code and only one has that assertion.
I can add them but I don't see a reason for that now.

Comment on lines +31 to +32
int *am_slot; /* (@) slots of used anons - refers to am_bckptr */
int *am_bckptr; /* (@) stack of used anons - refers to am_anon & am_slots */
Copy link
Collaborator

Choose a reason for hiding this comment

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

According to UVM functionality of am_slot and am_backptr should be swapped.

@franciscozdo
Copy link
Collaborator

@cahirwpz I think that it can be closed hence I will implement UVM like subsystem in #1379 and later PRs.

@cahirwpz
Copy link
Owner

Closing the PR as requested in #1072 (comment)

@cahirwpz cahirwpz closed this May 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal should we spend time on it?
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants