Skip to contentSkip to conversation

Event Channels

DISCUSSION Julian Stecklina 3 participants 4 messages Jan 12, 2007 – Jan 18, 2007

lore
Share & tools
lore
#0 lore raw

Hello,

in an application I develop, event channel semantics seem a bit odd to me. Consider the following scenario: A Mini-OS binds an unbound port for domain 0 and issues a notification every second:

	evtchn_alloc_unbound(0, msg_handler, NULL,
			     &port);

	printk("%u %u %u\n", domid, port);

	while (1) {
		sleep(1000);
		notify_remote_via_evtchn(port);
	}

A Linux program running on Domain 0 calls bind_interdomain using domid and port to obtain local_port and watches for pending notifications:

	evtchn_port_t local_port = xc_evtchn_bind_interdomain(ev, domid, port);

	while (1) {
		evtchn_port_t port;

		port = xc_evtchn_pending(ev);
		printf("%u\n", port);
		xc_evtchn_unmask(ev, port);
	}

Now what I do not understand is, why the Linux program sees exactly one
notification and then indefinitely blocks. Any help on what I may be doing wrong is greatly appreciated. This is with xen-3.0.4-testing.

Regards,
Julian

#1 lore raw

I don't see anything wrong with your code... are you sure the minios is behaving itself and sending the events? Have you tried putting printks in there to see if it's definitely successfully operating?

Are you sure the value of "port" you're binding in dom0 is correct? If necessary, you could try adding tracing code to the Linux evtchn driver.

I can't quite see what's going wrong from the code you posted, sorry not to be more helpful.

Cheers,
Mark

Quoted 41 lines · Julian Stecklina

Hello,

in an application I develop, event channel semantics seem a bit odd to me. Consider the following scenario: A Mini-OS binds an unbound port for domain 0 and issues a notification every second:

	evtchn_alloc_unbound(0, msg_handler, NULL,
			     &port);

	printk("%u %u %u\n", domid, port);

	while (1) {
		sleep(1000);
		notify_remote_via_evtchn(port);
	}

A Linux program running on Domain 0 calls bind_interdomain using domid and port to obtain local_port and watches for pending notifications:

	evtchn_port_t local_port = xc_evtchn_bind_interdomain(ev, domid, port);

	while (1) {
		evtchn_port_t port;

		port = xc_evtchn_pending(ev);
		printf("%u\n", port);
		xc_evtchn_unmask(ev, port);
	}

Now what I do not understand is, why the Linux program sees exactly one notification and then indefinitely blocks. Any help on what I may be doing wrong is greatly appreciated. This is with xen-3.0.4-testing.

Regards,
Julian

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Signature · 4 lines
Dave: Just a question. What use is a unicyle with no seat?  And no pedals!
Mark: To answer a question with a question: What use is a skateboard?
Dave: Skateboards have wheels.
Mark: My wheel has a wheel!
#2 lore raw
Quoted 3 lines · Mark Williamson

I don't see anything wrong with your code... are you sure the minios is behaving itself and sending the events? Have you tried putting printks in there to see if it's definitely successfully operating?

Are you sure the value of "port" you're binding in dom0 is correct? If necessary, you could try adding tracing code to the Linux evtchn driver.

It seems that the hypercall that ought to perform the notification is returning ENOSYS, which is rather strange. I am going to add some printk()s to the hypervisor in order to see what is going wrong.

Regards,
Julian

#3 lore raw
In reply to Julian Stecklina
Quoted 30 lines · Julian Stecklina

Hello,

in an application I develop, event channel semantics seem a bit odd to me. Consider the following scenario: A Mini-OS binds an unbound port for domain 0 and issues a notification every second:

	evtchn_alloc_unbound(0, msg_handler, NULL,
			     &port);

	printk("%u %u %u\n", domid, port);

	while (1) {
		sleep(1000);
		notify_remote_via_evtchn(port);
	}

A Linux program running on Domain 0 calls bind_interdomain using domid and port to obtain local_port and watches for pending notifications:

	evtchn_port_t local_port = xc_evtchn_bind_interdomain(ev, domid, 
	port);

	while (1) {
		evtchn_port_t port;

		port = xc_evtchn_pending(ev);
		printf("%u\n", port);
		xc_evtchn_unmask(ev, port);
	}
Quoted 3 lines

Now what I do not understand is, why the Linux program sees exactly one notification and then indefinitely blocks. Any help on what I may be doing wrong is greatly appreciated. This is with xen-3.0.4-testing.

According to the interface guide

http://www.cl.cam.ac.uk/research/srg/netos/xen/readmes/interface/interface.html#SECTION00600000000000000000

the event is masked until the receiver clears the notification. I think you do this by sending a notify back along the same port:

while (1) {
	evtchn_port_t port;
 
	port = xc_evtchn_pending(ev);
	printf("%u\n", port);
	xc_evtchn_notify(ev, port);
	xc_evtchn_unmask(ev, port);
}