[PATCH 2/4] x86/PoD: HVM guests can't pin their pages

Jan Beulich posted 4 patches 4 years, 2 months ago
There is a newer version of this series
[PATCH 2/4] x86/PoD: HVM guests can't pin their pages
Posted by Jan Beulich 4 years, 2 months ago
Pinning is a PV concept, used there only for page table pages.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
I'm actually inclined to hide _PGT_pinned in !HVM builds; the downside
of doing so is some new #ifdef-ary which would need adding.

--- a/xen/arch/x86/mm/p2m-pod.c
+++ b/xen/arch/x86/mm/p2m-pod.c
@@ -260,9 +260,6 @@ p2m_pod_set_cache_target(struct p2m_doma
                 goto out;
             }
 
-            if ( test_and_clear_bit(_PGT_pinned, &(page+i)->u.inuse.type_info) )
-                put_page_and_type(page + i);
-
             put_page_alloc_ref(page + i);
             put_page(page + i);
 


Re: [PATCH 2/4] x86/PoD: HVM guests can't pin their pages
Posted by Andrew Cooper 4 years, 2 months ago
On 01/12/2021 10:53, Jan Beulich wrote:
> Pinning is a PV concept, used there only for page table pages.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>

Perhaps this is a leftover from autotranslate mode?  That was doing some
very HVM-like things for PV guests.

> ---
> I'm actually inclined to hide _PGT_pinned in !HVM builds; the downside
> of doing so is some new #ifdef-ary which would need adding.

Judging by the current users, I doubt it is worth it, although folding
this delta wouldn't go amiss.

diff --git a/xen/include/asm-x86/mm.h b/xen/include/asm-x86/mm.h
index cb9052749963..e5f63daa1a71 100644
--- a/xen/include/asm-x86/mm.h
+++ b/xen/include/asm-x86/mm.h
@@ -36,7 +36,7 @@
  /* Page is locked? */
 #define _PGT_locked       PG_shift(4)
 #define PGT_locked        PG_mask(1, 4)
- /* Owning guest has pinned this page to its current type? */
+ /* Owning guest has pinned this page to its current type? PV only */
 #define _PGT_pinned       PG_shift(5)
 #define PGT_pinned        PG_mask(1, 5)
  /* Has this page been validated for use as its current type? */

~Andrew