• Andrew Morton's avatar
    [PATCH] oprofile: fix P4 HT msr sharing · 6a59dff3
    Andrew Morton authored
    From: Philippe Elie <phil.el@wanadoo.fr>
    
    When I debugged P4 ht oprofile a few month ago I noticed that but though it
    wasn't a problem...  The fix I propose is not completely clean.
    
    With P4 HT we split msr in two subset, one for each logical processor.  The
    msrs subset used in op_model_p4.c at save and setup point of view are
    distinct (*), it means we must serialize setup and save operation else a
    logical processor can save some msr value already setup by the other thread
    then when oprofile shutdown we restore wrong msrs values.
    
    Nobody noticed the problem because after restoring the msrs we call
    enable_lapic_nmi_watchdog() -> setup_p4_watchdog() wich clear all the msrs
    but it's a bit fragile.  If nmi watchdog is not enabled nothing bad occurs
    because the LVTPC remains disabled.
    
    (*) this is done in this way because it allows a lot of simplification in
    op_model_p4.c, yes it isn't clean but it's not fixable w/o rewriting 75% of
    op_model_p4.c and I think the code will be bigger and more complex.
    6a59dff3
nmi_int.c 8.63 KB