Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp563070ybh; Tue, 10 Mar 2020 04:10:48 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtfbeREKwS1BHh+iSg9VN4cAg9+oLSdcKTRrtLZzDveVAYnUwATpquDONVIM1XadwSxikRH X-Received: by 2002:a05:6830:239b:: with SMTP id l27mr10423839ots.278.1583838648071; Tue, 10 Mar 2020 04:10:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583838648; cv=none; d=google.com; s=arc-20160816; b=UeVUIFBiEZACOx/z9HBsdAM8lhOuSzZMuWRotBgapLzbd4PmmwO4/gV0WwOcV94dpW UF/PTMxKI1/kIkxFG+sfBrJbbHwesNg4Tm5AcF3y1nB/w4vUJ8Dyh82lgg7ZsLWhwULb OArs0934ZIZ1yI7e6nS/fPf0YAZ5wojWg6xJE2Dtwz/Dw+9FB1depYrhHHTYC36O7qtw Lk0bjxe/Oz6T/WSVz7QGbd8lvzZ193pI29Y6BpK0zJnzaOnhBqkA9dnsEatMPzpHphSV PKBgSiIFW6lQAazZ2cThcvkKBiz97E4F3eeJaLi+3axj7ynxAM5IDsSKwziEyxEqSxtE /ocg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:subject:from:dmarc-filter :dkim-signature; bh=Va3n/cJLbQfqQGCh5nSi8Ti3b5OUaE9Hu4OHUP+lYJM=; b=ai/QGNKOVs3PJHdUa6knCyTUMRMt7kYw29fLLJSNBC1c0pYBjOvB3s9wsHl9tmZl2o gVYPr20J59kOkxan1sCpLvq9Y873Z8XCtdz5k+DXR18JqhNnlNKFGIBNHSxST+MnYB7E lfCNBcXUtjOkDPKdYFrFHchnVk3uoSAFISklaOaH2E80Tc9qP/LQw+dU3PMFngquDQxn 97thVacedh3EnS+Zj3o6n6gcKatGRqa1VkKAaQm+017p+s+J8uxgDiQHv9ncZc9j+gRa bWogRhUkFZZSVrJebRDUWhpQt0Eism3yzuhv8owxhTz0lDGKCgbrBCgC5NZL32OGJ16M 4O7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=KimsQRUi; 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 h25si2428202otq.53.2020.03.10.04.10.35; Tue, 10 Mar 2020 04:10:48 -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=fail header.i=@mg.codeaurora.org header.s=smtp header.b=KimsQRUi; 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 S1726445AbgCJLKD (ORCPT + 99 others); Tue, 10 Mar 2020 07:10:03 -0400 Received: from mail27.static.mailgun.info ([104.130.122.27]:27962 "EHLO mail27.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725937AbgCJLKC (ORCPT ); Tue, 10 Mar 2020 07:10:02 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1583838602; h=Content-Transfer-Encoding: Content-Type: In-Reply-To: MIME-Version: Date: Message-ID: References: Cc: To: Subject: From: Sender; bh=Va3n/cJLbQfqQGCh5nSi8Ti3b5OUaE9Hu4OHUP+lYJM=; b=KimsQRUiktGsQdHQsRjyaCHai52dO+qLPfWPbI61D1MsYw9/eclKpOTSZSpVWQ+fc87RtqH/ yIM6+DYwRBTJcWElH8n5R28chscqdTYAEeMS+ISnm4sjQqWnCQRxIjl2kBklwhQQxapoChF2 ezIzrguYgpJn5tBF2H6V3V3SNP8= 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 5e67757a.7f87c5cede30-smtp-out-n03; Tue, 10 Mar 2020 11:09:46 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 29253C432C2; Tue, 10 Mar 2020 11:09:46 +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 [192.168.1.2] (unknown [183.83.137.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mkshah) by smtp.codeaurora.org (Postfix) with ESMTPSA id 78BEEC433CB; Tue, 10 Mar 2020 11:09:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 78BEEC433CB 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 Subject: Re: [PATCH v13 3/5] soc: qcom: rpmh: Invalidate SLEEP and WAKE TCSes before flushing new data To: Doug Anderson Cc: Stephen Boyd , Matthias Kaehlcke , Evan Green , Bjorn Andersson , LKML , linux-arm-msm , Andy Gross , Rajendra Nayak , Lina Iyer , lsrao@codeaurora.org References: <1583746236-13325-1-git-send-email-mkshah@codeaurora.org> <1583746236-13325-4-git-send-email-mkshah@codeaurora.org> Message-ID: Date: Tue, 10 Mar 2020 16:39:38 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-GB Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/10/2020 5:12 AM, Doug Anderson wrote: > Hi, > > On Mon, Mar 9, 2020 at 2:31 AM Maulik Shah wrote: >> TCSes have previously programmed data when rpmh_flush is called. >> This can cause old data to trigger along with newly flushed. >> >> Fix this by cleaning SLEEP and WAKE TCSes before new data is flushed. >> >> With this there is no need to invoke rpmh_rsc_invalidate() call from >> rpmh_invalidate(). >> >> Simplify rpmh_invalidate() by moving invalidate_batch() inside. >> >> Fixes: 600513dfeef3 ("drivers: qcom: rpmh: cache sleep/wake state requests") >> Signed-off-by: Maulik Shah >> --- >> drivers/soc/qcom/rpmh.c | 36 +++++++++++++++--------------------- >> 1 file changed, 15 insertions(+), 21 deletions(-) >> >> diff --git a/drivers/soc/qcom/rpmh.c b/drivers/soc/qcom/rpmh.c >> index 03630ae..5bed8f4 100644 >> --- a/drivers/soc/qcom/rpmh.c >> +++ b/drivers/soc/qcom/rpmh.c >> @@ -317,19 +317,6 @@ static int flush_batch(struct rpmh_ctrlr *ctrlr) >> return ret; >> } >> >> -static void invalidate_batch(struct rpmh_ctrlr *ctrlr) >> -{ >> - struct batch_cache_req *req, *tmp; >> - unsigned long flags; >> - >> - spin_lock_irqsave(&ctrlr->cache_lock, flags); >> - 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); >> -} >> - >> /** >> * rpmh_write_batch: Write multiple sets of RPMH commands and wait for the >> * batch to finish. >> @@ -467,6 +454,11 @@ int rpmh_flush(struct rpmh_ctrlr *ctrlr) >> return 0; >> } >> >> + /* Invalidate the TCSes first to avoid stale data */ >> + do { >> + ret = rpmh_rsc_invalidate(ctrlr_to_drv(ctrlr)); >> + } while (ret == -EAGAIN); >> + > You forgot to actually check the return value. > > if (ret) > return ret; Done. > >> /* First flush the cached batch requests */ >> ret = flush_batch(ctrlr); >> if (ret) >> @@ -503,19 +495,21 @@ int rpmh_flush(struct rpmh_ctrlr *ctrlr) >> * >> * @dev: The device making the request >> * >> - * Invalidate the sleep and active values in the TCS blocks. >> + * Invalidate the sleep and wake values in batch_cache. > Thanks for updating this. It was on my todo list. Can you also > update the function description, which still says "Invalidate all > sleep and active sets sets." While you're at it, remove the double > "sets". Done. Thanks, Maulik -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation