From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.bufferbloat.net (Postfix) with ESMTPS id 99BB43B29D for ; Fri, 7 Oct 2022 20:19:04 -0400 (EDT) Received: by mail-wr1-x430.google.com with SMTP id f11so9371682wrm.6 for ; Fri, 07 Oct 2022 17:19:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=BAfp2qLrvxFELvSBxqJZJ1bO7g4HNokACefb8QQN6mc=; b=pyncUxIWgmUIsvHf8lqPSP1jpJpmO+T/2t47A1QFlYzKFIUhT9f6H7NXkwozr0WFbP 4FQhX8IISATsfj+lp27KC2orww0Kd77QjaWrv445UsEHa9UUr9QEl3lOlTSHmDKrJeK7 ppquXI3nMOwSPm0/7u3AF3OyVk45RfIi8xbVGO9s7j/0NFkSSWkfCwr5U88pLoF8ZA5g MR/2x1+U3ftsq6E6vwq22SFVHo6pD1DFP1+5HRt6RZ2cHdtKeYkg9g9Ysd8yJeLuUom1 OtmINK5+IB8X37+O9qerMEaQ6ZPeW167+qAgS3qy6huT+O2DeCZq6roAB6IY0vDYD6xl jjcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=BAfp2qLrvxFELvSBxqJZJ1bO7g4HNokACefb8QQN6mc=; b=0L3mCHtps/Qd8XUqFXUWXvbJpTcU6WZ3uXBfcUghrQqZv3xSd82VosKXY6PiJORkyc tie3EcYher+NKNhQyPHgIw54GsU6sDTuYxkMSEkfBPfQ9AGH5AYuXAMAOuG8sCdYIDiS WX9uU9To0whU19kgDMvQacpQA8F+zPGNKcA/l/N781LfiKtWiQu0BVJoC66L1ChLqMDQ gDbuvRd4UmvGbC6zwdNMpzN86lTpha0MgXf4Q/eKxbU4D8d34BxMZh58y46/jqEwZ8uE qmEdhNAUEsGNDVog8/OG7XfUZNkDCrYPxuetsAqAh3EtZW3YxysxvXV3bkEBoPn7sBB0 TNzw== X-Gm-Message-State: ACrzQf3tZp1CJXSeG+Kd5g7KVzoM1Kd0cfwQUW+rkanKK7rI50JluHdg 04sPuhtehr4Jc5pJ94riubuO6MWfIgCplFFaiumi/DEh X-Google-Smtp-Source: AMsMyM67GIpzuWYQAxu2OW9+KBRi0EMXUToX8Tau0WdcRmyIUB7nj9ZgY6gFZ7v47Hj8N7udDKER/jqIdNOwh+SZ7X8= X-Received: by 2002:a05:6000:69b:b0:22e:36aa:5f1 with SMTP id bo27-20020a056000069b00b0022e36aa05f1mr4614585wrb.430.1665188342855; Fri, 07 Oct 2022 17:19:02 -0700 (PDT) MIME-Version: 1.0 References: <1665178723-52902-1-git-send-email-jdamato@fastly.com> <1665178723-52902-5-git-send-email-jdamato@fastly.com> In-Reply-To: <1665178723-52902-5-git-send-email-jdamato@fastly.com> From: Dave Taht Date: Fri, 7 Oct 2022 17:18:50 -0700 Message-ID: To: libreqos@lists.bufferbloat.net Content-Type: multipart/alternative; boundary="000000000000a8ff5c05ea7adf9f" Subject: [LibreQoS] Fwd: [next-queue v4 4/4] i40e: Add i40e_napi_poll tracepoint X-BeenThere: libreqos@lists.bufferbloat.net X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Oct 2022 00:19:04 -0000 --000000000000a8ff5c05ea7adf9f Content-Type: text/plain; charset="UTF-8" ---------- Forwarded message --------- From: Joe Damato Date: Fri, Oct 7, 2022, 2:43 PM Subject: [next-queue v4 4/4] i40e: Add i40e_napi_poll tracepoint To: Cc: , , , < anthony.l.nguyen@intel.com>, , < maciej.fijalkowski@intel.com>, , Joe Damato < jdamato@fastly.com> Add a tracepoint for i40e_napi_poll that allows users to get detailed information about the amount of work done. This information can help users better tune the correct NAPI parameters (like weight and budget), as well as debug NIC settings like rx-usecs and tx-usecs, etc. When perf is attached, this tracepoint only fires when not in XDP mode. An example of the output from this tracepoint: $ sudo perf trace -e i40e:i40e_napi_poll -a --call-graph=fp --libtraceevent_print [..snip..] 388.258 :0/0 i40e:i40e_napi_poll(i40e_napi_poll on dev eth2 q i40e-eth2-TxRx-9 irq 346 irq_mask 00000000,00000000,00000000,00000000,00000000,00800000 curr_cpu 23 budget 64 bpr 64 rx_cleaned 28 tx_cleaned 0 rx_clean_complete 1 tx_clean_complete 1) i40e_napi_poll ([i40e]) i40e_napi_poll ([i40e]) __napi_poll ([kernel.kallsyms]) net_rx_action ([kernel.kallsyms]) __do_softirq ([kernel.kallsyms]) common_interrupt ([kernel.kallsyms]) asm_common_interrupt ([kernel.kallsyms]) intel_idle_irq ([kernel.kallsyms]) cpuidle_enter_state ([kernel.kallsyms]) cpuidle_enter ([kernel.kallsyms]) do_idle ([kernel.kallsyms]) cpu_startup_entry ([kernel.kallsyms]) [0x243fd8] ([kernel.kallsyms]) secondary_startup_64_no_verify ([kernel.kallsyms]) Signed-off-by: Joe Damato Acked-by: Jesse Brandeburg Acked-by: Sridhar Samudrala --- drivers/net/ethernet/intel/i40e/i40e_trace.h | 49 ++++++++++++++++++++++++++++ drivers/net/ethernet/intel/i40e/i40e_txrx.c | 4 +++ 2 files changed, 53 insertions(+) diff --git a/drivers/net/ethernet/intel/i40e/i40e_trace.h b/drivers/net/ethernet/intel/i40e/i40e_trace.h index b5b1229..79d587a 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_trace.h +++ b/drivers/net/ethernet/intel/i40e/i40e_trace.h @@ -55,6 +55,55 @@ * being built from shared code. */ +#define NO_DEV "(i40e no_device)" + +TRACE_EVENT(i40e_napi_poll, + + TP_PROTO(struct napi_struct *napi, struct i40e_q_vector *q, int budget, + int budget_per_ring, unsigned int rx_cleaned, unsigned int tx_cleaned, + bool rx_clean_complete, bool tx_clean_complete), + + TP_ARGS(napi, q, budget, budget_per_ring, rx_cleaned, tx_cleaned, + rx_clean_complete, tx_clean_complete), + + TP_STRUCT__entry( + __field(int, budget) + __field(int, budget_per_ring) + __field(unsigned int, rx_cleaned) + __field(unsigned int, tx_cleaned) + __field(int, rx_clean_complete) + __field(int, tx_clean_complete) + __field(int, irq_num) + __field(int, curr_cpu) + __string(qname, q->name) + __string(dev_name, napi->dev ? napi->dev->name : NO_DEV) + __bitmask(irq_affinity, nr_cpumask_bits) + ), + + TP_fast_assign( + __entry->budget = budget; + __entry->budget_per_ring = budget_per_ring; + __entry->rx_cleaned = rx_cleaned; + __entry->tx_cleaned = tx_cleaned; + __entry->rx_clean_complete = rx_clean_complete; + __entry->tx_clean_complete = tx_clean_complete; + __entry->irq_num = q->irq_num; + __entry->curr_cpu = get_cpu(); + __assign_str(qname, q->name); + __assign_str(dev_name, napi->dev ? napi->dev->name : NO_DEV); + __assign_bitmask(irq_affinity, cpumask_bits(&q->affinity_mask), + nr_cpumask_bits); + ), + + TP_printk("i40e_napi_poll on dev %s q %s irq %d irq_mask %s curr_cpu %d " + "budget %d bpr %d rx_cleaned %u tx_cleaned %u " + "rx_clean_complete %d tx_clean_complete %d", + __get_str(dev_name), __get_str(qname), __entry->irq_num, + __get_bitmask(irq_affinity), __entry->curr_cpu, __entry->budget, + __entry->budget_per_ring, __entry->rx_cleaned, __entry->tx_cleaned, + __entry->rx_clean_complete, __entry->tx_clean_complete) +); + /* Events related to a vsi & ring */ DECLARE_EVENT_CLASS( i40e_tx_template, diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c index 5901e58..f2b1b94 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c +++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c @@ -2752,6 +2752,10 @@ int i40e_napi_poll(struct napi_struct *napi, int budget) clean_complete = rx_clean_complete = false; } + if (!i40e_enabled_xdp_vsi(vsi)) + trace_i40e_napi_poll(napi, q_vector, budget, budget_per_ring, rx_cleaned, + tx_cleaned, rx_clean_complete, tx_clean_complete); + /* If work not completed, return budget and polling will return */ if (!clean_complete) { int cpu_id = smp_processor_id(); -- 2.7.4 --000000000000a8ff5c05ea7adf9f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

---------- Forwarded message ---------
From: Joe Damato <jdamato@fastly.com>
Date: Fri, Oct 7, 2022, 2:43 PM
Subject: [next-queue v4 4/4] i40e= : Add i40e_napi_poll tracepoint
To: <intel-wired-lan@lists.osuosl.org>
Cc: <<= a href=3D"mailto:netdev@vger.kernel.org">netdev@vger.kernel.org>, &= lt;kuba@kernel.org>, <davem@davemloft.net>, <anthony.l.nguyen@intel.com>, = <jesse.brandeburg@intel.c= om>, <maciej.fij= alkowski@intel.com>, <sridhar.samudrala@intel.com>, Joe Damato <jdamato@fastly.com>


Add a trace= point for i40e_napi_poll that allows users to get detailed
information about the amount of work done. This information can help users<= br> better tune the correct NAPI parameters (like weight and budget), as well as debug NIC settings like rx-usecs and tx-usecs, etc.

When perf is attached, this tracepoint only fires when not in XDP mode.

An example of the output from this tracepoint:

$ sudo perf trace -e i40e:i40e_napi_poll -a --call-graph=3Dfp --libtraceeve= nt_print

[..snip..]

388.258 :0/0 i40e:i40e_napi_poll(i40e_napi_poll on dev eth2 q i40e-eth2-TxR= x-9 irq 346 irq_mask 00000000,00000000,00000000,00000000,00000000,00800000 = curr_cpu 23 budget 64 bpr 64 rx_cleaned 28 tx_cleaned 0 rx_clean_complete 1= tx_clean_complete 1)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 i40e_napi_poll ([i40e])
=C2=A0 =C2=A0 =C2=A0 =C2=A0 i40e_napi_poll ([i40e])
=C2=A0 =C2=A0 =C2=A0 =C2=A0 __napi_poll ([kernel.kallsyms])
=C2=A0 =C2=A0 =C2=A0 =C2=A0 net_rx_action ([kernel.kallsyms])
=C2=A0 =C2=A0 =C2=A0 =C2=A0 __do_softirq ([kernel.kallsyms])
=C2=A0 =C2=A0 =C2=A0 =C2=A0 common_interrupt ([kernel.kallsyms])
=C2=A0 =C2=A0 =C2=A0 =C2=A0 asm_common_interrupt ([kernel.kallsyms])
=C2=A0 =C2=A0 =C2=A0 =C2=A0 intel_idle_irq ([kernel.kallsyms])
=C2=A0 =C2=A0 =C2=A0 =C2=A0 cpuidle_enter_state ([kernel.kallsyms])
=C2=A0 =C2=A0 =C2=A0 =C2=A0 cpuidle_enter ([kernel.kallsyms])
=C2=A0 =C2=A0 =C2=A0 =C2=A0 do_idle ([kernel.kallsyms])
=C2=A0 =C2=A0 =C2=A0 =C2=A0 cpu_startup_entry ([kernel.kallsyms])
=C2=A0 =C2=A0 =C2=A0 =C2=A0 [0x243fd8] ([kernel.kallsyms])
=C2=A0 =C2=A0 =C2=A0 =C2=A0 secondary_startup_64_no_verify ([kernel.kallsym= s])

