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

Re: [Minios-devel] Implement event channels in two minios domains



Hello

First thing I want to mention is that please don't send image
attachments to mailing list. Please be considerate to those who have
limited bandwidth. :-)

On Fri, May 06, 2016 at 01:59:46PM +0800, 喻凯 wrote:
> I want to implement event channels in two minios domains, DomA and DomB. DomA 
> allocates the channel, DomB binds the channel to its local port and then 
> sends a event. But DomA doesn't receive the event(maybe received but didn't 
> handle the event). I want to know if i lost a procedure. Here is my code, 
> main func in minios, and the two attachments are the printed results. Thanks.
> 
> 
> 
> 
> int main()
> {
> sleep(1);
> struct xs_handle *xs;
> unsigned int domid, remote_dom;
> evtchn_port_t local_port, remote_port;
> 
> 
> /* Get a connection to the daemon */
> xs = xs_daemon_open();
> if(xs == NULL)
> {
> perror( "---> xs_deamon_open:" );
> }
> printf( "---> xs_deamon_open OK!\n" );
> 
> 
> //get the current dom
> domid = get_domid(xs);
> int is_parent= domid % 2 == 0 ? 0 : 1;
> if(is_parent == 1)
> goto parent;
> else
> goto child;
> parent:
> printf( "---> I am first DomU!\n" );
> 
> 
> //wait for next dom to start
> sleep(30);
> remote_dom = domid + 1;
> 
> 
> //allocate a event channel
> evtchn_alloc_unbound(remote_dom, evt_handler, NULL, &local_port);
> printf("local port: %d\n", local_port);
> //bind VCPU 0
> evtchn_bind_vcpu_t bind_vcpu;
> bind_vcpu.port = local_port;
> bind_vcpu.vcpu = 0;
> HYPERVISOR_event_channel_op(EVTCHNOP_bind_vcpu, &bind_vcpu);
> 
> 
> //write_xenstore(domid, "evtchn_port", local_port);
> //wait the event
> while(1)
> {
> sleep(5);
> }
>  return 0;
> 
> 
> child:
> printf( "---> I am child DomU!\n" );
> remote_dom = domid - 1;
> //wait the previous dom to allocate event channel
> sleep(40);
> //get the remote_port and bind the channel to local_port
> //remote_port = read_xenstore(remote_dom, "evtchn_port");
> remote_port = 5;
> evtchn_bind_interdomain(remote_dom, remote_port, evt_handler, NULL, 
> &local_port);
> printf("local port: %d\n", local_port);
> 
> 

What does your evt_handler do? Have you tried printing something inside
the handler?

Wei.


> sleep(5);
> 
> 
>  //send the event
>  evtchn_send_t send;
>  send.port = local_port;
>  HYPERVISOR_event_channel_op(EVTCHNOP_send, &send);
> printf("---> send the event\n");
> 
> 
>  while(1)
>  {
>  sleep(5);
> 
> 
>  }
>  return 0;
> }






> _______________________________________________
> Minios-devel mailing list
> Minios-devel@xxxxxxxxxxxxxxxxxxxx
> http://lists.xenproject.org/cgi-bin/mailman/listinfo/minios-devel


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
http://lists.xenproject.org/cgi-bin/mailman/listinfo/minios-devel

 


Rackspace

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