2
0
mirror of https://github.com/xcat2/xNBA.git synced 2024-11-23 01:51:58 +00:00

[intel] Profile common virtual machine operations

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>
This commit is contained in:
Michael Brown 2014-04-27 21:51:26 +01:00
parent 2c820d684a
commit 8a3dcefc0c

View 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;