Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp6835721ybc; Thu, 28 Nov 2019 06:20:02 -0800 (PST) X-Google-Smtp-Source: APXvYqxTU8PMYHLiFshh6/U5pPZ6p7QX4KSCLOSxck6h57gYWG96ayBcKDXbFa/i7/ub7cyR913X X-Received: by 2002:a17:906:f28a:: with SMTP id gu10mr12590158ejb.107.1574950802644; Thu, 28 Nov 2019 06:20:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574950802; cv=none; d=google.com; s=arc-20160816; b=TVLIReXW29nN+L+JD0iM0T9k92NwWbjEQdbH6TrJ6Yp2uz8nRrlLaVf6bH8q1WtdXi FX00cNgBJMXzrfqEi9AvZz5rkrx0H6MzK6q9Aj90IRbdfAot/jfH/jKitQQi0KusD0KR bdOPr66/vmMsmexTp3De58tLS5NtIPSyqflheCPTlfMzb1e8xnP430E3XLiBR+75hRqL SBpcb9a4ldIib0P5ryzlRTk+ar1jW+3f8gr+aArZtqEmiEM9EOs3lgbbRDRz6GZh6mMx wLfiKVigvhxzqarGak1XV6nKGTO4K5CzMiDjca8G8ZwP3Bo8tX/MFmrZphvLxS89NXCT 5VWA== 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:date:subject:cc:to:from :dkim-signature; bh=JT/cyXM4c3hlhS/42ul0Bg6b/PSo9qW/fW/jL/8JN5I=; b=Og3OicmQUkTQ5ZJbcSg6w44drdhQ1G04ww4EjplWS4jaqZOguOoH6OLOc4tYIxXGv9 xy6ZfwIjfYaNiYds8u5J58QKPkma9Z9LxOBPohqF9iXeHIa7NdojxSHKtY8JTQAM9Gmn 02hCmcs5PT9x09mQoyV3UvAyUV5m6NDaauHH+x3uX4PhlB2jS3EJbZYLM7p/OpfXh3zB oPwrVmYEIeROg3b6EF2IqS9I/aEJEA16bgD4hDBfcaOidvewKtGpMW63qmQKw3sSnxOn hyyQLo6GFWaQPFQbUOQ6SCtoPfB/LsYLTPEnlJPOjpKThLVcOGbLnURnGVeZOXYE6WLp pPpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aBW4RYhY; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h11si13903027edf.93.2019.11.28.06.19.38; Thu, 28 Nov 2019 06:20:02 -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; dkim=pass header.i=@linaro.org header.s=google header.b=aBW4RYhY; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726749AbfK1OS3 (ORCPT + 99 others); Thu, 28 Nov 2019 09:18:29 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:42144 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726712AbfK1OS2 (ORCPT ); Thu, 28 Nov 2019 09:18:28 -0500 Received: by mail-wr1-f66.google.com with SMTP id a15so31329215wrf.9 for ; Thu, 28 Nov 2019 06:18:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=JT/cyXM4c3hlhS/42ul0Bg6b/PSo9qW/fW/jL/8JN5I=; b=aBW4RYhYozIkFwfWySiGzURoUK9gm0MvN+lR/Cel+fVCRq9AHk7CUDGMkIS89R3axU A2hDkR2Y3fkuG60BOe5DzK1Qnv2jNQ8ziyx8MRBjX1NicgfFIYbmUHlI3UKoeIJDyCxC Mw6q4RgeIqt0DHN03YALF2tnD/hYDDaHNccs1LgxIcY2KztA8IrK0meBV3r7KofbQuSi wnpUPgz9f2WYd1mjOa/1oDAAXEyOnmYIWkOD9BhkI2tl9ZjovrH2oAFhpHsHOuTVvkvZ YebdzA76BVW5RqTmgJ7qaTsII7a2hzcqc8t3cgTy7YYOzqw2oL9LtO9CwmEZ8ZDy4FLC gsMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JT/cyXM4c3hlhS/42ul0Bg6b/PSo9qW/fW/jL/8JN5I=; b=cTrGpVRgLsNKRzy1VcekguwJG4bgZf5RoKbqTjRNE7Gb+I8KeQjzb2YpemPx2L5M3A laWGSFgLgIMMTwUEnjg+vJx1kQihNe9M3bXHSzxXYtwDCX0dLK7EU6zN5M30yKkhJtQj jNXPZd1Vac+gG1AUFmESxngQM11hdPda6LQrvzydY7Vkoo+JW09k2Fd502p2RUm+F1ST z9GitJZNQBaGHLKn7sdNs1TJ3Hx3E3uR3u7g/q5oOhiQ48scJnQ4yU87BhGZdWHToBHm thPTXQ8dUYfzdlEmlCIx2c79IVIe2+A8i/l/o+w2zTrTp8Uo3HpxH5gePsIAEPbJ1CwH cV/A== X-Gm-Message-State: APjAAAWqtbvWQ8bzleJMvCPqLHAX3Oi1uIefC+AgA2I4mNBj23gDNj53 qsKiiemmiirGNqrK3PLZ15c3sw== X-Received: by 2002:a5d:6652:: with SMTP id f18mr6935257wrw.246.1574950704416; Thu, 28 Nov 2019 06:18:24 -0800 (PST) Received: from localhost.localdomain ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id f6sm23947092wrr.15.2019.11.28.06.18.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 28 Nov 2019 06:18:23 -0800 (PST) From: Georgi Djakov To: linux-pm@vger.kernel.org Cc: rostedt@goodmis.org, mingo@redhat.com, bjorn.andersson@linaro.org, vincent.guittot@linaro.org, daidavid1@codeaurora.org, okukatla@codeaurora.org, evgreen@chromium.org, mka@chromium.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, georgi.djakov@linaro.org Subject: [PATCH v4 3/3] interconnect: Add basic tracepoints Date: Thu, 28 Nov 2019 16:18:18 +0200 Message-Id: <20191128141818.32168-4-georgi.djakov@linaro.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191128141818.32168-1-georgi.djakov@linaro.org> References: <20191128141818.32168-1-georgi.djakov@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The tracepoints can help with understanding the system behavior of a given interconnect path when the consumer drivers change their bandwidth demands. This might be interesting when we want to monitor the requested interconnect bandwidth for each client driver. The paths may share the same nodes and this will help to understand "who and when is requesting what". All this is useful for subsystem drivers developers and may also provide hints when optimizing the power and performance profile of the system. Reviewed-by: Steven Rostedt (VMware) Signed-off-by: Georgi Djakov --- drivers/interconnect/Makefile | 1 + drivers/interconnect/core.c | 7 +++ drivers/interconnect/trace.h | 88 +++++++++++++++++++++++++++++++++++ 3 files changed, 96 insertions(+) create mode 100644 drivers/interconnect/trace.h diff --git a/drivers/interconnect/Makefile b/drivers/interconnect/Makefile index 28f2ab0824d5..725029ae7a2c 100644 --- a/drivers/interconnect/Makefile +++ b/drivers/interconnect/Makefile @@ -1,5 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 +CFLAGS_core.o := -I$(src) icc-core-objs := core.o obj-$(CONFIG_INTERCONNECT) += icc-core.o diff --git a/drivers/interconnect/core.c b/drivers/interconnect/core.c index c9e16bc1331e..0e4852feb395 100644 --- a/drivers/interconnect/core.c +++ b/drivers/interconnect/core.c @@ -21,6 +21,9 @@ #include "internal.h" +#define CREATE_TRACE_POINTS +#include "trace.h" + static DEFINE_IDR(icc_idr); static LIST_HEAD(icc_providers); static DEFINE_MUTEX(icc_lock); @@ -435,6 +438,8 @@ int icc_set_bw(struct icc_path *path, u32 avg_bw, u32 peak_bw) /* aggregate requests for this node */ aggregate_requests(node); + + trace_icc_set_bw(path, node, i, avg_bw, peak_bw); } ret = apply_constraints(path); @@ -453,6 +458,8 @@ int icc_set_bw(struct icc_path *path, u32 avg_bw, u32 peak_bw) mutex_unlock(&icc_lock); + trace_icc_set_bw_end(path, ret); + return ret; } EXPORT_SYMBOL_GPL(icc_set_bw); diff --git a/drivers/interconnect/trace.h b/drivers/interconnect/trace.h new file mode 100644 index 000000000000..3d668ff566bf --- /dev/null +++ b/drivers/interconnect/trace.h @@ -0,0 +1,88 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Interconnect framework tracepoints + * Copyright (c) 2019, Linaro Ltd. + * Author: Georgi Djakov + */ + +#undef TRACE_SYSTEM +#define TRACE_SYSTEM interconnect + +#if !defined(_TRACE_INTERCONNECT_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_INTERCONNECT_H + +#include +#include + +TRACE_EVENT(icc_set_bw, + + TP_PROTO(struct icc_path *p, struct icc_node *n, int i, + u32 avg_bw, u32 peak_bw), + + TP_ARGS(p, n, i, avg_bw, peak_bw), + + TP_STRUCT__entry( + __string(path_name, p->name) + __string(dev, dev_name(p->reqs[i].dev)) + __string(node_name, n->name) + __field(u32, avg_bw) + __field(u32, peak_bw) + __field(u32, node_avg_bw) + __field(u32, node_peak_bw) + ), + + TP_fast_assign( + __assign_str(path_name, p->name); + __assign_str(dev, dev_name(p->reqs[i].dev)); + __assign_str(node_name, n->name); + __entry->avg_bw = avg_bw; + __entry->peak_bw = peak_bw; + __entry->node_avg_bw = n->avg_bw; + __entry->node_peak_bw = n->peak_bw; + ), + + TP_printk("path=%s dev=%s node=%s avg_bw=%u peak_bw=%u agg_avg=%u agg_peak=%u", + __get_str(path_name), + __get_str(dev), + __get_str(node_name), + __entry->avg_bw, + __entry->peak_bw, + __entry->node_avg_bw, + __entry->node_peak_bw) +); + +TRACE_EVENT(icc_set_bw_end, + + TP_PROTO(struct icc_path *p, int ret), + + TP_ARGS(p, ret), + + TP_STRUCT__entry( + __string(path_name, p->name) + __string(dev, dev_name(p->reqs[0].dev)) + __field(int, ret) + ), + + TP_fast_assign( + __assign_str(path_name, p->name); + __assign_str(dev, dev_name(p->reqs[0].dev)); + __entry->ret = ret; + ), + + TP_printk("path=%s dev=%s ret=%d", + __get_str(path_name), + __get_str(dev), + __entry->ret) +); + +#endif /* _TRACE_INTERCONNECT_H */ + +/* This part must be outside protection */ + +#undef TRACE_INCLUDE_PATH +#define TRACE_INCLUDE_PATH . + +#undef TRACE_INCLUDE_FILE +#define TRACE_INCLUDE_FILE trace + +#include