how to handle lapic / xapic error

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
bookman
Posts: 3
Joined: Fri Sep 29, 2023 4:00 pm

how to handle lapic / xapic error

Post by bookman »

Hi everyone
I have been studying an OS -- MIT SV6, from https://github.com/aclements/sv6. These days I am migrating UHCI driver code (https://github.com/pdoane/osdev) to SV6. I am working on a real machine, a 2010 year Asus Z8-NA server computer, which are equiped with 2 Xeon CPU packages, and 4 cores for each package. There two front USB ports and 2 rear USB ports in this server. I set two I/O modes for the UHCI driver code -- Polling mode and Interrupt-driven mode. Polling mode works well, at each timer interrupt tick, it checks each UHCI controller and each attached keyboard and mouse to pick up the incoming data if any. However, the interrupt-driven mode works only on the two rear ports. On the two front ports, the interrupt-driven mode does not work prorperly. A keystroke on a front port keyboard triggers "lapic error" messages endlessly. Anyone please offer some help. Thank you so much, best regards.

The following is a code snippet from kernel/trap.cc of SV6 source code, which traps into the corresponding handler according to their interrupt types. Particularly, on the 4th line to the last line it displays "lapic error" when receiving IRQ_ERROR event.

...
case T_IRQ0 + IRQ_IDE:
ideintr();
lapiceoi();
piceoi();
break;
case T_IRQ0 + IRQ_KBD:
kbdintr();
lapiceoi();
piceoi();
break;
case T_IRQ0 + IRQ_COM2:
case T_IRQ0 + IRQ_COM1:
uartintr();
lapiceoi();
piceoi();
break;
case T_IRQ0 + 7:
case T_IRQ0 + IRQ_SPURIOUS:
cprintf("cpu%d: spurious interrupt at %x:%lx\n",
mycpu()->id, tf->cs, tf->rip);
// [Intel SDM 10.9 Spurious Interrupt] The spurious interrupt
// vector handler should return without an EOI.
//lapiceoi();
break;
case T_IRQ0 + IRQ_ERROR:
cprintf("cpu%d: lapic error?\n", mycpu()->id);
lapiceoi();
break;
...
Octocontrabass
Member
Member
Posts: 5218
Joined: Mon Mar 25, 2013 7:01 pm

Re: how to handle lapic / xapic error

Post by Octocontrabass »

Which interrupt vector is assigned to the USB controller? Could it be assigned to the same vector as the APIC error interrupt?

If they're not assigned to the same interrupt, check the local APIC's Error Status Register. That should help you figure out where to look next.
Post Reply