Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2929901pxb; Mon, 19 Apr 2021 18:27:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw8FKVLKWOXoM94ryruxcDOw7YyxrDsOellKcrP8b7Q4hxWokRw511V9AzNjwJ5/eEkzpVI X-Received: by 2002:a50:ec97:: with SMTP id e23mr8150401edr.98.1618882051735; Mon, 19 Apr 2021 18:27:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618882051; cv=none; d=google.com; s=arc-20160816; b=z1eFld9tpmt36oNGfZU64z/owIWpYILu8jO5QEa41WF1gRS4GnE+ZifuUsxF8SIYI4 Yu7NL0JbJa/OEOSUKlScpSk5/XS6Dm2R+7w5Bd99jtHjDyy9J6t7w2J6l7mQarNRcnM3 UycyrNrDOTqgsUA15F+AJLcnv2PsfRcbYrzOIrAm1jnAVHzCkto9xlstHdqmtmaHERny NSay0GHrl+cPajSnf6ACciCeeTswzzpDZ6Kc2qP45J4KZLXpGFQtWlPoii3Pc0FqrS0N 9Sp2g5/ptF0uodU+zhrI6fjExSbN5y/S/TkULHFyZqIQQxVi4RANxbYuu4e2BkaIKxdd 3nmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=v433RIgrg2kQQRI72xpOryqD9ZucPbQbhmAZVvLs6dA=; b=wbmL6B1pGtZr74nKaxqMLpwhQOCjXvAMfOVPZjT1Ch/c60p8R81aS0HdVYu8SeOzn+ Ra7UI3a3kNVAjuIMbMskOPiYfGqc/Lk8FQETRf+bWwpjSkm6fgaeRybKYnFFGful0TEj Mg1aRyWF1Z3X6Bts92GNw7jqd9kbpIT87he12AynaApWvDmmeGLRe1t9KXmoUw49nRTu kluUd69GgZgCeZgMR1y3DhEDMAUKa6LZZ5Gs1j5YGxwED1TOEzrNkxijb6w1j+jhHh4A W3sQKu4NVJmqMQ5Tzs14WZ1EQxU9VrxXrfIHN2K0iYY+V9gYk/oSj08lb2Oz9NhZWHDd 3/kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=Wu2EEDpZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id oz10si13979296ejb.8.2021.04.19.18.27.08; Mon, 19 Apr 2021 18:27:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=Wu2EEDpZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232568AbhDTB0g (ORCPT + 99 others); Mon, 19 Apr 2021 21:26:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229994AbhDTB0f (ORCPT ); Mon, 19 Apr 2021 21:26:35 -0400 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32595C06174A for ; Mon, 19 Apr 2021 18:26:05 -0700 (PDT) Received: by mail-ej1-x62d.google.com with SMTP id r20so6017447ejo.11 for ; Mon, 19 Apr 2021 18:26:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=v433RIgrg2kQQRI72xpOryqD9ZucPbQbhmAZVvLs6dA=; b=Wu2EEDpZHaYgPXWGrauzCxSPMzPN23CWLddOUY108yebHLnFrDOxqE7t7t0cL8laUX 0tGj7IHn9qeu43zTeKT+gMCCPLHGnMg30f0SiCu7Rch5ZPybGTfW3jdfAsqjhBqYKrZ+ nVFnJh3h8+4Cm1tRefpfDNf5HeyfSUBc5QVSiLIEaPunUFxZ2FumMcLtd/rfESQKZkqN 5TF/ek+vUYlspsTjkyj556afYFqvWE3RKkQp5UdslpMkdzD5JE6xhfFJySMs1+G9pjhb OAgjpiPAQw2DJq9D5VYjz4sGnOZO3TQ56P9elo1jQ3X53cAyz0oacKR6cKj3/5l6yyEW otEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=v433RIgrg2kQQRI72xpOryqD9ZucPbQbhmAZVvLs6dA=; b=IoYi48I6FymbDwKk9V1jaL3N4wzV6vCV2ZmxPbqrCmsqa8Qgl6XGfCJ+xOHpoELDYC 7msBhC5V9kD726G3+st47eQPPWxohLrWNJDR22qRyX0sYnkLLDK+3it2qFWC77WQguWe DA3GVxR+wg86ojK7BC2vUx0IklSei/Tafk2qnK9VPgMVceo8BB/4/9/TxoYwcHNa/4kr MAw0OEeMsILcuFv4eMUudbwWK7uLnT5qvdRsIr//StRPx0t/3HBBakaizVVMxS7foft/ o2aozaZkNsOT4G2YcP8fEWJ8NFB9sidvlPfDMHfw3aVZnYflpw477oRdnQTV2EoQmuLx gbHg== X-Gm-Message-State: AOAM530W+158THBlSgRzw4v5w52AJ8sCsZIYljuFVFr07gHnhXSb06Ce V6ozD8F1YqKF5pMUOCSbMOQv814GZ1jCZ4Rbbc9EmA== X-Received: by 2002:a17:906:18e1:: with SMTP id e1mr8408011ejf.341.1618881963818; Mon, 19 Apr 2021 18:26:03 -0700 (PDT) MIME-Version: 1.0 References: <1299622684.20306.77.camel@gandalf.stny.rr.com> <877hc64klm.fsf@rustcorp.com.au> <20130813111442.632f3421@gandalf.local.home> <87siybk8yl.fsf@rustcorp.com.au> <20130814233228.778f25d0@gandalf.local.home> <77a6e40b57df092d1bd8967305906a210f286111.camel@intel.com> <20210419181111.5eb582e8@gandalf.local.home> In-Reply-To: <20210419181111.5eb582e8@gandalf.local.home> From: Dan Williams Date: Mon, 19 Apr 2021 18:25:54 -0700 Message-ID: Subject: Re: [PATCH][RFC] tracing: Enable tracepoints via module parameters To: Steven Rostedt Cc: "fweisbec@gmail.com" , "jeyu@kernel.org" , "mathieu.desnoyers@efficios.com" , "linux-kernel@vger.kernel.org" , "mingo@elte.hu" , "chris@chris-wilson.co.uk" , "yuanhan.liu@linux.intel.com" , "Grumbach, Emmanuel" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 19, 2021 at 3:11 PM Steven Rostedt wrote: > > On Mon, 19 Apr 2021 21:54:13 +0000 > "Williams, Dan J" wrote: > > > [ drop Rusty, add Jessica and Emmanuel ] > > Probably could have kept Jessica on as she's the module maintainer. Oh, you misread, I swapped out Rusty for Jessica on the Cc. > > > > > On Wed, 2013-08-14 at 23:32 -0400, Steven Rostedt wrote: > > > On Thu, 15 Aug 2013 11:32:10 +0930 > > Wow, this is coming back from the dead! No thread rests in peace! No one can escape the all seeing eye of lore, and it makes it so easy to reply to ancient stuff. I thought it useful to kick the zombie because this thread is the first thing that comes up in the Google search of: "enable tracepoint at module load" > > > > Rusty Russell wrote: > > > > > > > Steven Rostedt writes: > > > > > But the thing about this that bothers me is that there's no way > > > > > to say, > > > > > "Enable all tracepoints in this module on load". I would like a > > > > > way to > > > > > do that, but I don't know of a way to do that without modifying > > > > > the > > > > > module code. Have any ideas? Basically, I would love to have: > > > > > > > > > > insmod foo tracepoints=all > > > > > > > > > > or something and have all tracepoints enabled. > > > > > > > > "without modifying the module code"? Why? The code isn't that > > > > scary, > > > > and this seems useful. > > > > > > I'm not afraid of the code, I'm afraid of you ;-) I hear you have > > > killer puppies. > > > > > > > > > OK, then when I get some time, I may cook something up. > > > "when I get some time" HAHAHAHAHAHAH!!!! That was what? 8 years ago! free time coming up... any day now. > > > > > > > Thanks, > > > > > > -- Steve > > > > Revive an old thread... > > I'll say! > > > > > Steven, did you ever end up with a solution to the "enable tracing at > > module load" problem? > > For tracepoints, no. For function tracing, yes! > > > > > I see some people getting admonished to use ftrace over dev_dbg() [1], > > but one of the features that keeps dev_dbg() proliferating is its > > generic "$mod_name.dyndbg=" module parameter support for selective > > debug enabling at boot / module-load. > > > > It would be useful to be able to do > > /sys/kernel/debug/dynamic_debug/control enabling for tracepoints, but > > also module::function_name patterns for "got here" style debugging. I'd > > be happy to help with this, but wanted to understand where you left > > things. > > > > [1]: https://lore.kernel.org/linux-wireless/YHRFy3aq%2FgB7Vde6@kroah.com/ > > I don't think I did anything with trace events, I'll have to dig deeper. > But today you have this: > > # cd /sys/kernel/tracing > > # rmmod bridge > > # echo ':mod:bridge' > set_ftrace_filter > > # cat set_ftrace_filter > :mod:bridge > > # echo function > current_tracer > > # cat trace > # tracer: function > # > # entries-in-buffer/entries-written: 0/0 #P:8 > # > # _-----=> irqs-off > # / _----=> need-resched > # | / _---=> hardirq/softirq > # || / _--=> preempt-depth > # ||| / delay > # TASK-PID CPU# |||| TIMESTAMP FUNCTION > # | | | |||| | | > > # modprobe bridge > > # cat set_ftrace_filter > br_switchdev_event [bridge] > br_device_event [bridge] > br_net_exit [bridge] > br_boolopt_get [bridge] > br_boolopt_multi_get [bridge] > br_opt_toggle [bridge] > br_boolopt_toggle [bridge] > br_boolopt_multi_toggle [bridge] > br_dev_set_multicast_list [bridge] > br_get_link_ksettings [bridge] > [..] > > # cat trace > # tracer: function > # > # entries-in-buffer/entries-written: 10/10 #P:8 > # > # _-----=> irqs-off > # / _----=> need-resched > # | / _---=> hardirq/softirq > # || / _--=> preempt-depth > # ||| / delay > # TASK-PID CPU# |||| TIMESTAMP FUNCTION > # | | | |||| | | > modprobe-2364 [006] .... 12929.869510: br_init <-do_one_initcall > modprobe-2364 [006] .... 12929.869513: br_fdb_init <-br_init > modprobe-2364 [006] .... 12929.869522: br_device_event <-call_netdevice_register_net_notifiers > modprobe-2364 [006] .... 12929.869522: br_device_event <-call_netdevice_register_net_notifiers > modprobe-2364 [006] .... 12929.869522: br_device_event <-call_netdevice_register_net_notifiers > modprobe-2364 [006] .... 12929.869522: br_device_event <-call_netdevice_register_net_notifiers > modprobe-2364 [006] .... 12929.869523: br_device_event <-call_netdevice_register_net_notifiers > modprobe-2364 [006] .... 12929.869523: br_device_event <-call_netdevice_register_net_notifiers > modprobe-2364 [006] .... 12929.869524: br_netlink_init <-br_init > modprobe-2364 [006] .... 12929.869524: br_mdb_init <-br_netlink_init > > > So yes, function tracing now allows setting a filter to trace only the > functions for a given module, and if that module is not yet loaded, it > stores the filter until it is. Ah, thanks for the pointer. So if I wanted to convert a kernel command like: libnvdimm.dyndbg ...it would be something like: ftrace=function ftrace_filter=:mod:libnvdimm ...and then "cat /sys/kernel/tracing/trace" instead of "dmesg" to retrieve... assuming only "got here" style debug was being attempted. > To do something similar for tracepoints, I think we still need to add it as > a module parameter. The dev_dbg() filter language is attractive, it's too bad trace_printk() has such a high runtime cost as combining dynamic-debug and tracing would seem to be a panacea.