On 01/06/2013 10:30, Xinxin Jin wrote:> Hi all,
>
> I found there is hypercall preemption check in some hypercall handlers:
>
> #define hypercall_preempt_check() (unlikely( \
> softirq_pending(smp_processor_id()) | \
> local_events_need_delivery() \
> ))
>
> Generally speaking, if there is pending softirq or upcall events, the
> hypercall handler will exit and try to re-execute next time. I have
> two confusions on hypercall preemption:
> (1) Why pending softirq or upcall events can affect hypercall''s
> continuation ?
> (2) When do we need to do hypercall_preempt_check()? For example,
> do_mmuext_op() has this check but many other hypercall handles
don''t
> do the check. How to judge where to appy preemption check?
>
> A lot of thanks,
>
> Xinxin
The whole point of hypercall preemeption is to prevent long running
hypercalls starve VCPUs of events. Pending softirqs means that a Xen
timer has expired and needs to run, while local events will be to the
vcpu making the hypercall.
Judging when to use preeemption is harder. First of all, work out
whether it is possible/safe to split the work of the hypercall up across
continuations. Most hypercalls cant, but are fairly short. On the
other hand, any hypercall which is looping over guest arrays is a good
candidate for preemption.
~Andrew
--------------040209070703020708060208
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: 8bit
<html>
<head>
<meta content="text/html; charset=UTF-8"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">On 01/06/2013 10:30, Xinxin Jin
wrote:<br>
</div>
<blockquote
cite="mid:CAJJWZcxvm1r2+FSUisWUDyaKWrM-Qo-8fjHR0wPzQhZW_pJucw@mail.gmail.com"
type="cite"><font
face="arial,helvetica,sans-serif">
<div>Hi all,</div>
<div><br>
</div>
<div>I found there is hypercall preemption check in some
hypercall handlers: </div>
</font><font face="arial,helvetica,sans-serif">
<div><br>
</div>
<div>
#define hypercall_preempt_check() (unlikely( \</div>
<div> softirq_pending(smp_processor_id()) | \</div>
<div> local_events_need_delivery() \</div>
<div> ))</div>
<div><br>
</div>
<div>Generally speaking, if there is pending softirq or upcall
events, the hypercall handler will exit and try to re-execute
next time. I have two confusions on hypercall preemption:</div>
<div>(1) Why pending softirq or upcall events can affect
hypercall''s continuation ? </div>
<div>(2) When do we need to do hypercall_preempt_check()? For
example, do_mmuext_op() has this check but many other
hypercall handles don''t do the check. How to judge where to
appy preemption check?</div>
<div><br>
</div>
<div>A lot of thanks, </div>
</font><br clear="all">
<div><font face="arial, helvetica,
sans-serif">Xinxin</font></div>
</blockquote>
<br>
The whole point of hypercall preemeption is to prevent long running
hypercalls starve VCPUs of events. Pending softirqs means that a
Xen timer has expired and needs to run, while local events will be
to the vcpu making the hypercall.<br>
<br>
Judging when to use preeemption is harder. First of all, work out
whether it is possible/safe to split the work of the hypercall up
across continuations. Most hypercalls cant, but are fairly short.
On the other hand, any hypercall which is looping over guest arrays
is a good candidate for preemption.<br>
<br>
~Andrew<br>
</body>
</html>
--------------040209070703020708060208--
--===============1731923675211863848=Content-Type: text/plain;
charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
--===============1731923675211863848==--