Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1128814rwi; Mon, 10 Oct 2022 11:35:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4h7QWXPpMPe5s4nGuLugru8TTegIYaSUucNCeCyTU7H5OkB5FXRpIdApaKcBhuY7Hvu7uj X-Received: by 2002:a63:fc5b:0:b0:43c:3f90:ca07 with SMTP id r27-20020a63fc5b000000b0043c3f90ca07mr18275044pgk.110.1665426945369; Mon, 10 Oct 2022 11:35:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665426945; cv=none; d=google.com; s=arc-20160816; b=jvt2TFz4NWfgxdBDl5sb8C4QkhdDjHtkW6NdnhXHKGqQu6XwSLM1P2NKbSazienqWd B3G74q0oIKbK8ywotnHtfDcFdY148E36JqMhXUeX6/BfjZZwtEM/h3wCWnMtazJf4AQe HMGcAmrHEjol1JOVdwgQ+AVyYcI3an55rgN/SmIsWVexks1wruIM/RYSnDQ0zd1qxGns GLcbFPB7517OYXQ5WJHLL3Vr2pcQGIGZZjB2hhZpHPf8KHYeV+JRtXh8m6ABfK/JD3uq uLwwttCrGu8usKn3H0RDjsLO3qIr+ysSXfB/BGRhrM01+eJnBdusMtXcjQdV2TrJMDGW 8ycQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=+bSxSJqNb+sqoNTXSt8Ye05VUAgMzhi/zgUSPCGgMEc=; b=CHN/bVO5abpcppEckouHPAIFUckzPMZe7gGb1RGyHSALN97B5hKRi8p0k55WfrmVH7 938uoj6lQZR6CJNKnqBvzun80O0Rc9Y1/qjFsXTp3NINO0m5LL3vtiBJfNf58dGo9rP4 8y9d/ylMvDIOLO5h8E7kJ9m1ZBnCDJw/WniDS/E++yfE/SfY4kbhY4e8C6NTf2StpewC QBl5sIYh+nkhajfxp1ehTx3CMXYHqWqy8j5P65QGJlw0IxLBKJTZJW5FsRFWi9sE4nQ2 iUzLpb9XdJkW3AQ+bY1vpFJ6fVCicsKEE+4i7gw2Xe4x/KTbF0Zm03CkwhgD/62+vNAa bZEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fastly.com header.s=google header.b="n/8VHYiA"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=fastly.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o15-20020a63fb0f000000b0045cc8781244si12729816pgh.220.2022.10.10.11.35.30; Mon, 10 Oct 2022 11:35:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@fastly.com header.s=google header.b="n/8VHYiA"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=fastly.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229675AbiJJSWZ (ORCPT + 99 others); Mon, 10 Oct 2022 14:22:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229591AbiJJSWX (ORCPT ); Mon, 10 Oct 2022 14:22:23 -0400 Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6EDA647F5 for ; Mon, 10 Oct 2022 11:22:22 -0700 (PDT) Received: by mail-pg1-x536.google.com with SMTP id e129so10876741pgc.9 for ; Mon, 10 Oct 2022 11:22:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastly.com; s=google; h=message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+bSxSJqNb+sqoNTXSt8Ye05VUAgMzhi/zgUSPCGgMEc=; b=n/8VHYiA7PJrbHwJIQGtT8aJdABS3/DM5tlhlN+UkXerEmjBV7g962mdOrOsnsFT0Z oKIpOF3iS/VaLfq79VOaHWcjnEGmtPNYaUtINafZ8N+Asxq+MC3qgBTt2Sh6iTREKXQQ 0N5G//kY1te3/PKLi1pL5hwN5Ju4eFQlJ88RA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+bSxSJqNb+sqoNTXSt8Ye05VUAgMzhi/zgUSPCGgMEc=; b=mH9DFQvngM0C2QEfdhgXB3sWw2UpNTCYMx9D4S0R5thOK8Tmlgc1aUk0avPOzYoprK Btehz8FFsA2eUjWUngeAhxqXFnj/tT4VxML5QE4e2/4bto4UziJABqXbGJQdG/8CxJW2 tUiM/W1nLqsHmK+CdSpXklc+WSyPt1icjvhUOjeiEKn2T7vXvZnevA+N/dTQcM9DCAW4 Kp/S3tYECL6+qQzGBhs57hWsJ455+6B0aLQs1Ly9KPmPee+CwRNW9eMNl4nV2nmrUlNe 0sHBsOWCeGH2hoMDmpjzsgGDed1OtFiFnQPgS0YVyqNx4XV/rqSLdmIabnVENZz4InZ5 CsCQ== X-Gm-Message-State: ACrzQf0OgW7oKlqQf7LUNH0vgFKO3VHYHxqHwDEk6T26yAEg69OZQ5bw PWgdmCGECXIqt6pdXXSEKoGH4/7gi8bwPA== X-Received: by 2002:a63:186:0:b0:442:ee11:48a5 with SMTP id 128-20020a630186000000b00442ee1148a5mr17565584pgb.284.1665426142330; Mon, 10 Oct 2022 11:22:22 -0700 (PDT) Received: from localhost.localdomain (c-24-6-151-244.hsd1.ca.comcast.net. [24.6.151.244]) by smtp.gmail.com with ESMTPSA id z18-20020aa79e52000000b005632d3b5c9csm3460195pfq.211.2022.10.10.11.22.21 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Oct 2022 11:22:22 -0700 (PDT) From: Joe Damato To: netdev@vger.kernel.org Cc: kuba@kernel.org, davem@davemloft.net, edumazet@google.com, linux-kernel@vger.kernel.org, Joe Damato Subject: [net-next PATCH] net: core: Add napi_complete_done tracepoint Date: Mon, 10 Oct 2022 11:21:34 -0700 Message-Id: <1665426094-88160-1-git-send-email-jdamato@fastly.com> X-Mailer: git-send-email 2.7.4 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a tracepoint to help debug napi_complete_done. Users who set defer_hard_irqs and the GRO timer can use this tracepoint to better understand what impact these options have when their NIC driver calls napi_complete_done. perf trace can be used to enable the tracepoint and the output can be examined to determine which settings should be adjusted. $ sudo perf trace -e napi:napi_complete_done -a --call-graph=fp --libtraceevent_print 356.774 :0/0 napi:napi_complete_done(napi_complete_done on napi struct 0xffff88e052f02010 dev vlan100 irq_defers_remaining 2 timeout 20000 work_done 0 ret 0) napi_complete_done ([kernel.kallsyms]) napi_complete_done ([kernel.kallsyms]) i40e_napi_poll ([i40e]) __napi_poll ([kernel.kallsyms]) net_rx_action ([kernel.kallsyms]) __do_softirq ([kernel.kallsyms]) sysvec_apic_timer_interrupt ([kernel.kallsyms]) asm_sysvec_apic_timer_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]) [0x243d98] ([kernel.kallsyms]) secondary_startup_64_no_verify ([kernel.kallsyms]) Signed-off-by: Joe Damato --- include/trace/events/napi.h | 29 +++++++++++++++++++++++++++++ net/core/dev.c | 2 ++ 2 files changed, 31 insertions(+) diff --git a/include/trace/events/napi.h b/include/trace/events/napi.h index 6678cf8..e8473d3 100644 --- a/include/trace/events/napi.h +++ b/include/trace/events/napi.h @@ -11,6 +11,35 @@ #define NO_DEV "(no_device)" +TRACE_EVENT(napi_complete_done, + TP_PROTO(struct napi_struct *napi, int hard_irq_defer, unsigned long timeout, + int work_done, bool ret), + + TP_ARGS(napi, hard_irq_defer, timeout, work_done, ret), + + TP_STRUCT__entry( + __field( struct napi_struct *, napi) + __string( dev_name, napi->dev ? napi->dev->name : NO_DEV) + __field( int, hard_irq_defer) + __field( unsigned long, timeout) + __field( int, work_done) + __field( int, ret) + ), + + TP_fast_assign( + __entry->napi = napi; + __assign_str(dev_name, napi->dev ? napi->dev->name : NO_DEV); + __entry->hard_irq_defer = hard_irq_defer; + __entry->timeout = timeout; + __entry->work_done = work_done; + __entry->ret = ret; + ), + + TP_printk("napi_complete_done on napi struct %p dev %s irq_defers_remaining %d timeout %lu work_done %d ret %d", + __entry->napi, __get_str(dev_name), __entry->hard_irq_defer, + __entry->timeout, __entry->work_done, __entry->ret) +); + TRACE_EVENT(napi_poll, TP_PROTO(struct napi_struct *napi, int work, int budget), diff --git a/net/core/dev.c b/net/core/dev.c index fa53830..e601f97 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -6091,6 +6091,8 @@ bool napi_complete_done(struct napi_struct *n, int work_done) if (timeout) hrtimer_start(&n->timer, ns_to_ktime(timeout), HRTIMER_MODE_REL_PINNED); + + trace_napi_complete_done(n, n->defer_hard_irqs_count, timeout, work_done, ret); return ret; } EXPORT_SYMBOL(napi_complete_done); -- 2.7.4