]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[intel] Profile common virtual machine operations
authorMichael Brown <mcb30@ipxe.org>
Sun, 27 Apr 2014 20:51:26 +0000 (21:51 +0100)
committerMichael Brown <mcb30@ipxe.org>
Sun, 27 Apr 2014 22:14:48 +0000 (23:14 +0100)
Operations which are negligible on physical hardware (such as issuing
a posted write to the transmit ring tail register) may involve
substantial amounts of processing within the hypervisor if running in
a virtual machine.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/drivers/net/intel.c

index f56012634947947ab52a60c406800701f640ca2e..5abcdd7f82411e5858b8571564cdab2fe624b7d3 100644 (file)
@@ -30,6 +30,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
 #include <ipxe/iobuf.h>
 #include <ipxe/malloc.h>
 #include <ipxe/pci.h>
+#include <ipxe/profile.h>
 #include "intel.h"
 
 /** @file
@@ -38,6 +39,18 @@ FILE_LICENCE ( GPL2_OR_LATER );
  *
  */
 
+/** VM transmit profiler */
+static struct profiler intel_vm_tx_profiler __profiler =
+       { .name = "intel.vm_tx" };
+
+/** VM receive refill profiler */
+static struct profiler intel_vm_refill_profiler __profiler =
+       { .name = "intel.vm_refill" };
+
+/** VM poll profiler */
+static struct profiler intel_vm_poll_profiler __profiler =
+       { .name = "intel.vm_poll" };
+
 /******************************************************************************
  *
  * EEPROM interface
@@ -471,7 +484,9 @@ void intel_refill_rx ( struct intel_nic *intel ) {
                intel->rx_iobuf[rx_idx] = iobuf;
 
                /* Push descriptor to card */
+               profile_start ( &intel_vm_refill_profiler );
                writel ( rx_tail, intel->regs + intel->rx.reg + INTEL_xDT );
+               profile_stop ( &intel_vm_refill_profiler );
 
                DBGC2 ( intel, "INTEL %p RX %d is [%llx,%llx)\n", intel, rx_idx,
                        ( ( unsigned long long ) address ),
@@ -611,7 +626,9 @@ int intel_transmit ( struct net_device *netdev, struct io_buffer *iobuf ) {
        wmb();
 
        /* Notify card that there are packets ready to transmit */
+       profile_start ( &intel_vm_tx_profiler );
        writel ( tx_tail, intel->regs + intel->tx.reg + INTEL_xDT );
+       profile_stop ( &intel_vm_tx_profiler );
 
        DBGC2 ( intel, "INTEL %p TX %d is [%llx,%llx)\n", intel, tx_idx,
                ( ( unsigned long long ) address ),
@@ -703,7 +720,9 @@ static void intel_poll ( struct net_device *netdev ) {
        uint32_t icr;
 
        /* Check for and acknowledge interrupts */
+       profile_start ( &intel_vm_poll_profiler );
        icr = readl ( intel->regs + INTEL_ICR );
+       profile_stop ( &intel_vm_poll_profiler );
        if ( ! icr )
                return;