Skip to content

Fix pmm deadlock #345

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

Merged
merged 2 commits into from
Jan 29, 2025
Merged

Conversation

sparchatus
Copy link
Contributor

An ugly first attempt to allow pmm frame array refill without deadlocking.

Intended to fix #343

@sparchatus sparchatus requested a review from a team as a code owner December 2, 2024 14:04
@sparchatus
Copy link
Contributor Author

Optimally, we would refill the 4K frames while still holding the paging lock. However, this would need a new interface in pmm to allow refill without taking the paging lock again.

@sparchatus
Copy link
Contributor Author

there is still the deadlock issue where paging wants to get a frame but pmm is waiting for paging to map a new array. It looks like some kind of backoff is required.

@sparchatus sparchatus marked this pull request as draft December 2, 2024 15:01
@sparchatus
Copy link
Contributor Author

based on #344

Also fixes a (potential?) bug where total_free_frames did not count the early array frames.

@sparchatus sparchatus marked this pull request as ready for review December 3, 2024 09:44
@sparchatus sparchatus changed the title WIP: Fix pmm deadlock Fix pmm deadlock Dec 3, 2024
@sparchatus sparchatus force-pushed the fix_pmm_deadlock branch 3 times, most recently from 6521e20 to d01825b Compare December 4, 2024 09:40
jcjgraf
jcjgraf previously approved these changes Dec 4, 2024
Copy link
Contributor

@jcjgraf jcjgraf left a comment

Choose a reason for hiding this comment

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

I am no longer able to reproduce the deadlock 👍

@wipawel wipawel self-requested a review December 4, 2024 09:51
@sparchatus sparchatus force-pushed the fix_pmm_deadlock branch 3 times, most recently from 3b6e6ca to dc3e94c Compare January 27, 2025 09:11
1. paging gets exclusive pmm access during array refill.
2. pmm can call back into paging while holding the paging lock.
3. paging performs pmm refill if needed to ensure reserved frames.

Signed-off-by: Sandro Rüegge <[email protected]>
@wipawel wipawel merged commit 5a1e856 into KernelTestFramework:mainline Jan 29, 2025
4 checks passed
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

Successfully merging this pull request may close these issues.

[BUG] PMM Deadlock
3 participants