WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH] multicall: don't ignore failure from __copy_to_g

To: Jan Beulich <JBeulich@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] multicall: don't ignore failure from __copy_to_guest() upon preemption
From: Keir Fraser <keir.xen@xxxxxxxxx>
Date: Fri, 11 Nov 2011 13:13:51 +0000
Cc:
Delivery-date: Fri, 11 Nov 2011 05:16:29 -0800
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=user-agent:date:subject:from:to:message-id:thread-topic :thread-index:in-reply-to:mime-version:content-type :content-transfer-encoding; bh=4q989XuWL9EpO32mKrXZqPY+eto6UtcCKe/3gIj1wxs=; b=WKpQ6IL8KyCtlewn0Cm07ihAAxJNvO0HpvQ+rTPyOW+u3LUY2Kd7C9eKC9o3J5aqbp FIs04idxvDbUvyqylr2gCO7HUJMFdnFKRhor4sZs57o5uMePUPq79c0d3oLRytG8BeWL DhRV21W5pOV5GsTR422sePp51icXK3m+ev7Qo=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <4EBD122E0200007800060675@xxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: Acygc8E0T/YJ2Cd6ukaElZ5+ZREOjQ==
Thread-topic: [Xen-devel] [PATCH] multicall: don't ignore failure from __copy_to_guest() upon preemption
User-agent: Microsoft-Entourage/12.31.0.110725
On 11/11/2011 11:16, "Jan Beulich" <JBeulich@xxxxxxxx> wrote:

> At once adjust perf counter updates to also count calls from here even
> if a guest memory access failed.
> 
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

Acked-by: Keir Fraser <keir@xxxxxxx>

> --- a/xen/common/multicall.c
> +++ b/xen/common/multicall.c
> @@ -25,6 +25,7 @@ do_multicall(
>  {
>      struct mc_state *mcs = &current->mc_state;
>      unsigned int     i;
> +    int              rc = 0;
>  
>      if ( unlikely(__test_and_set_bit(_MCSF_in_multicall, &mcs->flags)) )
>      {
> @@ -33,15 +34,18 @@ do_multicall(
>      }
>  
>      if ( unlikely(!guest_handle_okay(call_list, nr_calls)) )
> -        goto fault;
> +        rc = -EFAULT;
>  
> -    for ( i = 0; i < nr_calls; i++ )
> +    for ( i = 0; !rc && i < nr_calls; i++ )
>      {
>          if ( hypercall_preempt_check() )
>              goto preempted;
>  
>          if ( unlikely(__copy_from_guest(&mcs->call, call_list, 1)) )
> -            goto fault;
> +        {
> +            rc = -EFAULT;
> +            break;
> +        }
>  
>          do_multicall_call(&mcs->call);
>  
> @@ -58,30 +62,25 @@ do_multicall(
>  #endif
>  
>          if ( unlikely(__copy_field_to_guest(call_list, &mcs->call, result)) )
> -            goto fault;
> -
> -        if ( test_bit(_MCSF_call_preempted, &mcs->flags) )
> +            rc = -EFAULT;
> +        else if ( test_bit(_MCSF_call_preempted, &mcs->flags) )
>          {
>              /* Translate sub-call continuation to guest layout */
>              xlat_multicall_entry(mcs);
>  
>              /* Copy the sub-call continuation. */
> -            (void)__copy_to_guest(call_list, &mcs->call, 1);
> -            goto preempted;
> +            if ( likely(!__copy_to_guest(call_list, &mcs->call, 1)) )
> +                goto preempted;
> +            rc = -EFAULT;
>          }
> -
> -        guest_handle_add_offset(call_list, 1);
> +        else
> +            guest_handle_add_offset(call_list, 1);
>      }
>  
>      perfc_incr(calls_to_multicall);
> -    perfc_add(calls_from_multicall, nr_calls);
> -    mcs->flags = 0;
> -    return 0;
> -
> - fault:
> -    perfc_incr(calls_to_multicall);
> +    perfc_add(calls_from_multicall, i);
>      mcs->flags = 0;
> -    return -EFAULT;
> +    return rc;
>  
>   preempted:
>      perfc_add(calls_from_multicall, i);
> 
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>