This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


Re: [Xen-devel] How Xen handles Dom1 interrupts?

To: "Daniel Stodden" <stodden@xxxxxxxxxx>
Subject: Re: [Xen-devel] How Xen handles Dom1 interrupts?
From: "Jun Koi" <junkoi2004@xxxxxxxxx>
Date: Fri, 11 Aug 2006 23:13:59 +0900
Cc: Xen Developers <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Fri, 11 Aug 2006 07:14:24 -0700
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=fW+peg5fr7i/IpmVVcH7cvSoZ4ySQdWPcH7nVky6qh1gW9mPCx9Dhs292uGOeAGc3axE6GueM19bdqe/cIHU7h7sInFSaPlPJvok8VlX6e4IuAZAkvETvzI3OJZ2Cx6e1XzjOJtepTaVqyH2KNIBJ7KK5b078pdzCFSkUhrG5jM=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <1155292762.18655.27.camel@xxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <fdaac4d50608110303g1ac77269u8501af326dce7e75@xxxxxxxxxxxxxx> <1155292762.18655.27.camel@xxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Hi Daniel,

On 8/11/06, Daniel Stodden <stodden@xxxxxxxxxx> wrote:
On Fri, 2006-08-11 at 19:03 +0900, Jun Koi wrote:
> Good morning,
> I am new to Xen, and trying to understand how Xen works. I have some
> questions about virtualization of interrupts on Xen. Thanks in advance
> for all helps.
> 1) From papers about Xen architecture found at Xen homepage, Xen
> seemingly intercepts interrupts of Dom1 (paravirtualization). So
> interrupts occur in Dom1's context are sent to Xen, and Xen handles
> them. Is that correct?

similar to interrupts to a native operating systems, interrupts could
occur in just any context (as long as they're not blocked).

the domU never 'receives' the interrupt in a way that it won't even be
able to install a handler for it. the idt belongs to xen, and xen is
where it is actually handled, interrupting whatever used to be running
when it occurred.

> But then how can Dom1 gets the interrupts? For example if int3 occurs
> inside Dom1, Xen intercepts int3, but then how debugger (like gdb) can
> still work in Dom1? Maybe Xen sends that interrupt back to Dom1 after
> processing it in VMM layer?

hardware interrupts in turn drive 'virtual interrupts', which are in the
paravirtualized case a pure software abstraction. in xen, you'll find a
lot of references to a concept called 'event channels', and that's just

so it's xen making then decision on whether a domain interrupt handler
is called, which one's called, when it's called, and whether anything
called at all. don't worry, in practice, xen is doing the right thing,
but that's the way it needs to work. :).

> 2) I have read
> linux-xen-sparse/arch/i386/kernel/{traps-xen.c,traps.c,vmlinux.lds.S},
> and looks like Dom1 still handles interrupts itself? Why, because I
> suppose that the VMM already intercepts those interrupts?

an guest system, whether it's virtualized or not, is not living in a
vacuum. it needs some kind of signalling from the hardware environment,
whether it's virtual or physical, in order to get notified of events.
that's 'asynchronous input' of some kind, not necessarily purelay
hardware interrupt driven, though.

e.g. it needs a regular timer interrupt as well as as notification of
events regarding virtual device interfaces.
so it still has interrupt handlers.

it is, however, not modifying the real IDT. see e.g. trap_init() in
traps-xen.c and read about HYPERVISOR_set_trap_table in the interface

Very interesting. So here is what I imagine about things in Xen:

- When Dom1 boots, it asks VMM (via set_trap_table hypercall) to setup
the IDT for it. Meanwhile Dom1 still setups its IDT but all the
interrupts are from event-channels instead of from physical interrupts
like in native case. An event sent to Dom1 via event-channel will fire
a virtual interrupt, and Dom1's interrupt handler will handle it like
in native case.
- When an interrupt occurs in Dom1's context, VMM handles it first,
then fires an event corresponding to the interrupt via event-channel
to Dom1, thus creates an virtual interrupt. Dom1 processes this
virtual interrupt.

Is that all correct?

I follow the above assumption, and as an example, trying to track down
how int3 is processed if we use gdb to debug an application in Dom1.
But looks like the int3 handler in VMM never send event to Dom1 as I
supposed. Or I missed something? Any pointer on which code of VMM does


Xen-devel mailing list