Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3995671ybi; Fri, 19 Jul 2019 12:49:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqyYummuOO0Xd/RqCQ00wv2/PlMSO5UVrC9puLNgqBx8VhZ1jji/DF8zNfRT2dErlMRj4sq6 X-Received: by 2002:a63:6ecf:: with SMTP id j198mr55492184pgc.437.1563565770931; Fri, 19 Jul 2019 12:49:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563565770; cv=none; d=google.com; s=arc-20160816; b=LUkGUuM3QcUBVe7125MsOsErQNzZHCki6xB8WzioBCCvhcJAx5kV2vNqiSaJHf9nHp b1I813cIUw0zaNFwwIVIG2AdB9T0DCw1RiMZQm2M+fJS5tJfo8WYpdnIuFdQ5TszBmzF CEUteyK9ZQ5QpM0jlOdESG+VlawG6PHTy1McrF4RB4Tg4SOCkM/lfvrkZJUmD9VAwBRB jNB34LLDhhWYlKOAKcgWtNzosIaHknJ7WiaHDFNV3K7B/2ft7B9FV5ssya7iD7txU6PQ cYlwq95eJa6gmyatm35s8oY5OQuDcHK8MmTiNXGOV1RjmugwY7ka1Vj7Y4gAHzvUEkQ1 G1gA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:user-agent:from:cc:to:subject :references:in-reply-to:content-transfer-encoding:mime-version :message-id:dkim-signature; bh=M26syJ4cW7NPI3SuosUdPQTeP9LfAyv4R4zcZOR5omc=; b=yDZS0J3wrCyLGVdyEQ/IwYrpx0WtHSE87T0RyUrnn2NIVj7DymI0qe6Gm4J9U7wwqi wK0tUyQbBbZHLG4Ts8kQy1ZexosXwT4rXoeaW7Az+tTVLtChN03/4xawFDjLXT+C8gXj ZWyINm8BgluOTDsITdjTV/fVKdJUGtjRb9zAYXoN2LbQRZ2iwV/TuwtgXgvFOPcPu+8f l4LJxUvpcvKhoezoS7qxpYMjnEo+a/rIKkjxfQ/qTApZ+aA3Bv4Tra2qc9+Of72+iYGS ZbG4XQx1WgxLrgSBvT/PE5ZWW01OtvZubVQib0rBV+6KaRlE5zqgzoP8Vfq4NhExG+H1 geBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=StxKZQU6; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g24si1306193pfi.119.2019.07.19.12.49.14; Fri, 19 Jul 2019 12:49:30 -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=@chromium.org header.s=google header.b=StxKZQU6; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731402AbfGSSUZ (ORCPT + 99 others); Fri, 19 Jul 2019 14:20:25 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:36148 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729267AbfGSSUZ (ORCPT ); Fri, 19 Jul 2019 14:20:25 -0400 Received: by mail-pl1-f195.google.com with SMTP id k8so16016638plt.3 for ; Fri, 19 Jul 2019 11:20:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=message-id:mime-version:content-transfer-encoding:in-reply-to :references:subject:to:cc:from:user-agent:date; bh=M26syJ4cW7NPI3SuosUdPQTeP9LfAyv4R4zcZOR5omc=; b=StxKZQU6THFXUJQCrcXp31nW4A0j02kuJ4ttDn46X3RRw7GUDQXFmw1gncEUDBBZo5 yeTqHL3JVWT8kOb8uEgDgx2CTMTPqvUWLnqK/U43jqsgPKdrViYR8hS00FSaxSwadwT8 Oz1dYGLf4pS5wt2SCQDkhAP1iycL+/pj3pvjg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:mime-version :content-transfer-encoding:in-reply-to:references:subject:to:cc:from :user-agent:date; bh=M26syJ4cW7NPI3SuosUdPQTeP9LfAyv4R4zcZOR5omc=; b=fz0aU5zsrukpTtOiU/HwLqJ8TYUP3vVmE8z8aUFvKbPqTTnZErIW8MlgQaNerVFxAf sNgv9HJQB/XbehhF2HpIUa+k/TD3YkG1OSF/ZxyDZPDA4GVDSTAuH9i6gX4Ml9UaABW4 Oxm0CXqYfS4jgAI/+XuA3UjdKulrhyOQntHpwAZuVC7OwLHsub3+LhSpPG1SO8/sDGzW ifEpAsCOb7Xvpdb6qI8ZpoC68s8La3ch3q1SMZuAkfUcCnrieHyySAnvfgzCCOwWLvjs izPRblpfsEhpYqezhk57Bf6cTFlMu6iijKikAwxPl8QMre4Xxgc0/0UPf2VlhNnZhhGh zY2A== X-Gm-Message-State: APjAAAVEi1mdKMpJJLPgK4VLOHnBAUxR3+jjoB8qL+tH9CBSwYapnQIu Q/h8EXnk33PKvNdEGil0Dk1Sew== X-Received: by 2002:a17:902:be15:: with SMTP id r21mr57134298pls.293.1563560424619; Fri, 19 Jul 2019 11:20:24 -0700 (PDT) Received: from chromium.org ([2620:15c:202:1:fa53:7765:582b:82b9]) by smtp.gmail.com with ESMTPSA id s15sm31288067pfd.183.2019.07.19.11.20.23 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 19 Jul 2019 11:20:23 -0700 (PDT) Message-ID: <5d3209e7.1c69fb81.5ef1.5195@mx.google.com> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: <20190701152907.16407-1-ilina@codeaurora.org> References: <20190701152907.16407-1-ilina@codeaurora.org> Subject: Re: [PATCH 1/2] drivers: qcom: rpmh-rsc: simplify TCS locking To: Lina Iyer , andy.gross@linaro.org, bjorn.andersson@linaro.org Cc: linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, rnayak@codeaurora.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, dianders@chromium.org, mkshah@codeaurora.org, "Raju P.L.S.S.S.N" , Lina Iyer From: Stephen Boyd User-Agent: alot/0.8.1 Date: Fri, 19 Jul 2019 11:20:22 -0700 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Lina Iyer (2019-07-01 08:29:06) > From: "Raju P.L.S.S.S.N" >=20 > tcs->lock was introduced to serialize access with in TCS group. But > even without tcs->lock, drv->lock is serving the same purpose. So > use a single drv->lock. Isn't the downside now that we're going to be serializing access to the different TCSes when two are being written in parallel or waited on? I thought that was the whole point of splitting the lock into a TCS lock and a general "driver" lock that protects the global driver state vs. the specific TCS state. >=20 > Other optimizations include - > - Remove locking around clear_bit() in IRQ handler. clear_bit() is > atomic. > - Remove redundant read of TCS registers. > - Use spin_lock instead of _irq variants as the locks are not held > in interrupt context. Can you please split this patch up into 3 or 4 different patches? I'm not sure why any of these patches are marked with Fixes either. It's an optimization patch, not a fix patch, unless the optimization is really large somehow? >=20 > Fixes: 658628 ("drivers: qcom: rpmh-rsc: add RPMH controller for QCOM > SoCs") > Signed-off-by: Raju P.L.S.S.S.N > Signed-off-by: Lina Iyer > --- > drivers/soc/qcom/rpmh-internal.h | 2 -- > drivers/soc/qcom/rpmh-rsc.c | 37 +++++++++++--------------------- > drivers/soc/qcom/rpmh.c | 20 +++++++---------- > 3 files changed, 21 insertions(+), 38 deletions(-) >=20 > diff --git a/drivers/soc/qcom/rpmh-internal.h b/drivers/soc/qcom/rpmh-int= ernal.h > index a7bbbb67991c..969d5030860e 100644 > --- a/drivers/soc/qcom/rpmh-internal.h > +++ b/drivers/soc/qcom/rpmh-internal.h > diff --git a/drivers/soc/qcom/rpmh-rsc.c b/drivers/soc/qcom/rpmh-rsc.c > index e278fc11fe5c..92461311aef3 100644 > --- a/drivers/soc/qcom/rpmh-rsc.c > +++ b/drivers/soc/qcom/rpmh-rsc.c > @@ -93,8 +93,7 @@ static void write_tcs_reg_sync(struct rsc_drv *drv, int= reg, int tcs_id, > =20 > static bool tcs_is_free(struct rsc_drv *drv, int tcs_id) > { > - return !test_bit(tcs_id, drv->tcs_in_use) && > - read_tcs_reg(drv, RSC_DRV_STATUS, tcs_id, 0); > + return !test_bit(tcs_id, drv->tcs_in_use); This can be a different patch. Why is reading the tcs register redundant? Please put that information in the commit text.