From patchwork Fri Oct 18 14:17:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georgi Djakov X-Patchwork-Id: 176843 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp923813ill; Fri, 18 Oct 2019 07:17:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqybz3G9bGoT46VSjnoKK5XBUMmkhHddRuJ82oPCO6P5YMEq4IebQfUHnwQBNssg004/PrDO X-Received: by 2002:a05:6402:28c:: with SMTP id l12mr10119842edv.145.1571408279249; Fri, 18 Oct 2019 07:17:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571408279; cv=none; d=google.com; s=arc-20160816; b=z9zFPKlhPksIRpw5afE6KmK3/fh9fe8cP83NsF6gmMGziCI0n6AFREQMvnrXaUQbG6 wX/WP4wELb/5musAOVG1RROR0DgRuED32CNiYnSuB/63YVo9rdX3aILUr1m6eoBx4ty5 nPRgtaOszKbhVo6IjZADMjw6V2NEd6uLjLj3haYDmKjnspAMQG9wUoPSmSybgQ8exlqZ VBRzR2MaN76gNO6Q9fYRyL6PzVQHQ4pknJJMMVEgOsW+zCu6j5kax0ry+Znf2/2GB6Pa I/o1uXzMm6qaFGHUBcpQAe5WZEPovrTA50DU+dGi5EtGSyaszLsndQqe4pnIDrHkCPvS sw0g== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=fTm5JH2L5agfNTgSt6jIVduSEI+HxSv62N1+6WMd74s=; b=uKja+QC7cut4JXd+IYup3WVrnEczfEWEf4IKDU963vHpTN9pVSfx7wwvIIi+H98V+y vRWUEmFFYg5zXTpSYWV724gysYh7Cp753OM/8USDygDXTb6nlpbb5W8RTIM/b4pJzoPa bNbCvzoCxXptQ9+sRNDJmtj2TTl8bQeUBtqLh4KU554gA+hifJwt+ayUASGRfalRlm0r osYKlr3tvzQT6L/LdDNHDDt4YOukA54rCY0lOC+zs6WnepQK6D/E/LwxdDU46Wih7SPS iMqFiQ0cyv8Ep845bY7WH/hJ4cUFstPNz8KUwfFtXPh4Yoc4FH02fkLTReXXssIt9VoI EVTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=R67W02Lz; 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 w34si3882034edc.252.2019.10.18.07.17.58; Fri, 18 Oct 2019 07:17:59 -0700 (PDT) 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=R67W02Lz; 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 S2408400AbfJRORy (ORCPT + 26 others); Fri, 18 Oct 2019 10:17:54 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:35071 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732676AbfJRORy (ORCPT ); Fri, 18 Oct 2019 10:17:54 -0400 Received: by mail-wr1-f66.google.com with SMTP id l10so6050946wrb.2 for ; Fri, 18 Oct 2019 07:17:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=fTm5JH2L5agfNTgSt6jIVduSEI+HxSv62N1+6WMd74s=; b=R67W02Lz1HjMvW2zQm++LCIQ21AzasDaKd9lyBCAv1JTy32UMXliPR+K+neuS3KxxR IUeID/8BP/H7qC61bBPYfLeuuDOgQW5c0Zy1VjzZOg8ma8zsEgdQWKWyDTgPXxEFuMo/ u89cpWHzeoHBCkfqK4kNCh7bWGZbVn6bQXYwsCT9Pe1VLMF1poeq9qEDdVppr9uRBiQ9 SI5F/BQTW2j+V2QP4q/fnGgWM+dHfAoG1MErow6uLKvK35S134x5sL0grP0Jr9pBta62 uxcOEkzrKXdQMiimnSkNOCeiq8CyB0i+YwhoP+ex01NdUEh4koGBpt/zSeavD5Bqv7ps kSZw== 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:mime-version :content-transfer-encoding; bh=fTm5JH2L5agfNTgSt6jIVduSEI+HxSv62N1+6WMd74s=; b=sshaGm1Ghm1bTqVmfJCxfO4BQKj6y5xAt0GPAhera2yB6RJXC0oVhWfYnIc1KpoXPi VGN8/khLTUNVcIphzHqY1VFgA4fEg9MEOi7xOvfgI/nsebd3ew7vi919IoW/VS15ToU/ Fa8lloUdeZkcGBMGNnjg7g+2fBR/7ZHj1R07RZ4PVleivl13RsekQ7GOB9eozfmbiXnl qktH4LMamkLfmHghSu1uUeG0BwtUOhIMjsNjziP1YZ9ifjIlWc9ZlftR5TlSCj0Zcr49 EnPEf2niFXY3jAzL+Mg+RSLKeiKMFCBHHFkx2dLk8efLA1KF1vblmEqRgJ3mdXs/Oiyn ymEg== X-Gm-Message-State: APjAAAVNIi3wjrtWcUW/G9lZJ+SODVzVZ3L0KUJekZNM7O+pZpqUBAiU CjpxIUxtasz9GTxNtEKKWkmnzQ== X-Received: by 2002:a5d:490e:: with SMTP id x14mr8607219wrq.340.1571408272158; Fri, 18 Oct 2019 07:17:52 -0700 (PDT) Received: from localhost.localdomain ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id r13sm7110988wra.74.2019.10.18.07.17.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 18 Oct 2019 07:17:51 -0700 (PDT) From: Georgi Djakov To: linux-pm@vger.kernel.org, evgreen@chromium.org, daidavid1@codeaurora.org Cc: vincent.guittot@linaro.org, bjorn.andersson@linaro.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Georgi Djakov Subject: [PATCH] interconnect: Add locking in icc_set_tag() Date: Fri, 18 Oct 2019 17:17:50 +0300 Message-Id: <20191018141750.17032-1-georgi.djakov@linaro.org> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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);