[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-users] How to bind an irq_handler to an event channel?



Hi,

I'm trying to use event channel to communicate between DomUs. In my understanding, to use event channel, I should allocate one and bind it to an irq_handler on one DomU and then connect this channel on another DomU. But I cannot succeed to bind. Here is part of my code:

 
//irq_handler
static irqreturn_t server_handler(int irq, void * dev){
        struct evtchn_send args;
        int rc;

        memset(&args,0,sizeof(struct evtchn_send));
        args.port=local_port; //local_port is globle

        printk("%d:get message from %d\n",DOMID_SELF,remote_id);

        rc=HYPERVISOR_event_channel_op(EVTCHNOP_send, &args);
        if(rc!=0){
                printk("%d:cannot send event to %d\n",DOMID_SELF,remote_id);
        }
        else{
                printk("%d:send event to %d\n",DOMID_SELF,remote_id);
        }
        return IRQ_HANDLED;

}

static int server_allocate_event_channel(domid_t rdom, evtchn_port_t *pport){
        struct evtchn_alloc_unbound args;
        int rc,rc2;

        memset(&args,0,sizeof(struct evtchn_alloc_unbound));
        args.dom=DOMID_SELF;
        args.remote_dom=rdom;

        if((rc=HYPERVISOR_event_channel_op(EVTCHNOP_alloc_unbound, &args))!=0){
                printk("Cannot allocate event channel in server\n");
                return rc;
        }

        *pport=args.port;

        rc2=bind_evtchn_to_irqhandler(args.port,server_handler,IRQF_DISABLED,NULL,NULL);
        if(rc<=0){
                printk("Cannot bind event channel with a server's irq\n");
                return -1;
        }
        return 0;
}

And the error message is :"insmod: error inserting 'node.ko': -1 Cannot allocate memory".

Frankly speaking, I have very few knowledge of this irqhandler stuff. I've seen some information on http://xen.1045712.n5.nabble.com/XEN-event-channel-interdomain-communication-td3402677.html. but could someone explain how these bind_evtchn_* functions to be used?

Thanks a lot!
_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxx
http://lists.xen.org/xen-users

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.