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

Re: [Xen-devel] [PATCH V2 1/2] xen, libxc: Fine grained control of REP emulation optimizations



>>> On 21.09.15 at 15:31, <rcojocaru@xxxxxxxxxxxxxxx> wrote:
> --- a/xen/arch/x86/hvm/emulate.c
> +++ b/xen/arch/x86/hvm/emulate.c
> @@ -514,7 +514,8 @@ static int hvmemul_virtual_to_linear(
>       * being triggered for repeated writes to a whole page.
>       */
>      *reps = min_t(unsigned long, *reps,
> -                  unlikely(current->domain->arch.mem_access_emulate_enabled)
> +                  unlikely(current->domain->arch.mem_access_emulate_enabled 
> &&
> +                           current->domain->arch.mem_access_emulate_each_rep)
>                             ? 1 : 4096);

unlikely() should not wrap compound conditions, or else its effect of
eliminating mis-predicted branches from the fast path won't be
achieved. In the case here I wonder though whether you couldn't
simply test only ->arch.mem_access_emulate_each_rep.

> --- a/xen/arch/x86/monitor.c
> +++ b/xen/arch/x86/monitor.c
> @@ -79,6 +79,12 @@ int monitor_domctl(struct domain *d, struct 
> xen_domctl_monitor_op *mop)
>          return 0;
>      }
>  
> +    if ( mop->op == XEN_DOMCTL_MONITOR_OP_EMULATE_EACH_REP )
> +    {
> +        d->arch.mem_access_emulate_each_rep = !!mop->event;
> +        return 0;
> +    }

Considering that there's another "if(mop->op == ...)" right above
this, these two together should become another switch().

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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