Skip to contentSkip to conversation

x86/mm: Drop preemptible signal through {get, put}_page_type*()

PATCH In review Andrew Cooper 2 participants 2 messages Aug 28, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/mm: Drop preemptible signal through {get, put}_page_type*()

After XSA-273, handling of L2 pagetables must strictly be preemptible, meaning that all page types are now strictly preemptible (>= L2) or not (L1, SEGDESC).

Simplify the code by removing the preemptible booleans, which has an unexpectedly large change to _get_page_type().

add/remove: 0/0 grow/shrink: 0/15 up/down: 0/-509 (-509)
Function old new delta

  put_page_type                                  9       7      -2
  get_page_type                                 24      22      -2
  put_page_from_l2e                            251     247      -4
  put_page_type_preemptible                     12       7      -5
  put_page_from_l4e                            268     263      -5
  put_page_from_l3e                            461     456      -5
  get_page_type_preemptible                     10       5      -5
  put_page_from_l1e                            385     377      -8
  vcpu_destroy_pagetables                      450     437     -13
  put_old_guest_table                          119     103     -16
  get_page_from_l1e                           1214    1196     -18
  get_page_and_type_from_mfn                   240     206     -34
  _put_page_type                               842     804     -38
  do_mmuext_op                                5576    5526     -50

_get_page_type 5771 5467 -304
Total: Before=3297078, After=3296569, chg -0.02%

---
CC: Jan Beulich <[email protected]>
CC: Wei Liu <[email protected]>
CC: Roger Pau Monné <[email protected]>

---
 xen/arch/x86/domain.c    |  2 +-
 xen/arch/x86/mm.c        | 76 ++++++++++++++++++++----------------------------
 xen/include/asm-x86/mm.h |  3 +-
 3 files changed, 34 insertions(+), 47 deletions(-)
xen/arch/x86/domain.c +1 -1
index eb1e93f..4f64602 100644
@@ -1875,7 +1875,7 @@ static int relinquish_memory(
             if ( likely(y == x) )
             {
                 /* No need for atomic update of type_info here: noone else updates it. */
-                switch ( ret = free_page_type(page, x, 1) )
+                switch ( ret = free_page_type(page, x) )
                 {
                 case 0:
                     break;
xen/arch/x86/mm.c +32 -44

279 lines not on this page · raw message

xen/include/asm-x86/mm.h +1 -2
index 6e45651..1988e57 100644
@@ -330,8 +330,7 @@ static inline void *__page_to_virt(const struct page_info *pg)
                     (PAGE_SIZE / (sizeof(*pg) & -sizeof(*pg))));
 }
 
-int free_page_type(struct page_info *page, unsigned long type,
-                   int preemptible);
+int free_page_type(struct page_info *page, unsigned long type);
 
 void init_xen_pae_l2_slots(l2_pgentry_t *l2t, const struct domain *d);
 void init_xen_l4_slots(l4_pgentry_t *l4t, mfn_t l4mfn,
Signature · 7 lines
2.1.4


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

xen/arch/x86/mm.c static int get_page_and_type_from_mfn( · line 633

Quoted 12 lines
Quoted 1 line
Quoted 1 line · On 28.08.18 at 17:35, <[email protected]> wrote:
xen/arch/x86/mm.c +2 -2
@@ -627,10 +626,10 @@ static int get_page_and_type_from_mfn(
          unlikely(!get_page_from_mfn(mfn, d)) )
         return -EINVAL;
 
-    rc = _get_page_type(page, type, preemptible);
+    rc = _get_page_type(page, type);
 
     if ( unlikely(rc) && partial >= 0 &&
-         (!preemptible || page != current->arch.old_guest_table) )
+         page != current->arch.old_guest_table )
         put_page(page);

If preemptibility is now tied to the type, how can this part of the condition go away altogether here? At least I didn't understand the description to mean everything is meant to become preemptible.

Same elsewhere. Please clarify.

Jan

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