linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] interconnect: Add locking in icc_set_tag()
@ 2019-10-18 14:17 Georgi Djakov
  2019-10-18 16:49 ` Bjorn Andersson
  0 siblings, 1 reply; 2+ messages in thread
From: Georgi Djakov @ 2019-10-18 14:17 UTC (permalink / raw)
  To: linux-pm, evgreen, daidavid1
  Cc: vincent.guittot, bjorn.andersson, linux-arm-msm, linux-kernel,
	Georgi Djakov

We must ensure that the tag is not changed while we aggregate the
requests. Currently the icc_set_tag() is not using any locks and this
may cause the values to be aggregated incorrectly. Fix this by acquiring
the icc_lock while we set the tag.

Fixes: 127ab2cc5f19 ("interconnect: Add support for path tags")
Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>
---
 drivers/interconnect/core.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/interconnect/core.c b/drivers/interconnect/core.c
index e24092558c29..4940c0741d40 100644
--- a/drivers/interconnect/core.c
+++ b/drivers/interconnect/core.c
@@ -408,8 +408,12 @@ void icc_set_tag(struct icc_path *path, u32 tag)
 	if (!path)
 		return;
 
+	mutex_lock(&icc_lock);
+
 	for (i = 0; i < path->num_nodes; i++)
 		path->reqs[i].tag = tag;
+
+	mutex_unlock(&icc_lock);
 }
 EXPORT_SYMBOL_GPL(icc_set_tag);
 

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] interconnect: Add locking in icc_set_tag()
  2019-10-18 14:17 [PATCH] interconnect: Add locking in icc_set_tag() Georgi Djakov
@ 2019-10-18 16:49 ` Bjorn Andersson
  0 siblings, 0 replies; 2+ messages in thread
From: Bjorn Andersson @ 2019-10-18 16:49 UTC (permalink / raw)
  To: Georgi Djakov
  Cc: linux-pm, evgreen, daidavid1, vincent.guittot, linux-arm-msm,
	linux-kernel

On Fri 18 Oct 07:17 PDT 2019, Georgi Djakov wrote:

> We must ensure that the tag is not changed while we aggregate the
> requests. Currently the icc_set_tag() is not using any locks and this
> may cause the values to be aggregated incorrectly. Fix this by acquiring
> the icc_lock while we set the tag.
> 
> Fixes: 127ab2cc5f19 ("interconnect: Add support for path tags")
> Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>

Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>

> ---
>  drivers/interconnect/core.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/interconnect/core.c b/drivers/interconnect/core.c
> index e24092558c29..4940c0741d40 100644
> --- a/drivers/interconnect/core.c
> +++ b/drivers/interconnect/core.c
> @@ -408,8 +408,12 @@ void icc_set_tag(struct icc_path *path, u32 tag)
>  	if (!path)
>  		return;
>  
> +	mutex_lock(&icc_lock);
> +
>  	for (i = 0; i < path->num_nodes; i++)
>  		path->reqs[i].tag = tag;
> +
> +	mutex_unlock(&icc_lock);
>  }
>  EXPORT_SYMBOL_GPL(icc_set_tag);
>  

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-10-18 16:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-18 14:17 [PATCH] interconnect: Add locking in icc_set_tag() Georgi Djakov
2019-10-18 16:49 ` Bjorn Andersson

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).