ice: add tracepoints
Subsystems (2)
PATCH 1/1 ice: add tracepoints
This patch is modeled after one by Scott Peterson for i40e.
Add tracepoints to the driver, via a new file ice_trace.h and some new trace calls added in interesting places in the driver. Add some tracing for DIMLIB to help debug interrupt moderation problems.
Performance should not be affected, and this can be very useful for debugging and adding new trace events to paths in the future.
Note eBPF programs can attach to these events, as well as perf can count them since we're attaching to the events subsystem in the kernel.
---
NOTE: checkpatch will complain about this patch due to the macros defining the new trace functionality being formatted for readability.
Testing Hints:
See that performance is unaffected while tracepoints are present but disabled (default state). Enable them all and see they appear in /sys/kernel/debug/tracing/trace when exercised, and after 'make install' you can see the events in perf list.
When disabled, a tracepoint reduces to a 5-byte no-op. When enabled, that code is patched to jump to the tracepoint clause, which is located somewhere nearby. See include/linux/jump_label.h for info in static keys, and samples/trace-events/trace-events-samples.[ch] for info on the trace events.
To test tracepoints:
insmod ice and bring up a link
cd /sys/kernel/debug/tracing
echo > trace
echo 1 > events/ice/enable
send something over ice
cat trace
echo 0 > events/ice/enable
---
v2: updated commit message and copyright on new file
--- drivers/net/ethernet/intel/ice/ice_main.c | 8 + drivers/net/ethernet/intel/ice/ice_trace.h | 232 +++++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_txrx.c | 9 + 3 files changed, 249 insertions(+) create mode 100644 drivers/net/ethernet/intel/ice/ice_trace.h
drivers/net/ethernet/intel/ice/ice_main.c +8 -0
@@ -13,6 +13,12 @@#include "ice_dcb_lib.h" #include "ice_dcb_nl.h" #include "ice_devlink.h" +/* Including ice_trace.h with CREATE_TRACE_POINTS defined will generate the +* ice tracepoint functions. This must be done exactly once across the +* ice driver. +*/ +#define CREATE_TRACE_POINTS +#include "ice_trace.h" #define DRV_SUMMARY "Intel(R) Ethernet Connection E800 Series Linux Driver"static const char ice_driver_string[] =DRV_SUMMARY ;
@@ -5410,6 +5416,7 @@ static void ice_tx_dim_work(struct work_struct *work) itr = tx_profile[dim->profile_ix].itr; intrl = tx_profile[dim->profile_ix].intrl; +ice_trace (tx_dim_work, q_vector, dim);ice_write_itr (rc, itr);ice_write_intrl (q_vector, intrl);
@@ -5434,6 +5441,7 @@ static void ice_rx_dim_work(struct work_struct *work) itr = rx_profile[dim->profile_ix].itr; intrl = rx_profile[dim->profile_ix].intrl; +ice_trace (rx_dim_work, q_vector, dim);ice_write_itr (rc, itr);ice_write_intrl (q_vector, intrl);
drivers/net/ethernet/intel/ice/ice_trace.h new file +232 -0
232 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_txrx.c +9 -0
@@ -10,6 +10,7 @@#include "ice_txrx_lib.h" #include "ice_lib.h" #include "ice.h" +#include "ice_trace.h" #include "ice_dcb_lib.h" #include "ice_xsk.h"
@@ -224,6 +225,7 @@ static bool ice_clean_tx_irq(struct ice_ring *tx_ring, int napi_budget)smp_rmb ();/* prevent any other reads prior to eop_desc */ +ice_trace (clean_tx_irq, tx_ring, tx_desc, tx_buf);/* if the descriptor isn't done, no work yet to do */ if (!(eop_desc->cmd_type_offset_bsz &cpu_to_le64 (ICE_TX_DESC_DTYPE_DESC_DONE )))
@@ -254,6 +256,7 @@ static bool ice_clean_tx_irq(struct ice_ring *tx_ring, int napi_budget)/* unmap remaining buffers */ while (tx_desc != eop_desc) { +ice_trace (clean_tx_irq_unmap, tx_ring, tx_desc, tx_buf); tx_buf++; tx_desc++; i++;
@@ -272,6 +275,7 @@ static bool ice_clean_tx_irq(struct ice_ring *tx_ring, int napi_budget)dma_unmap_len_set (tx_buf, len,0 ); } } +ice_trace (clean_tx_irq_unmap_eop, tx_ring, tx_desc, tx_buf);/* move us one more past the eop_desc for start of next pkt */ tx_buf++;
@@ -1102,6 +1106,7 @@ int ice_clean_rx_irq(struct ice_ring *rx_ring, int budget)*/ dma_rmb (); +ice_trace (clean_rx_irq, rx_ring, rx_desc);if (rx_desc->wb.rxdid ==FDIR_DESC_RXDID || !rx_ring->netdev) {struct ice_vsi *ctrl_vsi = rx_ring->vsi;
@@ -1207,6 +1212,7 @@ int ice_clean_rx_irq(struct ice_ring *rx_ring, int budget)ice_process_skb_fields (rx_ring, rx_desc, skb, rx_ptype); +ice_trace (clean_rx_irq_indicate, rx_ring, rx_desc, skb);/* send completed skb up the stack */ ice_receive_skb (rx_ring, skb, vlan_tag); skb =NULL ;
@@ -2188,6 +2194,8 @@ ice_xmit_frame_ring(struct sk_buff *skb, struct ice_ring *tx_ring)unsigned int count;int tso, csum; +ice_trace (xmit_frame_ring, tx_ring, skb); + count =ice_xmit_desc_count (skb);if (ice_chk_linearize (skb, count)) {if (__skb_linearize (skb))
@@ -2262,6 +2270,7 @@ ice_xmit_frame_ring(struct sk_buff *skb, struct ice_ring *tx_ring)return NETDEV_TX_OK ; out_drop: +ice_trace (xmit_frame_ring_drop, tx_ring, skb);dev_kfree_skb_any (skb);return NETDEV_TX_OK ; }
25,959 lines not shown · raw message
Part of this message is not shown here. View the raw message.