Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp440226ybv; Wed, 19 Feb 2020 02:42:39 -0800 (PST) X-Google-Smtp-Source: APXvYqyphOpGl5kseL0U8ZSKDbe+8Ht/qxOicacqILYMzV8a9yc0cx/+n/l28jeH55KLUdGLq5Ut X-Received: by 2002:aca:53c6:: with SMTP id h189mr4179790oib.11.1582108959368; Wed, 19 Feb 2020 02:42:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582108959; cv=none; d=google.com; s=arc-20160816; b=rc6LsZQijHmHznvd5bQtgWALJuz3XhMASUNXVjNSU2mbttFtxCGbcfw9Y3+zw+5beg UV7aeGU4Ve+kN+CjOtLS8pfbJ//UhyvVKXByYaaqPdjlV5MYYFz93SFkoYEo5buX0QxP 2NBg3fsC4SUM7xdYhE1EqBr70ioRi/QMow6NY8aScP7GyIVH8sPmjLkmNcsOcqkJPQmu iQYlO8PwIOHKCu15HAlZeHvEEartHAsYFZf3RDlvkhSdUDPqzO3DhqJS9lg2YWYx8zAS 7a+3domxmk2O/QEmDpJnF9xQQg/RO+QAkenSlghjmhTWOmTC1Lo1ahthCyoQCTSoAoJr GcTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dmarc-filter:dkim-signature; bh=YM7FasSIeoqBY/ligxY0Vj0FIRx2784q8vfiDdf3EEY=; b=uP8arSqQ/VLnd8gMDqlIrkCqrogPwU30wPZggrtpmD7XDcoAfaj4HO3OqgDR/JL4ok yHFfhyiI29aHYy9H+/1y69NNs4hPv26JiGZyEsq4dBENGPuAH5QmOwGsU+Y+vwqOlUWz Vit4+9PRIFynWPjoSG7QzLlGT9wVhATiZT7jmyAa4UPQQWy/6/F/fxDxOz5YTtlsR6vx xK3V2JpR4MU0jaZ60YH/39+hqPbLTZdjtGJUYHYLo/PZwsUwg6OXL5edzQctXPn6IDTU wauQ0p1PKI8h+2qROeteVjAjenJ3grOlyWr2TWJVSjSIbvHNb0ik5/KLeKkOwEfh3SZz laAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b="c4U0/pVH"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t22si877626oth.211.2020.02.19.02.42.27; Wed, 19 Feb 2020 02:42:39 -0800 (PST) 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=fail header.i=@mg.codeaurora.org header.s=smtp header.b="c4U0/pVH"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727001AbgBSKk7 (ORCPT + 99 others); Wed, 19 Feb 2020 05:40:59 -0500 Received: from mail27.static.mailgun.info ([104.130.122.27]:43621 "EHLO mail27.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726948AbgBSKk6 (ORCPT ); Wed, 19 Feb 2020 05:40:58 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1582108858; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=YM7FasSIeoqBY/ligxY0Vj0FIRx2784q8vfiDdf3EEY=; b=c4U0/pVHhaIfbWYPe6yepEG5eIYIxnhfmO1/FJq0S3RF9XdnuWbhHAsEBwAaGLTrFoThvS3j ZRVMTQlIYxPrBWY8DtOOX0GqIIk19aRqdXY3RMiqhTgumYd9x+9injMJ7KdNCwNeALK+oV1Y nYlDBb3XlfQEhafKRDKhbJpfqTo= X-Mailgun-Sending-Ip: 104.130.122.27 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by mxa.mailgun.org with ESMTP id 5e4d10b9.7faf98af6d18-smtp-out-n01; Wed, 19 Feb 2020 10:40:57 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id B8EC5C447AB; Wed, 19 Feb 2020 10:40:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mkshah-linux.qualcomm.com (blr-c-bdr-fw-01_GlobalNAT_AllZones-Outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mkshah) by smtp.codeaurora.org (Postfix) with ESMTPSA id 0C8CFC447A4; Wed, 19 Feb 2020 10:40:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 0C8CFC447A4 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=mkshah@codeaurora.org From: Maulik Shah To: swboyd@chromium.org, mka@chromium.org, evgreen@chromium.org, bjorn.andersson@linaro.org Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, agross@kernel.org, dianders@chromium.org, rnayak@codeaurora.org, ilina@codeaurora.org, lsrao@codeaurora.org, Maulik Shah Subject: [PATCH v5 6/7] soc: qcom: rpmh: Update dirty flag only when data changes Date: Wed, 19 Feb 2020 16:10:09 +0530 Message-Id: <1582108810-21263-7-git-send-email-mkshah@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1582108810-21263-1-git-send-email-mkshah@codeaurora.org> References: <1582108810-21263-1-git-send-email-mkshah@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently rpmh ctrlr dirty flag is set for all cases regardless of data is really changed or not. Add changes to update it when data is updated to newer values. Also move dirty flag updates to happen from within cache_lock. Signed-off-by: Maulik Shah --- drivers/soc/qcom/rpmh.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/drivers/soc/qcom/rpmh.c b/drivers/soc/qcom/rpmh.c index eb0ded0..83ba4e0 100644 --- a/drivers/soc/qcom/rpmh.c +++ b/drivers/soc/qcom/rpmh.c @@ -139,20 +139,27 @@ static struct cache_req *cache_rpm_request(struct rpmh_ctrlr *ctrlr, existing: switch (state) { case RPMH_ACTIVE_ONLY_STATE: - if (req->sleep_val != UINT_MAX) + if (req->sleep_val != UINT_MAX) { req->wake_val = cmd->data; + ctrlr->dirty = true; + } break; case RPMH_WAKE_ONLY_STATE: - req->wake_val = cmd->data; + if (req->wake_val != cmd->data) { + req->wake_val = cmd->data; + ctrlr->dirty = true; + } break; case RPMH_SLEEP_STATE: - req->sleep_val = cmd->data; + if (req->sleep_val != cmd->data) { + req->sleep_val = cmd->data; + ctrlr->dirty = true; + } break; default: break; } - ctrlr->dirty = true; unlock: spin_unlock_irqrestore(&ctrlr->cache_lock, flags); @@ -287,6 +294,7 @@ static void cache_batch(struct rpmh_ctrlr *ctrlr, struct batch_cache_req *req) spin_lock_irqsave(&ctrlr->cache_lock, flags); list_add_tail(&req->list, &ctrlr->batch_cache); + ctrlr->dirty = true; spin_unlock_irqrestore(&ctrlr->cache_lock, flags); } @@ -323,6 +331,7 @@ static void invalidate_batch(struct rpmh_ctrlr *ctrlr) list_for_each_entry_safe(req, tmp, &ctrlr->batch_cache, list) kfree(req); INIT_LIST_HEAD(&ctrlr->batch_cache); + ctrlr->dirty = true; spin_unlock_irqrestore(&ctrlr->cache_lock, flags); } @@ -456,6 +465,7 @@ static int send_single(struct rpmh_ctrlr *ctrlr, enum rpmh_state state, int rpmh_flush(struct rpmh_ctrlr *ctrlr) { struct cache_req *p; + unsigned long flags; int ret; if (!ctrlr->dirty) { @@ -488,7 +498,9 @@ int rpmh_flush(struct rpmh_ctrlr *ctrlr) return ret; } + spin_lock_irqsave(&ctrlr->cache_lock, flags); ctrlr->dirty = false; + spin_unlock_irqrestore(&ctrlr->cache_lock, flags); return 0; } @@ -507,7 +519,6 @@ int rpmh_invalidate(const struct device *dev) int ret; invalidate_batch(ctrlr); - ctrlr->dirty = true; do { ret = rpmh_rsc_invalidate(ctrlr_to_drv(ctrlr)); -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation