linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Georgi Djakov <georgi.djakov@linaro.org>
To: gregkh@linuxfoundation.org
Cc: sanjayc@nvidia.com, maxime.ripard@bootlin.com,
	mturquette@baylibre.com, daidavid1@codeaurora.org,
	bjorn.andersson@linaro.org, skannan@codeaurora.org,
	abailon@baylibre.com, vincent.guittot@linaro.org,
	seansw@qti.qualcomm.com, khilman@baylibre.com,
	evgreen@chromium.org, ksitaraman@nvidia.com,
	devicetree@vger.kernel.org, arnd@arndb.de,
	linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	henryc.chen@mediatek.com, andy.gross@linaro.org,
	robh+dt@kernel.org, linux-mediatek@lists.infradead.org,
	linux-tegra@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, rjw@rjwysocki.net,
	dianders@chromium.org, amit.kucheria@linaro.org,
	linux-kernel@vger.kernel.org, thierry.reding@gmail.com,
	olof@lixom.net, georgi.djakov@linaro.org
Subject: [PATCH v13 8/8] interconnect: Revert to previous config if any request fails
Date: Wed, 16 Jan 2019 18:11:03 +0200	[thread overview]
Message-ID: <20190116161103.6937-9-georgi.djakov@linaro.org> (raw)
In-Reply-To: <20190116161103.6937-1-georgi.djakov@linaro.org>

When consumers report their bandwidth needs with icc_set_bw(), it's
possible that the requested amount of bandwidth is not available or just
the new configuration fails to apply on some path. In this case revert to
the previous configuration and propagate the error back to the consumers
to let them know that bandwidth is not available, hardware is busy or
whatever error is returned by the interconnect platform driver.

Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>
---
 drivers/interconnect/core.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/interconnect/core.c b/drivers/interconnect/core.c
index 8091d998549a..6005a1c189f6 100644
--- a/drivers/interconnect/core.c
+++ b/drivers/interconnect/core.c
@@ -414,14 +414,18 @@ EXPORT_SYMBOL_GPL(of_icc_get);
 int icc_set_bw(struct icc_path *path, u32 avg_bw, u32 peak_bw)
 {
 	struct icc_node *node;
+	u32 old_avg, old_peak;
 	size_t i;
 	int ret;
 
-	if (!path)
+	if (!path || !path->num_nodes)
 		return 0;
 
 	mutex_lock(&icc_lock);
 
+	old_avg = path->reqs[0].avg_bw;
+	old_peak = path->reqs[0].peak_bw;
+
 	for (i = 0; i < path->num_nodes; i++) {
 		node = path->reqs[i].node;
 
@@ -434,10 +438,19 @@ int icc_set_bw(struct icc_path *path, u32 avg_bw, u32 peak_bw)
 	}
 
 	ret = apply_constraints(path);
-	if (ret)
+	if (ret) {
 		pr_debug("interconnect: error applying constraints (%d)\n",
 			 ret);
 
+		for (i = 0; i < path->num_nodes; i++) {
+			node = path->reqs[i].node;
+			path->reqs[i].avg_bw = old_avg;
+			path->reqs[i].peak_bw = old_peak;
+			aggregate_requests(node);
+		}
+		apply_constraints(path);
+	}
+
 	mutex_unlock(&icc_lock);
 
 	return ret;

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2019-01-16 16:21 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-16 16:10 [PATCH v13 0/8] Introduce on-chip interconnect API Georgi Djakov
2019-01-16 16:10 ` [PATCH v13 1/8] interconnect: Add generic " Georgi Djakov
2019-01-16 16:10 ` [PATCH v13 2/8] dt-bindings: Introduce interconnect binding Georgi Djakov
2019-01-16 16:10 ` [PATCH v13 3/8] interconnect: Allow endpoints translation via DT Georgi Djakov
2019-01-16 16:10 ` [PATCH v13 4/8] interconnect: Add debugfs support Georgi Djakov
2019-01-16 16:11 ` [PATCH v13 5/8] interconnect: qcom: Add sdm845 interconnect provider driver Georgi Djakov
2019-01-16 16:11 ` [PATCH v13 6/8] arm64: dts: sdm845: Add interconnect provider DT nodes Georgi Djakov
2019-01-16 16:11 ` [PATCH v13 7/8] MAINTAINERS: add a maintainer for the interconnect API Georgi Djakov
2019-01-16 16:11 ` Georgi Djakov [this message]
2019-01-22 12:42 ` [PATCH v13 0/8] Introduce on-chip " Greg KH
2019-01-22 14:45   ` Georgi Djakov
2019-01-22 15:00     ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190116161103.6937-9-georgi.djakov@linaro.org \
    --to=georgi.djakov@linaro.org \
    --cc=abailon@baylibre.com \
    --cc=amit.kucheria@linaro.org \
    --cc=andy.gross@linaro.org \
    --cc=arnd@arndb.de \
    --cc=bjorn.andersson@linaro.org \
    --cc=daidavid1@codeaurora.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dianders@chromium.org \
    --cc=evgreen@chromium.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=henryc.chen@mediatek.com \
    --cc=khilman@baylibre.com \
    --cc=ksitaraman@nvidia.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=maxime.ripard@bootlin.com \
    --cc=mturquette@baylibre.com \
    --cc=olof@lixom.net \
    --cc=rjw@rjwysocki.net \
    --cc=robh+dt@kernel.org \
    --cc=sanjayc@nvidia.com \
    --cc=seansw@qti.qualcomm.com \
    --cc=skannan@codeaurora.org \
    --cc=thierry.reding@gmail.com \
    --cc=vincent.guittot@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).