Sched_op hypercall small questions
Quoted 11 lines
Quoted 1 line
Quoted 1 line
Daniel Castro 09/20/11 8:18 AM >>>
Quoted 9 lines · Keir Fraser
Quoted 6 lines · Daniel Castro
Greetings all.
Some small question regarding schedule poll operation hypercall.
1. struct
sched_pollpoll.timeout is measured in what unit of time? Secs, ms? ns?
Quoted 6 lines
Quoted 1 line
It is an absolute system time (rather than a duration), in nanoseconds.
really an absolute system time?
When the timeout is set and the timeout is reached, the system behaves like if the event had been received? i.e the bit is changed?
No, the bit would remain unset - the poll times out then, it doesn't "complete".
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
2. After issuing the
hypercall_sched_op(SCHEDOP_poll, &poll); if no timeout is used in poll struct how long will I yield the CPU?Until one of the specified event channel ports is pending.
If the channel port never changes (the event never arrives) then I would yield for ever?
Yes.
Quoted 4 lines
I am trying to read from xenstore, so I have the following:
I write on my xenstore ring the query I want, then, hypercall_event_channel_op(EVTCHNOP_send ...
If I read the ring inmediatly the answer is not ready so I issue a
That would suggest an ordering problem on either or both sides.
Quoted 10 lines
hypercall_sched_op(SCHEDOP_poll, &poll);
But while I am entering the yield state the answer comes, so the event is never seen because it has already been delivered.If I use some way to wait (just for very brief instant) after the
event_channel_opsend then, when I check the ring the answer is there; And I do not need to yield the CPU.Should I issue the wait after the send, rather than when I am about to read the answer?
When you start the wait really shouldn't matter. But ordering needs to be in place so that the event only gets signaled when the consuming side can actually see what the producer put into the shared data structure. Since the signaling is done through a hypercall, there shouldn't really be anything the producer needs to do (unless your shared data is not in memory).
Jan
Quoted 13 lines · Jan Beulich
Quoted 13 lines
Quoted 1 line
Quoted 1 line
Daniel Castro 09/20/11 8:18 AM >>>
Quoted 10 lines · Keir Fraser
Quoted 6 lines · Daniel Castro
Greetings all.
Some small question regarding schedule poll operation hypercall.
1. struct
sched_pollpoll.timeout is measured in what unit of time? Secs, ms? ns?It is an absolute system time (rather than a duration), in nanoseconds.
Quoted 7 lines
Quoted 4 lines
really an absolute system time?
When the timeout is set and the timeout is reached, the system behaves like if the event had been received? i.e the bit is changed?
No, the bit would remain unset - the poll times out then, it doesn't "complete".
My Guest VM would get stuck on the hypercall call, like if it was an infinite loop?
And once the timeout occurs or the event get delivered, then the hypercall would return, right?
Thanks
Quoted 43 lines
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
2. After issuing the
hypercall_sched_op(SCHEDOP_poll, &poll); if no timeout is used in poll struct how long will I yield the CPU?Until one of the specified event channel ports is pending.
If the channel port never changes (the event never arrives) then I would yield for ever?
Yes.
Quoted 4 lines
I am trying to read from xenstore, so I have the following:
I write on my xenstore ring the query I want, then, hypercall_event_channel_op(EVTCHNOP_send ...
If I read the ring inmediatly the answer is not ready so I issue aThat would suggest an ordering problem on either or both sides.
Quoted 10 lines
hypercall_sched_op(SCHEDOP_poll, &poll);
But while I am entering the yield state the answer comes, so the event is never seen because it has already been delivered.If I use some way to wait (just for very brief instant) after the
event_channel_opsend then, when I check the ring the answer is there; And I do not need to yield the CPU.Should I issue the wait after the send, rather than when I am about to read the answer?
When you start the wait really shouldn't matter. But ordering needs to be in place so that the event only gets signaled when the consuming side can actually see what the producer put into the shared data structure. Since the signaling is done through a hypercall, there shouldn't really be anything the producer needs to do (unless your shared data is not in memory).
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Signature · 7 lines
+-=====---------------------------+ | +---------------------------------+ | This space intentionally blank for notetaking. | | | Daniel Castro, | | | | Consultant/Programmer.| | | | U Andes | +-------------------------------------+
Quoted 17 lines
Quoted 1 line
Quoted 1 line · Daniel Castro
Quoted 15 lines · Jan Beulich
Quoted 15 lines
Quoted 1 line
Quoted 1 line
Daniel Castro 09/20/11 8:18 AM >>>
Quoted 10 lines · Keir Fraser
Quoted 6 lines · Daniel Castro
Greetings all.
Some small question regarding schedule poll operation hypercall.
1. struct
sched_pollpoll.timeout is measured in what unit of time? Secs, ms? ns?It is an absolute system time (rather than a duration), in nanoseconds.
really an absolute system time?
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
When the timeout is set and the timeout is reached, the system behaves like if the event had been received? i.e the bit is changed?
No, the bit would remain unset - the poll times out then, it doesn't "complete".
My Guest VM would get stuck on the hypercall call, like if it was an infinite loop?
I'm not following. Of course, if you blindly and constantly re-issue the hypercall, then you'd be stuck in a loop. Allowing to prevent that is what the timeout is for.
Quoted 2 lines
And once the timeout occurs or the event get delivered, then the hypercall would return, right?
Yes.
Jan
Quoted 23 lines · Jan Beulich
Quoted 23 lines
Quoted 1 line
Quoted 1 line · Daniel Castro
Quoted 20 lines · Jan Beulich
Quoted 11 lines
Quoted 1 line
Quoted 1 line
Daniel Castro 09/20/11 8:18 AM >>>
Quoted 9 lines · Keir Fraser
Quoted 6 lines · Daniel Castro
Greetings all.
Some small question regarding schedule poll operation hypercall.
1. struct
sched_pollpoll.timeout is measured in what unit of time? Secs, ms? ns?Quoted 6 lines
Quoted 1 line
It is an absolute system time (rather than a duration), in nanoseconds.
really an absolute system time?
When the timeout is set and the timeout is reached, the system behaves like if the event had been received? i.e the bit is changed?
No, the bit would remain unset - the poll times out then, it doesn't "complete".
Quoted 6 lines
Quoted 2 lines
My Guest VM would get stuck on the hypercall call, like if it was an infinite loop?
I'm not following. Of course, if you blindly and constantly re-issue the hypercall, then you'd be stuck in a loop. Allowing to prevent that is what the timeout is for.
What I am trying is writing to the xenstore ring, issue the send hypercall, then wait (poll hypercall) for event, then read answer from ring.
The waiting is not working, but If I wait enough time, the ring will contain the answer, but apparently I have a problem with my event channel port. So to test this theory I am using event channel status hypercall, and I get:
Status 2 (meaning interdomain connected)
VCPU 0
The Union reports dom 32752 and port 2.
Right now, there are two things that jump to my mind, first when I issue the poll hypercall the system continues execution, instead of yielding CPU unitl event arrives. If it were never to arrive it should yield infinitely, right?
Second, the bit is never set. Or it is being undone before I can check it.
Thanks,
Daniel
Quoted 9 lines
Quoted 3 lines
And once the timeout occurs or the event get delivered, then the hypercall would return, right?
Yes.
Jan
Signature · 7 lines
+-=====---------------------------+ | +---------------------------------+ | This space intentionally blank for notetaking. | | | Daniel Castro, | | | | Consultant/Programmer.| | | | U Andes | +-------------------------------------+
Quoted 4 lines
Quoted 1 line
Quoted 1 line · Daniel Castro
What I am trying is writing to the xenstore ring, issue the send hypercall, then wait (poll hypercall) for event, then read answer from ring.
That reads as if you do all this from the same thread in the same domain. Which might be your problem, particularly if additionally you use the same event channel for signaling production and consumption.
Quoted 7 lines
The waiting is not working, but If I wait enough time, the ring will contain the answer, but apparently I have a problem with my event channel port. So to test this theory I am using event channel status hypercall, and I get:
Status 2 (meaning interdomain connected)
VCPU 0
The Union reports dom 32752 and port 2.
32752 == DOMID_SELF. And I can't see where the hypercall implementation would return DOMID_SELF here.
Quoted 4 lines
Right now, there are two things that jump to my mind, first when I issue the poll hypercall the system continues execution, instead of yielding CPU unitl event arrives. If it were never to arrive it should yield infinitely, right?
Without a timeout, yes.
Quoted 1 line
Second, the bit is never set. Or it is being undone before I can check it.
That would need to be you to undo it.
Jan
Quoted 8 lines · Jan Beulich
Quoted 4 lines
Quoted 1 line
Quoted 1 line · Daniel Castro
What I am trying is writing to the xenstore ring, issue the send hypercall, then wait (poll hypercall) for event, then read answer from ring.
That reads as if you do all this from the same thread in the same domain. Which might be your problem, particularly if additionally you use the same event channel for signaling production and consumption.
Yes you are correct, I have all in the same thread. But I have no other choice, since this is run inside hvmloader when the BIOS is being deployed.
Quoted 10 lines
Quoted 7 lines
The waiting is not working, but If I wait enough time, the ring will contain the answer, but apparently I have a problem with my event channel port. So to test this theory I am using event channel status hypercall, and I get:
Status 2 (meaning interdomain connected)
VCPU 0
The Union reports dom 32752 and port 2.32752 ==
DOMID_SELF. And I can't see where the hypercall implementation would returnDOMID_SELFhere.
Sorry I had a coding error, but it is corrected (I did not call the union correctly, so I ended up calling dom in the main struct). Anyway here is the output corrected:
Xenbus rings @0xfeffc000, event channel 2
Event Chn 2 Status 2 VCPU 0.
Event is interdomain (2) union dom 983040 union port 42
Thanks,
Daniel
Quoted 15 lines
Quoted 5 lines
Right now, there are two things that jump to my mind, first when I issue the poll hypercall the system continues execution, instead of yielding CPU unitl event arrives. If it were never to arrive it should yield infinitely, right?
Without a timeout, yes.
Quoted 1 line
Second, the bit is never set. Or it is being undone before I can check it.
That would need to be you to undo it.
Jan
Signature · 7 lines
+-=====---------------------------+ | +---------------------------------+ | This space intentionally blank for notetaking. | | | Daniel Castro, | | | | Consultant/Programmer.| | | | U Andes | +-------------------------------------+
Quoted 7 lines
Quoted 1 line
Quoted 1 line · Daniel Castro
Quoted 5 lines · Jan Beulich
Quoted 4 lines
Quoted 1 line
Quoted 1 line · Daniel Castro
What I am trying is writing to the xenstore ring, issue the send hypercall, then wait (poll hypercall) for event, then read answer from ring.
Quoted 7 lines
Quoted 3 lines
That reads as if you do all this from the same thread in the same domain. Which might be your problem, particularly if additionally you use the same event channel for signaling production and consumption.
Yes you are correct, I have all in the same thread. But I have no other choice, since this is run inside hvmloader when the BIOS is being deployed.
What do you need the synchronization/signaling/polling for then?
Jan
Quoted 10 lines · Daniel Castro
Quoted 2 lines · Jan Beulich
32752 ==
DOMID_SELF. And I can't see where the hypercall implementation would returnDOMID_SELFhere.Sorry I had a coding error, but it is corrected (I did not call the union correctly, so I ended up calling dom in the main struct). Anyway here is the output corrected:
Xenbus rings @0xfeffc000, event channel 2
Event Chn 2 Status 2 VCPU 0.
Event is interdomain (2) union dom 983040 union port 42
That's dom 0xf0000 but domid_t is a 16 bit value so there's no way you really have that value -- I think you must have used the wrong printf format specifier. The lower 16 bits are 0 which makes sense.
You could confirm using lsevtchn.
Ian.
Quoted 8 lines · Jan Beulich
Quoted 8 lines
The waiting is not working, but If I wait enough time, the ring will contain the answer, but apparently I have a problem with my event channel port. So to test this theory I am using event channel status hypercall, and I get:
Status 2 (meaning interdomain connected)
VCPU 0
The Union reports dom 32752 and port 2.
You can also use lsevtchn in dom0, it lives in the /usr/lib/xen/bin dir. You can give it a domid and therefore check that you can see both ends look sane e.g. if I run it on an hvm domain I see:
# lsevtchn 3 1: VCPU 0: Interdomain (Connected) - Remote Domain 0, Port 51 2: VCPU 1: Interdomain (Connected) - Remote Domain 0, Port 52 3: VCPU 0: Interdomain (Connected) - Remote Domain 0, Port 49 4: VCPU 0: Interdomain (Connected) - Remote Domain 0, Port 50
and in dom0 I see:
# lsevtchn 0 | grep Domain.3 49: VCPU 0: Interdomain (Connected) - Remote Domain 3, Port 3 50: VCPU 0: Interdomain (Connected) - Remote Domain 3, Port 4 51: VCPU 3: Interdomain (Connected) - Remote Domain 3, Port 1 52: VCPU 3: Interdomain (Connected) - Remote Domain 3, Port 2
i.e. everything matches up.
Quoted 2 lines
32752 ==
DOMID_SELF. And I can't see where the hypercall implementation would returnDOMID_SELFhere.
Daniel, are you 100% sure you are printing/looking at evtchn_status_t->u.interdomain.dom and not evtchn_status_t->dom?
Oh wait, you discovered that you weren't already.
Ian.