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

Add refcount tracking for ACPICA's mappings and use VIRT_KERNEL_MAP area #241

Merged
merged 4 commits into from
Jan 22, 2022

Conversation

wipawel
Copy link
Contributor

@wipawel wipawel commented Jan 19, 2022

ACPICA maps and unmaps memory in chunks whose address (or size) might not
be PAGE_SIZE aligned. It might for example map memory at address 0x00 and
map another chunk at address 0x40. KTF performs memory (un)mapping using
PAGE_SIZE aligned memory frames. If ACPICA allocates memory at 0x00 and 0x40,
KTF maps the same physical frame to the same virtual address twice.
This does not hurt, but ACPICA can unmap the memory chunk at address 0x40
and assume the chunk at 0x00 is still mapped. KTF will simply unmap entire
frame.

As of now KTF does not need to track mapped frames refcounting based on
smaller granularity than PAGE_SIZE. If a 4K frame is mapped (even multiple
times) and then unmapped once, the frame should be unmapped as a result.

To make ACPICA work with this, add mapped_frames list tracking ACPICA
mapped frames with refcounting. If a frame is mapped several times, it gets
really unmapped only if the same number of times it has been unmapped by
ACPICA.

@wipawel wipawel added the bugfix This fixes a bug label Jan 19, 2022
@wipawel wipawel force-pushed the acpica_refcnt branch 2 times, most recently from e5958eb to cf0fc56 Compare January 20, 2022 09:24
@wipawel wipawel changed the title Add refcount tracking for ACPICA's mappings and use VIRT_KERNEL_HIGH area Add refcount tracking for ACPICA's mappings and use VIRT_KERNEL_MAP area Jan 20, 2022
dkgupta-amzn
dkgupta-amzn previously approved these changes Jan 20, 2022
ACPICA maps and unmaps memory in chunks whose address (or size) might not
be PAGE_SIZE aligned. It might for example map memory at address 0x00 and
map another chunk at address 0x40. KTF performs memory (un)mapping using
PAGE_SIZE aligned memory frames. If ACPICA allocates memory at 0x00 and 0x40,
KTF maps the same physical frame to the same virtual address twice.
This does not hurt, but ACPICA can unmap the memory chunk at address 0x40
and assume the chunk at 0x00 is still mapped. KTF will simply unmap entire
frame.

As of now KTF does not need to track mapped frames refcounting based on
smaller granularity than PAGE_SIZE. If a 4K frame is mapped (even multiple
times) and then unmapped once, the frame should be unmapped as a result.

To make ACPICA work with this, add mapped_frames list tracking ACPICA
mapped frames with refcounting. If a frame is mapped several times, it gets
really unmapped only if the same number of times it has been unmapped by
ACPICA.

Signed-off-by: Pawel Wieczorkiewicz <[email protected]>
@wipawel wipawel disabled auto-merge January 22, 2022 12:15
@wipawel wipawel merged commit 07ca758 into KernelTestFramework:mainline Jan 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix This fixes a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants