Skip to contentSkip to conversation

A Question about Interrupt Handling

DISCUSSION Jiaqing Du 1 participant 1 message Jan 12, 2010

lore
Share & tools
lore

Jiaqing Du

author
#0 lore raw

Hi list,

I am trying to figure out when & how a interrupt handler of the guest is called after Xen sets evtchn_upcall_pending to non-zero. Below is my understanding. Please let me know if something is wrong.

When Xen wants to inject an interrupt to the guest, the following functions are called sequentially.

send_guest_vcpu_virq()-->evtchn_set_pending()-->vcpu_mark_events_pending()-->vcpu_kick()-->cpu_raise_softirq()-->smp_send_event_check_cpu()-->send_IPI_mask(mask, EVENT_CHECK_VECTOR). Then an interrupt handler will handle this IPI
with vector EVENT_CHECK_VECTOR. I think within this interrupt handler,
Xen calls the registered virtual interrupt handler of the guest. Right
or not?

The IPI handler is defined as

BUILD_SMP_INTERRUPT(event_check_interrupt,EVENT_CHECK_VECTOR),

then the definition of this macro goes here,

#define BUILD_SMP_INTERRUPT(x,v) XBUILD_SMP_INTERRUPT(x,v)

#define XBUILD_SMP_INTERRUPT(x,v)               \
asmlinkage void x(void);                        \
__asm__(                                        \
    "\n"__ALIGN_STR"\n"                         \
    ".globl " STR(x) "\n\t"                     \
    STR(x) ":\n\t"                              \
    "pushl $"#v"<<16\n\t"                       \
    STR(FIXUP_RING0_GUEST_STACK)                \
    STR(SAVE_ALL(1f,1f)) "\n\t"                 \
    "1:movl %esp,%eax\n\t"                      \
    "pushl %eax\n\t"                            \
    "call "STR(smp_##x)"\n\t"                   \
    "addl $4,%esp\n\t"                          \
    "jmp ret_from_intr\n");

Inside this assembly code block, smp_event_check_interrupt() is called. Then I could not find where this function is defined..

Any comments?

Thanks,
Jiaqing