Re: [RFC 06/16] KVM: Use GUP instead of copy_from/to_user() to access guest memory

Paolo Bonzini
2020-06-01T16:35:31Z

On 25/05/20 17:17, Kirill A. Shutemov wrote:
>> Personally, I would've just added 'struct kvm' pointer to 'struct
>> kvm_memory_slot' to be able to extract 'mem_protected' info when
>> needed. This will make the patch much smaller.
> Okay, can do.
>
> Other thing I tried is to have per-slot flag to indicate that it's
> protected. But Sean pointed that it's all-or-nothing feature and having
> the flag in the slot would be misleading.
>

Perhaps it would be misleading, but it's an optimization. Saving a
pointer dereference can be worth it, also because there are some places
where we just pass around a memslot and we don't have the struct kvm*.

Also, it's an all-or-nothing feature _now_. It doesn't have to remain
that way.

Paolo