All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: xen-devel <xen-devel@lists.xenproject.org>, Keir Fraser <keir@xen.org>
Subject: Re: [PATCH 1/2] common: make hypercall preemption checks consistent
Date: Tue, 4 Mar 2014 11:29:42 +0000	[thread overview]
Message-ID: <5315B926.6030306@citrix.com> (raw)
In-Reply-To: <5315C6160200007800120CF3@nat28.tlf.novell.com>


[-- Attachment #1.1: Type: text/plain, Size: 2769 bytes --]

On 04/03/14 11:24, Jan Beulich wrote:
> - never preempt on the first iteration (ensure forward progress)
> - do cheap checks first
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>

>
> --- a/xen/common/memory.c
> +++ b/xen/common/memory.c
> @@ -63,7 +63,7 @@ static void increase_reservation(struct 
>  
>      for ( i = a->nr_done; i < a->nr_extents; i++ )
>      {
> -        if ( hypercall_preempt_check() )
> +        if ( i != a->nr_done && hypercall_preempt_check() )
>          {
>              a->preempted = 1;
>              goto out;
> @@ -109,7 +109,7 @@ static void populate_physmap(struct memo
>  
>      for ( i = a->nr_done; i < a->nr_extents; i++ )
>      {
> -        if ( hypercall_preempt_check() )
> +        if ( i != a->nr_done && hypercall_preempt_check() )
>          {
>              a->preempted = 1;
>              goto out;
> @@ -268,7 +268,7 @@ static void decrease_reservation(struct 
>  
>      for ( i = a->nr_done; i < a->nr_extents; i++ )
>      {
> -        if ( hypercall_preempt_check() && i != a->nr_done )
> +        if ( i != a->nr_done && hypercall_preempt_check() )
>          {
>              a->preempted = 1;
>              goto out;
> @@ -398,7 +398,8 @@ static long memory_exchange(XEN_GUEST_HA
>            i < (exch.in.nr_extents >> in_chunk_order);
>            i++ )
>      {
> -        if ( hypercall_preempt_check() )
> +        if ( i != (exch.nr_exchanged >> in_chunk_order) &&
> +             hypercall_preempt_check() )
>          {
>              exch.nr_exchanged = i << in_chunk_order;
>              rcu_unlock_domain(d);
> --- a/xen/common/multicall.c
> +++ b/xen/common/multicall.c
> @@ -52,7 +52,7 @@ do_multicall(
>  
>      for ( i = 0; !rc && i < nr_calls; i++ )
>      {
> -        if ( hypercall_preempt_check() )
> +        if ( i && hypercall_preempt_check() )
>              goto preempted;
>  
>          if ( unlikely(__copy_from_guest(&mcs->call, call_list, 1)) )
> --- a/xen/drivers/char/console.c
> +++ b/xen/drivers/char/console.c
> @@ -375,12 +375,12 @@ static DECLARE_SOFTIRQ_TASKLET(notify_do
>  static long guest_console_write(XEN_GUEST_HANDLE_PARAM(char) buffer, int count)
>  {
>      char kbuf[128];
> -    int kcount;
> +    int kcount = 0;
>      struct domain *cd = current->domain;
>  
>      while ( count > 0 )
>      {
> -        if ( hypercall_preempt_check() )
> +        if ( kcount && hypercall_preempt_check() )
>              return hypercall_create_continuation(
>                  __HYPERVISOR_console_io, "iih",
>                  CONSOLEIO_write, count, buffer);
>
>
>
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel


[-- Attachment #1.2: Type: text/html, Size: 3698 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:[~2014-03-04 11:29 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-04 11:21 [PATCH 0/2] make hypercall preemption checks consistent Jan Beulich
2014-03-04 11:24 ` [PATCH 1/2] common: " Jan Beulich
2014-03-04 11:29   ` Andrew Cooper [this message]
2014-03-04 11:26 ` [PATCH 2/2] x86: " Jan Beulich
2014-03-04 11:35   ` Andrew Cooper
2014-03-04 11:30 ` [PATCH 0/2] " Jan Beulich
2014-03-11 11:38   ` Ian Campbell
2014-03-04 11:46 ` Tim Deegan
2014-03-04 11:52 ` Andrew Cooper
2014-03-04 12:00   ` Jan Beulich
2014-03-04 12:10     ` David Vrabel
2014-03-04 13:06       ` Jan Beulich
2014-03-04 14:07         ` David Vrabel
2014-03-12  9:35 ` Ping: " Jan Beulich
2014-03-13 10:26 ` Keir Fraser

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=5315B926.6030306@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=keir@xen.org \
    --cc=xen-devel@lists.xenproject.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 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.