WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] Sched_op hypercall small questions

To: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
Subject: Re: [Xen-devel] Sched_op hypercall small questions
From: Daniel Castro <evil.dani@xxxxxxxxx>
Date: Thu, 22 Sep 2011 16:43:29 +0900
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Thu, 22 Sep 2011 00:44:02 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=W+SAL0ssgUsoNPed35dLzcREm1vGW3qf5oknOh9MZfA=; b=YxYyx7+5tzULsU0/Alfxj+PvTW1WecxIHa/qvkH+Mk3LLjbfQLzOJMG9NjJ4SYLqU7 aAX86wU3PK+ljI59VTk4nEexkwcel//oAEYN4qB3oigHrXzhILyhbMPr2hNkrfJ0Pu/W WsgyQutqnFWYtM4zdNr1StAHr5VX9fP6yTYOY=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1316673048.27431.7.camel@xxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <CAP2B85_rPbB=hZpKJYSPgC59jU=YG6deD4ZkWMmXwtMV4un1mg@xxxxxxxxxxxxxx> <CA9D757C.2119E%keir.xen@xxxxxxxxx> <CAP2B85-e64NKts_iC21Bh0OL3X3nUh4jLriYfE2+stHkPfMFWg@xxxxxxxxxxxxxx> <4E793DC4.7080808@xxxxxxxx> <CAP2B859vtSK_tC0J6HWB_m6hjHKM18vZ7Qh6ABFejCiEfxs+6g@xxxxxxxxxxxxxx> <CAP2B85-_kMLh0C6NCBpRbUchNYw96drLVJu33EdKV25jJ=p+4g@xxxxxxxxxxxxxx> <1316673048.27431.7.camel@xxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Thu, Sep 22, 2011 at 3:30 PM, Ian Campbell <Ian.Campbell@xxxxxxxxxx> wrote:
> On Thu, 2011-09-22 at 06:41 +0100, Daniel Castro wrote:
>> On Wed, Sep 21, 2011 at 10:28 AM, Jeremy Fitzhardinge <jeremy@xxxxxxxx> 
>> wrote:
>> > On 09/19/2011 11:17 PM, Daniel Castro wrote:
>> >> On Tue, Sep 20, 2011 at 2:41 PM, Keir Fraser <keir.xen@xxxxxxxxx> wrote:
>> >>> On 19/09/2011 22:21, "Daniel Castro" <evil.dani@xxxxxxxxx> wrote:
>> >>>
>> >>>> Greetings all.
>> >>>>
>> >>>> Some small question regarding schedule poll operation hypercall.
>> >>>>
>> >>>> 1. struct sched_poll poll.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?
>> >>
>> >> 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?
>> >
>> > You specify the timeout in the the form "wake up by time t".  If t is in
>> > the past, it times out immediately.
>> >
>> >>>> 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?
>> >
>> > If you have events unmasked and you get an unmasked event, then it will
>> > go into the event handler.
>>
>> My vcpu[0].evntchn_upcall_mask is 0, does this prevents the guest from
>> receiving events?
>
> IIRC it's vice versa: setting it to 1 prevents the guest from receiving
> events.
>
>> would that also explain why poll hypercall returns
>> immediately?
>
> I don't see any reference to the masks in
> xen/common/schedule.c:do_poll() so I don't think so.
>
>>  According to Xen's Definitive Guide evntchn_upcall_mask
>> is unset at boot (my case exactly) so if it is 0 from the start and
>> the guest (me) has to change it to 1 in order to receive events.
>
> I think that's the wrong way round.
>
>> How can I change the flag, I tried changing the value but it does not work
>> like that apparently.
>
> evtchn_upcall_mask is the global mask but you may also need to unmask
> the specific evtchn, which means clearing the relevant bit in
> evtchn_mask.

Thanks for the answer Ian, one question: If I do not manually change
the mask bit, then after writing to the ring and the response arrives
how can I be sure that xenstore is delivering an event? I am
suspecting that xenstore does not use event notification for simple
read and write operations. Could I be right?

>
>>
>> Thanks
>> >
>> >>>> 3. If I issue the hypercall and the event never comes is it possible
>> >>>> to to yield the CPU for ever?
>> >>> Yes, if you do not specify a timeout.
>> >> Keir thanks for the answer.
>> >>
>> >> 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
>> >> 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.
>> >
>> > It generally only makes sense to poll on masked events.
>> >
>> >>
>> >> If I use some way to wait (just for very brief instant) after the
>> >> event_channel_op send 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?
>> >
>> > What environment is this in?
>> >
>> >    J
>> >
>>
>>
>>
>> --
>> +-=====---------------------------+
>> | +---------------------------------+ | This space intentionally blank
>> for notetaking.
>> | |   | Daniel Castro,                |
>> | |   | Consultant/Programmer.|
>> | |   | U Andes                         |
>> +-------------------------------------+
>>
>>
>>
>
>
>



-- 
+-=====---------------------------+
| +---------------------------------+ | This space intentionally blank
for notetaking.
| |   | Daniel Castro,                |
| |   | Consultant/Programmer.|
| |   | U Andes                         |
+-------------------------------------+

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel