lkml.org 
[lkml]   [2021]   [Feb]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 10/14] KVM: x86: Further clarify the logic and comments for toggling log dirty
Date
On 18/02/21 17:15, Sean Christopherson wrote:
> On Thu, Feb 18, 2021, Paolo Bonzini wrote:
>> On 13/02/21 01:50, Sean Christopherson wrote:
>>>
>>> - * Nothing to do for RO slots or CREATE/MOVE/DELETE of a slot.
>>> - * See comments below.
>>> + * Nothing to do for RO slots (which can't be dirtied and can't be made
>>> + * writable) or CREATE/MOVE/DELETE of a slot. See comments below.
>>> */
>>> if ((change != KVM_MR_FLAGS_ONLY) || (new->flags & KVM_MEM_READONLY))
>>> return;
>>> + /*
>>> + * READONLY and non-flags changes were filtered out above, and the only
>>> + * other flag is LOG_DIRTY_PAGES, i.e. something is wrong if dirty
>>> + * logging isn't being toggled on or off.
>>> + */
>>> + if (WARN_ON_ONCE(!((old->flags ^ new->flags) & KVM_MEM_LOG_DIRTY_PAGES)))
>>> + return;
>>> +
>>
>> What about readonly -> readwrite changes?
>
> Not allowed without first deleting the memslot. See commit 75d61fbcf563 ("KVM:
> set_memory_region: Disallow changing read-only attribute later"). RW->RO is
> also not supported.
>
> if (!old.npages) {
> change = KVM_MR_CREATE;
> new.dirty_bitmap = NULL;
> memset(&new.arch, 0, sizeof(new.arch));
> } else { /* Modify an existing slot. */
> if ((new.userspace_addr != old.userspace_addr) ||
> (new.npages != old.npages) ||
> ((new.flags ^ old.flags) & KVM_MEM_READONLY))
> return -EINVAL;
>

Right you are, thanks. Then the warning would catch this quick. I
queued 10 and 11 too, and will reply on 12 now that I looked at it more
closely.

Paolo

\
 
 \ /
  Last update: 2021-02-18 19:54    [W:0.309 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site