Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp430587ybc; Fri, 22 Nov 2019 07:29:01 -0800 (PST) X-Google-Smtp-Source: APXvYqxUCQdlHDLLYpXko7jhni5e/HT9HlPV75jbe9ewPWmQa/gUFDpjvxTqU6EWesTnIWVWskeL X-Received: by 2002:a05:6402:7cd:: with SMTP id u13mr1742511edy.246.1574436541611; Fri, 22 Nov 2019 07:29:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574436541; cv=none; d=google.com; s=arc-20160816; b=EkSehxhjPD5Nt2m08070svXTwrMAFksTFlL28XXpawUZWWpwGhSw5YLz5ehZbgk0Se E46olQuyAHXGCTpIt71zks3TQsO8kV2pSMPdWi3dBb1jjCwp+I3UYvgpTh1V+arvfm7V wBZ2kfdJCAXMghU/HGuumtgT6hy7bhalSqCZTMPNUITGp2WrXHvmVgvPryYgGbUpmCeg N+0djJ4PQYxVDbUcvnsH3hu+G8D9oDqCvOIBpgPfiuaAC12geTzFkDtDwIfjAAeT4uiT ATZN3rnN7WNiFA+FHYW5XhavnU9lH3JUcCcVmY1vefXbmm5HgWMBsU5obpc0qpV163/P /xQw== 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 u2si4401254ejo.137.2019.11.22.07.28.37; Fri, 22 Nov 2019 07:29:01 -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 S1727282AbfKVP1U (ORCPT + 99 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 Content-Transfer-Encoding: 8bit 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[]; };