From patchwork Thu Nov 28 14:18:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georgi Djakov X-Patchwork-Id: 11266081 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 24CCE109A for ; Thu, 28 Nov 2019 14:18:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F0D86217D6 for ; Thu, 28 Nov 2019 14:18:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="v8Lraqn+" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726556AbfK1OSY (ORCPT ); Thu, 28 Nov 2019 09:18:24 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:41509 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726227AbfK1OSY (ORCPT ); Thu, 28 Nov 2019 09:18:24 -0500 Received: by mail-wr1-f67.google.com with SMTP id b18so31336367wrj.8 for ; Thu, 28 Nov 2019 06:18:22 -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=bnMxp132Vd6L+3AapluWQFT+FYtyktAJGLaxzIjZpzU=; b=v8Lraqn+HwF1Jmnt9l7ey+j9HyaetIIlDY3yX1tnMX9Muug090zyvm0w6i3cU4pd/K Pa2OKpyX475YQw3p2FFtBoJO1iTAoSy9EeDen5vcawxNnvMHuELNp1gxnW9pgmc+BXpV La6x8X6j3yVOszKKghMEX2Lfkea4i57LamXpzukoN5Fpr1D9LIPGl14cHGeQbwrXzRGK jpjsCrtj/Fz6G6DutIfiPOiMUKRsScuurqCBE+UHtNHdC47r4FaIX75OVVk6CId06kVB o0f+dM55SChfzPXMtQWLJY/r2IeFWVJZF5cBsKe2EYstl4RprPkAFlMLFYBr+yaK4qP9 /xUg== 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=bnMxp132Vd6L+3AapluWQFT+FYtyktAJGLaxzIjZpzU=; b=k28lCDU7/AFnDioM3Gth/YwPALebs6+EqMAEqJUMiAzgITdhBFmYa65aIgYFo1DWAK IWTLLS1P/cy6iIDh3J7o6SelwBVtDiNfosMYjOPokfdWd+4W4nCqrKEqg+PZFl1K2y5I EvPzWKWhq8vRo4gafkPBaizJSos95ZvVbLInlSwEVyJiNfQfxASGuPVYG4uiN/Qq0qQh jQArCUrfi4yrKP5HhaeagnRxn9+sVsEPKM2TtSS/Meb2FmFm5dbyepBbuOUcDTfbiCaU CElhMvpaa6HYfJoWv8yiCEO+Qsf3qEL+C/xIgxJy9/uGB9sch7iEwGWrnXCBlJVk8mIk /AYQ== X-Gm-Message-State: APjAAAVGmBiRO1QHHMrPUgfLjo6gUGYvIymDyHQMKFueQQUGZ9k9epLy aq4UgqTYQepBO/OCyvMcdgeXyg== X-Google-Smtp-Source: APXvYqxCS1zWwYMGux3VT17qKlhcgF1FX0vEaM5jx7QSq/PBF1udA38wr/OTGj0D25QUERplroOaYw== X-Received: by 2002:adf:d848:: with SMTP id k8mr2430296wrl.328.1574950701769; Thu, 28 Nov 2019 06:18:21 -0800 (PST) Received: from localhost.localdomain ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id f6sm23947092wrr.15.2019.11.28.06.18.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 28 Nov 2019 06:18:21 -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 1/3] interconnect: Move internal structs into a separate file Date: Thu, 28 Nov 2019 16:18:16 +0200 Message-Id: <20191128141818.32168-2-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 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Move the interconnect framework internal structs into a separate file, so that it can be included and used by ftrace code. This will allow us to expose some more useful information in the traces. Signed-off-by: Georgi Djakov Reviewed-by: Bjorn Andersson --- drivers/interconnect/core.c | 30 ++----------------------- drivers/interconnect/internal.h | 40 +++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 28 deletions(-) create mode 100644 drivers/interconnect/internal.h diff --git a/drivers/interconnect/core.c b/drivers/interconnect/core.c index 1b811423020a..f30a326dc7ce 100644 --- a/drivers/interconnect/core.c +++ b/drivers/interconnect/core.c @@ -19,39 +19,13 @@ #include #include +#include "internal.h" + static DEFINE_IDR(icc_idr); static LIST_HEAD(icc_providers); static DEFINE_MUTEX(icc_lock); static struct dentry *icc_debugfs_dir; -/** - * struct icc_req - constraints that are attached to each node - * @req_node: entry in list of requests for the particular @node - * @node: the interconnect node to which this constraint applies - * @dev: reference to the device that sets the constraints - * @tag: path tag (optional) - * @avg_bw: an integer describing the average bandwidth in kBps - * @peak_bw: an integer describing the peak bandwidth in kBps - */ -struct icc_req { - struct hlist_node req_node; - struct icc_node *node; - struct device *dev; - u32 tag; - u32 avg_bw; - u32 peak_bw; -}; - -/** - * struct icc_path - interconnect path structure - * @num_nodes: number of hops (nodes) - * @reqs: array of the requests applicable to this path of nodes - */ -struct icc_path { - size_t num_nodes; - struct icc_req reqs[]; -}; - static void icc_summary_show_one(struct seq_file *s, struct icc_node *n) { if (!n) diff --git a/drivers/interconnect/internal.h b/drivers/interconnect/internal.h new file mode 100644 index 000000000000..5853e8faf223 --- /dev/null +++ b/drivers/interconnect/internal.h @@ -0,0 +1,40 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Interconnect framework internal structs + * + * Copyright (c) 2019, Linaro Ltd. + * Author: Georgi Djakov + */ + +#ifndef __DRIVERS_INTERCONNECT_INTERNAL_H +#define __DRIVERS_INTERCONNECT_INTERNAL_H + +/** + * struct icc_req - constraints that are attached to each node + * @req_node: entry in list of requests for the particular @node + * @node: the interconnect node to which this constraint applies + * @dev: reference to the device that sets the constraints + * @tag: path tag (optional) + * @avg_bw: an integer describing the average bandwidth in kBps + * @peak_bw: an integer describing the peak bandwidth in kBps + */ +struct icc_req { + struct hlist_node req_node; + struct icc_node *node; + struct device *dev; + u32 tag; + u32 avg_bw; + u32 peak_bw; +}; + +/** + * struct icc_path - interconnect path structure + * @num_nodes: number of hops (nodes) + * @reqs: array of the requests applicable to this path of nodes + */ +struct icc_path { + size_t num_nodes; + struct icc_req reqs[]; +}; + +#endif From patchwork Thu Nov 28 14:18:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georgi Djakov X-Patchwork-Id: 11266079 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0D20A109A for ; Thu, 28 Nov 2019 14:18:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E00AF21739 for ; Thu, 28 Nov 2019 14:18:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Cr18FxmY" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726702AbfK1OSZ (ORCPT ); Thu, 28 Nov 2019 09:18:25 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:38747 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726582AbfK1OSZ (ORCPT ); Thu, 28 Nov 2019 09:18:25 -0500 Received: by mail-wr1-f66.google.com with SMTP id i12so31410996wro.5 for ; Thu, 28 Nov 2019 06:18:23 -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=qyyDjQdnoeb2queL1lR7vTcgx8zyzYmqnXXfouU/oLY=; b=Cr18FxmY/IBf8ucdTROQ28wKO0nRAvii2N1tI+avejHCJ4/M7e7lber8GjL6Z6I0st Oe3eI3Ts6y+pKbGAl8WOoMVTRDGX8NDwhBn867vxFfbBxPea6/0RhV4zOLJkWtdVUnF0 Cq5KT7SilV9g0vqVttuzBuhy3w4thT4RQqxjrbixVTnPK0IH8fESguUQXqHoOSxcOpPF GDTTtQKYJTpRDi9pMuOv5bxJuUfpxQnbFhJtH/GxKPc/XyzvR38MJfg72g9W1BFP7n5Y iVvAtpxpO34HGYmRP2wO6okXrof2yNGfNh/BCvWrdvJALnRg1eawTMdSCK4vmMlfiDr7 djNg== 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=qyyDjQdnoeb2queL1lR7vTcgx8zyzYmqnXXfouU/oLY=; b=N5NiEkef15l1JfnsFqIgSUnB263+goGLdTLZefX3eIqYahZ/w/lsoZlqZUEZocuNAx /qriH0A6wRI3brRlL0SSMOBzNLTiBqS+ZYg3pVHVWx+nPongNr/dOy3/bli0poSueoCf 8FAQCednjOHgNF1e4BA6nqGP6Y8w6NxWse4E0XO8hOctIGH3jREFyZzB9EbsGbvafV+k 7eFu8M5TT7K+qHQeF9QNNGqQcVHbFNc4v2J9UidShg/rFcqR40pavpj1raVg9ZDuaxQG ABTb1+OxbjZupv0uUWTyKzs9dkkk8ytDVrKJiQeyU5c5sbyDTwB2xo99oXzYEIbUwDqc bCPA== X-Gm-Message-State: APjAAAVzoYb44inET9Psg4l5Y4v+Lk8DbPMGh3qDLM4+WSX4AQsY6Dq3 buFfDuHw+T5Zrb5mAnOdY3aSCw== X-Google-Smtp-Source: APXvYqwCgQz6TJbmvCy58G73SgRuCmaOeDmHeE5hwehaXWFQCG5K9PP7/edDoHjbuxaZQFCYw46elA== X-Received: by 2002:adf:ea8d:: with SMTP id s13mr48495689wrm.366.1574950703019; Thu, 28 Nov 2019 06:18:23 -0800 (PST) Received: from localhost.localdomain ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id f6sm23947092wrr.15.2019.11.28.06.18.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 28 Nov 2019 06:18:22 -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 2/3] interconnect: Add a name to struct icc_path Date: Thu, 28 Nov 2019 16:18:17 +0200 Message-Id: <20191128141818.32168-3-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 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org When debugging interconnect things, it turned out that saving the path name and including it in the traces is quite useful, especially for devices with multiple paths. For the path name we use the one specified in DT, or if we use platform data, the name is based on the source and destination node names. Suggested-by: Bjorn Andersson Signed-off-by: Georgi Djakov Reviewed-by: Bjorn Andersson --- drivers/interconnect/core.c | 18 +++++++++++++++--- drivers/interconnect/internal.h | 2 ++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/drivers/interconnect/core.c b/drivers/interconnect/core.c index f30a326dc7ce..c9e16bc1331e 100644 --- a/drivers/interconnect/core.c +++ b/drivers/interconnect/core.c @@ -356,9 +356,17 @@ struct icc_path *of_icc_get(struct device *dev, const char *name) mutex_lock(&icc_lock); path = path_find(dev, src_node, dst_node); - if (IS_ERR(path)) - dev_err(dev, "%s: invalid path=%ld\n", __func__, PTR_ERR(path)); mutex_unlock(&icc_lock); + if (IS_ERR(path)) { + dev_err(dev, "%s: invalid path=%ld\n", __func__, PTR_ERR(path)); + return path; + } + + if (name) + path->name = kstrdup(name, GFP_KERNEL); + else + path->name = kasprintf(GFP_KERNEL, "%s-%s", + src_node->name, dst_node->name); return path; } @@ -481,9 +489,12 @@ struct icc_path *icc_get(struct device *dev, const int src_id, const int dst_id) goto out; path = path_find(dev, src, dst); - if (IS_ERR(path)) + if (IS_ERR(path)) { dev_err(dev, "%s: invalid path=%ld\n", __func__, PTR_ERR(path)); + goto out; + } + path->name = kasprintf(GFP_KERNEL, "%s-%s", src->name, dst->name); out: mutex_unlock(&icc_lock); return path; @@ -519,6 +530,7 @@ void icc_put(struct icc_path *path) } mutex_unlock(&icc_lock); + kfree(path->name); kfree(path); } EXPORT_SYMBOL_GPL(icc_put); diff --git a/drivers/interconnect/internal.h b/drivers/interconnect/internal.h index 5853e8faf223..bf18cb7239df 100644 --- a/drivers/interconnect/internal.h +++ b/drivers/interconnect/internal.h @@ -29,10 +29,12 @@ struct icc_req { /** * struct icc_path - interconnect path structure + * @name: a string name of the path (useful for ftrace) * @num_nodes: number of hops (nodes) * @reqs: array of the requests applicable to this path of nodes */ struct icc_path { + const char *name; size_t num_nodes; struct icc_req reqs[]; }; From patchwork Thu Nov 28 14:18:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georgi Djakov X-Patchwork-Id: 11266075 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0A55D14B7 for ; Thu, 28 Nov 2019 14:18:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D4BF1215A5 for ; Thu, 28 Nov 2019 14:18:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="aBW4RYhY" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726722AbfK1OS1 (ORCPT ); Thu, 28 Nov 2019 09:18:27 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:42145 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726227AbfK1OS0 (ORCPT ); Thu, 28 Nov 2019 09:18:26 -0500 Received: by mail-wr1-f67.google.com with SMTP id a15so31329214wrf.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=JYIeNyfaWi998I8HHCiKtkKSCavniAUL73kWEihQ6k3Cf9vheeOvuqO0qgJUAZeUc3 b4sCqtulhJdG2N1sMjMhp1PRggEAJfq23bUFWWUBdDI3sQYnj11sWfNvF3uPL1omLnKM oA+47PJRRQu0bbfRbPQVvy+yttYP1CLP7cuRzyfQXQNtLZk7uNeUxIkMK6nSsGfEgCeg uaYYiMryCzJ0rwxYPaPk3j8ioZflLoMziaVgxDxHUecCoz9IYr7jRICqRNtDSb2EkqG0 uSbyUMO3rB/PGlwr9m+gp89MUGfIbKj52OU600pFxN2I8PWOmi/bR9zzgAYDkCVB6mfP Jrrg== X-Gm-Message-State: APjAAAWlNIGdj5ZszPJ0NzgUZzMyxkedA11ECtUwEV7lkNS7HAgLnkpW UFJlbTD6VW6+Q6dakY3ykuRXAQ== X-Google-Smtp-Source: APXvYqycAPzTOk7jiYu0x7chzYsqp4QkBnI1R5T6PVG42h5covchwVRihpX7Va66RoE5RKSY6KNu2g== 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 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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 Reviewed-by: Bjorn Andersson --- 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