lkml.org 
[lkml]   [2023]   [Nov]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    SubjectRe: [PATCH v13 09/35] KVM: Add KVM_EXIT_MEMORY_FAULT exit to report faults to userspace
    From
    On 11/2/2023 1:36 AM, Sean Christopherson wrote:
    >> KVM_CAP_MEMORY_FAULT_INFO is x86 only, is it better to put this function to
    >> <asm/kvm_host.h>?
    > I'd prefer to keep it in generic code, as it's highly likely to end up there
    > sooner than later. There's a known use case for ARM (exit to userspace on missing
    > userspace mapping[*]), and I'm guessing pKVM (also ARM) will also utilize this API.
    >
    > [*]https://lore.kernel.org/all/20230908222905.1321305-8-amoorthy@google.com

    I wonder how this CAP is supposed to be checked in userspace, for guest
    memfd case? something like this?

    if (!kvm_check_extension(s, KVM_CAP_MEMORY_FAULT_INFO) &&
    run->exit_reason == KVM_EXIT_MEMORY_FAULT)
    abort("unexpected KVM_EXIT_MEMORY_FAULT");

    In my implementation of QEMU patches, I find it's unnecessary. When
    userspace gets an exit with KVM_EXIT_MEMORY_FAULT, it implies
    "KVM_CAP_MEMORY_FAULT_INFO".

    So I don't see how it is necessary in this series. Whether it's
    necessary or not for [*], I don't have the answer but we can leave the
    discussion to that patch series.

    \
     
     \ /
      Last update: 2023-11-02 03:20    [W:2.578 / U:0.016 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site