[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] The scenario of hypercall_preempt_check()

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,Â


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.

Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.