From: John L. <mov...@us...> - 2001-09-04 12:50:13
|
Update of /cvsroot/oprofile/oprofile In directory usw-pr-cvs1:/tmp/cvs-serv13179 Modified Files: ChangeLog oprofile.c Log Message: fix for lvtpc_apic_restore Index: ChangeLog =================================================================== RCS file: /cvsroot/oprofile/oprofile/ChangeLog,v retrieving revision 1.96 retrieving revision 1.97 diff -u -d -r1.96 -r1.97 --- ChangeLog 2001/09/02 14:34:44 1.96 +++ ChangeLog 2001/09/04 12:50:10 1.97 @@ -1,3 +1,7 @@ +2001-09-04 John Levon <mo...@co...> + + * oprofile.c: change lvtpc_apic_restore to be more careful ! + 2001-09-02 John Levon <mo...@co...> * oprofile.c: don't allow unload on SMP unless allow_unload Index: oprofile.c =================================================================== RCS file: /cvsroot/oprofile/oprofile/oprofile.c,v retrieving revision 1.79 retrieving revision 1.80 diff -u -d -r1.79 -r1.80 --- oprofile.c 2001/09/02 14:34:44 1.79 +++ oprofile.c 2001/09/04 12:50:10 1.80 @@ -241,7 +241,8 @@ #endif } -static uint old_lvtpc[NR_CPUS]; +static uint lvtpc_old_mask[NR_CPUS]; +static uint lvtpc_old_mode[NR_CPUS]; static void __init lvtpc_apic_setup(void *dummy) { @@ -249,17 +250,25 @@ /* set up LVTPC as we need it */ /* IA32 V3, Figure 7.8 */ - old_lvtpc[smp_processor_id()] = val = apic_read(APIC_LVTPC); + val = apic_read(APIC_LVTPC); + lvtpc_old_mask[smp_processor_id()] = val & APIC_LVT_MASKED; /* allow PC overflow interrupts */ val &= ~APIC_LVT_MASKED; /* set delivery to NMI */ + lvtpc_old_mode[smp_processor_id()] = GET_APIC_DELIVERY_MODE(val); val = SET_APIC_DELIVERY_MODE(val, APIC_MODE_NMI); apic_write(APIC_LVTPC, val); } static void __exit lvtpc_apic_restore(void *dummy) { - apic_write(APIC_LVTPC, old_lvtpc[smp_processor_id()]); + uint val = apic_read(APIC_LVTPC); + val = SET_APIC_DELIVERY_MODE(val, lvtpc_old_mode[smp_processor_id()]); + if (lvtpc_old_mask[smp_processor_id()]) + val |= APIC_LVT_MASKED; + else + val &= ~APIC_LVT_MASKED; + apic_write(APIC_LVTPC, val); } static int __init apic_needs_setup(void) |