[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190116161103.6937-9-georgi.djakov@linaro.org>
Date: Wed, 16 Jan 2019 18:11:03 +0200
From: Georgi Djakov <georgi.djakov@...aro.org>
To: gregkh@...uxfoundation.org
Cc: andy.gross@...aro.org, olof@...om.net, arnd@...db.de,
rjw@...ysocki.net, robh+dt@...nel.org, mturquette@...libre.com,
khilman@...libre.com, vincent.guittot@...aro.org,
skannan@...eaurora.org, bjorn.andersson@...aro.org,
amit.kucheria@...aro.org, seansw@....qualcomm.com,
daidavid1@...eaurora.org, evgreen@...omium.org,
dianders@...omium.org, abailon@...libre.com,
maxime.ripard@...tlin.com, thierry.reding@...il.com,
ksitaraman@...dia.com, sanjayc@...dia.com,
henryc.chen@...iatek.com, linux-pm@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-arm-msm@...r.kernel.org, linux-tegra@...r.kernel.org,
linux-mediatek@...ts.infradead.org, georgi.djakov@...aro.org
Subject: [PATCH v13 8/8] interconnect: Revert to previous config if any request fails
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@...aro.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;
Powered by blists - more mailing lists