Skip to contentSkip to conversation

x86/mm: avoid playing with directmap when self-snoop can be relied upon

PATCH In review Jan Beulich 2 participants 3 messages Oct 20, 2020 – Oct 22, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/mm: avoid playing with directmap when self-snoop can be relied upon

The set of systems affected by XSA-345 would have been smaller is we had this in place already: When the processor is capable of dealing with mismatched cacheability, there's no extra work we need to carry out.

xen/arch/x86/mm.c +4 -0
@@ -795,6 +795,9 @@ static int update_xen_mappings(unsigned
     unsigned long xen_va =
         XEN_VIRT_START + ((mfn - PFN_DOWN(xen_phys_start)) << PAGE_SHIFT);
 
+    if ( boot_cpu_has(X86_FEATURE_XEN_SELFSNOOP) )
+        return 0;
+
     if ( unlikely(alias) && cacheattr )
         err = map_pages_to_xen(xen_va, _mfn(mfn), 1, 0);
     if ( !err )
@@ -802,6 +805,7 @@ static int update_xen_mappings(unsigned
                      PAGE_HYPERVISOR | cacheattr_to_pte_flags(cacheattr));
     if ( unlikely(alias) && !cacheattr && !err )
         err = map_pages_to_xen(xen_va, _mfn(mfn), 1, PAGE_HYPERVISOR);
+
     return err;
 }
 
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Jan Beulich

The set of systems affected by XSA-345 would have been smaller is we had this in place already: When the processor is capable of dealing with mismatched cacheability, there's no extra work we need to carry out.

I guess it's not worth using the alternative framework to patch this up at boot in order to avoid the call in the first place?

Thanks, Roger.

#2 lore raw
Quoted 8 lines · Roger Pau Monné
Quoted 5 lines · Jan Beulich

The set of systems affected by XSA-345 would have been smaller is we had this in place already: When the processor is capable of dealing with mismatched cacheability, there's no extra work we need to carry out.

Thanks.

Quoted 2 lines

I guess it's not worth using the alternative framework to patch this up at boot in order to avoid the call in the first place?

It being non-trivial (afaict) in cases like this one makes me think that the price to do so would be higher than the gain to be had. But I might be wrong ...

Jan