public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Claudio Imbrenda <imbrenda@linux.ibm.com>
To: kvm@vger.kernel.org
Cc: borntraeger@de.ibm.com, frankja@linux.ibm.com, thuth@redhat.com,
	david@redhat.com, linux-s390@vger.kernel.org,
	linux-kernel@vger.kernel.org, scgl@linux.ibm.com,
	seiden@linux.ibm.com, nrb@linux.ibm.com
Subject: [PATCH v14 4/6] KVM: s390: pv: avoid export before import if possible
Date: Fri, 30 Sep 2022 16:01:48 +0200	[thread overview]
Message-ID: <20220930140150.37463-5-imbrenda@linux.ibm.com> (raw)
In-Reply-To: <20220930140150.37463-1-imbrenda@linux.ibm.com>

If the appropriate UV feature bit is set, there is no need to perform
an export before import.

The misc feature indicates, among other things, that importing a shared
page from a different protected VM will automatically also transfer its
ownership.

Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Reviewed-by: Nico Boehr <nrb@linux.ibm.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
---
 arch/s390/kernel/uv.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/s390/kernel/uv.c b/arch/s390/kernel/uv.c
index f9810d2a267c..9f18a4af9c13 100644
--- a/arch/s390/kernel/uv.c
+++ b/arch/s390/kernel/uv.c
@@ -255,6 +255,13 @@ static int make_secure_pte(pte_t *ptep, unsigned long addr,
  */
 static bool should_export_before_import(struct uv_cb_header *uvcb, struct mm_struct *mm)
 {
+	/*
+	 * The misc feature indicates, among other things, that importing a
+	 * shared page from a different protected VM will automatically also
+	 * transfer its ownership.
+	 */
+	if (test_bit_inv(BIT_UV_FEAT_MISC, &uv_info.uv_feature_indications))
+		return false;
 	if (uvcb->cmd == UVC_CMD_UNPIN_PAGE_SHARED)
 		return false;
 	return atomic_read(&mm->context.protected_count) > 1;
-- 
2.37.3


  parent reply	other threads:[~2022-09-30 14:02 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-30 14:01 [PATCH v14 0/6] KVM: s390: pv: implement lazy destroy for reboot Claudio Imbrenda
2022-09-30 14:01 ` [PATCH v14 1/6] KVM: s390: pv: asynchronous " Claudio Imbrenda
2022-10-04 13:43   ` Steffen Eiden
2022-10-04 16:56     ` Claudio Imbrenda
2022-10-10 11:38   ` Janosch Frank
2022-09-30 14:01 ` [PATCH v14 2/6] KVM: s390: pv: api documentation for asynchronous destroy Claudio Imbrenda
2022-10-04 13:43   ` Steffen Eiden
2022-10-10 11:41   ` Janosch Frank
2022-09-30 14:01 ` [PATCH v14 3/6] KVM: s390: pv: add KVM_CAP_S390_PROTECTED_ASYNC_DISABLE Claudio Imbrenda
2022-10-04 13:44   ` Steffen Eiden
2022-10-10 11:45   ` Janosch Frank
2022-10-10 12:15     ` Claudio Imbrenda
2022-10-10 13:10       ` Janosch Frank
2022-09-30 14:01 ` Claudio Imbrenda [this message]
2022-10-04 13:47   ` [PATCH v14 4/6] KVM: s390: pv: avoid export before import if possible Steffen Eiden
2022-09-30 14:01 ` [PATCH v14 5/6] KVM: s390: pv: support for Destroy fast UVC Claudio Imbrenda
2022-10-04 13:48   ` Steffen Eiden
2022-09-30 14:01 ` [PATCH v14 6/6] KVM: s390: pv: module parameter to fence asynchronous destroy Claudio Imbrenda
2022-10-04 13:48   ` Steffen Eiden

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=20220930140150.37463-5-imbrenda@linux.ibm.com \
    --to=imbrenda@linux.ibm.com \
    --cc=borntraeger@de.ibm.com \
    --cc=david@redhat.com \
    --cc=frankja@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=nrb@linux.ibm.com \
    --cc=scgl@linux.ibm.com \
    --cc=seiden@linux.ibm.com \
    --cc=thuth@redhat.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