-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Labels
Good first issueIndicates a good issue for first-time contributorsIndicates a good issue for first-time contributorsPriority: MediumIndicates than an issue or pull request should be resolved ahead of issues or pull requests labelledIndicates than an issue or pull request should be resolved ahead of issues or pull requests labelledStatus: WIPIndicates that an issue is currently being worked on or triagedIndicates that an issue is currently being worked on or triagedType: EnhancementIndicates new feature requestsIndicates new feature requestsrustPull requests that update Rust codePull requests that update Rust code
Description
Feature Request
PV Steal Time reporting on ARM is available in KVM since 5.10 at least but Firecracker doesn't enable it.
Describe the desired solution
We could enable the PVTIME device in Firecracker on ARM to allow for stolen time reporting.
Describe possible alternatives
- check if
rust-vmm
has some off-the-shelf implementation we could use
Additional context
I found that this is the KVM patch that introduced it: https://lwn.net/Articles/797954/
And this is how QEMU integrated with it: https://patchew.org/QEMU/[email protected]/[email protected]/
It needs to be enabled via ioctl to the vcpu fd, there's an example in the kernel self tests: https://github.com/amazonlinux/linux/blob/kernel-5.10.215-203.850.amzn2/tools/testing/selftests/kvm/steal_time.c#L172
static void steal_time_init(struct kvm_vm *vm)
{
struct kvm_device_attr dev = {
.group = KVM_ARM_VCPU_PVTIME_CTRL,
.attr = KVM_ARM_VCPU_PVTIME_IPA,
};
int i, ret;
ret = _vcpu_ioctl(vm, 0, KVM_HAS_DEVICE_ATTR, &dev);
if (ret != 0 && errno == ENXIO) {
print_skip("steal-time not supported");
exit(KSFT_SKIP);
}
for (i = 0; i < NR_VCPUS; ++i) {
uint64_t st_ipa;
vcpu_ioctl(vm, i, KVM_HAS_DEVICE_ATTR, &dev);
dev.addr = (uint64_t)&st_ipa;
/* ST_GPA_BASE is identity mapped */
st_gva[i] = (void *)(ST_GPA_BASE + i * STEAL_TIME_SIZE);
sync_global_to_guest(vm, st_gva[i]);
st_ipa = (ulong)st_gva[i] | 1;
ret = _vcpu_ioctl(vm, i, KVM_SET_DEVICE_ATTR, &dev);
TEST_ASSERT(ret == -1 && errno == EINVAL, "Bad IPA didn't report EINVAL");
st_ipa = (ulong)st_gva[i];
vcpu_ioctl(vm, i, KVM_SET_DEVICE_ATTR, &dev);
ret = _vcpu_ioctl(vm, i, KVM_SET_DEVICE_ATTR, &dev);
TEST_ASSERT(ret == -1 && errno == EEXIST, "Set IPA twice without EEXIST");
}
}
Checks
- Have you searched the Firecracker Issues database for similar requests?
- Have you read all the existing relevant Firecracker documentation?
- Have you read and understood Firecracker's core tenets?
Metadata
Metadata
Assignees
Labels
Good first issueIndicates a good issue for first-time contributorsIndicates a good issue for first-time contributorsPriority: MediumIndicates than an issue or pull request should be resolved ahead of issues or pull requests labelledIndicates than an issue or pull request should be resolved ahead of issues or pull requests labelledStatus: WIPIndicates that an issue is currently being worked on or triagedIndicates that an issue is currently being worked on or triagedType: EnhancementIndicates new feature requestsIndicates new feature requestsrustPull requests that update Rust codePull requests that update Rust code
Type
Projects
Status
Shipped