[v3 3/5] KVM: PPC: Book3S HV: migrate remaining normal-GFNs to secure-GFNs in H_SVM_INIT_DONE
Ram Pai
linuxram at us.ibm.com
Wed Jul 15 15:05:41 AEST 2020
On Mon, Jul 13, 2020 at 03:15:06PM +0530, Bharata B Rao wrote:
> On Sat, Jul 11, 2020 at 02:13:45AM -0700, Ram Pai wrote:
> > The Ultravisor is expected to explicitly call H_SVM_PAGE_IN for all the pages
> >
> > if (!(*mig.src & MIGRATE_PFN_MIGRATE)) {
> > - ret = -1;
> > + ret = -2;
>
> migrate_vma_setup() has marked that this pfn can't be migrated. What
> transient errors are you observing which will disappear within 10
> retries?
>
> Also till now when UV used to pull in all the pages, we never seemed to
> have hit these transient errors. But now when HV is pushing the same
> pages, we see these errors which are disappearing after 10 retries.
> Can you explain this more please? What sort of pages are these?
We did see them even before this patch. The retry alleviates the
problem, but does not entirely eliminate it. If the chance of seeing
the issue without the patch is 1%, the chance of seeing this issue
with this patch becomes 0.25%.
>
> > goto out_finalize;
> > }
> > + bool retry = 0;
...snip...
> > +
> > + *ret = 0;
> > + while (kvmppc_next_nontransitioned_gfn(memslot, kvm, &gfn)) {
> > +
> > + down_write(&kvm->mm->mmap_sem);
>
> Acquiring and releasing mmap_sem in a loop? Any reason?
>
> Now that you have moved ksm_madvise() calls to init time, any specific
> reason to take write mmap_sem here?
The semaphore protects the vma. right?
And its acquired/released in the loop, to provide the ability to relinquish
the cpu without getting into a tight loop and cause softlockups.
>
> > + start = gfn_to_hva(kvm, gfn);
> > + if (kvm_is_error_hva(start)) {
> > + *ret = H_STATE;
> > + goto next;
> > + }
> > +
> > + end = start + (1UL << PAGE_SHIFT);
> > + vma = find_vma_intersection(kvm->mm, start, end);
> > + if (!vma || vma->vm_start > start || vma->vm_end < end) {
> > + *ret = H_STATE;
> > + goto next;
> > + }
> > +
> > + mutex_lock(&kvm->arch.uvmem_lock);
> > + *ret = kvmppc_svm_migrate_page(vma, start, end,
> > + (gfn << PAGE_SHIFT), kvm, PAGE_SHIFT, false);
> > + mutex_unlock(&kvm->arch.uvmem_lock);
> > +
> > +next:
> > + up_write(&kvm->mm->mmap_sem);
> > +
> > + if (*ret == -2) {
> > + retry = 1;
>
> Using true or false assignment makes it easy to understand the intention
> of this 'retry' variable.
ok. next version will have that change.
Thanks for the comments,
RP
More information about the Linuxppc-dev
mailing list