Commit c8a9fb59 authored by John Levon's avatar John Levon Committed by Linus Torvalds

[PATCH] fix APIC errors on oprofile restore

As per comment:

  restoring APIC_LVTPC can trigger an apic error because the delivery
  mode and vector nr combination can be illegal. That's by design: on
  power on apic lvt contain a zero vector nr which are legal only for
  NMI delivery mode. So inhibit apic err before restoring lvtpc
parent 1c03b1a9
...@@ -135,9 +135,19 @@ static void nmi_restore_registers(struct op_msrs * msrs) ...@@ -135,9 +135,19 @@ static void nmi_restore_registers(struct op_msrs * msrs)
static void nmi_cpu_shutdown(void * dummy) static void nmi_cpu_shutdown(void * dummy)
{ {
unsigned int v;
int cpu = smp_processor_id(); int cpu = smp_processor_id();
struct op_msrs * msrs = &cpu_msrs[cpu]; struct op_msrs * msrs = &cpu_msrs[cpu];
/* restoring APIC_LVTPC can trigger an apic error because the delivery
* mode and vector nr combination can be illegal. That's by design: on
* power on apic lvt contain a zero vector nr which are legal only for
* NMI delivery mode. So inhibit apic err before restoring lvtpc
*/
v = apic_read(APIC_LVTERR);
apic_write(APIC_LVTERR, v | APIC_LVT_MASKED);
apic_write(APIC_LVTPC, saved_lvtpc[cpu]); apic_write(APIC_LVTPC, saved_lvtpc[cpu]);
apic_write(APIC_LVTERR, v);
nmi_restore_registers(msrs); nmi_restore_registers(msrs);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment