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

Re: [Xen-devel] [PATCH v9 09/13] Add xentrace to vmware_port



On 02/17/15 08:45, Andrew Cooper wrote:
> On 16/02/15 23:05, Don Slutz wrote:
>> Also added missing TRAP_DEBUG & VLAPIC.
>>
>> Signed-off-by: Don Slutz <dslutz@xxxxxxxxxxx>
> 
> This patch doesn't actually add any trace points.
> 

Sigh.  They got lost in rebaseing.  Will recover and add to v10.

Here is just the trace parts:

diff --git a/xen/arch/x86/hvm/io.c b/xen/arch/x86/hvm/io.c
index 2d06956..752eeb8 100644
--- a/xen/arch/x86/hvm/io.c
+++ b/xen/arch/x86/hvm/io.c
@@ -205,6 +205,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 131bafd..de44893 100644
--- a/xen/arch/x86/hvm/vmware/vmport.c
+++ b/xen/arch/x86/hvm/vmware/vmport.c
...

@@ -133,11 +135,20 @@ int vmport_ioport(int dir, uint32_t port, uint32_t
bytes, uint32_t *val)
             /* Let backing DM handle */
             return X86EMUL_VMPORT_SEND;
         }
+        HVMTRACE_ND7(VMPORT_HANDLED, 0, 0/*cycles*/, 7,
+                     cmd, new_eax, regs->_ebx, regs->_ecx,
+                     regs->_edx, regs->_esi, regs->_edi);
         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);
+        if ( dir == IOREQ_READ )
+            *val = ~0u;
+    }

     return X86EMUL_OKAY;
 }


>> ---
>> v9:
>>   Dropped unneed VMPORT_UNHANDLED, VMPORT_DECODE.
>>
...
>> diff --git a/xen/arch/x86/hvm/vmware/vmport.c 
>> b/xen/arch/x86/hvm/vmware/vmport.c
>> index 131bafd..fb191a2 100644
>> --- a/xen/arch/x86/hvm/vmware/vmport.c
>> +++ b/xen/arch/x86/hvm/vmware/vmport.c
>> @@ -17,6 +17,7 @@
>>  #include <asm/hvm/hvm.h>
>>  #include <asm/hvm/support.h>
>>  #include <asm/hvm/vmport.h>
>> +#include <asm/hvm/trace.h>
>>  
>>  #include "backdoor_def.h"
>>  
>> @@ -55,8 +56,9 @@ int vmport_ioport(int dir, uint32_t port, uint32_t bytes, 
>> uint32_t *val)
>>          uint64_t value;
>>          struct vcpu *curr = current;
>>          struct domain *d = curr->domain;
>> +        uint16_t cmd = regs->_ecx;
>>  
>> -        switch ( regs->_ecx & 0xffff )
>> +        switch ( cmd )
> 
> This hunk really looks like it belongs in patch 5.
> 

That my be, but in patch 5, there is only 1 use of cmd and Jan Beulich
said to drop them.  This patch adds a 2nd use:

+        HVMTRACE_ND7(VMPORT_HANDLED, 0, 0/*cycles*/, 7,
+                     cmd, new_eax, regs->_ebx, regs->_ecx,
+                     regs->_edx, regs->_esi, regs->_edi);

(which was accidentally dropped).

   -Don Slutz

> ~Andrew
> 
>>          {
>>          case BDOOR_CMD_GETMHZ:
>>              new_eax = d->arch.tsc_khz / 1000;
>> 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)
>> +
>>  #define HVMTRACE_6D(evt, d1, d2, d3, d4, d5, d6)    \
>>      HVMTRACE_ND(evt, 0, 0, 6, d1, d2, d3, d4, d5, d6)
>>  #define HVMTRACE_5D(evt, d1, d2, d3, d4, d5)        \
>> diff --git a/xen/include/public/trace.h b/xen/include/public/trace.h
>> index 5211ae7..16b87f9 100644
>> --- a/xen/include/public/trace.h
>> +++ b/xen/include/public/trace.h
>> @@ -227,6 +227,9 @@
>>  #define TRC_HVM_TRAP             (TRC_HVM_HANDLER + 0x23)
>>  #define TRC_HVM_TRAP_DEBUG       (TRC_HVM_HANDLER + 0x24)
>>  #define TRC_HVM_VLAPIC           (TRC_HVM_HANDLER + 0x25)
>> +#define TRC_HVM_VMPORT_HANDLED   (TRC_HVM_HANDLER + 0x26)
>> +#define TRC_HVM_VMPORT_IGNORED   (TRC_HVM_HANDLER + 0x27)
>> +#define TRC_HVM_VMPORT_QEMU      (TRC_HVM_HANDLER + 0x28)
>>  
>>  #define TRC_HVM_IOPORT_WRITE    (TRC_HVM_HANDLER + 0x216)
>>  #define TRC_HVM_IOMEM_WRITE     (TRC_HVM_HANDLER + 0x217)
> 

_______________________________________________
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®.