linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Ram Pai <linuxram@us.ibm.com>
To: Bharata B Rao <bharata@linux.ibm.com>
Cc: ldufour@linux.ibm.com, cclaudio@linux.ibm.com,
	kvm-ppc@vger.kernel.org, sathnaga@linux.vnet.ibm.com,
	aneesh.kumar@linux.ibm.com, sukadev@linux.vnet.ibm.com,
	linuxppc-dev@lists.ozlabs.org, bauerman@linux.ibm.com,
	david@gibson.dropbear.id.au
Subject: Re: [v4 4/5] KVM: PPC: Book3S HV: retry page migration before erroring-out
Date: Thu, 23 Jul 2020 04:44:01 -0700	[thread overview]
Message-ID: <20200723114401.GC5493@oc0525413822.ibm.com> (raw)
In-Reply-To: <20200723061344.GB1082478@in.ibm.com>

I am dropping this patch based on our conversation, where we agreed, we
need to rootcause the migration failure.

On Thu, Jul 23, 2020 at 11:43:44AM +0530, Bharata B Rao wrote:
> On Fri, Jul 17, 2020 at 01:00:26AM -0700, Ram Pai wrote:
> > @@ -812,7 +842,7 @@ unsigned long kvmppc_h_svm_page_in(struct kvm *kvm, unsigned long gpa,
> >  	struct vm_area_struct *vma;
> >  	int srcu_idx;
> >  	unsigned long gfn = gpa >> page_shift;
> > -	int ret;
> > +	int ret, repeat_count = REPEAT_COUNT;
> >  
> >  	if (!(kvm->arch.secure_guest & KVMPPC_SECURE_INIT_START))
> >  		return H_UNSUPPORTED;
> > @@ -826,34 +856,44 @@ unsigned long kvmppc_h_svm_page_in(struct kvm *kvm, unsigned long gpa,
> >  	if (flags & H_PAGE_IN_SHARED)
> >  		return kvmppc_share_page(kvm, gpa, page_shift);
> >  
> > -	ret = H_PARAMETER;
> >  	srcu_idx = srcu_read_lock(&kvm->srcu);
> > -	mmap_read_lock(kvm->mm);
> >  
> > -	start = gfn_to_hva(kvm, gfn);
> > -	if (kvm_is_error_hva(start))
> > -		goto out;
> > -
> > -	mutex_lock(&kvm->arch.uvmem_lock);
> >  	/* Fail the page-in request of an already paged-in page */
> > -	if (kvmppc_gfn_is_uvmem_pfn(gfn, kvm, NULL))
> > -		goto out_unlock;
> > +	mutex_lock(&kvm->arch.uvmem_lock);
> > +	ret = kvmppc_gfn_is_uvmem_pfn(gfn, kvm, NULL);
> > +	mutex_unlock(&kvm->arch.uvmem_lock);
> 
> Same comment as for the prev patch. I don't think you can release
> the lock here.
> 
> > +	if (ret) {
> > +		srcu_read_unlock(&kvm->srcu, srcu_idx);
> > +		return H_PARAMETER;
> > +	}
> >  
> > -	end = start + (1UL << page_shift);
> > -	vma = find_vma_intersection(kvm->mm, start, end);
> > -	if (!vma || vma->vm_start > start || vma->vm_end < end)
> > -		goto out_unlock;
> > +	do {
> > +		ret = H_PARAMETER;
> > +		mmap_read_lock(kvm->mm);
> >  
> > -	if (kvmppc_svm_migrate_page(vma, start, end, gpa, kvm, page_shift,
> > -				true))
> > -		goto out_unlock;
> > +		start = gfn_to_hva(kvm, gfn);
> > +		if (kvm_is_error_hva(start)) {
> > +			mmap_read_unlock(kvm->mm);
> > +			break;
> > +		}
> >  
> > -	ret = H_SUCCESS;
> > +		end = start + (1UL << page_shift);
> > +		vma = find_vma_intersection(kvm->mm, start, end);
> > +		if (!vma || vma->vm_start > start || vma->vm_end < end) {
> > +			mmap_read_unlock(kvm->mm);
> > +			break;
> > +		}
> > +
> > +		mutex_lock(&kvm->arch.uvmem_lock);
> > +		ret = kvmppc_svm_migrate_page(vma, start, end, gpa, kvm, page_shift, true);
> > +		mutex_unlock(&kvm->arch.uvmem_lock);
> > +
> > +		mmap_read_unlock(kvm->mm);
> > +	} while (ret == -2 && repeat_count--);
> > +
> > +	if (ret == -2)
> > +		ret = H_BUSY;
> >  
> > -out_unlock:
> > -	mutex_unlock(&kvm->arch.uvmem_lock);
> > -out:
> > -	mmap_read_unlock(kvm->mm);
> >  	srcu_read_unlock(&kvm->srcu, srcu_idx);
> >  	return ret;
> >  }
> > -- 
> > 1.8.3.1

-- 
Ram Pai

  reply	other threads:[~2020-07-23 11:46 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-17  8:00 [v4 0/5] Migrate non-migrated pages of a SVM Ram Pai
2020-07-17  8:00 ` [v4 1/5] KVM: PPC: Book3S HV: Disable page merging in H_SVM_INIT_START Ram Pai
2020-07-22  8:52   ` Bharata B Rao
2020-07-17  8:00 ` [v4 2/5] KVM: PPC: Book3S HV: track the state GFNs associated with secure VMs Ram Pai
2020-07-23  4:48   ` Bharata B Rao
2020-07-23 11:14     ` Ram Pai
2020-07-17  8:00 ` [v4 3/5] KVM: PPC: Book3S HV: in H_SVM_INIT_DONE, migrate remaining normal-GFNs to secure-GFNs Ram Pai
2020-07-23  6:10   ` Bharata B Rao
2020-07-23 11:39     ` Ram Pai
2020-07-17  8:00 ` [v4 4/5] KVM: PPC: Book3S HV: retry page migration before erroring-out Ram Pai
2020-07-23  6:13   ` Bharata B Rao
2020-07-23 11:44     ` Ram Pai [this message]
2020-07-17  8:00 ` [v4 5/5] KVM: PPC: Book3S HV: migrate hot plugged memory Ram Pai
2020-07-22 10:01   ` Bharata B Rao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200723114401.GC5493@oc0525413822.ibm.com \
    --to=linuxram@us.ibm.com \
    --cc=aneesh.kumar@linux.ibm.com \
    --cc=bauerman@linux.ibm.com \
    --cc=bharata@linux.ibm.com \
    --cc=cclaudio@linux.ibm.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=ldufour@linux.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=sathnaga@linux.vnet.ibm.com \
    --cc=sukadev@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).