From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 535A0C433EF for ; Thu, 11 Nov 2021 13:26:05 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1A7D461211 for ; Thu, 11 Nov 2021 13:26:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 1A7D461211 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=efficios.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Subject:References: In-Reply-To:Message-ID:Cc:To:From:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=KeGWNT2+nx1ysqpEOfHx8dk3XbIA+mGIMJi5x9STHGs=; b=1dTUmrVQTlK/SKupRbDApkGJjv KAB5MgxD1mbyqJHn3OMs5cGQcr4TYSzPIWZf1RY8bVky9UFxLnfxCLxIQha1uIKhtiEKK8VD46T8E ItuSqBZXNuobQfyc4L1PrcQxrYWqD3L4n5jqdoUbx1b1NLoRklxB+2CUTTiSqhEi4ZbWNN4evke1d 0uwAhokv5PQmELZcyna7HCV7pjsjHG/0y5M2/kjf3gspWQZziQfEriK2Re4NMcK65invbu64ylABy rFiWY+KZYR8gIo1TBAySeJSzYm36amWDQ/i9iIbJZyFOCKDjPzwwBkUERf5iSzUeGhd7xX05GRNa/ P3mGpELA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mlA4N-007xzf-5Z; Thu, 11 Nov 2021 13:24:47 +0000 Received: from mail.efficios.com ([167.114.26.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mlA4J-007xxN-DY for linux-arm-kernel@lists.infradead.org; Thu, 11 Nov 2021 13:24:45 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id C098839676E; Thu, 11 Nov 2021 08:24:35 -0500 (EST) Received: from mail.efficios.com ([127.0.0.1]) by localhost (mail03.efficios.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id YYeI4G3aTRmn; Thu, 11 Nov 2021 08:24:35 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id 20DA93968C7; Thu, 11 Nov 2021 08:24:35 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com 20DA93968C7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=default; t=1636637075; bh=pmN1tZi2Ga/dogjwxPcnzqahDJ8goX5On/iHqGwpSbE=; h=Date:From:To:Message-ID:MIME-Version; b=Ep8aNNCfY7m5K1FBeU42+IxLJnYEeIucA9LeFe7FtX6rgfdqjKKAIxiSxtzpYBpMw JwhI8VJ5GoYdFQAthOyyF7sBoN2oCZN7726uMOg2cJ4tutjs/Lg6RNzqjAEKOechyX O1eWLaSXwfJ0o6BBu4oA9U6KhWoftzN0ViFg0zH7LPd30Q94HCSjjWZzaq3v174fHE FLCEZ99WL+hSAXD+oYI3a6fsDYKNTo5J3HtjM4yOGNxguccT1jeUKjvf6LxyDtvl4w GChlGiWSB/IR0QXL1JOJh0eKN2LLk5tRRa1xFxvu/RLRY3BNilhWUXD/db3b1MP1tM Q56Cr0aCyRIxw== X-Virus-Scanned: amavisd-new at efficios.com Received: from mail.efficios.com ([127.0.0.1]) by localhost (mail03.efficios.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id zsyUYC97eWzG; Thu, 11 Nov 2021 08:24:35 -0500 (EST) Received: from mail03.efficios.com (mail03.efficios.com [167.114.26.124]) by mail.efficios.com (Postfix) with ESMTP id 083E1396B00; Thu, 11 Nov 2021 08:24:35 -0500 (EST) Date: Thu, 11 Nov 2021 08:24:34 -0500 (EST) From: Mathieu Desnoyers To: rostedt Cc: jbaron , Sai Prakash Ranjan , Will Deacon , Catalin Marinas , quic psodagud , maz , Greg Kroah-Hartman , Arnd Bergmann , linux-arm-kernel , linux-kernel , linux-arm-msm@vger.kernel.org, Ingo Molnar , jim cromie , seanpaul@chromium.org Message-ID: <1665247433.56.1636637074878.JavaMail.zimbra@efficios.com> In-Reply-To: <20211109172848.304b1c19@gandalf.local.home> References: <264b77dd-5509-60f9-248c-a93135b01aa9@quicinc.com> <20211109124046.2a772bcb@gandalf.local.home> <20211109165104.176b4cf9@gandalf.local.home> <55a9fe7b-5573-0f80-e075-758b377a6c47@akamai.com> <20211109172848.304b1c19@gandalf.local.home> Subject: Re: [PATCHv3 3/3] dynamic_debug: Add a flag for dynamic event tracing MIME-Version: 1.0 X-Originating-IP: [167.114.26.124] X-Mailer: Zimbra 8.8.15_GA_4156 (ZimbraWebClient - FF94 (Linux)/8.8.15_GA_4156) Thread-Topic: dynamic_debug: Add a flag for dynamic event tracing Thread-Index: ETB17VPNXK5+4Gp8n5NYuqqK7RA4yg== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211111_052443_574712_D3E26265 X-CRM114-Status: GOOD ( 27.80 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org ----- On Nov 9, 2021, at 5:28 PM, rostedt rostedt@goodmis.org wrote: > [ Hmm, should add Mathieu in on this discussion ] > > On Tue, 9 Nov 2021 17:13:13 -0500 > Jason Baron wrote: > >> > What we are looking at there is to pass the dynamic debug descriptor to the >> > trace event filtering logic, where you could filter on information passed >> > to it. For example, on a specific file if a trace event is called by >> > several different files or modules. >> > >> > -- Steve >> >> Ok, Could this be done at the dynamic debug level as it can already match >> on specific files and line numbers currently? > > Not sure what you mean by that. > > The idea was that this would only be enabled if dynamic debug is enabled > and that the DEFINE_DYNAMIC_DEBUG_METADATA() could be used at the > tracepoint function location (trace_foo()) by the tracepoint macros. And > then if one of the callbacks registered for the tracepoint had a > "dynamic_debug" flag set, it would be passed the descriptor in as a pointer. > > And then, for example, the filtering logic of ftrace could then reference > the information of the event, if the user passed in something special. > > # echo 'DEBUG_FILE ~ "drivers/soc/qcom/*"' > events/rwmmio/rwmmio_write/filter > # echo 1 > events/rwmmio/rwmmio_write/enable > > And then only the rwmmio_write events that came from the qcom directory > would be printed. > > We would create special event fields like "DEBUG_FILE", "DEBUG_FUNC", > "DEBUG_MOD", "DEBUG_LINE", etc, that could be used if dyndebug is enabled > in the kernel. > > Of course this is going to bloat the kernel as it will create a dynamic > debug descriptor at every tracepoint location. I think there is indeed value in doing this. Where I'm not sure is regarding how we allow this to be enabled/configured. The way I see it, it might be sufficient and simpler to do just something along those lines: - Introduce a new struct tracepoint_caller_info, which would contain information about file, line number and module name where each trace_*() statement is located. - Add a new CONFIG_TRACEPOINT_CALLER_INFO which generates this new structure at build time for kernel and modules. This would indeed bloat the kernel, but it's a build-time configurable trade-off. - Change the prototype for the tracepoint callbacks to add an additional argument "struct tracepoint_caller_info *caller_info". When CONFIG_TRACEPOINT_CALLER_INFO is disabled, simply have this pointer be NULL. When CONFIG_TRACEPOINT_CALLER_INFO is enabled, pass the tracepoint's caller_info structure as parameter. It should be straightforward to adapt the tracepoint callback prototypes within each user within the Linux kernel tree. And for out-of-tree users, they have to adapt to that kind of change already anyway. Thoughts ? Thanks, Mathieu -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel