diff --git a/arch/x86/kernel/apic.c b/arch/x86/kernel/apic.c index f75d7fff7..3f4c43898 100644 --- a/arch/x86/kernel/apic.c +++ b/arch/x86/kernel/apic.c @@ -247,7 +247,7 @@ void apic_eoi(size_t int_no) * If the IDT entry that was invoked was greater-than-or-equal to 48, * then we use the APIC */ - if (apic_is_enabled() || int_no >= 123) { + if (apic_is_enabled() || int_no >= 48) { lapic_write(APIC_EOI, 0); } else { /* @@ -963,6 +963,11 @@ int ipi_tlb_flush(void) continue; LOG_DEBUG("Send IPI to %zd\n", i); + /* + * Make previous memory operations globally visible before + * sending the IPI through x2apic wrmsr. => serializing + */ + mb(); wrmsr(0x830, (i << 32)|APIC_INT_ASSERT|APIC_DM_FIXED|112); } irq_nested_enable(flags); @@ -996,7 +1001,7 @@ int ipi_tlb_flush(void) static void apic_tlb_handler(struct state *s) { - LOG_DEBUG("Receive IPI at core %d to flush the TLB\n", CORE_ID); + LOG_INFO("Receive IPI at core %d to flush the TLB\n", CORE_ID); write_cr3(read_cr3()); } #endif @@ -1009,6 +1014,11 @@ int apic_send_ipi(uint64_t dest, uint8_t irq) if (has_x2apic()) { flags = irq_nested_disable(); LOG_DEBUG("send IPI %d to %lld\n", (int)irq, dest); + /* + * Make previous memory operations globally visible before + * sending the IPI through x2apic wrmsr. => serializing + */ + mb(); wrmsr(0x830, (dest << 32)|APIC_INT_ASSERT|APIC_DM_FIXED|irq); irq_nested_enable(flags); } else { @@ -1098,7 +1108,7 @@ static void apic_shutdown(struct state* s) static void apic_wakeup(struct state* s) { - LOG_DEBUG("Receive wakeup interrupt\n"); + LOG_INFO("Receive wakeup interrupt\n"); } int apic_init(void)