Skip to contentSkip to conversation

x86/mem_sharing: reorder when pages are unlocked and released

PATCH Superseded Tamas K Lengyel 5 participants 18 messages May 16, 2019 – Jun 17, 2019

v5 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v5 1/4 x86/mem_sharing: reorder when pages are unlocked and released

Calling _put_page_type while also holding the page_lock for that page can cause a deadlock.

The comment being dropped is incorrect since it's now out-of-date.

Cc Jan Beulich <[email protected]>
Cc Andrew Cooper <[email protected]>
Cc George Dunlap <[email protected]>
Cc Wei Liu <[email protected]>
Cc Roger Pau Monne <[email protected]>

---
This series is based on Andrew Cooper's x86-next branch

v5: BUG_ON early before releasing references

---
 xen/arch/x86/mm/mem_sharing.c | 41 ++++++++++-------------------------
 1 file changed, 11 insertions(+), 30 deletions(-)
xen/arch/x86/mm/mem_sharing.c +11 -30
index f16a3f5324..13b2f009d4 100644
@@ -648,10 +648,6 @@ static int page_make_private(struct domain *d, struct page_info *page)
         return -EBUSY;
     }
 
-    /* We can only change the type if count is one */
-    /* Because we are locking pages individually, we need to drop
-     * the lock here, while the page is typed. We cannot risk the 
-     * race of page_unlock and then put_page_type. */
     expected_type = (PGT_shared_page | PGT_validated | PGT_locked | 2);
     if ( page->u.inuse.type_info != expected_type )
     {
@@ -660,12 +656,11 @@ static int page_make_private(struct domain *d, struct page_info *page)
         return -EEXIST;
     }
 
+    mem_sharing_page_unlock(page);
+
     /* Drop the final typecount */
     put_page_and_type(page);
 
-    /* Now that we've dropped the type, we can unlock */
-    mem_sharing_page_unlock(page);
-
     /* Change the owner */
     ASSERT(page_get_owner(page) == dom_cow);
     page_set_owner(page, d);
@@ -900,6 +895,7 @@ static int share_pages(struct domain *sd, gfn_t sgfn, shr_handle_t sh,
     p2m_type_t smfn_type, cmfn_type;
     struct two_gfns tg;
     struct rmap_iterator ri;
+    unsigned long put_count = 0;
 
     get_two_gfns(sd, sgfn, &smfn_type, NULL, &smfn,
                  cd, cgfn, &cmfn_type, NULL, &cmfn, 0, &tg);
@@ -964,15 +960,6 @@ static int share_pages(struct domain *sd, gfn_t sgfn, shr_handle_t sh,
         goto err_out;
     }
 
-    /* Acquire an extra reference, for the freeing below to be safe. */
-    if ( !get_page(cpage, dom_cow) )
-    {
-        ret = -EOVERFLOW;
-        mem_sharing_page_unlock(secondpg);
-        mem_sharing_page_unlock(firstpg);
-        goto err_out;
-    }
-
     /* Merge the lists together */
     rmap_seed_iterator(cpage, &ri);
     while ( (gfn = rmap_iterate(cpage, &ri)) != NULL)
@@ -984,13 +971,14 @@ static int share_pages(struct domain *sd, gfn_t sgfn, shr_handle_t sh,
          * Don't change the type of rmap for the client page. */
         rmap_del(gfn, cpage, 0);
         rmap_add(gfn, spage);
-        put_page_and_type(cpage);
+        put_count++;
         d = get_domain_by_id(gfn->domain);
         BUG_ON(!d);
         BUG_ON(set_shared_p2m_entry(d, gfn->gfn, smfn));
         put_domain(d);
     }
     ASSERT(list_empty(&cpage->sharing->gfns));
+    BUG_ON(!put_count);
 
     /* Clear the rest of the shared state */
     page_sharing_dispose(cpage);
@@ -1002,7 +990,9 @@ static int share_pages(struct domain *sd, gfn_t sgfn, shr_handle_t sh,
     /* Free the client page */
     if(test_and_clear_bit(_PGC_allocated, &cpage->count_info))
         put_page(cpage);
-    put_page(cpage);
+
+    while ( put_count-- )
+        put_page_and_type(cpage);
 
     /* We managed to free a domain page. */
     atomic_dec(&nr_shared_mfns);
@@ -1167,20 +1157,11 @@ int __mem_sharing_unshare_page(struct domain *d,
     {
         if ( !last_gfn )
             mem_sharing_gfn_destroy(page, d, gfn_info);
-        put_page_and_type(page);
         mem_sharing_page_unlock(page);
-        if ( last_gfn )
-        {
-            if ( !get_page(page, dom_cow) )
-            {
-                put_gfn(d, gfn);
-                domain_crash(d);
-                return -EOVERFLOW;
-            }
-            if ( test_and_clear_bit(_PGC_allocated, &page->count_info) )
-                put_page(page);
+        if ( last_gfn &&
+            test_and_clear_bit(_PGC_allocated, &page->count_info) )
             put_page(page);
-        }
+        put_page_and_type(page);
         put_gfn(d, gfn);
 
         return 0;
Signature · 7 lines
2.20.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#1 lore raw

PATCH v5 2/4 x86/mem_sharing: copy a page_lock version to be internal to memshr

Patch cf4b30dca0a "Add debug code to detect illegal page_lock and put_page_type ordering" added extra sanity checking to page_lock/page_unlock for debug builds with the assumption that no hypervisor path ever locks two pages at once.

This assumption doesn't hold during memory sharing so we copy a version of page_lock/unlock to be used exclusively in the memory sharing subsystem without the sanity checks.

Cc George Dunlap <[email protected]>
Cc Jan Beulich <[email protected]>
Cc Andrew Cooper <[email protected]>
Cc Wei Liu <[email protected]>
Cc Roger Pau Monne <[email protected]>

---
v5: comments and TODOs

---
 xen/arch/x86/mm/mem_sharing.c | 54 ++++++++++++++++++++++++++++++++---
 xen/include/asm-x86/mm.h      | 15 ++--------
 2 files changed, 53 insertions(+), 16 deletions(-)
xen/arch/x86/mm/mem_sharing.c +50 -4
index 13b2f009d4..f2354d2d6f 100644
@@ -112,13 +112,59 @@ static inline void page_sharing_dispose(struct page_info *page)
 
 #endif /* MEM_SHARING_AUDIT */
 
-static inline int mem_sharing_page_lock(struct page_info *pg)
+/*
+ * Private implementations of page_lock/unlock to bypass PV-only
+ * sanity checks not applicable to mem-sharing.
+ *
+ * _page_lock is used in memory sharing to protect addition (share) and removal
+ * (unshare) of (gfn,domain) tupples to a list of gfn's that the shared page is
+ * currently backing.
+ * Nesting may happen when sharing (and locking) two pages.
+ * Deadlock is avoided by locking pages in increasing order.
+ * All memory sharing code paths take the p2m lock of the affected gfn before
+ * taking the lock for the underlying page. We enforce ordering between page_lock
+ * and p2m_lock using an mm-locks.h construct.
+ *
+ * TODO: Investigate if PGT_validated is necessary.
+ */
+static inline bool _page_lock(struct page_info *page)
 {
-    int rc;
+    unsigned long x, nx;
+
+    do {
+        while ( (x = page->u.inuse.type_info) & PGT_locked )
+            cpu_relax();
+        nx = x + (1 | PGT_locked);
+        if ( !(x & PGT_validated) ||
+             !(x & PGT_count_mask) ||
+             !(nx & PGT_count_mask) )
+            return false;
+    } while ( cmpxchg(&page->u.inuse.type_info, x, nx) != x );
+
+    return true;
+}
+
+static inline void _page_unlock(struct page_info *page)
+{
+    unsigned long x, nx, y = page->u.inuse.type_info;
+
+    do {
+        x = y;
+        ASSERT((x & PGT_count_mask) && (x & PGT_locked));
+
+        nx = x - (1 | PGT_locked);
+        /* We must not drop the last reference here. */
+        ASSERT(nx & PGT_count_mask);
+    } while ( (y = cmpxchg(&page->u.inuse.type_info, x, nx)) != x );
+}
+
+static inline bool mem_sharing_page_lock(struct page_info *pg)
+{
+    bool rc;
     pg_lock_data_t *pld = &(this_cpu(__pld));
 
     page_sharing_mm_pre_lock();
-    rc = page_lock(pg);
+    rc = _page_lock(pg);
     if ( rc )
     {
         preempt_disable();
@@ -135,7 +181,7 @@ static inline void mem_sharing_page_unlock(struct page_info *pg)
     page_sharing_mm_unlock(pld->mm_unlock_level, 
                            &pld->recurse_count);
     preempt_enable();
-    page_unlock(pg);
+    _page_unlock(pg);
 }
 
 static inline shr_handle_t get_next_handle(void)
xen/include/asm-x86/mm.h +3 -12
index 6faa563167..24c4205ba7 100644
@@ -356,24 +356,15 @@ struct platform_bad_page {
 const struct platform_bad_page *get_platform_badpages(unsigned int *array_size);
 
 /* Per page locks:
- * page_lock() is used for two purposes: pte serialization, and memory sharing.
+ * page_lock() is used for pte serialization.
  *
  * All users of page lock for pte serialization live in mm.c, use it
  * to lock a page table page during pte updates, do not take other locks within
  * the critical section delimited by page_lock/unlock, and perform no
  * nesting.
  *
- * All users of page lock for memory sharing live in mm/mem_sharing.c. Page_lock
- * is used in memory sharing to protect addition (share) and removal (unshare)
- * of (gfn,domain) tupples to a list of gfn's that the shared page is currently
- * backing. Nesting may happen when sharing (and locking) two pages -- deadlock
- * is avoided by locking pages in increasing order.
- * All memory sharing code paths take the p2m lock of the affected gfn before
- * taking the lock for the underlying page. We enforce ordering between page_lock
- * and p2m_lock using an mm-locks.h construct.
- *
- * These two users (pte serialization and memory sharing) do not collide, since
- * sharing is only supported for hvm guests, which do not perform pv pte updates.
+ * The use of PGT_locked in mem_sharing does not collide, since mem_sharing is
+ * only supported for hvm guests, which do not perform pv pte updates.
  */
 int page_lock(struct page_info *page);
 void page_unlock(struct page_info *page);
Signature · 7 lines
2.20.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Acked-by on v5 2/4
#2 lore raw

Re: [PATCH v5 2/4] x86/mem_sharing: copy a page_lock version to be internal to memshr

Quoted 18 lines
Quoted 1 line
Quoted 1 line · On 16.05.19 at 23:37, <[email protected]> wrote:
xen/include/asm-x86/mm.h +1 -4
@@ -356,24 +356,15 @@ struct platform_bad_page {
 const struct platform_bad_page *get_platform_badpages(unsigned int *array_size);
 
 /* Per page locks:
- * page_lock() is used for two purposes: pte serialization, and memory sharing.
+ * page_lock() is used for pte serialization.
  *
  * All users of page lock for pte serialization live in mm.c, use it
  * to lock a page table page during pte updates, do not take other locks within
  * the critical section delimited by page_lock/unlock, and perform no
  * nesting.
  *
- * All users of page lock for memory sharing live in mm/mem_sharing.c. Page_lock
- * is used in memory sharing to protect addition (share) and removal (unshare)
- * of (gfn,domain) tupples to a list of gfn's that the shared page is currently

xen/include/asm-x86/mm.h struct platform_bad_page { · line 367

Quoted 10 lines
xen/include/asm-x86/mm.h +2 -8
- * backing. Nesting may happen when sharing (and locking) two pages -- deadlock
- * is avoided by locking pages in increasing order.
- * All memory sharing code paths take the p2m lock of the affected gfn before
- * taking the lock for the underlying page. We enforce ordering between page_lock
- * and p2m_lock using an mm-locks.h construct.
- *
- * These two users (pte serialization and memory sharing) do not collide, since
- * sharing is only supported for hvm guests, which do not perform pv pte updates.
+ * The use of PGT_locked in mem_sharing does not collide, since mem_sharing is
+ * only supported for hvm guests, which do not perform pv pte updates.

Hmm, I thought we had agreed on you also correcting the wording of the sentence you now retain (as requested). As said before, a HVM (PVH to be precise) Dom0 can very well perform PV PTE updates, just not on itself. I had suggested the wording "which do not have PV PTEs updated" - I'd be fine for this to be folded in while committing, to avoid another round trip. With this

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#3 lore raw

Re: [PATCH v5 2/4] x86/mem_sharing: copy a page_lock version to be internal to memshr

Quoted 28 lines · Jan Beulich
Quoted 28 lines
Quoted 2 lines
Quoted 2 lines · On 16.05.19 at 23:37, <[email protected]> wrote:
xen/include/asm-x86/mm.h +2 -12
@@ -356,24 +356,15 @@ struct platform_bad_page {
 const struct platform_bad_page *get_platform_badpages(unsigned int *array_size);
 
 /* Per page locks:
- * page_lock() is used for two purposes: pte serialization, and memory sharing.
+ * page_lock() is used for pte serialization.
  *
  * All users of page lock for pte serialization live in mm.c, use it
  * to lock a page table page during pte updates, do not take other locks within
  * the critical section delimited by page_lock/unlock, and perform no
  * nesting.
  *
- * All users of page lock for memory sharing live in mm/mem_sharing.c. Page_lock
- * is used in memory sharing to protect addition (share) and removal (unshare)
- * of (gfn,domain) tupples to a list of gfn's that the shared page is currently
- * backing. Nesting may happen when sharing (and locking) two pages -- deadlock
- * is avoided by locking pages in increasing order.
- * All memory sharing code paths take the p2m lock of the affected gfn before
- * taking the lock for the underlying page. We enforce ordering between page_lock
- * and p2m_lock using an mm-locks.h construct.
- *
- * These two users (pte serialization and memory sharing) do not collide, since
- * sharing is only supported for hvm guests, which do not perform pv pte updates.
+ * The use of PGT_locked in mem_sharing does not collide, since mem_sharing is
Quoted 8 lines

xen/include/asm-x86/mm.h struct platform_bad_page { · line 367

Quoted 1 line
xen/include/asm-x86/mm.h +1 -0
+ * only supported for hvm guests, which do not perform pv pte updates.

Hmm, I thought we had agreed on you also correcting the wording of the sentence you now retain (as requested). As said before, a HVM (PVH to be precise) Dom0 can very well perform PV PTE updates, just not on itself. I had suggested the wording "which do not have PV PTEs updated" - I'd be fine for this to be folded in while committing, to avoid another round trip. With this

Thanks, I do seem to have missed that.

Tamas

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

author Acked-by Jan Beulich on v5 2/4
#4 lore raw

Re: [Xen-devel] [PATCH v5 2/4] x86/mem_sharing: copy a page_lock version to be internal to memshr

In reply to Tamas K Lengyel
Quoted 10 lines · Tamas K Lengyel

Patch cf4b30dca0a "Add debug code to detect illegal page_lock and put_page_type ordering" added extra sanity checking to page_lock/page_unlock for debug builds with the assumption that no hypervisor path ever locks two pages at once.

This assumption doesn't hold during memory sharing so we copy a version of page_lock/unlock to be used exclusively in the memory sharing subsystem without the sanity checks.

Patch ping. Current tally:

Thanks,
Tamas

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#5 lore raw

PATCH v5 3/4 x86/mem_sharing: enable mem_share audit mode only in debug builds

In reply to Tamas K Lengyel

Improves performance for release builds.

Cc Jan Beulich <[email protected]>
Cc Andrew Cooper <[email protected]>
Cc Wei Liu <[email protected]>
Cc Roger Pau Monne <[email protected]>
---
 xen/include/asm-x86/mem_sharing.h | 4 ++++
 1 file changed, 4 insertions(+)
xen/include/asm-x86/mem_sharing.h +4 -0
index 9f9f7e93e3..afd0c17292 100644
@@ -25,7 +25,11 @@
 #include <public/memory.h>
 
 /* Auditing of memory sharing code? */
+#ifndef NDEBUG
 #define MEM_SHARING_AUDIT 1
+#else
+#define MEM_SHARING_AUDIT 0
+#endif
 
 typedef uint64_t shr_handle_t; 
 
Signature · 7 lines
2.20.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#6 lore raw

Re: [Xen-devel] [PATCH v5 3/4] x86/mem_sharing: enable mem_share audit mode only in debug builds

Quoted 4 lines · Tamas K Lengyel

Improves performance for release builds.

Patch ping. Unclear whose Ack is strictly needed as this is only touching mem_sharing code and nothing else.

Thanks,
Tamas

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#7 lore raw

PATCH v5 4/4 x86/mem_sharing: compile mem_sharing subsystem only when kconfig is enabled

In reply to Tamas K Lengyel

Disable it by default as it is only an experimental subsystem.

Cc Jan Beulich <[email protected]>
Cc Andrew Cooper <[email protected]>
Cc Wei Liu <[email protected]>
Cc Roger Pau Monne <[email protected]>
Cc George Dunlap <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Julien Grall <[email protected]>
Cc Konrad Rzeszutek Wilk <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Tim Deegan <[email protected]>
Cc George Dunlap <[email protected]>

----
v4: add ASSERT_UNREACHABLE to inlined functions where applicable & other fixups

---
 xen/arch/x86/Kconfig              |  6 +++++-
 xen/arch/x86/domain.c             |  2 ++
 xen/arch/x86/domctl.c             |  2 ++
 xen/arch/x86/mm/Makefile          |  2 +-
 xen/arch/x86/x86_64/compat/mm.c   |  2 ++
 xen/arch/x86/x86_64/mm.c          |  2 ++
 xen/common/Kconfig                |  3 ---
 xen/common/domain.c               |  2 +-
 xen/common/grant_table.c          |  2 +-
 xen/common/memory.c               |  2 +-
 xen/common/vm_event.c             |  6 +++---
 xen/include/asm-x86/mem_sharing.h | 28 ++++++++++++++++++++++++++++
 xen/include/asm-x86/mm.h          |  3 +++
 xen/include/xen/sched.h           |  2 +-
 xen/include/xsm/dummy.h           |  2 +-
 xen/include/xsm/xsm.h             |  4 ++--
 xen/xsm/dummy.c                   |  2 +-
 xen/xsm/flask/hooks.c             |  4 ++--
 18 files changed, 58 insertions(+), 18 deletions(-)
xen/arch/x86/Kconfig +5 -1
index 4b8b07b549..600ca5c12e 100644
@@ -17,7 +17,6 @@ config X86
 	select HAS_KEXEC
 	select MEM_ACCESS_ALWAYS_ON
 	select HAS_MEM_PAGING
-	select HAS_MEM_SHARING
 	select HAS_NS16550
 	select HAS_PASSTHROUGH
 	select HAS_PCI
@@ -198,6 +197,11 @@ config PV_SHIM_EXCLUSIVE
 	  firmware, and will not function correctly in other scenarios.
 
 	  If unsure, say N.
+
+config MEM_SHARING
+	bool "Xen memory sharing support" if EXPERT = "y"
+	depends on HVM
+
 endmenu
 
 source "common/Kconfig"
xen/arch/x86/domain.c +2 -0
index d2d9f2fc3c..474df8433b 100644
@@ -2046,6 +2046,7 @@ int domain_relinquish_resources(struct domain *d)
             d->arch.auto_unmask = 0;
         }
 
+#ifdef CONFIG_MEM_SHARING
     PROGRESS(shared):
 
         if ( is_hvm_domain(d) )
@@ -2056,6 +2057,7 @@ int domain_relinquish_resources(struct domain *d)
             if ( ret )
                 return ret;
         }
+#endif
 
         spin_lock(&d->page_alloc_lock);
         page_list_splice(&d->arch.relmem_list, &d->page_list);
xen/arch/x86/domctl.c +2 -0
index 9bf2d0820f..bc9e024ccc 100644
@@ -1231,9 +1231,11 @@ long arch_do_domctl(
         break;
     }
 
+#ifdef CONFIG_MEM_SHARING
     case XEN_DOMCTL_mem_sharing_op:
         ret = mem_sharing_domctl(d, &domctl->u.mem_sharing_op);
         break;
+#endif
 
 #if P2M_AUDIT && defined(CONFIG_HVM)
     case XEN_DOMCTL_audit_p2m:
xen/arch/x86/mm/Makefile +1 -1
index 5a17646f98..5010a29d6c 100644
@@ -6,7 +6,7 @@ obj-$(CONFIG_HVM) += guest_walk_2.o guest_walk_3.o guest_walk_4.o
 obj-$(CONFIG_SHADOW_PAGING) += guest_walk_2.o guest_walk_3.o guest_walk_4.o
 obj-$(CONFIG_MEM_ACCESS) += mem_access.o
 obj-y += mem_paging.o
-obj-y += mem_sharing.o
+obj-$(CONFIG_MEM_SHARING) += mem_sharing.o
 obj-y += p2m.o p2m-pt.o
 obj-$(CONFIG_HVM) += p2m-ept.o p2m-pod.o
 obj-y += paging.o
xen/arch/x86/x86_64/compat/mm.c +2 -0
index 32410ed273..d4c6be3032 100644
@@ -152,8 +152,10 @@ int compat_arch_memory_op(unsigned long cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
     case XENMEM_paging_op:
         return mem_paging_memop(guest_handle_cast(arg, xen_mem_paging_op_t));
 
+#ifdef CONFIG_MEM_SHARING
     case XENMEM_sharing_op:
         return mem_sharing_memop(guest_handle_cast(arg, xen_mem_sharing_op_t));
+#endif
 
     default:
         rc = -ENOSYS;
xen/arch/x86/x86_64/mm.c +2 -0
index d8f558bc3a..51d1d511f2 100644
@@ -993,8 +993,10 @@ long subarch_memory_op(unsigned long cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
     case XENMEM_paging_op:
         return mem_paging_memop(guest_handle_cast(arg, xen_mem_paging_op_t));
 
+#ifdef CONFIG_MEM_SHARING
     case XENMEM_sharing_op:
         return mem_sharing_memop(guest_handle_cast(arg, xen_mem_sharing_op_t));
+#endif
 
     default:
         rc = -ENOSYS;
xen/common/Kconfig +0 -3
index 7a12346f19..6e28fc48af 100644
@@ -45,9 +45,6 @@ config MEM_ACCESS
 config HAS_MEM_PAGING
 	bool
 
-config HAS_MEM_SHARING
-	bool
-
 config HAS_PDX
 	bool
 
xen/common/domain.c +1 -1
index 90c66079f9..0815cf8f07 100644
@@ -923,7 +923,7 @@ static void complete_domain_destroy(struct rcu_head *head)
     xfree(d->vm_event_paging);
 #endif
     xfree(d->vm_event_monitor);
-#ifdef CONFIG_HAS_MEM_SHARING
+#ifdef CONFIG_MEM_SHARING
     xfree(d->vm_event_share);
 #endif
 
xen/common/grant_table.c +1 -1
index 80728ea57d..6c40dccae9 100644
@@ -3760,7 +3760,7 @@ void grant_table_init_vcpu(struct vcpu *v)
     v->maptrack_tail = MAPTRACK_TAIL;
 }
 
-#ifdef CONFIG_HAS_MEM_SHARING
+#ifdef CONFIG_MEM_SHARING
 int mem_sharing_gref_to_gfn(struct grant_table *gt, grant_ref_t ref,
                             gfn_t *gfn, uint16_t *status)
 {
xen/common/memory.c +1 -1
index 520d6f4803..69851f4344 100644
@@ -1671,7 +1671,7 @@ int check_get_page_from_gfn(struct domain *d, gfn_t gfn, bool readonly,
         return -EAGAIN;
     }
 #endif
-#ifdef CONFIG_HAS_MEM_SHARING
+#ifdef CONFIG_MEM_SHARING
     if ( (q & P2M_UNSHARE) && p2m_is_shared(p2mt) )
     {
         if ( page )
xen/common/vm_event.c +3 -3
index 6e68be47bc..163a671cea 100644
@@ -544,7 +544,7 @@ static void monitor_notification(struct vcpu *v, unsigned int port)
     vm_event_resume(v->domain, v->domain->vm_event_monitor);
 }
 
-#ifdef CONFIG_HAS_MEM_SHARING
+#ifdef CONFIG_MEM_SHARING
 /* Registered with Xen-bound event channel for incoming notifications. */
 static void mem_sharing_notification(struct vcpu *v, unsigned int port)
 {
@@ -574,7 +574,7 @@ void vm_event_cleanup(struct domain *d)
         destroy_waitqueue_head(&d->vm_event_monitor->wq);
         (void)vm_event_disable(d, &d->vm_event_monitor);
     }
-#ifdef CONFIG_HAS_MEM_SHARING
+#ifdef CONFIG_MEM_SHARING
     if ( vm_event_check_ring(d->vm_event_share) )
     {
         destroy_waitqueue_head(&d->vm_event_share->wq);
@@ -720,7 +720,7 @@ int vm_event_domctl(struct domain *d, struct xen_domctl_vm_event_op *vec,
     }
     break;
 
-#ifdef CONFIG_HAS_MEM_SHARING
+#ifdef CONFIG_MEM_SHARING
     case XEN_DOMCTL_VM_EVENT_OP_SHARING:
     {
         rc = -EINVAL;
xen/include/asm-x86/mem_sharing.h +28 -0
index afd0c17292..db22468744 100644
@@ -24,6 +24,8 @@
 #include <public/domctl.h>
 #include <public/memory.h>
 
+#ifdef CONFIG_MEM_SHARING
+
 /* Auditing of memory sharing code? */
 #ifndef NDEBUG
 #define MEM_SHARING_AUDIT 1
@@ -99,4 +101,30 @@ int mem_sharing_domctl(struct domain *d,
  */
 int relinquish_shared_pages(struct domain *d);
 
+#else
+
+static inline unsigned int mem_sharing_get_nr_saved_mfns(void)
+{
+    return 0;
+}
+static inline unsigned int mem_sharing_get_nr_shared_mfns(void)
+{
+    return 0;
+}
+static inline int mem_sharing_unshare_page(struct domain *d,
+                                           unsigned long gfn,
+                                           uint16_t flags)
+{
+    ASSERT_UNREACHABLE();
+    return -EOPNOTSUPP;
+}
+static inline int mem_sharing_notify_enomem(struct domain *d, unsigned long gfn,
+                              bool allow_sleep)
+{
+    ASSERT_UNREACHABLE();
+    return -EOPNOTSUPP;
+}
+
+#endif
+
 #endif /* __MEM_SHARING_H__ */
xen/include/asm-x86/mm.h +3 -0
index 24c4205ba7..d8ab53d688 100644
@@ -127,6 +127,8 @@ struct page_info
         /* For non-pinnable single-page shadows, a higher entry that points
          * at us. */
         paddr_t up;
+
+#ifdef CONFIG_MEM_SHARING
         /* For shared/sharable pages, we use a doubly-linked list
          * of all the {pfn,domain} pairs that map this page. We also include
          * an opaque handle, which is effectively a version, so that clients
@@ -134,6 +136,7 @@ struct page_info
          * This list is allocated and freed when a page is shared/unshared.
          */
         struct page_sharing_info *sharing;
+#endif
     };
 
     /* Reference count and various PGC_xxx flags and fields. */
xen/include/xen/sched.h +1 -1
index 2201faca6b..410c74489f 100644
@@ -459,7 +459,7 @@ struct domain
     /* Various vm_events */
 
     /* Memory sharing support */
-#ifdef CONFIG_HAS_MEM_SHARING
+#ifdef CONFIG_MEM_SHARING
     struct vm_event_domain *vm_event_share;
 #endif
     /* Memory paging support */
xen/include/xsm/dummy.h +1 -1
index 01d2814fed..ef52bb1764 100644
@@ -597,7 +597,7 @@ static XSM_INLINE int xsm_mem_paging(XSM_DEFAULT_ARG struct domain *d)
 }
 #endif
 
-#ifdef CONFIG_HAS_MEM_SHARING
+#ifdef CONFIG_MEM_SHARING
 static XSM_INLINE int xsm_mem_sharing(XSM_DEFAULT_ARG struct domain *d)
 {
     XSM_ASSERT_ACTION(XSM_DM_PRIV);
xen/include/xsm/xsm.h +2 -2
index 9a90355056..d61ba77374 100644
@@ -150,7 +150,7 @@ struct xsm_operations {
     int (*mem_paging) (struct domain *d);
 #endif
 
-#ifdef CONFIG_HAS_MEM_SHARING
+#ifdef CONFIG_MEM_SHARING
     int (*mem_sharing) (struct domain *d);
 #endif
 
@@ -597,7 +597,7 @@ static inline int xsm_mem_paging (xsm_default_t def, struct domain *d)
 }
 #endif
 
-#ifdef CONFIG_HAS_MEM_SHARING
+#ifdef CONFIG_MEM_SHARING
 static inline int xsm_mem_sharing (xsm_default_t def, struct domain *d)
 {
     return xsm_ops->mem_sharing(d);
xen/xsm/dummy.c +1 -1
index c9a566f2b5..5705e52791 100644
@@ -128,7 +128,7 @@ void __init xsm_fixup_ops (struct xsm_operations *ops)
     set_to_dummy_if_null(ops, mem_paging);
 #endif
 
-#ifdef CONFIG_HAS_MEM_SHARING
+#ifdef CONFIG_MEM_SHARING
     set_to_dummy_if_null(ops, mem_sharing);
 #endif
 
xen/xsm/flask/hooks.c +2 -2
index a7d690ac3c..791c1f66af 100644
@@ -1262,7 +1262,7 @@ static int flask_mem_paging(struct domain *d)
 }
 #endif
 
-#ifdef CONFIG_HAS_MEM_SHARING
+#ifdef CONFIG_MEM_SHARING
 static int flask_mem_sharing(struct domain *d)
 {
     return current_has_perm(d, SECCLASS_DOMAIN2, DOMAIN2__MEM_SHARING);
@@ -1829,7 +1829,7 @@ static struct xsm_operations flask_ops = {
     .mem_paging = flask_mem_paging,
 #endif
 
-#ifdef CONFIG_HAS_MEM_SHARING
+#ifdef CONFIG_MEM_SHARING
     .mem_sharing = flask_mem_sharing,
 #endif
 
Signature · 7 lines
2.20.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Acked-by on v5 4/4
#8 lore raw

Re: [PATCH v5 4/4] x86/mem_sharing: compile mem_sharing subsystem only when kconfig is enabled

Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 16.05.19 at 23:37, <[email protected]> wrote:

Disable it by default as it is only an experimental subsystem.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#9 lore raw

Re: [PATCH v5 4/4] x86/mem_sharing: compile mem_sharing subsystem only when kconfig is enabled

In reply to Tamas K Lengyel
Quoted 30 lines
Quoted 1 line
Quoted 1 line · On 16.05.19 at 23:37, <[email protected]> wrote:

Disable it by default as it is only an experimental subsystem.

Cc Jan Beulich <[email protected]>
Cc Andrew Cooper <[email protected]>
Cc Wei Liu <[email protected]>
Cc Roger Pau Monne <[email protected]>
Cc George Dunlap <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Julien Grall <[email protected]>
Cc Konrad Rzeszutek Wilk <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Tim Deegan <[email protected]>
Cc George Dunlap <[email protected]>

----
v4: add ASSERT_UNREACHABLE to inlined functions where applicable & other fixups

---
 xen/arch/x86/Kconfig              |  6 +++++-
 xen/arch/x86/domain.c             |  2 ++
 xen/arch/x86/domctl.c             |  2 ++
 xen/arch/x86/mm/Makefile          |  2 +-
 xen/arch/x86/x86_64/compat/mm.c   |  2 ++
 xen/arch/x86/x86_64/mm.c          |  2 ++
 xen/common/Kconfig                |  3 ---
 xen/common/domain.c               |  2 +-
 xen/common/grant_table.c          |  2 +-
 xen/common/memory.c               |  2 +-
 xen/common/vm_event.c             |  6 +++---
Quoted 8 lines
 xen/include/asm-x86/mem_sharing.h | 28 ++++++++++++++++++++++++++++
 xen/include/asm-x86/mm.h          |  3 +++
 xen/include/xen/sched.h           |  2 +-
 xen/include/xsm/dummy.h           |  2 +-
 xen/include/xsm/xsm.h             |  4 ++--
 xen/xsm/dummy.c                   |  2 +-
 xen/xsm/flask/hooks.c             |  4 ++--
 18 files changed, 58 insertions(+), 18 deletions(-)

Daniel, it looks like you weren't Cc-ed here, but your ack is needed.

Jan

Quoted 354 lines
xen/arch/x86/Kconfig +5 -1
index 4b8b07b549..600ca5c12e 100644
@@ -17,7 +17,6 @@ config X86
 	select HAS_KEXEC
 	select MEM_ACCESS_ALWAYS_ON
 	select HAS_MEM_PAGING
-	select HAS_MEM_SHARING
 	select HAS_NS16550
 	select HAS_PASSTHROUGH
 	select HAS_PCI
@@ -198,6 +197,11 @@ config PV_SHIM_EXCLUSIVE
 	  firmware, and will not function correctly in other scenarios.
 
 	  If unsure, say N.
+
+config MEM_SHARING
+	bool "Xen memory sharing support" if EXPERT = "y"
+	depends on HVM
+
 endmenu
 
 source "common/Kconfig"
xen/arch/x86/domain.c +2 -0
index d2d9f2fc3c..474df8433b 100644
@@ -2046,6 +2046,7 @@ int domain_relinquish_resources(struct domain *d)
             d->arch.auto_unmask = 0;
         }
 
+#ifdef CONFIG_MEM_SHARING
     PROGRESS(shared):
 
         if ( is_hvm_domain(d) )
@@ -2056,6 +2057,7 @@ int domain_relinquish_resources(struct domain *d)
             if ( ret )
                 return ret;
         }
+#endif
 
         spin_lock(&d->page_alloc_lock);
         page_list_splice(&d->arch.relmem_list, &d->page_list);
xen/arch/x86/domctl.c +2 -0
index 9bf2d0820f..bc9e024ccc 100644
@@ -1231,9 +1231,11 @@ long arch_do_domctl(
         break;
     }
 
+#ifdef CONFIG_MEM_SHARING
     case XEN_DOMCTL_mem_sharing_op:
         ret = mem_sharing_domctl(d, &domctl->u.mem_sharing_op);
         break;
+#endif
 
 #if P2M_AUDIT && defined(CONFIG_HVM)
     case XEN_DOMCTL_audit_p2m:
xen/arch/x86/mm/Makefile +0 -0
index 5a17646f98..5010a29d6c 100644
@@ -6,7 +6,7 @@ obj-$(CONFIG_HVM) += guest_walk_2.o guest_walk_3.o 

guest_walk_4.o
obj-$(CONFIG_SHADOW_PAGING) += guest_walk_2.o guest_walk_3.o guest_walk_4.o obj-$(CONFIG_MEM_ACCESS) += mem_access.o
obj-y += mem_paging.o

xen/arch/x86/mm/Makefile +1 -1
-obj-y += mem_sharing.o
+obj-$(CONFIG_MEM_SHARING) += mem_sharing.o
 obj-y += p2m.o p2m-pt.o
 obj-$(CONFIG_HVM) += p2m-ept.o p2m-pod.o
 obj-y += paging.o
xen/arch/x86/x86_64/compat/mm.c +2 -0
index 32410ed273..d4c6be3032 100644
@@ -152,8 +152,10 @@ int compat_arch_memory_op(unsigned long cmd, 
 XEN_GUEST_HANDLE_PARAM(void) arg)
     case XENMEM_paging_op:
         return mem_paging_memop(guest_handle_cast(arg, 
 xen_mem_paging_op_t));
 
+#ifdef CONFIG_MEM_SHARING
     case XENMEM_sharing_op:
         return mem_sharing_memop(guest_handle_cast(arg, 
 xen_mem_sharing_op_t));
+#endif
 
     default:
         rc = -ENOSYS;
xen/arch/x86/x86_64/mm.c +2 -0
index d8f558bc3a..51d1d511f2 100644
@@ -993,8 +993,10 @@ long subarch_memory_op(unsigned long cmd, 
 XEN_GUEST_HANDLE_PARAM(void) arg)
     case XENMEM_paging_op:
         return mem_paging_memop(guest_handle_cast(arg, 
 xen_mem_paging_op_t));
 
+#ifdef CONFIG_MEM_SHARING
     case XENMEM_sharing_op:
         return mem_sharing_memop(guest_handle_cast(arg, 
 xen_mem_sharing_op_t));
+#endif
 
     default:
         rc = -ENOSYS;
xen/common/Kconfig +0 -3
index 7a12346f19..6e28fc48af 100644
@@ -45,9 +45,6 @@ config MEM_ACCESS
 config HAS_MEM_PAGING
 	bool
 
-config HAS_MEM_SHARING
-	bool
-
 config HAS_PDX
 	bool
 
xen/common/domain.c +1 -1
index 90c66079f9..0815cf8f07 100644
@@ -923,7 +923,7 @@ static void complete_domain_destroy(struct rcu_head 
 *head)
     xfree(d->vm_event_paging);
 #endif
     xfree(d->vm_event_monitor);
-#ifdef CONFIG_HAS_MEM_SHARING
+#ifdef CONFIG_MEM_SHARING
     xfree(d->vm_event_share);
 #endif
xen/common/grant_table.c +1 -1
index 80728ea57d..6c40dccae9 100644
@@ -3760,7 +3760,7 @@ void grant_table_init_vcpu(struct vcpu *v)
     v->maptrack_tail = MAPTRACK_TAIL;
 }
 
-#ifdef CONFIG_HAS_MEM_SHARING
+#ifdef CONFIG_MEM_SHARING
 int mem_sharing_gref_to_gfn(struct grant_table *gt, grant_ref_t ref,
                             gfn_t *gfn, uint16_t *status)
 {
xen/common/memory.c +1 -1
index 520d6f4803..69851f4344 100644
@@ -1671,7 +1671,7 @@ int check_get_page_from_gfn(struct domain *d, gfn_t 
 gfn, bool readonly,
         return -EAGAIN;
     }
 #endif
-#ifdef CONFIG_HAS_MEM_SHARING
+#ifdef CONFIG_MEM_SHARING
     if ( (q & P2M_UNSHARE) && p2m_is_shared(p2mt) )
     {

if ( page )

xen/common/vm_event.c +1 -1
index 6e68be47bc..163a671cea 100644
@@ -544,7 +544,7 @@ static void monitor_notification(struct vcpu *v, unsigned 
 int port)
     vm_event_resume(v->domain, v->domain->vm_event_monitor);
 }
 
-#ifdef CONFIG_HAS_MEM_SHARING
+#ifdef CONFIG_MEM_SHARING
 /* Registered with Xen-bound event channel for incoming notifications. */
 static void mem_sharing_notification(struct vcpu *v, unsigned int port)

{

xen/common/vm_event.c +2 -2
@@ -574,7 +574,7 @@ void vm_event_cleanup(struct domain *d)
         destroy_waitqueue_head(&d->vm_event_monitor->wq);
         (void)vm_event_disable(d, &d->vm_event_monitor);
     }
-#ifdef CONFIG_HAS_MEM_SHARING
+#ifdef CONFIG_MEM_SHARING
     if ( vm_event_check_ring(d->vm_event_share) )
     {
         destroy_waitqueue_head(&d->vm_event_share->wq);
@@ -720,7 +720,7 @@ int vm_event_domctl(struct domain *d, struct 
 xen_domctl_vm_event_op *vec,
     }
     break;
 
-#ifdef CONFIG_HAS_MEM_SHARING
+#ifdef CONFIG_MEM_SHARING
     case XEN_DOMCTL_VM_EVENT_OP_SHARING:
     {
         rc = -EINVAL;
xen/include/asm-x86/mem_sharing.h +28 -0
index afd0c17292..db22468744 100644
@@ -24,6 +24,8 @@
 #include <public/domctl.h>
 #include <public/memory.h>
 
+#ifdef CONFIG_MEM_SHARING
+
 /* Auditing of memory sharing code? */
 #ifndef NDEBUG
 #define MEM_SHARING_AUDIT 1
@@ -99,4 +101,30 @@ int mem_sharing_domctl(struct domain *d,
  */
 int relinquish_shared_pages(struct domain *d);
 
+#else
+
+static inline unsigned int mem_sharing_get_nr_saved_mfns(void)
+{
+    return 0;
+}
+static inline unsigned int mem_sharing_get_nr_shared_mfns(void)
+{
+    return 0;
+}
+static inline int mem_sharing_unshare_page(struct domain *d,
+                                           unsigned long gfn,
+                                           uint16_t flags)
+{
+    ASSERT_UNREACHABLE();
+    return -EOPNOTSUPP;
+}
+static inline int mem_sharing_notify_enomem(struct domain *d, unsigned long 
 gfn,
+                              bool allow_sleep)
+{
+    ASSERT_UNREACHABLE();
+    return -EOPNOTSUPP;
+}
+
+#endif
+

#endif /* __MEM_SHARING_H__ */

xen/include/asm-x86/mm.h +2 -0
index 24c4205ba7..d8ab53d688 100644
@@ -127,6 +127,8 @@ struct page_info
         /* For non-pinnable single-page shadows, a higher entry that points
          * at us. */
         paddr_t up;
+
+#ifdef CONFIG_MEM_SHARING
         /* For shared/sharable pages, we use a doubly-linked list
          * of all the {pfn,domain} pairs that map this page. We also 

include
* an opaque handle, which is effectively a version, so that
clients

xen/include/asm-x86/mm.h +1 -0
@@ -134,6 +136,7 @@ struct page_info
          * This list is allocated and freed when a page is shared/unshared.
          */
         struct page_sharing_info *sharing;
+#endif
     };
 
     /* Reference count and various PGC_xxx flags and fields. */
xen/include/xen/sched.h +1 -1
index 2201faca6b..410c74489f 100644
@@ -459,7 +459,7 @@ struct domain
     /* Various vm_events */
 
     /* Memory sharing support */
-#ifdef CONFIG_HAS_MEM_SHARING
+#ifdef CONFIG_MEM_SHARING
     struct vm_event_domain *vm_event_share;
 #endif
     /* Memory paging support */
xen/include/xsm/dummy.h +1 -1
index 01d2814fed..ef52bb1764 100644
@@ -597,7 +597,7 @@ static XSM_INLINE int xsm_mem_paging(XSM_DEFAULT_ARG 
 struct domain *d)
 }
 #endif
 
-#ifdef CONFIG_HAS_MEM_SHARING
+#ifdef CONFIG_MEM_SHARING
 static XSM_INLINE int xsm_mem_sharing(XSM_DEFAULT_ARG struct domain *d)
 {
     XSM_ASSERT_ACTION(XSM_DM_PRIV);
xen/include/xsm/xsm.h +2 -2
index 9a90355056..d61ba77374 100644
@@ -150,7 +150,7 @@ struct xsm_operations {
     int (*mem_paging) (struct domain *d);
 #endif
 
-#ifdef CONFIG_HAS_MEM_SHARING
+#ifdef CONFIG_MEM_SHARING
     int (*mem_sharing) (struct domain *d);
 #endif
 
@@ -597,7 +597,7 @@ static inline int xsm_mem_paging (xsm_default_t def, 
 struct domain *d)
 }
 #endif
 
-#ifdef CONFIG_HAS_MEM_SHARING
+#ifdef CONFIG_MEM_SHARING
 static inline int xsm_mem_sharing (xsm_default_t def, struct domain *d)
 {
     return xsm_ops->mem_sharing(d);
xen/xsm/dummy.c +1 -1
index c9a566f2b5..5705e52791 100644
@@ -128,7 +128,7 @@ void __init xsm_fixup_ops (struct xsm_operations *ops)
     set_to_dummy_if_null(ops, mem_paging);
 #endif
 
-#ifdef CONFIG_HAS_MEM_SHARING
+#ifdef CONFIG_MEM_SHARING
     set_to_dummy_if_null(ops, mem_sharing);
 #endif
 
xen/xsm/flask/hooks.c +2 -2
index a7d690ac3c..791c1f66af 100644
@@ -1262,7 +1262,7 @@ static int flask_mem_paging(struct domain *d)
 }
 #endif
 
-#ifdef CONFIG_HAS_MEM_SHARING
+#ifdef CONFIG_MEM_SHARING
 static int flask_mem_sharing(struct domain *d)
 {
     return current_has_perm(d, SECCLASS_DOMAIN2, DOMAIN2__MEM_SHARING);
@@ -1829,7 +1829,7 @@ static struct xsm_operations flask_ops = {
     .mem_paging = flask_mem_paging,
 #endif
 
-#ifdef CONFIG_HAS_MEM_SHARING
+#ifdef CONFIG_MEM_SHARING
     .mem_sharing = flask_mem_sharing,
 #endif
 
Signature · 1 line
2.20.1

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#10 lore raw

Re: [PATCH v5 4/4] x86/mem_sharing: compile mem_sharing subsystem only when kconfig is enabled

Quoted 40 lines · Jan Beulich
Quoted 31 lines
Quoted 2 lines
Quoted 2 lines · On 16.05.19 at 23:37, <[email protected]> wrote:

Disable it by default as it is only an experimental subsystem.

Cc Jan Beulich <[email protected]>
Cc Andrew Cooper <[email protected]>
Cc Wei Liu <[email protected]>
Cc Roger Pau Monne <[email protected]>
Cc George Dunlap <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Julien Grall <[email protected]>
Cc Konrad Rzeszutek Wilk <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Tim Deegan <[email protected]>
Cc George Dunlap <[email protected]>

----
v4: add ASSERT_UNREACHABLE to inlined functions where applicable & other fixups

---
 xen/arch/x86/Kconfig              |  6 +++++-
 xen/arch/x86/domain.c             |  2 ++
 xen/arch/x86/domctl.c             |  2 ++
 xen/arch/x86/mm/Makefile          |  2 +-
 xen/arch/x86/x86_64/compat/mm.c   |  2 ++
 xen/arch/x86/x86_64/mm.c          |  2 ++
 xen/common/Kconfig                |  3 ---
 xen/common/domain.c               |  2 +-
 xen/common/grant_table.c          |  2 +-
 xen/common/memory.c               |  2 +-
 xen/common/vm_event.c             |  6 +++---
Quoted 8 lines
 xen/include/asm-x86/mem_sharing.h | 28 ++++++++++++++++++++++++++++
 xen/include/asm-x86/mm.h          |  3 +++
 xen/include/xen/sched.h           |  2 +-
 xen/include/xsm/dummy.h           |  2 +-
 xen/include/xsm/xsm.h             |  4 ++--
 xen/xsm/dummy.c                   |  2 +-
 xen/xsm/flask/hooks.c             |  4 ++--
 18 files changed, 58 insertions(+), 18 deletions(-)
Quoted 1 line

Daniel, it looks like you weren't Cc-ed here, but your ack is needed.

Indeed, I've also seem to have missed CC-ing Razvan (fixed now).

Tamas

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#11 lore raw

Re: [PATCH v5 4/4] x86/mem_sharing: compile mem_sharing subsystem only when kconfig is enabled

Hi,

Quoted 41 lines · Tamas K Lengyel
Quoted 40 lines · Jan Beulich
Quoted 39 lines
Quoted 2 lines
Quoted 2 lines · On 16.05.19 at 23:37, <[email protected]> wrote:

Disable it by default as it is only an experimental subsystem.

Cc Jan Beulich <[email protected]>
Cc Andrew Cooper <[email protected]>
Cc Wei Liu <[email protected]>
Cc Roger Pau Monne <[email protected]>
Cc George Dunlap <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Julien Grall <[email protected]>
Cc Konrad Rzeszutek Wilk <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Tim Deegan <[email protected]>
Cc George Dunlap <[email protected]>

----
v4: add ASSERT_UNREACHABLE to inlined functions where applicable & other fixups

---
  xen/arch/x86/Kconfig              |  6 +++++-
  xen/arch/x86/domain.c             |  2 ++
  xen/arch/x86/domctl.c             |  2 ++
  xen/arch/x86/mm/Makefile          |  2 +-
  xen/arch/x86/x86_64/compat/mm.c   |  2 ++
  xen/arch/x86/x86_64/mm.c          |  2 ++
  xen/common/Kconfig                |  3 ---
  xen/common/domain.c               |  2 +-
  xen/common/grant_table.c          |  2 +-
  xen/common/memory.c               |  2 +-
  xen/common/vm_event.c             |  6 +++---
  xen/include/asm-x86/mem_sharing.h | 28 ++++++++++++++++++++++++++++
  xen/include/asm-x86/mm.h          |  3 +++
  xen/include/xen/sched.h           |  2 +-
  xen/include/xsm/dummy.h           |  2 +-
  xen/include/xsm/xsm.h             |  4 ++--
  xen/xsm/dummy.c                   |  2 +-
  xen/xsm/flask/hooks.c             |  4 ++--
  18 files changed, 58 insertions(+), 18 deletions(-)
Quoted 3 lines
Quoted 1 line

Daniel, it looks like you weren't Cc-ed here, but your ack is needed.

Indeed, I've also seem to have missed CC-ing Razvan (fixed now).

Nowadays, add_maintainers.pl should do the right for you without having to modifying by hand each patch:

42sh> scripts/add_maintainers.pl -d .

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#12 lore raw

Re: [PATCH v5 4/4] x86/mem_sharing: compile mem_sharing subsystem only when kconfig is enabled

Quoted 45 lines · Julien Grall

Hi,

Quoted 41 lines · Tamas K Lengyel
Quoted 40 lines · Jan Beulich
Quoted 39 lines
Quoted 2 lines
Quoted 2 lines · On 16.05.19 at 23:37, <[email protected]> wrote:

Disable it by default as it is only an experimental subsystem.

Cc Jan Beulich <[email protected]>
Cc Andrew Cooper <[email protected]>
Cc Wei Liu <[email protected]>
Cc Roger Pau Monne <[email protected]>
Cc George Dunlap <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Julien Grall <[email protected]>
Cc Konrad Rzeszutek Wilk <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Tim Deegan <[email protected]>
Cc George Dunlap <[email protected]>

----
v4: add ASSERT_UNREACHABLE to inlined functions where applicable & other fixups

---
  xen/arch/x86/Kconfig              |  6 +++++-
  xen/arch/x86/domain.c             |  2 ++
  xen/arch/x86/domctl.c             |  2 ++
  xen/arch/x86/mm/Makefile          |  2 +-
  xen/arch/x86/x86_64/compat/mm.c   |  2 ++
  xen/arch/x86/x86_64/mm.c          |  2 ++
  xen/common/Kconfig                |  3 ---
  xen/common/domain.c               |  2 +-
  xen/common/grant_table.c          |  2 +-
  xen/common/memory.c               |  2 +-
  xen/common/vm_event.c             |  6 +++---
  xen/include/asm-x86/mem_sharing.h | 28 ++++++++++++++++++++++++++++
  xen/include/asm-x86/mm.h          |  3 +++
  xen/include/xen/sched.h           |  2 +-
  xen/include/xsm/dummy.h           |  2 +-
  xen/include/xsm/xsm.h             |  4 ++--
  xen/xsm/dummy.c                   |  2 +-
  xen/xsm/flask/hooks.c             |  4 ++--
  18 files changed, 58 insertions(+), 18 deletions(-)
Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Daniel, it looks like you weren't Cc-ed here, but your ack is needed.

Indeed, I've also seem to have missed CC-ing Razvan (fixed now).

Nowadays, add_maintainers.pl should do the right for you without having to modifying by hand each patch:

42sh> scripts/add_maintainers.pl -d .

Hi Julien,
ah good call! I've been using scripts/get_maintainers.pl which evidently is more error-prone in case the patch goes through revisions and I forget to re-check if more people need CC-ing now.

Thanks,
Tamas

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#13 lore raw

Re: [PATCH v5 4/4] x86/mem_sharing: compile mem_sharing subsystem only when kconfig is enabled

In reply to Tamas K Lengyel
Quoted 41 lines · Tamas K Lengyel
Quoted 40 lines · Jan Beulich
Quoted 39 lines
Quoted 2 lines
Quoted 2 lines · On 16.05.19 at 23:37, <[email protected]> wrote:

Disable it by default as it is only an experimental subsystem.

Cc Jan Beulich <[email protected]>
Cc Andrew Cooper <[email protected]>
Cc Wei Liu <[email protected]>
Cc Roger Pau Monne <[email protected]>
Cc George Dunlap <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Julien Grall <[email protected]>
Cc Konrad Rzeszutek Wilk <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Tim Deegan <[email protected]>
Cc George Dunlap <[email protected]>

----
v4: add ASSERT_UNREACHABLE to inlined functions where applicable & other fixups

---
  xen/arch/x86/Kconfig              |  6 +++++-
  xen/arch/x86/domain.c             |  2 ++
  xen/arch/x86/domctl.c             |  2 ++
  xen/arch/x86/mm/Makefile          |  2 +-
  xen/arch/x86/x86_64/compat/mm.c   |  2 ++
  xen/arch/x86/x86_64/mm.c          |  2 ++
  xen/common/Kconfig                |  3 ---
  xen/common/domain.c               |  2 +-
  xen/common/grant_table.c          |  2 +-
  xen/common/memory.c               |  2 +-
  xen/common/vm_event.c             |  6 +++---
  xen/include/asm-x86/mem_sharing.h | 28 ++++++++++++++++++++++++++++
  xen/include/asm-x86/mm.h          |  3 +++
  xen/include/xen/sched.h           |  2 +-
  xen/include/xsm/dummy.h           |  2 +-
  xen/include/xsm/xsm.h             |  4 ++--
  xen/xsm/dummy.c                   |  2 +-
  xen/xsm/flask/hooks.c             |  4 ++--
  18 files changed, 58 insertions(+), 18 deletions(-)
Quoted 3 lines
Quoted 1 line

Daniel, it looks like you weren't Cc-ed here, but your ack is needed.

Indeed, I've also seem to have missed CC-ing Razvan (fixed now).

Thanks,
Razvan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#14 lore raw

Re: [Xen-devel] [PATCH v5 4/4] x86/mem_sharing: compile mem_sharing subsystem only when kconfig is enabled

In reply to Jan Beulich
Quoted 8 lines · Jan Beulich
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 16.05.19 at 23:37, <[email protected]> wrote:

Disable it by default as it is only an experimental subsystem.

Daniel, it looks like you weren't Cc-ed here, but your ack is needed.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

author Acked-by Razvan Cojocaru Acked-by Jan Beulich Acked-by Daniel De Graaf on v5 4/4
#15 lore raw

Re: [Xen-devel] [PATCH v5 4/4] x86/mem_sharing: compile mem_sharing subsystem only when kconfig is enabled

In reply to Tamas K Lengyel
Quoted 4 lines · Tamas K Lengyel

Disable it by default as it is only an experimental subsystem.

Patch ping, are any more ack's missing on this one? Current tally is:

This patch could be merged separate from the series I posted it as part of.

Thanks,
Tamas

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#16 lore raw
In reply to Tamas K Lengyel
Quoted 7 lines · Tamas K Lengyel

Calling _put_page_type while also holding the page_lock for that page can cause a deadlock.

The comment being dropped is incorrect since it's now out-of-date.

Patch ping. Unclear whose Ack is strictly needed as this is only touching mem_sharing code and nothing else.

Thanks,
Tamas

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#17 lore raw
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 17.06.19 at 14:23, <[email protected]> wrote:
Quoted 4 lines · Tamas K Lengyel

Calling _put_page_type while also holding the page_lock for that page can cause a deadlock.

Quoted 6 lines
Quoted 3 lines

The comment being dropped is incorrect since it's now out-of-date.

Patch ping. Unclear whose Ack is strictly needed as this is only touching mem_sharing code and nothing else.

In such cases I think it should be the next-level-up maintainer whose ack should be chased; at least that's what I typically would do. This would be George in this cases afaict. Otherwise, if George wouldn't have the cycles to look at this closely enough to give an ack, I'd be happy to provide mine as "replacement".

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel