From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7947C35247 for ; Wed, 5 Feb 2020 18:08:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7E06F20659 for ; Wed, 5 Feb 2020 18:08:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="WP7q3Sui" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727199AbgBESIK (ORCPT ); Wed, 5 Feb 2020 13:08:10 -0500 Received: from mail-lf1-f65.google.com ([209.85.167.65]:36703 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727079AbgBESIJ (ORCPT ); Wed, 5 Feb 2020 13:08:09 -0500 Received: by mail-lf1-f65.google.com with SMTP id f24so2164469lfh.3 for ; Wed, 05 Feb 2020 10:08:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=xxM2KM7SFU0OuxVauJZTx1kXhl4JXfEt7TGRJvg/kq4=; b=WP7q3SuitLJAbKGWLEGzBmTKDcmmUlPnu/WjZqrW3AduihyetE/g/gczvYpfzautL6 18mEc2wQE2TWpn0PWNlNcERY3LsWVlL/rX6rAqCMX+/x9U55YT9RwSnLBHIaK7t5IRl+ RRgU60ChxJtJzE81ltKegxet7Bbww509GWpFc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=xxM2KM7SFU0OuxVauJZTx1kXhl4JXfEt7TGRJvg/kq4=; b=W3Bq8vinoyWNrzFwRnPL5vrjjTxAkq3Mi8Yln4BOl4TWOGETAyW+68ZlhcPVC0zgCY I0OtTCXljw+Fx+z7E9Zsf8GzTwqRBvqBci44YrqGcwtT3cvLy85JJI7WgdSSCjk2dWSj W72nnGWKvxCTFTtByT63SXvQEcJE2wta1WWcBZ+ZLyPjzP5yv5uaa+HnSpAPVYZumfij 7XDFoXb6QbegFQyEgVEJwhYVOjguvS8df9xZxflvNcPasURJVRanjjkErXbBCA3RdnRS QwwOui3PqWosmZplHj+SLBy7a5zSn6+uwcWk56myVaFxQccxzGq7vUDJBiGwLU80VNhe xkpA== X-Gm-Message-State: APjAAAWMH9HZryg1KEYGPMN3YlxCT/1Gj1FbQyxR8ShikUb+Ri6QTddc WlebpxyNRpA1wVta1gwUX2Qh1Wl84po= X-Google-Smtp-Source: APXvYqyIF2VuBMxwXsL5DeOe0PTxnpj4qhU+Dz3O6h55pqzaL5xy4oPT/nqcfvvKfHpx+rE4QaJD8w== X-Received: by 2002:ac2:58cf:: with SMTP id u15mr18405993lfo.62.1580926087606; Wed, 05 Feb 2020 10:08:07 -0800 (PST) Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com. [209.85.167.50]) by smtp.gmail.com with ESMTPSA id d4sm108161lfn.42.2020.02.05.10.08.06 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 05 Feb 2020 10:08:06 -0800 (PST) Received: by mail-lf1-f50.google.com with SMTP id y19so2148880lfl.9 for ; Wed, 05 Feb 2020 10:08:06 -0800 (PST) X-Received: by 2002:a19:c205:: with SMTP id l5mr18197762lfc.159.1580926086038; Wed, 05 Feb 2020 10:08:06 -0800 (PST) MIME-Version: 1.0 References: <1580796831-18996-1-git-send-email-mkshah@codeaurora.org> <1580796831-18996-2-git-send-email-mkshah@codeaurora.org> In-Reply-To: From: Evan Green Date: Wed, 5 Feb 2020 10:07:29 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/3] soc: qcom: rpmh: Update dirty flag only when data changes To: Maulik Shah Cc: Bjorn Andersson , Andy Gross , linux-arm-msm , LKML , Stephen Boyd , Doug Anderson , Rajendra Nayak , Lina Iyer , lsrao@codeaurora.org Content-Type: text/plain; charset="UTF-8" Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org On Tue, Feb 4, 2020 at 8:14 PM Maulik Shah wrote: > > > On 2/5/2020 6:05 AM, Evan Green wrote: > > On Mon, Feb 3, 2020 at 10:14 PM Maulik Shah wrote: > >> 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 new values. > >> > >> Signed-off-by: Maulik Shah > >> --- > >> drivers/soc/qcom/rpmh.c | 15 +++++++++++---- > >> 1 file changed, 11 insertions(+), 4 deletions(-) > >> > >> diff --git a/drivers/soc/qcom/rpmh.c b/drivers/soc/qcom/rpmh.c > >> index 035091f..c3d6f00 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; > >> + } > > Don't you need to set dirty = true for ACTIVE_ONLY state always? The > > conditional is just saying "if nobody set a sleep vote, then maintain > > this vote when we wake back up". > > The ACTIVE_ONLY vote is cached as wake_val to be apply when wakeup happens. > > In case value didn't change,wake_val is still same as older value and > there is no need to mark the entire cache as dirty. > Ah, I see it now. We don't actually cache active_only votes anywhere, since they're one time requests. The sleep/wake votes seem to be the only thing that gets cached. I was thinking it might be safer to also set dirty = true just after list_add_tail, since in the non-existing case this is a new batch that RPMh has never seen before and should always be written. But I suppose your checks here should cover that case, since sleep_val and wake_val are initialized to UINT_MAX. If you think the code might evolve, it might still be nice to add it. While I'm looking at that, why do we have this needless INIT_LIST_HEAD? INIT_LIST_HEAD(&req->list); list_add_tail(&req->list, &ctrlr->cache); -Evan > -- > QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation