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

[PAL/vm-common] Get memory regions from VMM using "etc/e820" fw_cfg file #28

Open
wants to merge 1 commit into
base: intel_tdx
Choose a base branch
from

Conversation

dimakuv
Copy link
Contributor

@dimakuv dimakuv commented May 7, 2024

Description of the changes

Previously on the VM PAL, we hard-coded a single memory region that is RAM (i.e., not reserved) via FW_CFG_RAM_SIZE. This is a dangerous assumption which may break in the future. This commit uses a proper source of E820 info: the etc/e820 fw_cfg file.

As a side effect, find_fw_cfg_selector() function was slightly modified to also return the size of the object. All callers of this function now use this returned size.

Fixes #27.

How to test this PR?

Run on newer QEMU.


This change is Reviewable

Copy link
Contributor Author

@dimakuv dimakuv left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 5 files reviewed, 1 unresolved discussion

a discussion (no related file):
Blocking: must test and understand all reserved ranges on new QEMU/on different environments.


Previously on the VM PAL, we hard-coded a single memory region that is
RAM (i.e., not reserved) via `FW_CFG_RAM_SIZE`. This is a dangerous
assumption which may break in the future. This commit uses a proper
source of E820 info: the `etc/e820` fw_cfg file.

As a side effect, `find_fw_cfg_selector()` function was slightly
modified to also return the size of the object. All callers of this
function now use this returned size.

Signed-off-by: Dmitrii Kuvaiskii <dmitrii.kuvaiskii@intel.com>
@dimakuv dimakuv force-pushed the dimakuv/parse-etc-e820-fwcfg-file branch from a6cba2d to fb38207 Compare May 8, 2024 13:43
Copy link
Contributor Author

@dimakuv dimakuv left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 5 files reviewed, all discussions resolved

a discussion (no related file):

Previously, dimakuv (Dmitrii Kuvaiskii) wrote…

Blocking: must test and understand all reserved ranges on new QEMU/on different environments.

Update: the problem was not related to some new reserved memory ranges on newer QEMU (v8.0).

The root cause was that docker run ... by default sets 64MB of /dev/shm. As soon as I set this limit to the one used by Gramine VMs, it started working: e.g. docker run --shm-size 4G.


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.

[PAL/vm] Use etc/e820 fw_cfg file to learn reserved memory ranges
1 participant