Skip to content

Commit afe20eb

Browse files
Claudio Imbrendafrankjaa
authored andcommitted
KVM: s390: pv: avoid export before import if possible
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 <[email protected]> Reviewed-by: Nico Boehr <[email protected]> Reviewed-by: Janosch Frank <[email protected]> Reviewed-by: Steffen Eiden <[email protected]> Link: https://lore.kernel.org/r/[email protected] Message-Id: <[email protected]> Signed-off-by: Janosch Frank <[email protected]>
1 parent 8c516b2 commit afe20eb

File tree

1 file changed

+7
-0
lines changed
  • arch/s390/kernel

1 file changed

+7
-0
lines changed

arch/s390/kernel/uv.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,13 @@ static int make_secure_pte(pte_t *ptep, unsigned long addr,
255255
*/
256256
static bool should_export_before_import(struct uv_cb_header *uvcb, struct mm_struct *mm)
257257
{
258+
/*
259+
* The misc feature indicates, among other things, that importing a
260+
* shared page from a different protected VM will automatically also
261+
* transfer its ownership.
262+
*/
263+
if (test_bit_inv(BIT_UV_FEAT_MISC, &uv_info.uv_feature_indications))
264+
return false;
258265
if (uvcb->cmd == UVC_CMD_UNPIN_PAGE_SHARED)
259266
return false;
260267
return atomic_read(&mm->context.protected_count) > 1;

0 commit comments

Comments
 (0)