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

Fails to use JVM ballooning #1038

Open
nozohono opened this issue Apr 27, 2019 · 7 comments
Open

Fails to use JVM ballooning #1038

nozohono opened this issue Apr 27, 2019 · 7 comments

Comments

@nozohono
Copy link

nozohono commented Apr 27, 2019

I just want to use Jvm Balloon to run applications and osv will hang when partial copy completes.I find that osv hangs because it cannot access vma_list_rwlock.write() .I guess that this may be caused by mprotect——because mprotect is the last function that accsess vma_list_rwlock.write().

@nozohono nozohono changed the title Fails to use balloom Fails to use balloon Apr 27, 2019
@wkozaczuk
Copy link
Collaborator

This appears to be a duplicate of #398. @nyh can you confirm it?

@nyh
Copy link
Contributor

nyh commented May 1, 2019

@glommer ?

@glommer
Copy link
Contributor

glommer commented May 1, 2019

This seems like the same issue, yes. Unfortunately I don't have a lot of time to look into it these days

@nozohono
Copy link
Author

nozohono commented May 2, 2019

I think I have found the reason.In the vm_fault function there are locked by vma_list_mutex.for_read()

osv/core/mmu.cc

Line 1326 in 4e425d4

void vm_fault(uintptr_t addr, exception_frame* ef)

osv/core/mmu.cc

Line 1335 in 4e425d4

WITH_LOCK(vma_list_mutex.for_read()) {

and in the scope of vma_list_mutex.for_read() the function jvm_balloon_fault will be called
bool jvm_balloon_fault(balloon_ptr b, exception_frame *ef, mmu::jvm_balloon_vma *vma)

this time vma will be delete ,and the destructor will call map_anon(),which will access the vma_list_mutex.for_write().Apparently it cannot access this because the same thread hold read lock.

osv/core/mmu.cc

Line 1570 in 4e425d4

jvm_balloon_vma::~jvm_balloon_vma()

So I simply solve this problem by replacing the read lock with write lock and now I can use this function.I think there will be a nicer method

@wkozaczuk
Copy link
Collaborator

wkozaczuk commented May 7, 2019

@nozohono Honestly I am not too familiar with this code (yet:-)). Which version of JVM (8, ..., 12) have you tested it with (I am assuming it worked for you)?

Have you seen these two commits - e69fa2b and 4bd8720. I wonder if they may help you validate your solution and makes sure it does not break other thinks.

@wkozaczuk
Copy link
Collaborator

I also think this issue is a duplicate of #796.

@wkozaczuk wkozaczuk changed the title Fails to use balloon Fails to use JVM ballooning Jul 11, 2021
@wkozaczuk
Copy link
Collaborator

Linking #796 (comment) and #796 (comment) as useful information.

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

No branches or pull requests

4 participants