From patchwork Fri Nov 22 15:27:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georgi Djakov X-Patchwork-Id: 180070 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp378813ilf; Fri, 22 Nov 2019 07:27:25 -0800 (PST) X-Google-Smtp-Source: APXvYqymjAvBjBExdkw/qzkuHCjsbKaKmlIHJfZzUGe2LzwiH3uQqAmpyk0MlEBReIQ5nt3p9fKS X-Received: by 2002:a17:906:1e03:: with SMTP id g3mr23531515ejj.331.1574436444987; Fri, 22 Nov 2019 07:27:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574436444; cv=none; d=google.com; s=arc-20160816; b=NSHeqUgDUfsMPAm4XCet6ruYVof1dstS7JoW9YK5N6HGn7Jvs/k4oewN/90UikPk2w +3eoQ5DYy0DkcTwP4nd5xGCA58GsnOW7urXGYBlnlKOe/gF5KSkKka5AhDjD/7gwL1XB Z6x7AeqQVOXfU3qqze6VTN/ehsisqg1ZCx9RQiF1Yba0jdbtD2bQgLpj3233MsUpmqH6 9JntfU+DMA+yNeWp+7rR7o3H2uWF+NVIoCb6gq5TldgJnPuGK/R0YDsuQ2rthcGVHxMS FDkgaSLtkGGVF6I/B97kiUsHU9p3AbUcPJ99KiyCYgLwE9ncSTVAFTO44/2jjTpD2pc+ Nmsw== 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=eweICdklgtftJBxCro04D547skXpMw40lN0wG851Q8Y=; b=Ya4N8jKZkCWAVubCQTkoM6Cng8h6JJtu+o4CiBs6a6COWBwVArSSH9AI4H3wAaS8vY lUQzYkwcqxv77cbmRtPf8EViLPLSNU6DL2XrTCnhFn7q63fKRsIuErjU/GL+VohUrzq6 Ln/PvrvQpNhh9Yh8bH1pzWSm3Xxg5WnRg83U2HFAsFQuOjG9ZKuNCsnzv0qX3lK93VCQ 5i0k4exMILOWQjE0fQ7ddu3z8c8H6wk0hWH98GiVk6vUu1hOpKrwqekxK8bB6wFJid7T vy7C47SBkqewMomDprYeIFuzjlwr+611DFpzG49IEqZ3PO2a4G8bnoTgjMTgHqUx3dSX xi9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ee4cbJHq; 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 h13si1571621ejq.54.2019.11.22.07.27.24; Fri, 22 Nov 2019 07:27:24 -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=Ee4cbJHq; 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 S1727298AbfKVP1U (ORCPT + 26 others); Fri, 22 Nov 2019 10:27:20 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:40485 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727146AbfKVP1T (ORCPT ); Fri, 22 Nov 2019 10:27:19 -0500 Received: by mail-wr1-f65.google.com with SMTP id 4so5772444wro.7 for ; Fri, 22 Nov 2019 07:27:17 -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=eweICdklgtftJBxCro04D547skXpMw40lN0wG851Q8Y=; b=Ee4cbJHqmAb7pyy2MpzCOQm8pAD4EZdA9GpnkGAu00Qo6T6NoW6AyF8/fgzxC/5slv 5iRVO0Wr82T9F1XXz/1vTI6AXz7ta3qUDkp3B41/q5RJAta1wKh73G9ySad/CPZzyX3v UVkshIEEiIb11rkciVTahVMKB7z4j6t6tZzhd5g4qDIVQWlHLYBBr1FMgw4ZlF3JOK3S BFHI4O+1kJ5kAfn1NqotmKfJc2wMtESn9EB7YSvPnGFIq5VcJBLG8FOsQorCvFCWehrw IzioRR4M860jpSOOiFt6ZmMiH5a1a1Fjh/7qum6Civz6CPeLoH19PWCGWpWJWFThANtg AqYw== 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=eweICdklgtftJBxCro04D547skXpMw40lN0wG851Q8Y=; b=osGtuw3giD3Y2wh91LEgGhRqadnKptb7YbC0WKIUfK1rjFADUO50gdpBOpMNUWt/4h h9ujUKehfKWMbeGUmn7v9V+KjxgPbb0XiUOdWz1N1xgx4xadiyGH+kMQ2N2d9HcYBD3O Chsq0W3Z5tTPib3fuIa9v5LUBnncGEskeEspb8EljnSfCHtb5CLT6eFF8R720Ljb9U71 e62SyqRsP90NaJUyG6MpyQ5Nt5TAeSLLSLvHDWnp5rrQ9zEcgsEu8+17+VhtASAcKJtA 2egS4jmCYlYgiqoRwunRF6e9zgx3OOFaKJ3cgRe7PA5kfiFuFruzTAWYvzvMmY5lpq6l RUKA== X-Gm-Message-State: APjAAAW+g18sO/I0wb9Es2fE1ivVrZnleb9iSFCJLtOC2FQrjd4Agl92 0Ks57Rk2ppeK8BJ9mjE0SI7A/w== X-Received: by 2002:adf:e911:: with SMTP id f17mr19085504wrm.300.1574436437060; Fri, 22 Nov 2019 07:27:17 -0800 (PST) Received: from localhost.localdomain ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id a206sm4061081wmf.15.2019.11.22.07.27.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 22 Nov 2019 07:27:16 -0800 (PST) From: Georgi Djakov To: linux-pm@vger.kernel.org, rostedt@goodmis.org, mingo@redhat.com Cc: 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 v3 2/3] interconnect: Add a name to struct icc_path Date: Fri, 22 Nov 2019 17:27:11 +0200 Message-Id: <20191122152712.19105-3-georgi.djakov@linaro.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191122152712.19105-1-georgi.djakov@linaro.org> References: <20191122152712.19105-1-georgi.djakov@linaro.org> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 --- 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 b06ed180bae3..1ddad8ef3cf0 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[]; };