Skip to content

Conversation

@arcnmx
Copy link

@arcnmx arcnmx commented Oct 22, 2025

Heuristics using the largest allocation chunk are often insufficient - for example if the VM has a large memory-mapped VFIO device attached.

Heuristics using the largest allocation chunk are often insufficient
Copy link
Member

@h33p h33p left a comment

Choose a reason for hiding this comment

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

I really like the conceptual idea. I think it would be better to not add host_start into mapping, but instead, rename remap_start to remap_base, and use it as an absolute value. Then, there's no difference between using QMP or not, you just know that remap_base is address within the QEMU process virtual address space. But aside from this, I'm quite excited to get this merged in.

)?;

info!("qemu memory map found {:?}", qemu_map);
if let Some(qemu_map) = &biggest_map {
Copy link
Member

Choose a reason for hiding this comment

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

Why are we changing this?

Ok((gpa, hva)) if gpa == mapping.range_start =>
mapping.host_start = Some(hva),
_ => {
log::warn!("failed to parse host address from {line:?}");
Copy link
Member

Choose a reason for hiding this comment

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

Does this ever happen? If it does happen rarely, it might be better to throw an error, instead of silently ignoring and falling back to the largest map offset.

Copy link
Member

@ko1N ko1N left a comment

Choose a reason for hiding this comment

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

Thanks for the changes! Would be great if you could have a look at the suggestions and then we can merge it in 👍 🔥

cmdline: &str,
qemu_map: &CTup2<Address, umem>,
) -> Result<MemoryMap<(Address, umem)>> {
let qemu_map = || match qemu_map {
Copy link
Member

Choose a reason for hiding this comment

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

Why does this have to be a function that we resolve later in the different code paths? Can't we just error out immediately?

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.

3 participants