xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Chao Peng <chao.p.peng@linux.intel.com>, xen-devel@lists.xen.org
Cc: keir@xen.org, Ian.Campbell@citrix.com,
	stefano.stabellini@eu.citrix.com, George.Dunlap@eu.citrix.com,
	Ian.Jackson@eu.citrix.com, JBeulich@suse.com,
	dgdegra@tycho.nsa.gov
Subject: Re: [PATCH v15 01/11] multicall: add no preemption ability between two calls
Date: Fri, 5 Sep 2014 11:46:20 +0100	[thread overview]
Message-ID: <5409947C.3020402@citrix.com> (raw)
In-Reply-To: <1409906249-6057-2-git-send-email-chao.p.peng@linux.intel.com>

On 05/09/14 09:37, Chao Peng wrote:
> Add a flag to indicate if the execution can be preempted between two
> calls. If not specified, stay preemptable.
>
> Signed-off-by: Chao Peng <chao.p.peng@linux.intel.com>
> ---
>  xen/common/multicall.c   |    5 ++++-
>  xen/include/public/xen.h |    4 ++++
>  2 files changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/xen/common/multicall.c b/xen/common/multicall.c
> index fa9d910..83b96eb 100644
> --- a/xen/common/multicall.c
> +++ b/xen/common/multicall.c
> @@ -40,6 +40,7 @@ do_multicall(
>      struct mc_state *mcs = &current->mc_state;
>      uint32_t         i;
>      int              rc = 0;
> +    bool_t           preemptable = 0;
>  
>      if ( unlikely(__test_and_set_bit(_MCSF_in_multicall, &mcs->flags)) )
>      {
> @@ -52,7 +53,7 @@ do_multicall(
>  
>      for ( i = 0; !rc && i < nr_calls; i++ )
>      {
> -        if ( i && hypercall_preempt_check() )
> +        if ( preemptable && hypercall_preempt_check() )
>              goto preempted;
>  
>          if ( unlikely(__copy_from_guest(&mcs->call, call_list, 1)) )
> @@ -61,6 +62,8 @@ do_multicall(
>              break;
>          }
>  
> +        preemptable = mcs->call.flags & MC_NO_PREEMPT;
> +

Please consider what would happen if a malicious guest set NO_PREEMPT on
every multicall entry.

IMO, two back-to-back entries whith NO_PREEMPT set is grounds for an
immediate hypercall failure.

Furthermore, what happens if one of the multicall operations pre-empts
of its own accord?

~Andrew

>          trace_multicall_call(&mcs->call);
>  
>          do_multicall_call(&mcs->call);
> diff --git a/xen/include/public/xen.h b/xen/include/public/xen.h
> index a6a2092..3f8b908 100644
> --- a/xen/include/public/xen.h
> +++ b/xen/include/public/xen.h
> @@ -550,10 +550,14 @@ DEFINE_XEN_GUEST_HANDLE(mmu_update_t);
>  struct multicall_entry {
>      xen_ulong_t op, result;
>      xen_ulong_t args[6];
> +    uint32_t flags;
>  };
>  typedef struct multicall_entry multicall_entry_t;
>  DEFINE_XEN_GUEST_HANDLE(multicall_entry_t);
>  
> +/* These flags passed in the 'flags' field of multicall_entry_t. */
> +#define MC_NO_PREEMPT    (1<<0)  /* Can't be preempted before next entry? */
> +
>  #if __XEN_INTERFACE_VERSION__ < 0x00040400
>  /*
>   * Event channel endpoints per domain (when using the 2-level ABI):

  reply	other threads:[~2014-09-05 10:46 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-05  8:37 [PATCH v15 00/11] enable Cache QoS Monitoring (CQM) feature Chao Peng
2014-09-05  8:37 ` [PATCH v15 01/11] multicall: add no preemption ability between two calls Chao Peng
2014-09-05 10:46   ` Andrew Cooper [this message]
2014-09-09  6:43     ` Chao Peng
2014-09-09 10:39       ` Jan Beulich
2014-09-09 10:51         ` Andrew Cooper
2014-09-09 11:51           ` Jan Beulich
2014-09-09 12:44             ` Andrew Cooper
2014-09-09 13:15               ` Jan Beulich
2014-09-10  1:32                 ` Chao Peng
2014-09-10  9:43                   ` Andrew Cooper
2014-09-10 10:07                     ` Jan Beulich
2014-09-10 10:15                       ` Andrew Cooper
2014-09-10 10:25                         ` Jan Beulich
2014-09-10 11:12                           ` Andrew Cooper
2014-09-12  2:55                             ` Chao Peng
2014-09-17  9:22                               ` Chao Peng
2014-09-17  9:44                                 ` Jan Beulich
2014-09-18 13:45                                   ` Chao Peng
2014-09-18 14:22                                     ` Jan Beulich
2014-09-05  8:37 ` [PATCH v15 02/11] x86: add generic resource (e.g. MSR) access hypercall Chao Peng
2014-09-05 10:59   ` Andrew Cooper
2014-09-05 11:49     ` Jan Beulich
2014-09-10  2:55     ` Chao Peng
2014-09-29 18:52       ` Konrad Rzeszutek Wilk
2014-09-30  7:45         ` Jan Beulich
2014-09-05  8:37 ` [PATCH v15 03/11] xsm: add resource operation related xsm policy Chao Peng
2014-09-05  8:37 ` [PATCH v15 04/11] tools: provide interface for generic resource access Chao Peng
2014-09-05  8:37 ` [PATCH v15 05/11] x86: detect and initialize Platform QoS Monitoring feature Chao Peng
2014-09-05 11:05   ` Andrew Cooper
2014-09-05  8:37 ` [PATCH v15 06/11] x86: dynamically attach/detach QoS monitoring service for a guest Chao Peng
2014-09-05  8:37 ` [PATCH v15 07/11] x86: collect global QoS monitoring information Chao Peng
2014-09-05  8:37 ` [PATCH v15 08/11] x86: enable QoS monitoring for each domain RMID Chao Peng
2014-09-05  8:37 ` [PATCH v15 09/11] x86: add QoS monitoring related MSRs in allowed list Chao Peng
2014-09-05  8:37 ` [PATCH v15 10/11] xsm: add platform QoS related xsm policies Chao Peng
2014-09-05  8:37 ` [PATCH v15 11/11] tools: CMDs and APIs for Platform QoS Monitoring Chao Peng

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=5409947C.3020402@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=JBeulich@suse.com \
    --cc=chao.p.peng@linux.intel.com \
    --cc=dgdegra@tycho.nsa.gov \
    --cc=keir@xen.org \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xen.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).