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

Vcpu::get_cpuid always returns an empty CpuidSet #847

Closed
gjcolombo opened this issue Feb 4, 2025 · 0 comments · Fixed by #848
Closed

Vcpu::get_cpuid always returns an empty CpuidSet #847

gjcolombo opened this issue Feb 4, 2025 · 0 comments · Fixed by #848
Labels
bug Something that isn't working.

Comments

@gjcolombo
Copy link
Contributor

Observed during ad hoc testing.

The problem is that get_cpuid uses Vec::with_capacity to create an entry array, but never sets its actual length:

let mut entries = Vec::with_capacity(count as usize);
entries.fill(bhyve_api::vcpu_cpuid_entry::default());
config.vvcc_entries = entries.as_mut_ptr() as *mut libc::c_void;
unsafe {
self.hdl
.ioctl(bhyve_api::VM_GET_CPUID, &mut config)
.map_err(GetCpuidError::ReadIoctlFailed)?;
}

This breaks live migration of CPUID settings because the empty CPUID set gets applied during the device state phase even if the target applied different CPUID settings when processing the source's instance spec.

This can be fixed trivially by calling set_len in this path. That said, this entire code path might be obsolete now: with #844 in place, the instance specs sent during live migration always have the correct CPUID settings, so exporting and importing them duplicates work. (See the discussion in #844 for more details.) Given this it might make even more sense just to remove CPUID settings from the vCPU device state payload entirely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that isn't working.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant