Skip to contentSkip to conversation

suspending execution within Xen

DISCUSSION Avi Kivity 3 participants 5 messages Jun 29, 2005

lore
Share & tools
lore

Avi Kivity

author
#0 lore raw

I am trying to send a stream of events about one domain to another. so I set up a ring between the monitoring domain and xen (not the monitored domain). however I am having trouble blocking when buffer space runs out.

the intuitive

   while (!buffer_space_available())
       do_block();

does not work; do_block() appears to return to guest context, not to the while loop (is this correct?). the other alternative,

    while (!buffer_space_available())
	if (!test_and_set_bit(EDF_BLOCKED, &ed->ed_flags))
	    domain_sleep(ed);

freezes xen solid.

is there a way to do it? am I missing something obvious?

Avi

#1 lore raw

may be worth using wait queues here? (or schedule())

Quoted 21 lines · Avi Kivity

I am trying to send a stream of events about one domain to another. so I set up a ring between the monitoring domain and xen (not the monitored domain). however I am having trouble blocking when buffer space runs out.

the intuitive

   while (!buffer_space_available())
       do_block();

does not work; do_block() appears to return to guest context, not to the while loop (is this correct?). the other alternative,

    while (!buffer_space_available())
	if (!test_and_set_bit(EDF_BLOCKED, &ed->ed_flags))
	    domain_sleep(ed);

freezes xen solid.

is there a way to do it? am I missing something obvious?

Quoted 7 lines

Avi

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

--
Timenkov Yuri

#3 lore raw
In reply to Avi Kivity

Xen on x86 doesn't support stack-based continuations within the hypervisor -- that is, there is no way to deschedule the current domain within Xen and then automatically return to your current point of execution when you are re-scheduled.

If you have further work to do, before returning to guest context, when the domain is rescheduled then you need to install your own hook function into vcpu->arch.schedule_tail. You'll need to xmalloc any space you need for continuation data.

-- Keir

Quoted 28 lines · Avi Kivity

I am trying to send a stream of events about one domain to another. so I set up a ring between the monitoring domain and xen (not the monitored domain). however I am having trouble blocking when buffer space runs out.

the intuitive

   while (!buffer_space_available())
       do_block();

does not work; do_block() appears to return to guest context, not to the while loop (is this correct?). the other alternative,

    while (!buffer_space_available())
	if (!test_and_set_bit(EDF_BLOCKED, &ed->ed_flags))
	    domain_sleep(ed);

freezes xen solid.

is there a way to do it? am I missing something obvious?

Avi

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

#2 lore raw
In reply to Timenkov Yuri
Quoted 1 line · Timenkov Yuri

may be worth using wait queues here? (or schedule())

Xen's not Linux: the above primitives/functions do not exist.

-- Keir

author
#4 lore raw
In reply to Keir Fraser
Quoted 10 lines · Keir Fraser

Xen on x86 doesn't support stack-based continuations within the hypervisor -- that is, there is no way to deschedule the current domain within Xen and then automatically return to your current point of execution when you are re-scheduled.

If you have further work to do, before returning to guest context, when the domain is rescheduled then you need to install your own hook function into vcpu->arch.schedule_tail. You'll need to xmalloc any space you need for continuation data.

this will probably serve. thanks.

Quoted 35 lines

-- Keir

Quoted 30 lines · Avi Kivity

I am trying to send a stream of events about one domain to another. so I
set up a ring between the monitoring domain and xen (not the monitored domain). however I am having trouble blocking when buffer space runs out.

the intuitive

   while (!buffer_space_available())
       do_block();

does not work; do_block() appears to return to guest context, not to the
while loop (is this correct?). the other alternative,

    while (!buffer_space_available())
	if (!test_and_set_bit(EDF_BLOCKED, &ed->ed_flags))
	    domain_sleep(ed);

freezes xen solid.

is there a way to do it? am I missing something obvious?

Avi

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