Re: [RFC PATCH 2/8] KVM: Add KVM_MAP_MEMORY vcpu ioctl to pre-populate guest memory

Isaku Yamahata
2024-03-07T02:52:53Z

On Wed, Mar 06, 2024 at 04:49:19PM -0800,
David Matlack <dmatlack@google.com> wrote:

> > + cond_resched();
> > +
> > + r = kvm_arch_vcpu_map_memory(vcpu, mapping);
> > + if (r)
> > + break;
> > +
> > + added = true;
> > + }
> > +
> > + srcu_read_unlock(&vcpu->kvm->srcu, idx);
> > + vcpu_put(vcpu);
> > +
> > + if (added && mapping->nr_pages > 0)
> > + r = -EAGAIN;
>
> This can overwrite the return value from kvm_arch_vcpu_map_memory().

This is to convert ERESTART into EAGAIN. I'll drop this check
and document EINTR so that caller should be aware of partial population.
--
Isaku Yamahata <isaku.yamahata@linux.intel.com>