On Mon, Aug 5, 2024 at 3:51 PM Oliver Upton <oliver.upton@xxxxxxxxx> wrote: > > The wording of the cap documentation isn't as relaxed as I'd > anticipated. Perhaps: > > The presence of this capability indicates that KVM_RUN *may* fill > kvm_run.memory_fault if ... > > IOW, userspace is not guaranteed that the structure is filled for every > 'memory fault'. Agreed, I can add a patch to update the docs While we're at it, what do we think of removing this disclaimer? >Note: Userspaces which attempt to resolve memory faults so that they can retry > KVM_RUN are encouraged to guard against repeatedly receiving the same > error/annotated fault. I originally added this bit due to my concerns with the idea of filling kvm_run.memory_fault even for EFAULTs that weren't guaranteed to be returned by KVM_RUN [1]. However if I'm interpreting Sean's response to [2] correctly, I think we're now committed to only KVM_EXIT_MEMORY_FAULTing for EFAULTs/EHWPOISONs which return from KVM_RUN. At the very least, that seems to be true of current usages. [1] https://lore.kernel.org/kvm/CAF7b7mrDt6sPQiTenSiqTOHORo1TSPhjSC-tt8fJtuq55B86kg@xxxxxxxxxxxxxx/ [2] https://lore.kernel.org/kvm/CAF7b7mqYr0J-J2oaU=c-dzLys-m6Ttp7ZOb3Em7n1wUj3rhh+A@xxxxxxxxxxxxxx/#t > > -:Architectures: x86 > > +:Architectures: x86, arm64 > > nitpick: alphabetize > > > :Returns: Informational only, -EINVAL on direct KVM_ENABLE_CAP. > > > > The presence of this capability indicates that KVM_RUN will fill > > diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c > > index a7ca776b51ec..4121b5a43b9c 100644 > > --- a/arch/arm64/kvm/arm.c > > +++ b/arch/arm64/kvm/arm.c > > @@ -335,6 +335,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext) > > case KVM_CAP_ARM_SYSTEM_SUSPEND: > > case KVM_CAP_IRQFD_RESAMPLE: > > case KVM_CAP_COUNTER_OFFSET: > > + case KVM_CAP_MEMORY_FAULT_INFO: > > r = 1; > > break; > > Please just squash this into the following patch. Introducing the > capability without the implied functionality doesn't make a lot of > sense. > > -- > Thanks, > Oliver