Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp1793637ybf; Sun, 1 Mar 2020 18:18:53 -0800 (PST) X-Google-Smtp-Source: APXvYqz66k1lkvmyqKYcN8YKMTgQ2/fhgHyWwBnpkii9JUfYNP16oMbHxhb/tsJqauhDGfnwQDyk X-Received: by 2002:a9d:7a47:: with SMTP id z7mr11848733otm.179.1583115533239; Sun, 01 Mar 2020 18:18:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583115533; cv=none; d=google.com; s=arc-20160816; b=iNuVyGh23/bnwLotYquO5phLp0yU5L/vZf40FKoZxGD1TcMKHgR5tAh+4lVWgWYu1Q 6Rjg+kA6w3yq7o8o9O/vy8DhyS/gUaf8sC3ptRkc9IYTsDEXt4C6UuUdPK8CEI0/8ZIT 9OyhS13Jl5CRLKxpVWaxIDMkIAx7WuXkXtZHDWxyg+UZ2lrTBBzsnGRo7G40VF0Lyd3+ W7hi116LFI/2jY1DNX2JQ0BUD+AgtahjFgpT6joauJDDo+1Adw7zVIpIlUYbb7+ud9N3 Elh0V41Sp3YNGbiz4GE947A6cW/QtL+eQEFKh+xe6D3ktRNSIFEZZlxhSS47wzJxnAm1 +8bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=Etwmbdx9u0p5vTvrA5Ik37g2vaxyVXzA/ehI8ZyoH6g=; b=BBJkk+pGXOdzs2tdA+I+9pixpW0EHJLQ88gl5YG2ooztnWXbIu4pTf161drupw0hNi NxbMyuMUCli4rAlIdJj19Gjjg0ig5g9MMxEmJ2dVK7RxgX6rsOeL3/drTwRGIetnvOdc d5x4AvT0h5DunmP0gDaoc6BCdIvNKwXF/s1U5Kx++14wJ5L4RM2ErBRWt0ZTNroTYgM1 IoGYHkyuTRRT4qQdyE+Yi4/B94V25fcjkpE6DIly8MtnatkHzkKPB3iqjBesPbuOlb1O qDtZqmEannT4slCIPo3xB+rIQF0ni9HQ7RiGpg5fiRl/xUraOK8xLdsn/5EunWpPWzdZ G9xQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r23si1594932otd.203.2020.03.01.18.18.41; Sun, 01 Mar 2020 18:18:53 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726751AbgCBCRh (ORCPT + 99 others); Sun, 1 Mar 2020 21:17:37 -0500 Received: from mail.kernel.org ([198.145.29.99]:57098 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726690AbgCBCRh (ORCPT ); Sun, 1 Mar 2020 21:17:37 -0500 Received: from oasis.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 31A2824697; Mon, 2 Mar 2020 02:17:36 +0000 (UTC) Date: Sun, 1 Mar 2020 21:17:33 -0500 From: Steven Rostedt To: Cezary Rojewski Cc: "linux-kernel@vger.kernel.org" Subject: Re: Question about enabling trave_events on module load Message-ID: <20200301211733.26949f4a@oasis.local.home> In-Reply-To: <8107a684-3ade-2457-28e4-c7e29ab1b1f5@intel.com> References: <8107a684-3ade-2457-28e4-c7e29ab1b1f5@intel.com> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 28 Feb 2020 20:16:54 +0100 Cezary Rojewski wrote: > Hello Steven, > > I bet that is not the first time said question is asked - that's for > sure - but I failed to find a method for solving the issue, that is: not > missing a single trace from the moment given module is loaded. Maybe I'm > missing something or documentation wasn't clear enough and that's why > I'm here. > > If I am, please point to towards the right direction. Then you can slap > me for not reading the documentation carefully. > > "trace_event=" cmdline option seems to target built-in tracepoints > _only_ so ain't much of a help to me. After digging the past for some > time, I've found a very promising thread: > tracing: Enable tracepoints via module parameters > https://lore.kernel.org/patchwork/patch/240185/ I find this email extremely amusing. Just the day before (Thursday), I was trying to clean out my INBOX (it had emails back from 2008!) and I came across this very thread, and said to myself. "Hmm, I wonder if I should push this again?". What a coincidence that the next day, someone would email me about that thread after 9 years! > > Sadly, I wasn't able to find _that_ solution (or anything similar for > that matter) implemented into the kernel. That's because it was dropped and forgotten about :-( I left it in my INBOX to remind myself to bring it back, but that didn't work out as well as I expected, as my INBOX turned into more of a graveyard than a TODO list. > > So far, the only option I came with was separating traces into a > built-in piece that declares all events upfront so "trace_event=" option > has something to hook into. Said piece is of course made of a standard > trace header file filled with macro usage and a .c file with handful of > EXPORT_TRACEPOINT_SYMBOL(s). > > While that solution could suffice, localization is the problem here - if > a tree my module is built in is configured via -m, the built-in piece I'm unfamiliar with "-m", what does that do? > won't expose symbols at all and 'make' will leave me with bunch of > "ERROR: undefined" for every module my traces were used in. To > fix the problem, I've relocated my trace .c file to /kernel/trace/. > Finally it compiles and works as intended.. Well, obviously (as you state below), that's not an answer. > > Not really satisfying, though. While there are some examples of > subsystems keeping their trace .c in /kernel/trace (e.g.: > power-traces.c), I don't believe that place is open for _every single > driver_ to dump their trace sources into. > > If indeed traces cannot be enabled on module load, then this is a gap. > While not everyone looked satisfied in the 9year old thread, I believe > having the gap closed is important - and userspace can always be > improved upon as time passes. > > > Thank you in advance for your input and time. I think your email confirmed to me that I need to push this thread again. Thanks for reaching out! -- Steve