From patchwork Fri Jan 7 05:29:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 12706221 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id B6668C433F5 for ; Fri, 7 Jan 2022 05:32:36 +0000 (UTC) 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:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=awfCf0qBjGgzPVX0JMf0vBZzi99tDOE+oVeGg5pE3yA=; b=ejjQij0L2UZC9t Bof5IV3rlsN1f5SDg1HuTC6pD5WwdRmcJyLHNshKUw6Fm/+RsowGBI76O4jaIll3Dd2S5ts26qyoZ vwXiRfNllpA8KD7mxncFfOPDtZMEIB4/Kke+ME4jg3TK4OcIb32Cb9qSNgUNANABLnSfJZmpJ+bwV HtMNqeYxnclXk5iAXpETxApxFrPAzGmt9D4IF/MSuEdJ34ZjRfOgWrN6SxL8VlqNe8aN+YVD9WcLv ITUArYVR6Rhurzjru6FPExlDnYFlV1Xf5mrBczoSZcb3FxdJi3YqvnI349VS+14u4KfQWq3Wpu4Wl gx70BhFf+F3zSTIChuyg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n5hqN-002O3e-5t; Fri, 07 Jan 2022 05:31:15 +0000 Received: from mail-io1-xd35.google.com ([2607:f8b0:4864:20::d35]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n5hp7-002NID-0l for linux-arm-kernel@lists.infradead.org; Fri, 07 Jan 2022 05:29:58 +0000 Received: by mail-io1-xd35.google.com with SMTP id o7so5795441ioo.9 for ; Thu, 06 Jan 2022 21:29:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=e63T25IY0LrfOuX+XUbFrW7daTp0yjRBy27VA81f73c=; b=lrazqIvRI7nkcOWlxTYZ9i/W0BZLR+6pq9AkUgro+ggvyCEnHKGma1fZ9YSYg9sLXs t7BZGjrvTexU9tKlOt269njn3U2ieCQjxn3V0E4N2eAeb9iyPqe2sWWyYgK0Nfuor0Kj 7o8gVKi/QiHWa/zkHJSlpIbe+W1LFcV611bn1lba/8aTTOeI83SnxuUYqeOkhgc6fxis r+O2Hwht/mRN4l4ezOOBpeBeIejoXY9HrP/Tk+J5BH7NbzBXo4W18iiRxzUKlMX/9Qdf Q+RYhwObXjtRB9E85C74C9P6wIQKJ1j6GGz/BxLvSV3lqWyMnulc0/m7dOnhr0Pm/FNa maLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=e63T25IY0LrfOuX+XUbFrW7daTp0yjRBy27VA81f73c=; b=8Erd0HC0EsSlRIHRELLB51qXHh9Cy2IlMKhduvOlUWLOzakSknkQ8sH8q1sD2tDman osmixkmDe7cU6WhWWFXip64N/EfSxGsM8ywnbWADm+skCq1KW/1NbudXw1PSvi8/0H39 I7IZxjl/JsaXTogTYBXUd1fqKY0+4MtrjEnY1SjHR7tzS7PtuoRySX/GF6prubpJ4yo4 lQqa75IWPuj6mIPiyf3n38Mcz2zcdlO+wQSN4fb1WJ7GDzjmjCqk1LlVn9DZy17eTJpu +PjNYg2EHCEmJE9z9gMajMsLG3uwK7S7u1LpqZrYAohHoW7p65noKWp5rZngRC4Ya8kc FlKw== X-Gm-Message-State: AOAM533GX6Vp8qBh2xgZHdpl3yDM63b93iyrGMXh0SS0Re0texH+gyuE FutDs7vk5YVqkS9L/ogVO8U= X-Google-Smtp-Source: ABdhPJzCJ4a/OeMh5+Vd7ifGWNtNlzms8nsxPhCodTm0c6KSDOhbHpofTWUlQSognE0poa4IEhOEPg== X-Received: by 2002:a05:6638:2505:: with SMTP id v5mr31095831jat.250.1641533396065; Thu, 06 Jan 2022 21:29:56 -0800 (PST) Received: from frodo.. (c-24-9-77-57.hsd1.co.comcast.net. [24.9.77.57]) by smtp.googlemail.com with ESMTPSA id c18sm1843446iod.18.2022.01.06.21.29.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 21:29:55 -0800 (PST) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux@rasmusvillemoes.dk, rostedt@goodmis.org, mathieu.desnoyers@efficios.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: quic_saipraka@quicinc.com, will@kernel.org, catalin.marinas@arm.com, quic_psodagud@quicinc.com, maz@kernel.org, arnd@arndb.de, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, mingo@redhat.com, jim.cromie@gmail.com Subject: [PATCH v11 05/19] dyndbg: add desc, dev fields to event record Date: Thu, 6 Jan 2022 22:29:28 -0700 Message-Id: <20220107052942.1349447-6-jim.cromie@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220107052942.1349447-1-jim.cromie@gmail.com> References: <20220107052942.1349447-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220106_212957_092102_98F1B1BC X-CRM114-Status: GOOD ( 17.10 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org commit:HEAD~1 added pr_debug(), dev_dbg() params to the new events, but didn't actually capture the params. Do that now; add the other TP_* parts: __fields, fast-assign, and printk elements for the desccriptor and device params. The message capture part is copied from printk:console, it gets the whole message, including dyndbg's prefixing: the dev_name() etc, the optional module:function:line decorations, and the trailing newline (which is trimmed). dyndbg->trace-events must be enabled on both sides: in tracefs: echo 1 > /sys/kernel/tracing/events/dyndbg/enable in dyndbg: echo module drm +T > /proc/dynamic_debug/control This is good; it gives 2 orthogonal cuts at trace traffic, dyndbg can enable callsites indvidually, tracefs can (in principle) filter and trigger on the incoming event stream. ATM, TP_print adds "__entry->desc->{modname,function}", which is redundant with +Tmf enabled callsites. RFC Perhaps the whole decorations/prefix should be excluded from the event capture ? Vincent's skip-past-KERN_DEBUG trick could be extended to skip part or all of the prefix, and leave the "decorating" of events solely to TP_printk. Whats the right separation of concerns ? NB: __entry->desc is a pointer into kernel .data, a pretty stable reference, at least while the kernel is running. Signed-off-by: Jim Cromie --- include/trace/events/dyndbg.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/include/trace/events/dyndbg.h b/include/trace/events/dyndbg.h index 82620b10e968..2ac296cb451c 100644 --- a/include/trace/events/dyndbg.h +++ b/include/trace/events/dyndbg.h @@ -14,10 +14,12 @@ TRACE_EVENT(prdbg, TP_ARGS(desc, text, len), TP_STRUCT__entry( + __field(const struct _ddebug *, desc) __dynamic_array(char, msg, len + 1) ), TP_fast_assign( + __entry->desc = desc; /* * Each trace entry is printed in a new line. * If the msg finishes with '\n', cut it off @@ -30,8 +32,8 @@ TRACE_EVENT(prdbg, __get_str(msg)[len] = 0; ), - TP_printk("%s", __get_str(msg)) - + TP_printk("%s.%s %s", __entry->desc->modname, + __entry->desc->function, __get_str(msg)) ); /* capture dev_dbg() callsite descriptor, device, and message */ @@ -42,10 +44,14 @@ TRACE_EVENT(devdbg, TP_ARGS(desc, dev, text, len), TP_STRUCT__entry( + __field(const struct _ddebug *, desc) + __field(const struct device *, dev) __dynamic_array(char, msg, len + 1) ), TP_fast_assign( + __entry->desc = desc; + __entry->dev = (struct device *) dev; /* * Each trace entry is printed in a new line. * If the msg finishes with '\n', cut it off @@ -58,7 +64,8 @@ TRACE_EVENT(devdbg, __get_str(msg)[len] = 0; ), - TP_printk("%s", __get_str(msg)) + TP_printk("%s.%s %s", __entry->desc->modname, + __entry->desc->function, __get_str(msg)) ); #endif /* _TRACE_DYNDBG_H */