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

[xen staging] x86/MTRR: constrain AP sync and BSP restore



commit 1b0e74aa37e2035e84f797253fba429726512d30
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Thu Apr 3 09:38:41 2025 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu Apr 3 09:38:41 2025 +0200

    x86/MTRR: constrain AP sync and BSP restore
    
    mtrr_set_all() has quite a bit of overhead, which is entirely useless
    when set_mtrr_state() really does nothing. Furthermore, with
    mtrr_state.def_type never initialized from hardware, post_set()'s
    unconditional writing of the MSR means would leave us running in UC
    mode after the sync.
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Acked-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
 xen/arch/x86/cpu/mtrr/main.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/cpu/mtrr/main.c b/xen/arch/x86/cpu/mtrr/main.c
index 0a44ebbcb0..39b18c6013 100644
--- a/xen/arch/x86/cpu/mtrr/main.c
+++ b/xen/arch/x86/cpu/mtrr/main.c
@@ -605,13 +605,15 @@ void mtrr_aps_sync_begin(void)
 
 void mtrr_aps_sync_end(void)
 {
-       set_mtrr(~0U, 0, 0, 0);
+       if (mtrr_if)
+               set_mtrr(~0U, 0, 0, 0);
        hold_mtrr_updates_on_aps = 0;
 }
 
 void mtrr_bp_restore(void)
 {
-       mtrr_set_all();
+       if (mtrr_if)
+               mtrr_set_all();
 }
 
 static int __init cf_check mtrr_init_finialize(void)
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

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