All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xinxin Jin <xinxinjin89@gmail.com>
Cc: "Xen-devel@lists.xen.org" <Xen-devel@lists.xen.org>
Subject: Re: The scenario of hypercall_preempt_check()
Date: Sat, 1 Jun 2013 12:05:53 +0100	[thread overview]
Message-ID: <51A9D591.5060009@citrix.com> (raw)
In-Reply-To: <CAJJWZcxvm1r2+FSUisWUDyaKWrM-Qo-8fjHR0wPzQhZW_pJucw@mail.gmail.com>


[-- 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

  reply	other threads:[~2013-06-01 11:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-01  9:30 The scenario of hypercall_preempt_check() Xinxin Jin
2013-06-01 11:05 ` Andrew Cooper [this message]
2013-06-03 10:33   ` George Dunlap

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51A9D591.5060009@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=Xen-devel@lists.xen.org \
    --cc=xinxinjin89@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.