Skip to content

Commit

Permalink
x86: reduce Meltdown band-aid IPI overhead
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: George Dunlap <[email protected]>
Acked-by: Andrew Cooper <[email protected]>
  • Loading branch information
jbeulich committed Feb 7, 2018
1 parent c5d981c commit a22320e
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions xen/arch/x86/mm.c
Original file line number Diff line number Diff line change
Expand Up @@ -3706,8 +3706,18 @@ long do_mmu_update(
break;
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 = true;
break;

case PGT_writable_page:
Expand Down

0 comments on commit a22320e

Please sign in to comment.