Signed-off-by: Joe Damato <jdamato@fastly.com>
Acked-by: Jesse Brandeburg <jesse.brandeburg@intel.com> Acked-by: Sridhar Samudrala <sridhar.samudrala@intel.com>= ;
---
=C2=A0drivers/net/ethernet/intel/i40e/i40e_trace.h | 49 +++++++++++++++++++= +++++++++
=C2=A0drivers/net/ethernet/intel/i40e/i40e_txrx.c=C2=A0 |=C2=A0 4 +++
=C2=A02 files changed, 53 insertions(+)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_trace.h b/drivers/net/eth= ernet/intel/i40e/i40e_trace.h
index b5b1229..79d587a 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_trace.h
+++ b/drivers/net/ethernet/intel/i40e/i40e_trace.h
@@ -55,6 +55,55 @@
=C2=A0 * being built from shared code.
=C2=A0 */

+#define NO_DEV "(i40e no_device)"
+
+TRACE_EVENT(i40e_napi_poll,
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0TP_PROTO(struct napi_struct *napi, struct i40e_= q_vector *q, int budget,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 int budget_per_rin= g, unsigned int rx_cleaned, unsigned int tx_cleaned,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 bool rx_clean_comp= lete, bool tx_clean_complete),
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0TP_ARGS(napi, q, budget, budget_per_ring, rx_cl= eaned, tx_cleaned,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0rx_clean_complete, = tx_clean_complete),
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0TP_STRUCT__entry(
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0__field(int, budget= )
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0__field(int, budget= _per_ring)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0__field(unsigned in= t, rx_cleaned)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0__field(unsigned in= t, tx_cleaned)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0__field(int, rx_cle= an_complete)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0__field(int, tx_cle= an_complete)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0__field(int, irq_nu= m)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0__field(int, curr_c= pu)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0__string(qname, q-&= gt;name)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0__string(dev_name, = napi->dev ? napi->dev->name : NO_DEV)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0__bitmask(irq_affin= ity, nr_cpumask_bits)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0),
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0TP_fast_assign(
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0__entry->budget = =3D budget;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0__entry->budget_= per_ring =3D budget_per_ring;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0__entry->rx_clea= ned =3D rx_cleaned;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0__entry->tx_clea= ned =3D tx_cleaned;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0__entry->rx_clea= n_complete =3D rx_clean_complete;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0__entry->tx_clea= n_complete =3D tx_clean_complete;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0__entry->irq_num= =3D q->irq_num;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0__entry->curr_cp= u =3D get_cpu();
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0__assign_str(qname,= q->name);
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0__assign_str(dev_na= me, napi->dev ? napi->dev->name : NO_DEV);
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0__assign_bitmask(ir= q_affinity, cpumask_bits(&q->affinity_mask),
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 nr_cpumask_bits);
+=C2=A0 =C2=A0 =C2=A0 =C2=A0),
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0TP_printk("i40e_napi_poll on dev %s q %s i= rq %d irq_mask %s curr_cpu %d "
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"budget= %d bpr %d rx_cleaned %u tx_cleaned %u "
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"rx_cle= an_complete %d tx_clean_complete %d",
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0__get_str(dev_name)= , __get_str(qname), __entry->irq_num,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0__get_bitmask(irq_a= ffinity), __entry->curr_cpu, __entry->budget,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0__entry->budget_= per_ring, __entry->rx_cleaned, __entry->tx_cleaned,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0__entry->rx_clea= n_complete, __entry->tx_clean_complete)
+);
+
=C2=A0/* Events related to a vsi & ring */
=C2=A0DECLARE_EVENT_CLASS(
=C2=A0 =C2=A0 =C2=A0 =C2=A0 i40e_tx_template,
diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethe= rnet/intel/i40e/i40e_txrx.c
index 5901e58..f2b1b94 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
@@ -2752,6 +2752,10 @@ int i40e_napi_poll(struct napi_struct *napi, int bud= get)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 clean_complete =3D rx_clean_complete =3D false;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 }

+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (!i40e_enabled_xdp_vsi(vsi))
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0trace_i40e_napi_pol= l(napi, q_vector, budget, budget_per_ring, rx_cleaned,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 tx_cleaned, rx_clean_c= omplete, tx_clean_complete);
+
=C2=A0 =C2=A0 =C2=A0 =C2=A0 /* If work not completed, return budget and pol= ling will return */
=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (!clean_complete) {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 int cpu_id =3D smp_= processor_id();
--
2.7.4

--000000000000a8ff5c05ea7adf9f--