Przeglądaj źródła

[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>
tags/v1.20.1
Michael Brown 10 lat temu
rodzic
commit
8a3dcefc0c
1 zmienionych plików z 19 dodań i 0 usunięć
  1. 19
    0
      src/drivers/net/intel.c

+ 19
- 0
src/drivers/net/intel.c Wyświetl plik

@@ -30,6 +30,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
30 30
 #include <ipxe/iobuf.h>
31 31
 #include <ipxe/malloc.h>
32 32
 #include <ipxe/pci.h>
33
+#include <ipxe/profile.h>
33 34
 #include "intel.h"
34 35
 
35 36
 /** @file
@@ -38,6 +39,18 @@ FILE_LICENCE ( GPL2_OR_LATER );
38 39
  *
39 40
  */
40 41
 
42
+/** VM transmit profiler */
43
+static struct profiler intel_vm_tx_profiler __profiler =
44
+	{ .name = "intel.vm_tx" };
45
+
46
+/** VM receive refill profiler */
47
+static struct profiler intel_vm_refill_profiler __profiler =
48
+	{ .name = "intel.vm_refill" };
49
+
50
+/** VM poll profiler */
51
+static struct profiler intel_vm_poll_profiler __profiler =
52
+	{ .name = "intel.vm_poll" };
53
+
41 54
 /******************************************************************************
42 55
  *
43 56
  * EEPROM interface
@@ -471,7 +484,9 @@ void intel_refill_rx ( struct intel_nic *intel ) {
471 484
 		intel->rx_iobuf[rx_idx] = iobuf;
472 485
 
473 486
 		/* Push descriptor to card */
487
+		profile_start ( &intel_vm_refill_profiler );
474 488
 		writel ( rx_tail, intel->regs + intel->rx.reg + INTEL_xDT );
489
+		profile_stop ( &intel_vm_refill_profiler );
475 490
 
476 491
 		DBGC2 ( intel, "INTEL %p RX %d is [%llx,%llx)\n", intel, rx_idx,
477 492
 			( ( unsigned long long ) address ),
@@ -611,7 +626,9 @@ int intel_transmit ( struct net_device *netdev, struct io_buffer *iobuf ) {
611 626
 	wmb();
612 627
 
613 628
 	/* Notify card that there are packets ready to transmit */
629
+	profile_start ( &intel_vm_tx_profiler );
614 630
 	writel ( tx_tail, intel->regs + intel->tx.reg + INTEL_xDT );
631
+	profile_stop ( &intel_vm_tx_profiler );
615 632
 
616 633
 	DBGC2 ( intel, "INTEL %p TX %d is [%llx,%llx)\n", intel, tx_idx,
617 634
 		( ( unsigned long long ) address ),
@@ -703,7 +720,9 @@ static void intel_poll ( struct net_device *netdev ) {
703 720
 	uint32_t icr;
704 721
 
705 722
 	/* Check for and acknowledge interrupts */
723
+	profile_start ( &intel_vm_poll_profiler );
706 724
 	icr = readl ( intel->regs + INTEL_ICR );
725
+	profile_stop ( &intel_vm_poll_profiler );
707 726
 	if ( ! icr )
708 727
 		return;
709 728
 

Ładowanie…
Anuluj
Zapisz