All of lore.kernel.org
 help / color / mirror / Atom feed
From: Don Slutz <don.slutz@gmail.com>
To: George Dunlap <george.dunlap@eu.citrix.com>,
	Don Slutz <dslutz@verizon.com>,
	xen-devel@lists.xen.org
Cc: Kevin Tian <kevin.tian@intel.com>, Keir Fraser <keir@xen.org>,
	Ian Campbell <ian.campbell@citrix.com>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>,
	Eddie Dong <eddie.dong@intel.com>, Tim Deegan <tim@xen.org>,
	Jan Beulich <jbeulich@suse.com>,
	Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com>,
	Jun Nakajima <jun.nakajima@intel.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Subject: Re: [PATCH v11 9/9] Add xentrace to vmware_port
Date: Thu, 04 Jun 2015 08:31:23 -0400	[thread overview]
Message-ID: <5570451B.6000903@Gmail.com> (raw)
In-Reply-To: <55703478.3010407@eu.citrix.com>

On 06/04/15 07:20, George Dunlap wrote:
> On 05/22/2015 04:50 PM, Don Slutz wrote:
>> Also added missing TRAP_DEBUG & VLAPIC.
>>
>> Signed-off-by: Don Slutz <dslutz@verizon.com>
>> Acked-by: Ian Campbell <ian.campbell@citrix.com>
>> ---
>> v11:
>>   No change
>>
>> v10:
>>   Added Acked-by: Ian Campbell
>>   Added back in the trace point calls.
>>
>>     Why is cmd in this patch?
>>       Because the trace points use it.
>>
>> v9:
>>   Dropped unneed VMPORT_UNHANDLED, VMPORT_DECODE.
>>
>> v7:
>>       Dropped some of the new traces.
>>       Added HVMTRACE_ND7.
>>
>> v6:
>>       Dropped the attempt to use svm_nextrip_insn_length via
>>       __get_instruction_length (added in v2).  Just always look
>>       at upto 15 bytes on AMD.
>>
>> v5:
>>       exitinfo1 is used twice.
>>         Fixed.
>>
>>  tools/xentrace/formats           |  5 +++++
>>  xen/arch/x86/hvm/io.c            |  3 +++
>>  xen/arch/x86/hvm/vmware/vmport.c | 17 ++++++++++++++---
>>  xen/include/asm-x86/hvm/trace.h  | 22 ++++++++++++++++++++++
>>  xen/include/public/trace.h       |  3 +++
>>  5 files changed, 47 insertions(+), 3 deletions(-)
>>
>> diff --git a/tools/xentrace/formats b/tools/xentrace/formats
>> index 5d7b72a..eec65f4 100644
>> --- a/tools/xentrace/formats
>> +++ b/tools/xentrace/formats
>> @@ -79,6 +79,11 @@
>>  0x00082020  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  INTR_WINDOW [ value = 0x%(1)08x ]
>>  0x00082021  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  NPF         [ gpa = 0x%(2)08x%(1)08x mfn = 0x%(4)08x%(3)08x qual = 0x%(5)04x p2mt = 0x%(6)04x ]
>>  0x00082023  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  TRAP        [ vector = 0x%(1)02x ]
>> +0x00082024  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  TRAP_DEBUG  [ exit_qualification = 0x%(1)08x ]
>> +0x00082025  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  VLAPIC
>> +0x00082026  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  VMPORT_HANDLED   [ cmd = %(1)d eax = 0x%(2)08x ebx = 0x%(3)08x ecx = 0x%(4)08x edx = 0x%(5)08x esi = 0x%(6)08x edi = 0x%(7)08x ]
>> +0x00082027  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  VMPORT_IGNORED   [ port = %(1)d eax = 0x%(2)08x ebx = 0x%(3)08x ecx = 0x%(4)08x edx = 0x%(5)08x esi = 0x%(6)08x edi = 0x%(7)08x ]
>> +0x00082028  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  VMPORT_QEMU      [ eax = 0x%(1)08x ebx = 0x%(2)08x ecx = 0x%(3)08x edx = 0x%(4)08x esi = 0x%(5)08x edi = 0x%(6)08x ]
>>  
>>  0x0010f001  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  page_grant_map      [ domid = %(1)d ]
>>  0x0010f002  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  page_grant_unmap    [ domid = %(1)d ]
>> diff --git a/xen/arch/x86/hvm/io.c b/xen/arch/x86/hvm/io.c
>> index 7684cf0..6a9cfb0 100644
>> --- a/xen/arch/x86/hvm/io.c
>> +++ b/xen/arch/x86/hvm/io.c
>> @@ -206,6 +206,9 @@ void hvm_io_assist(ioreq_t *p)
>>                  regs->_edx = vr->edx;
>>                  regs->_esi = vr->esi;
>>                  regs->_edi = vr->edi;
>> +                HVMTRACE_ND(VMPORT_QEMU, 0, 1/*cycles*/, 6,
>> +                            p->data, regs->_ebx, regs->_ecx,
>> +                            regs->_edx, regs->_esi, regs->_edi);
>>              }
>>          }
>>          if ( vio->io_size == 4 ) /* Needs zero extension. */
>> diff --git a/xen/arch/x86/hvm/vmware/vmport.c b/xen/arch/x86/hvm/vmware/vmport.c
>> index 36e3f1b..3c3ccd4 100644
>> --- a/xen/arch/x86/hvm/vmware/vmport.c
>> +++ b/xen/arch/x86/hvm/vmware/vmport.c
>> @@ -16,6 +16,7 @@
>>  #include <xen/lib.h>
>>  #include <asm/hvm/hvm.h>
>>  #include <asm/hvm/support.h>
>> +#include <asm/hvm/trace.h>
>>  
>>  #include "backdoor_def.h"
>>  
>> @@ -35,6 +36,7 @@ static int vmport_ioport(int dir, uint32_t port, uint32_t bytes, uint32_t *val)
>>      if ( port == BDOOR_PORT && regs->_eax == BDOOR_MAGIC )
>>      {
>>          uint32_t new_eax = ~0u;
>> +        uint16_t cmd = regs->_ecx;
>>          uint64_t value;
>>          struct vcpu *curr = current;
>>          struct domain *currd = curr->domain;
>> @@ -45,7 +47,7 @@ static int vmport_ioport(int dir, uint32_t port, uint32_t bytes, uint32_t *val)
>>           * leaving the high 32-bits unchanged, unlike what one would
>>           * expect to happen.
>>           */
>> -        switch ( regs->_ecx & 0xffff )
>> +        switch ( cmd )
>>          {
>>          case BDOOR_CMD_GETMHZ:
>>              new_eax = currd->arch.tsc_khz / 1000;
>> @@ -123,11 +125,20 @@ static int vmport_ioport(int dir, uint32_t port, uint32_t bytes, uint32_t *val)
>>              /* Let backing DM handle */
>>              return X86EMUL_UNHANDLEABLE;
>>          }
>> +        HVMTRACE_ND7(VMPORT_HANDLED, 0, 0/*cycles*/, 7,
>> +                     cmd, new_eax, regs->_ebx, regs->_ecx,
>> +                     regs->_edx, regs->_esi, regs->_edi);
> 
> Do you need to log edi as well? It looks like it's not used.


I guess not, but since there are VMware port commands that do use edi, a
future add might need it.  I find it simpler to have this and the QEMU
case above the same but will change it if you want.

> 
>>          if ( dir == IOREQ_READ )
>>              *val = new_eax;
>>      }
>> -    else if ( dir == IOREQ_READ )
>> -        *val = ~0u;
>> +    else
>> +    {
>> +        HVMTRACE_ND7(VMPORT_IGNORED, 0, 0/*cycles*/, 7,
>> +                     port, regs->_eax, regs->_ebx, regs->_ecx,
>> +                     regs->_edx, regs->_esi, regs->_edi);
> 
> And do you need to log all the registers here?  It seems like port +
> regs->_ecx would be enough to tell you why it got ignored.
> 

The min would be port and regs->_eax.  QEMU is the one that cares about
regs->_ecx.

Happy to make this change. Will wait until response from above.

>> +        if ( dir == IOREQ_READ )
>> +            *val = ~0u;
>> +    }
>>  
>>      return X86EMUL_OKAY;
>>  }
>> diff --git a/xen/include/asm-x86/hvm/trace.h b/xen/include/asm-x86/hvm/trace.h
>> index de802a6..0ad805f 100644
>> --- a/xen/include/asm-x86/hvm/trace.h
>> +++ b/xen/include/asm-x86/hvm/trace.h
>> @@ -54,6 +54,9 @@
>>  #define DO_TRC_HVM_TRAP             DEFAULT_HVM_MISC
>>  #define DO_TRC_HVM_TRAP_DEBUG       DEFAULT_HVM_MISC
>>  #define DO_TRC_HVM_VLAPIC           DEFAULT_HVM_MISC
>> +#define DO_TRC_HVM_VMPORT_HANDLED   DEFAULT_HVM_IO
>> +#define DO_TRC_HVM_VMPORT_IGNORED   DEFAULT_HVM_IO
>> +#define DO_TRC_HVM_VMPORT_QEMU      DEFAULT_HVM_IO
>>  
>>  
>>  #define TRC_PAR_LONG(par) ((par)&0xFFFFFFFF),((par)>>32)
>> @@ -83,6 +86,25 @@
>>          }                                                                 \
>>      } while(0)
>>  
>> +#define HVMTRACE_ND7(evt, modifier, cycles, count, d1, d2, d3, d4, d5, d6, d7) \
>> +    do {                                                                  \
>> +        if ( unlikely(tb_init_done) && DO_TRC_HVM_ ## evt )               \
>> +        {                                                                 \
>> +            struct {                                                      \
>> +                u32 d[7];                                                 \
>> +            } _d;                                                         \
>> +            _d.d[0]=(d1);                                                 \
>> +            _d.d[1]=(d2);                                                 \
>> +            _d.d[2]=(d3);                                                 \
>> +            _d.d[3]=(d4);                                                 \
>> +            _d.d[4]=(d5);                                                 \
>> +            _d.d[5]=(d6);                                                 \
>> +            _d.d[6]=(d7);                                                 \
>> +            __trace_var(TRC_HVM_ ## evt | (modifier), cycles,             \
>> +                        sizeof(*_d.d) * count, &_d);                      \
>> +        }                                                                 \
>> +    } while(0)
> 
> If you reduced the registers as mentioned above, you wouldn't need this
> here either.
> 

Yes.  However with out this, I did not understand that a trace could
have 7 32bit arguments.  Happy to go either way depending on changes above.

   -Don Slutz

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

      reply	other threads:[~2015-06-04 12:31 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-22 15:50 [PATCH v11 0/9] Xen VMware tools support Don Slutz
2015-05-22 15:50 ` [PATCH v11 1/9] tools: Add vga=vmware Don Slutz
2015-05-22 15:50 ` [PATCH v11 2/9] xen: Add support for VMware cpuid leaves Don Slutz
2015-05-22 15:50 ` [PATCH v11 3/9] tools: Add vmware_hwver support Don Slutz
2015-06-03 14:53   ` George Dunlap
2015-06-04 15:15     ` Ian Campbell
2015-06-04 15:46       ` Don Slutz
2015-06-04 15:17   ` Ian Campbell
2015-06-04 15:59     ` Don Slutz
2015-05-22 15:50 ` [PATCH v11 4/9] vmware: Add VMware provided include file Don Slutz
2015-05-22 15:50 ` [PATCH v11 5/9] xen: Add vmware_port support Don Slutz
2015-06-05  9:52   ` Jan Beulich
2015-06-05 13:18     ` Don Slutz
2015-05-22 15:50 ` [PATCH v11 6/9] xen: Add ring 3 " Don Slutz
2015-06-03 15:26   ` George Dunlap
2015-06-03 15:58     ` Andrew Cooper
2015-06-03 16:23       ` George Dunlap
2015-06-03 16:40         ` Andrew Cooper
2015-06-03 17:00           ` George Dunlap
2015-06-03 16:41         ` Don Slutz
2015-06-03 16:58           ` George Dunlap
2015-06-04 12:37             ` Don Slutz
2015-06-04 14:14               ` George Dunlap
2015-06-04 16:17                 ` Don Slutz
2015-06-03 16:36       ` Don Slutz
2015-06-03 16:50         ` George Dunlap
2015-06-05  9:31           ` Jan Beulich
2015-06-05 10:54             ` Ian Campbell
2015-06-11 22:10               ` Don Slutz
2015-06-12  6:25                 ` Jan Beulich
2015-06-12 12:52                   ` Don Slutz
2015-06-23 16:14   ` Jan Beulich
2015-06-26 14:54     ` Don Slutz
2015-05-22 15:50 ` [PATCH v11 7/9] tools: Add " Don Slutz
2015-06-03 17:06   ` George Dunlap
2015-06-04 15:49     ` Ian Campbell
2015-06-04 16:09       ` Don Slutz
2015-06-04 15:20   ` Ian Campbell
2015-05-22 15:50 ` [PATCH v11 8/9] Add IOREQ_TYPE_VMWARE_PORT Don Slutz
2015-06-03 17:09   ` George Dunlap
2015-06-04 11:28     ` Don Slutz
2015-06-05  9:35       ` Jan Beulich
2015-06-05 10:03         ` Paul Durrant
2015-06-08 10:05       ` George Dunlap
2015-06-11 21:51         ` Don Slutz
2015-05-22 15:50 ` [PATCH v11 9/9] Add xentrace to vmware_port Don Slutz
2015-06-04 11:20   ` George Dunlap
2015-06-04 12:31     ` Don Slutz [this message]

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=5570451B.6000903@Gmail.com \
    --to=don.slutz@gmail.com \
    --cc=Aravind.Gopalakrishnan@amd.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=dslutz@verizon.com \
    --cc=eddie.dong@intel.com \
    --cc=george.dunlap@eu.citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=jun.nakajima@intel.com \
    --cc=keir@xen.org \
    --cc=kevin.tian@intel.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=suravee.suthikulpanit@amd.com \
    --cc=tim@xen.org \
    --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.