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

Fix PMM handling of 4K frames #335

Merged
merged 4 commits into from
Nov 24, 2023

Conversation

wipawel
Copy link
Contributor

@wipawel wipawel commented Nov 24, 2023

No description provided.

Using public API (get_free_frame() and get_free_page()) in the very
internal new_frames_array() is a bad idea.
The new frames array allocation can be triggered from within the
public API functions, while the PMM lock is already taken.
This obviously leads to a deadlock.

Signed-off-by: Pawel Wieczorkiewicz <[email protected]>
If there is not enough early frames (or for whatever reason the frame
physical address is big enough), it might be the case that such frame
mapping does not fit into the relatively small KERNEL_BASE area.
It is better to always map in the large enough KERNEL_MAP area.

The early frames arrays (before the final page tables are created)
have to be mapped into the KERNEL_BASE area as this is the only space
covered by boot time page tables (see EARLY_VIRT_MEM settings).

Signed-off-by: Pawel Wieczorkiewicz <[email protected]>
@wipawel wipawel added bugfix This fixes a bug Severity: high Very important bug - fix ASAP labels Nov 24, 2023
@wipawel wipawel requested a review from a team as a code owner November 24, 2023 15:56
mm/pmm.c Outdated Show resolved Hide resolved
mm/pmm.c Outdated Show resolved Hide resolved
If we run out of 4k frames it becomes impossible to perform a higher
order frames splitting, since new frames creation may need new frames
array, which is 4k as well.
To prevent these kind of situations, always keep at least two free 4k
frames available.
@wipawel wipawel merged commit e79b129 into KernelTestFramework:mainline Nov 24, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix This fixes a bug Severity: high Very important bug - fix ASAP
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants