[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen stable-4.7] x86: reduce Meltdown band-aid IPI overhead



commit 2a97af1145cbdfb36129867da46b699615787f1b
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Tue Mar 6 16:18:28 2018 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Tue Mar 6 16:18:28 2018 +0100

    x86: reduce Meltdown band-aid IPI overhead
    
    In case we can detect single-threaded guest processes (by checking
    whether we can account for all root page table uses locally on the vCPU
    that's running), there's no point in issuing a sync IPI upon an L4 entry
    update, as no other vCPU of the guest will have that page table loaded.
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Acked-by: George Dunlap <george.dunlap@xxxxxxxxxx>
    Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    master commit: a22320e32dca0918ed23799583f470afe4c24330
    master date: 2018-02-07 16:31:41 +0100
---
 xen/arch/x86/mm.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 07015e3160..7572a01459 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -4006,8 +4006,18 @@ long do_mmu_update(
                 case PGT_l4_page_table:
                     rc = mod_l4_entry(va, l4e_from_intpte(req.val), mfn,
                                       cmd == MMU_PT_UPDATE_PRESERVE_AD, v);
-                    if ( !rc )
-                        sync_guest = !!this_cpu(root_pgt);
+                    /*
+                     * No need to sync if all uses of the page can be accounted
+                     * to the page lock we hold, its pinned status, and uses on
+                     * this (v)CPU.
+                     */
+                    if ( !rc && this_cpu(root_pgt) &&
+                         ((page->u.inuse.type_info & PGT_count_mask) >
+                          (1 + !!(page->u.inuse.type_info & PGT_pinned) +
+                           (pagetable_get_pfn(curr->arch.guest_table) == mfn) +
+                           (pagetable_get_pfn(curr->arch.guest_table_user) ==
+                            mfn))) )
+                        sync_guest = 1;
                     break;
                 case PGT_writable_page:
                     perfc_incr(writable_mmu_updates);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.7

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.