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

From: Isaku Yamahata
Date: Wed Mar 06 2024 - 21:53:08 EST


On Wed, Mar 06, 2024 at 04:49:19PM -0800,
David Matlack <dmatlack@xxxxxxxxxx> 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@xxxxxxxxxxxxxxx>