Srujan D. Kotikela
2010-Oct-19 16:29 UTC
[Xen-devel] Handling inter-domain interrupts in Dom0
Hi,
If I understand correctly, events are used for asynchronous communication in
Xen where these events can be mapped to incoming VIRQs, PIRQs or just mean
inter-domain events.
However to handle these events we should map the events to IRQs and handle
the IRQ. (correct me if I am wrong)
I have few questions here.
i am trying to simply notify Dom0 that something has occurred in DomU from
application level. Ideally I would prefer a OS/Platform independent
mechanism for this.
I tried to bind an event channel to an VIRQ (See the code below):
int main(void){
int xce_handle, src_port, dst_port, xc_handle;
int dom, remote_dom, ret, vchn;
dom=0;
remote_dom=2;
xc_handle=xc_interface_open(); //open the hypervisor interface
printf("\n Accquired HYPERVISOR INTERFACE HANDLE: %d \n", xc_handle);
dst_port = xc_evtchn_alloc_unbound(xc_handle, remote_dom, dom); //allocate a
port on the remote domain
printf("\n Allocated the DEST port %d \n", dst_port);
xce_handle = xc_evtchn_open(); //create a handle for event channel
printf("\n Accquired HYPERVISOR INTERFACE EVTCHN HANDLE: %d\n",
xce_handle);
src_port = xc_evtchn_bind_interdomain(xce_handle, remote_dom, dst_port);
printf("\n Allocated the SRC port %d \n", src_port);
ret = xc_evtchn_bind_virq(xce_handle, VIRQ_MYVIRQ); //MYVIRQ declared in
xen.h
printf("\n EventChannel Bound to VIRQ %d \n", ret);
printf("\n NOTIFIED: %d\n", xc_evtchn_notify(xce_handle, ret));
xc_interface_close(xc_handle);
xc_evtchn_close(xce_handle);
return 0;
}
1. If I have to notify Dom0 about an event (anything I consider as an
event). How should I do it? From the libraries/api available I can only see
xc_evtchn_notify() for this purpose.
But I don''t want to assume the guest is having xen or xen libraries
available.
2. When we say an event has been delivered (in the above setup) does it
means that MYVIRQ occurs in Dom0 as soon as I call notify() in DomU (subject
to pending and masking of evtchn and vcpu0)
3. I am thinking of a more minimal communication mechanism like an interrupt
occurs in DomU which will be trapped by hypervisor and forwarded to handler
in Dom0. Is such a design feasible and beneficial?
My task requires an event notification. Event here is very specific to my
application. Which should be followed by memory introspection using
xenaccess from Dom0.
--
Regards,
Srujan D. Kotikela
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
Srujan D. Kotikela
2010-Oct-19 17:22 UTC
[Xen-devel] Re: Handling inter-domain interrupts in Dom0
To put all that in simple words: How does hypervisor forward interrupts to domains? Can I configure handler in hypervisor such that an interrupt from DomU can be forwarded to handler in Dom0 ? -- Srujan D. Kotikela On Tue, Oct 19, 2010 at 11:29 AM, Srujan D. Kotikela <ksrujandas@gmail.com>wrote:> Hi, > > If I understand correctly, events are used for asynchronous communication > in Xen where these events can be mapped to incoming VIRQs, PIRQs or just > mean inter-domain events. > However to handle these events we should map the events to IRQs and handle > the IRQ. (correct me if I am wrong) > > I have few questions here. > > i am trying to simply notify Dom0 that something has occurred in DomU from > application level. Ideally I would prefer a OS/Platform independent > mechanism for this. > I tried to bind an event channel to an VIRQ (See the code below): > > int main(void){ > > int xce_handle, src_port, dst_port, xc_handle; > int dom, remote_dom, ret, vchn; > > dom=0; > remote_dom=2; > > xc_handle=xc_interface_open(); //open the hypervisor interface > printf("\n Accquired HYPERVISOR INTERFACE HANDLE: %d \n", xc_handle); > > dst_port = xc_evtchn_alloc_unbound(xc_handle, remote_dom, dom); //allocate > a port on the remote domain > printf("\n Allocated the DEST port %d \n", dst_port); > > xce_handle = xc_evtchn_open(); //create a handle for event channel > printf("\n Accquired HYPERVISOR INTERFACE EVTCHN HANDLE: %d\n", > xce_handle); > > src_port = xc_evtchn_bind_interdomain(xce_handle, remote_dom, dst_port); > printf("\n Allocated the SRC port %d \n", src_port); > > ret = xc_evtchn_bind_virq(xce_handle, VIRQ_MYVIRQ); //MYVIRQ declared in > xen.h > printf("\n EventChannel Bound to VIRQ %d \n", ret); > > printf("\n NOTIFIED: %d\n", xc_evtchn_notify(xce_handle, ret)); > xc_interface_close(xc_handle); > xc_evtchn_close(xce_handle); > return 0; > } > > > 1. If I have to notify Dom0 about an event (anything I consider as an > event). How should I do it? From the libraries/api available I can only see > xc_evtchn_notify() for this purpose. > But I don''t want to assume the guest is having xen or xen libraries > available. > > 2. When we say an event has been delivered (in the above setup) does it > means that MYVIRQ occurs in Dom0 as soon as I call notify() in DomU (subject > to pending and masking of evtchn and vcpu0) > > 3. I am thinking of a more minimal communication mechanism like an > interrupt occurs in DomU which will be trapped by hypervisor and forwarded > to handler in Dom0. Is such a design feasible and beneficial? > > My task requires an event notification. Event here is very specific to my > application. Which should be followed by memory introspection using > xenaccess from Dom0. > > -- > Regards, > Srujan D. Kotikela >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel