Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp1741189ybg; Sat, 19 Oct 2019 01:30:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqxOxZvju6gnB4nhMO2x4guIwO8vcMC8jvTJcgEkWJ7gKtjafi/7K8XbFSFwm7LnWnEDmatw X-Received: by 2002:a17:906:5e19:: with SMTP id n25mr12726471eju.131.1571473820744; Sat, 19 Oct 2019 01:30:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571473820; cv=none; d=google.com; s=arc-20160816; b=pq0bKuxfW6zans4CfnLzZlX3IpPPLcOxicEuMieHDhHDQeLxIlJh2FKWZQCjIfoyOY ADGuqD5e5aU2eiNwGfQMkafLdww1joSEryPvvZDC9yJqCOJe0bqmfWoBVOddy63DHwQR KFl8sdk6vpGIcFHZzmEIwtWV5K2P7zZq2GDu0ln5rV8rnHoJSz7SUfdoRLcgVkBsjoKL 6GkpIEyokd79GM4KQ2UNqaslOeecLj5J7E0qpA3g8hZvVtZ0AXBSggeA6R0izWUy34rB FXc8CMZiBThggzqL3EEEieMcghvIhr7P56Ri/p5kQOecHaRi2+gMa43TSfvuzW5/r32k oJzQ== 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 n8si4960712ejh.169.2019.10.19.01.29.57; Sat, 19 Oct 2019 01:30:20 -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 S2405715AbfJRORy (ORCPT + 99 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 Content-Transfer-Encoding: 8bit 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);