All of lore.kernel.org
 help / color / mirror / Atom feed
From: Razvan Cojocaru <rcojocaru@bitdefender.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>, xen-devel@lists.xen.org
Cc: tamas@tklengyel.com, 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,
	wei.liu2@citrix.com
Subject: Re: [PATCH 1/2] xen, libxc: Introduced XEN_DOMCTL_emulate_each_rep
Date: Thu, 17 Sep 2015 16:20:12 +0300	[thread overview]
Message-ID: <55FABE0C.8050902@bitdefender.com> (raw)
In-Reply-To: <55FAB936.2090202@citrix.com>

On 09/17/2015 03:59 PM, Andrew Cooper wrote:
> On 15/09/15 10:19, Razvan Cojocaru wrote:
>> Previously, if vm_event emulation support was enabled, then REP
>> optimizations were disabled when emulating REP-compatible
>> instructions. This patch allows fine-tuning of this behaviour by
>> providing a dedicated libxc helper function.
>>
>> Signed-off-by: Razvan Cojocaru <rcojocaru@bitdefender.com>
> 
> This disables all rep optimisations by default, so on its own is
> inappropriate.

REP optimizations are enabled by default. Emulate_each_rep is initially
set to 0, when struct hvm_domain is being initialized, which means that
REP optimizations are enabled. I've tested this and it does work, am I
missing something?

> I am also not sure that an individual domctl subop is appropriate.  Its
> purpose is to undo a performance hit caused by introspection, so should
> live as an introspection subop IMO.

Do you mean xc_monitor_emulate_each_rep() instead of
xc_domain_emulate_each_rep()?

I've placed this in its own domctl subop because it's not introspection
(or vm_event) specific. The change in
xen/arch/x86/hvm/emulate.c enables / disables REP emulation
optimizations regardless of whether there's a vm_event client or not. I
thought this might come handy for somebody else too.

>> ---
>>  tools/libxc/include/xenctrl.h    |   11 +++++++++++
>>  tools/libxc/xc_domain.c          |   18 ++++++++++++++++++
>>  xen/arch/x86/hvm/emulate.c       |    2 +-
>>  xen/common/domctl.c              |    5 +++++
>>  xen/include/asm-x86/hvm/domain.h |    1 +
>>  xen/include/public/domctl.h      |    8 ++++++++
>>  6 files changed, 44 insertions(+), 1 deletion(-)
>>
>> diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h
>> index 3482544..4ece851 100644
>> --- a/tools/libxc/include/xenctrl.h
>> +++ b/tools/libxc/include/xenctrl.h
>> @@ -643,6 +643,17 @@ int xc_domain_node_getaffinity(xc_interface *xch,
>>                                 xc_nodemap_t nodemap);
>>  
>>  /**
>> + * This function enables / disables emulation for each REP for a
>> + * REP-compatible instruction.
>> + *
>> + * @parm xch a handle to an open hypervisor interface.
>> + * @parm domid the domain id one wants to get the node affinity of.
>> + * @parm enable if 0 optimize when possible, else emulate each REP.
>> + * @return 0 on success, -1 on failure.
>> + */
>> +int xc_domain_emulate_each_rep(xc_interface *xch, uint32_t domid, int enable);
>> +
>> +/**
>>   * This function specifies the CPU affinity for a vcpu.
>>   *
>>   * There are two kinds of affinity. Soft affinity is on what CPUs a vcpu
>> diff --git a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c
>> index e7278dd..19b2e46 100644
>> --- a/tools/libxc/xc_domain.c
>> +++ b/tools/libxc/xc_domain.c
>> @@ -2555,6 +2555,24 @@ int xc_domain_soft_reset(xc_interface *xch,
>>      domctl.domain = (domid_t)domid;
>>      return do_domctl(xch, &domctl);
>>  }
>> +
>> +int xc_domain_emulate_each_rep(xc_interface *xch, uint32_t domid, int enable)
>> +{
>> +    int ret = -1;
>> +    DECLARE_DOMCTL;
>> +
>> +    domctl.cmd = XEN_DOMCTL_emulate_each_rep;
>> +    domctl.domain = (domid_t)domid;
>> +    domctl.u.emulate_each_rep.op = enable;
>> +
>> +    ret = do_domctl(xch, &domctl);
>> +
>> +    if ( ret == -ESRCH )
>> +        errno = ENOENT;
> 
> Why do you override ESRCH?  ESRCH is the expected error for a missing
> domain.

I shouldn't, really. This is a copy/paste issue - I've copied and
changed a similar function in Xen 4.4, and that code just got carried
over to this patch. I'll remove that check.


Thanks,
Razvan

  reply	other threads:[~2015-09-17 13:20 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-15  9:19 [PATCH 0/2] Introspection optimization helpers Razvan Cojocaru
2015-09-15  9:19 ` [PATCH 1/2] xen, libxc: Introduced XEN_DOMCTL_emulate_each_rep Razvan Cojocaru
2015-09-15  9:51   ` Ian Campbell
2015-09-15 15:36   ` Julien Grall
2015-09-15 15:46     ` Razvan Cojocaru
2015-09-17 12:59   ` Andrew Cooper
2015-09-17 13:20     ` Razvan Cojocaru [this message]
2015-09-17 13:37       ` Andrew Cooper
2015-09-17 13:45         ` Razvan Cojocaru
2015-09-15  9:19 ` [PATCH 2/2] xen: Introduce VM_EVENT_FLAG_SET_EIP Razvan Cojocaru
2015-09-16 15:57   ` Tamas K Lengyel
2015-09-16 16:12     ` Razvan Cojocaru
2015-09-18 19:19       ` Tamas K Lengyel
2015-09-21  8:53         ` Jan Beulich
2015-09-21  9:05           ` Razvan Cojocaru

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=55FABE0C.8050902@bitdefender.com \
    --to=rcojocaru@bitdefender.com \
    --cc=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=keir@xen.org \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=tamas@tklengyel.com \
    --cc=wei.liu2@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 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.