Signed-off-by: Wei Liu <wei.l...@citrix.com> --- xen/arch/x86/flushtlb.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-)
diff --git a/xen/arch/x86/flushtlb.c b/xen/arch/x86/flushtlb.c index 8a7a76b8ff..e4ea4f3297 100644 --- a/xen/arch/x86/flushtlb.c +++ b/xen/arch/x86/flushtlb.c @@ -9,6 +9,7 @@ #include <xen/sched.h> #include <xen/softirq.h> +#include <asm/invpcid.h> #include <asm/flushtlb.h> #include <asm/page.h> @@ -120,11 +121,24 @@ unsigned int flush_area_local(const void *va, unsigned int flags) else { u32 t = pre_flush(); - unsigned long cr4 = read_cr4(); - write_cr4(cr4 & ~X86_CR4_PGE); - barrier(); - write_cr4(cr4); + if ( !cpu_has_invpcid ) + { + unsigned long cr4 = read_cr4(); + + write_cr4(cr4 & ~X86_CR4_PGE); + barrier(); + write_cr4(cr4); + } + else + { + /* + * Using invpcid to flush all mappings works + * regardless of whether PCID is enabled or not. + * It is faster than read-modify-write CR4. + */ + invpcid_flush_all(); + } post_flush(t); } -- 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel