Author: sephe
Date: Thu Jan 14 03:11:35 2016
New Revision: 293874
URL: https://svnweb.freebsd.org/changeset/base/293874

Log:
  hyperv: add interrupt counters
  
  Submitted by:         Howard Su <howard0su gmail com>
  Reviewed by:          royger, Dexuan Cui <decui microsoft com>, adrian
  Approved by:          adrian (mentor)
  Sponsored by:         Microsoft OSTC
  Differential Revision:        https://reviews.freebsd.org/D4693

Modified:
  head/sys/dev/hyperv/vmbus/hv_connection.c
  head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c

Modified: head/sys/dev/hyperv/vmbus/hv_connection.c
==============================================================================
--- head/sys/dev/hyperv/vmbus/hv_connection.c   Thu Jan 14 03:05:10 2016        
(r293873)
+++ head/sys/dev/hyperv/vmbus/hv_connection.c   Thu Jan 14 03:11:35 2016        
(r293874)
@@ -423,12 +423,6 @@ VmbusProcessChannelEvent(uint32_t relid)
        // mtx_unlock(&channel->inbound_lock);
 }
 
-#ifdef HV_DEBUG_INTR
-extern uint32_t hv_intr_count;
-extern uint32_t hv_vmbus_swintr_event_cpu[MAXCPU];
-extern uint32_t hv_vmbus_intr_cpu[MAXCPU];
-#endif
-
 /**
  * Handler for events
  */
@@ -449,17 +443,6 @@ hv_vmbus_on_events(void *arg) 
        KASSERT(cpu <= mp_maxid, ("VMBUS: hv_vmbus_on_events: "
            "cpu out of range!"));
 
-#ifdef HV_DEBUG_INTR
-       int i;
-       hv_vmbus_swintr_event_cpu[cpu]++;
-       if (hv_intr_count % 10000 == 0) {
-                printf("VMBUS: Total interrupt %d\n", hv_intr_count);
-                for (i = 0; i < mp_ncpus; i++)
-                        printf("VMBUS: hw cpu[%d]: %d, event sw intr cpu[%d]: 
%d\n",
-                           i, hv_vmbus_intr_cpu[i], i, 
hv_vmbus_swintr_event_cpu[i]);
-        }
-#endif
-
        if ((hv_vmbus_protocal_version == HV_VMBUS_VERSION_WS2008) ||
            (hv_vmbus_protocal_version == HV_VMBUS_VERSION_WIN7)) {
                maxdword = HV_MAX_NUM_CHANNELS_SUPPORTED >> 5;

Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c
==============================================================================
--- head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c    Thu Jan 14 03:05:10 
2016        (r293873)
+++ head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c    Thu Jan 14 03:11:35 
2016        (r293874)
@@ -225,32 +225,24 @@ hv_vmbus_isr(struct trapframe *frame)
        return (FILTER_HANDLED);
 }
 
-#ifdef HV_DEBUG_INTR 
-uint32_t hv_intr_count = 0;
-#endif
 uint32_t hv_vmbus_swintr_event_cpu[MAXCPU];
-uint32_t hv_vmbus_intr_cpu[MAXCPU];
+u_long *hv_vmbus_intr_cpu[MAXCPU];
 
 void
 hv_vector_handler(struct trapframe *trap_frame)
 {
-#ifdef HV_DEBUG_INTR
        int cpu;
-#endif
 
        /*
         * Disable preemption.
         */
        critical_enter();
 
-#ifdef HV_DEBUG_INTR
        /*
         * Do a little interrupt counting.
         */
        cpu = PCPU_GET(cpuid);
-       hv_vmbus_intr_cpu[cpu]++;
-       hv_intr_count++;
-#endif
+       (*hv_vmbus_intr_cpu[cpu])++;
 
        hv_vmbus_isr(trap_frame);
 
@@ -479,6 +471,7 @@ static int
 vmbus_bus_init(void)
 {
        int i, j, n, ret;
+       char buf[MAXCOMLEN + 1];
 
        if (vmbus_inited)
                return (0);
@@ -515,13 +508,15 @@ vmbus_bus_init(void)
        setup_args.vector = hv_vmbus_g_context.hv_cb_vector;
 
        CPU_FOREACH(j) {
-               hv_vmbus_intr_cpu[j] = 0;
                hv_vmbus_swintr_event_cpu[j] = 0;
                hv_vmbus_g_context.hv_event_intr_event[j] = NULL;
                hv_vmbus_g_context.hv_msg_intr_event[j] = NULL;
                hv_vmbus_g_context.event_swintr[j] = NULL;
                hv_vmbus_g_context.msg_swintr[j] = NULL;
 
+               snprintf(buf, sizeof(buf), "cpu%d:hyperv", j);
+               intrcnt_add(buf, &hv_vmbus_intr_cpu[j]);
+
                for (i = 0; i < 2; i++)
                        setup_args.page_buffers[2 * j + i] = NULL;
        }
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to