]> xenbits.xensource.com Git - people/liuw/xen.git/commitdiff
x86/AMD: flush TLB after ucode update
authorJan Beulich <jbeulich@suse.com>
Mon, 28 Jan 2019 16:40:39 +0000 (17:40 +0100)
committerJan Beulich <jbeulich@suse.com>
Mon, 28 Jan 2019 16:40:39 +0000 (17:40 +0100)
The increased number of messages (spec_ctrl.c:print_details()) within a
certain time window made me notice some slowness of boot time screen
output. Experimentally I've narrowed the time window to be from
immediately after the early ucode update on the BSP to the PAT write in
cpu_init(), which upon further investigation has an effect because of
the full TLB flush that's implied by that write.

For that reason, as a workaround, flush the TLB of the mapping of the
page that holds the blob. Note that flushing just a single page is
sufficient: As per verify_patch_size() patch size can't exceed 4k, and
the way xmalloc() works the blob can't be crossing a page boundary.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Brian Woods <brian.woods@amd.com>
Release-acked-by: Juergen Gross <jgross@suse.com>
xen/arch/x86/microcode_amd.c

index fba44ccba962252aa637c98b39e9650d671207d7..7a854c012f4df9dce1eafae1cb35c040d5c7d10b 100644 (file)
@@ -218,6 +218,12 @@ static int apply_microcode(unsigned int cpu)
 
     spin_unlock_irqrestore(&microcode_update_lock, flags);
 
+    /*
+     * Some processors leave the ucode blob mapping as UC after the update.
+     * Flush the mapping to regain normal cacheability.
+     */
+    flush_area_local(hdr, FLUSH_TLB_GLOBAL | FLUSH_ORDER(0));
+
     /* check current patch id and patch's id for match */
     if ( hw_err || (rev != hdr->patch_id) )
     {