Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp8842120ybl; Fri, 17 Jan 2020 02:01:57 -0800 (PST) X-Google-Smtp-Source: APXvYqy/r1L1EqzzgmFUTWjqXMAxBiq6IU6kKSg9oKgxsvPogUg4ws/sRfmo9JaFh0TUhqITvonv X-Received: by 2002:a9d:7cd9:: with SMTP id r25mr5193711otn.326.1579255317474; Fri, 17 Jan 2020 02:01:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579255317; cv=none; d=google.com; s=arc-20160816; b=TFQPNy7aEn7vGvXHeRNcf2eWveheJJRAFTgTEQCbFzwFPyXmz7cIZc8o+KenMv2rAo moyhUMXdRIFTRIrHTxkgSZe+dgydXuF65NEbkfLIkJDfsF0UX/s05r5wql7uL6ODc/ip AQTrgtvfz+6ydRnI1izppr9HKfUTz9K+W8FGoCBCFhARohPLVVL/E3zZeTS2zh9m3d0C EaPbbLmwUfkAXobN/Qsue4iqQdkBKrBkZERfgpLpVsqaNLsHKnJWWBBH7Ih0Jmk2ePcr S4Lvo212OcDEkCilBOgvIpf3dxBMQVJDdcfL9kAVbZCGg6nMjb0WUga/Y5917dm9gyUB vaIA== 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=vdr1R6he+EPUd/NCIYt7CQBDB83sSDrPxTnifgtApfQ=; b=ZGe5X7uymaQjz/ANPgKab5BHmr08DGUr/ZscIoo1GyR043fXxD2WQCBUuZacErpwQf gsMMm7a5AgvCimCEDl4mvp5RNebAEKZHQvzcFPWi7QFkfzWYKXoJQBiSaoRdc2mu80cU kmwBlMlDJ0n5TuGSDfC5ZV/ZMQBRAZn0iowi1SWYjRtS3FS8/5+wSHipfrXmDKRFxaAp PHKpzzzqpbFIsykWEqY7DRnf8Y14wGV2USfpUPbiIxToeTrAoiAF8Pge0WD16sIJtVLh WGWshmxAeN/2bmgdRIAmaJ+uzdgTui/7KLlUfnK5pYVl6WQQUH2G7Yv1piqDMp1jXcDp WMcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ROhabsZf; 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 l21si13103006oic.126.2020.01.17.02.01.44; Fri, 17 Jan 2020 02:01:57 -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=ROhabsZf; 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 S1728863AbgAQJ62 (ORCPT + 99 others); Fri, 17 Jan 2020 04:58:28 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:37383 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728794AbgAQJ60 (ORCPT ); Fri, 17 Jan 2020 04:58:26 -0500 Received: by mail-wr1-f68.google.com with SMTP id w15so22099995wru.4 for ; Fri, 17 Jan 2020 01:58:24 -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=vdr1R6he+EPUd/NCIYt7CQBDB83sSDrPxTnifgtApfQ=; b=ROhabsZfAAiEDR7Gzc8sCW8VUDb0mnVMwJ06LQzZcVDa8sh7M+fsbMH83pXxpwM+U1 Xa3XjS8pqN9oEcjv/1DIf5uRHpbrCwMesgQCfzdTbrh9fSHnoXq/dAEGtOAk2iFs1Pke CpuYNTjhkp1JN8cF/f4n5ICIo7eKCktztF8g69TA2UF5348dxmb6wABTxzDfnPatN54a qKVaOc8ULZPv5VU8K9uYDmS6tl5M3sYwNi14NL+46CihyhOAXeNSTSln6KVR/iGquJar 1b0zxh3WLCpley9d6LWSCRco2mkxjleo5/NvJXy0Z0kIg4ImjUmt051jkCUzBiodVGQw 3DLQ== 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=vdr1R6he+EPUd/NCIYt7CQBDB83sSDrPxTnifgtApfQ=; b=ox60vF+hzSoinh31+yHRIK+W2mhmAtsIGCq2DyRoe0Oat2OKtmtfAG8DT6uX1LDLbP 3IUYcRFBosNSHlxC6lfi4Kfjm9JvQvh6d7k8yqq7OaU/xr3ns0Hvphry7FGkc+lDj8ei /KTpy81Qt016ZaCW7A8+Cxc+vRGQ9raBzh1YgUlWnbMgtI6gWzbDAG79dJB39DHfNFr7 nHB3aQ1rSY5rg8nOi5tBVqxRDVreNMKKbwUHWyYtJfmeQ4ZOCU1Iqxul8Cq1SHdgRtZZ cOGDMcSm+ioZgfq+xDMiHtLu8lCUvJSeEXIIIyto3+K0msvNBZCskrYm5r4CZntjT3ss Njsw== X-Gm-Message-State: APjAAAUPCgUjAFq2NRLSq0lfIkOyjsWKs4+18x0q0d6978RUP6tIqrL4 72Mw3CT2CVgCl2kR5Uu2TD0olg== X-Received: by 2002:a5d:6406:: with SMTP id z6mr2166824wru.294.1579255104160; Fri, 17 Jan 2020 01:58:24 -0800 (PST) Received: from localhost.localdomain ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id r62sm9967007wma.32.2020.01.17.01.58.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 17 Jan 2020 01:58:23 -0800 (PST) From: Georgi Djakov To: gregkh@linuxfoundation.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Georgi Djakov , Bjorn Andersson Subject: [PATCH 04/12] interconnect: Add a name to struct icc_path Date: Fri, 17 Jan 2020 11:58:08 +0200 Message-Id: <20200117095816.23575-5-georgi.djakov@linaro.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200117095816.23575-1-georgi.djakov@linaro.org> References: <20200117095816.23575-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 Reviewed-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 f30a326dc7ce..4f9bdb7f9165 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_const(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_const(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[]; };