* The scenario of hypercall_preempt_check()
@ 2013-06-01 9:30 Xinxin Jin
2013-06-01 11:05 ` Andrew Cooper
0 siblings, 1 reply; 3+ messages in thread
From: Xinxin Jin @ 2013-06-01 9:30 UTC (permalink / raw)
To: Xen-devel
[-- Attachment #1.1: Type: text/plain, Size: 717 bytes --]
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
[-- Attachment #1.2: Type: text/html, Size: 1082 bytes --]
[-- Attachment #2: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: The scenario of hypercall_preempt_check()
2013-06-01 9:30 The scenario of hypercall_preempt_check() Xinxin Jin
@ 2013-06-01 11:05 ` Andrew Cooper
2013-06-03 10:33 ` George Dunlap
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Cooper @ 2013-06-01 11:05 UTC (permalink / raw)
To: Xinxin Jin; +Cc: Xen-devel@lists.xen.org
[-- Attachment #1.1: Type: text/plain, Size: 1347 bytes --]
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
[-- Attachment #1.2: Type: text/html, Size: 2337 bytes --]
[-- Attachment #2: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: The scenario of hypercall_preempt_check()
2013-06-01 11:05 ` Andrew Cooper
@ 2013-06-03 10:33 ` George Dunlap
0 siblings, 0 replies; 3+ messages in thread
From: George Dunlap @ 2013-06-03 10:33 UTC (permalink / raw)
To: Andrew Cooper; +Cc: Xinxin Jin, Xen-devel@lists.xen.org
On Sat, Jun 1, 2013 at 12:05 PM, Andrew Cooper
<andrew.cooper3@citrix.com> wrote:
> 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.
In addition to allowing events to be delivered to vcpus, it also
allows Xen to switch to other vcpus, to prevent one VM making really
long hypercalls from locking up the whole system.
-George
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-06-03 10:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-01 9:30 The scenario of hypercall_preempt_check() Xinxin Jin
2013-06-01 11:05 ` Andrew Cooper
2013-06-03 10:33 ` George Dunlap
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.