Sean Christopherson <[email protected]> writes:

> On Fri, May 15, 2026, Ackerley Tng wrote:
>> Sean Christopherson <[email protected]> writes:
>>
>> >
>> > [...snip...]
>> >
>> >> +#ifdef CONFIG_USERFAULTFD
>> >> +static bool kvm_gmem_can_userfault(struct vm_area_struct *vma, 
>> >> vm_flags_t vm_flags)
>> >> +{
>> >> + struct inode *inode = file_inode(vma->vm_file);
>> >> +
>> >> + /*
>> >> +  * Only support userfaultfd for guest_memfd with INIT_SHARED flag.
>> >> +  * This ensures the memory can be mapped to userspace.
>> >> +  */
>>
>> Is the principle here that any memory that is allowed to be mapped to
>> userspace can be userfault-ed?
>
> Yes?  It's more the opposite though: memory that can't be SHARED and thus 
> can't
> be mapped into userspace can't possibly support userfaultfd.  Six of one, half
> dozen of the other, but I think it's important to highlight that there's no
> judgment call being made, i.e. we aren't deciding to support only SHARED just
> because we're lazy, it's a hard requirement.

I guess this series is only intended to support some kinds of UFFD, but
IIUC technically UFFDIO_CONTINUE can be used after the private memory is
inserted (e.g. for TDX live migration).

Reply via email to