Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp554857ybv; Wed, 5 Feb 2020 10:11:01 -0800 (PST) X-Google-Smtp-Source: APXvYqylxfQ/5isbctKyzhEFriyiohAByDDo923Jy8L+NGbahDL9orqnvWAyhia5NLZb6cW/amNa X-Received: by 2002:a9d:7cd9:: with SMTP id r25mr25629209otn.326.1580926261606; Wed, 05 Feb 2020 10:11:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580926261; cv=none; d=google.com; s=arc-20160816; b=LmI117gJHBWFPCV5XvbVu6Nuk5Os+B8XjYK4jE2fKWxSRJMegjhPP3MhPp2OHfRB3i 6D74CI3rtCGXxhXJkp33wO+4WNQZ/kKgx1cP1D/W1CiX+9/4tDFA5wLggkSKkuXbLWQ+ 7UHtYUYrQAAdyDZynB1lvYtC6L9g7XU0j12u1rMkXa8LZJJkQwfypI2gFBoFs/mpVmlQ 0THh+IJkQY61cemR6AF4E9HNqiHCeJHwGztMHCbkiKEzTNg1tfIz3m1ONaR3xw88bY1W PTpbYepWYXYRtizkJ117YIAdpIthqY3ixZvu0WFkVfBrEZucCmCgHHckCxZNSRQqrS1H z70A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=xxM2KM7SFU0OuxVauJZTx1kXhl4JXfEt7TGRJvg/kq4=; b=to+dz0LH6I+/44wv+ieJ8OG+LLwKCED4CuWWTt+7A6e50ReTXI4aaGxBiZp58DYZ9t 2Q0YwlWEfxn5X2Bjf+JUMjt3QLx+kW91kufzur+Wr9T7ElkWfD6aBeHPFTjKhAzr+jTR MT+YhUi/F8JwsYUZwvK1qLa0jA7mg+Kmb2OJDbIVlMyZuWHXx2mUAH6OjrXTwSFgtSaR cXBMIM3JZWYUTS/qlXU3XTCUdIyjy8XoQICRo1OfzK/5HXiDd4Ie64Q5cZ4TLl16spKX 7rRPeqFRUW0y0l+mwxMasEaZKhKP+5MBzJ7A4TTKm3AVA5C7iFOb+WCoc7sXAqcfaG0j CKaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=WP7q3Sui; 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 y23si142388oti.65.2020.02.05.10.10.49; Wed, 05 Feb 2020 10:11:01 -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=pass header.i=@chromium.org header.s=google header.b=WP7q3Sui; 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 S1727331AbgBESIL (ORCPT + 99 others); Wed, 5 Feb 2020 13:08:11 -0500 Received: from mail-lf1-f67.google.com ([209.85.167.67]:42866 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727165AbgBESIK (ORCPT ); Wed, 5 Feb 2020 13:08:10 -0500 Received: by mail-lf1-f67.google.com with SMTP id y19so2148992lfl.9 for ; Wed, 05 Feb 2020 10:08:09 -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=ah+5mWeWJMjnKVnxudtSDgjJ+UVRJkDgCL2oE4PvFlzfEUVLEwJSUqn6oGEXDBNfjS MpWUpkNNkJpYaY1l+X6Bg42JqINC5GobF81C6RJ/0ta4VxzSJ24iQy93zmCYWwojWxID GsQLK//xkq/1b2wERpmowvv9JXVBwGrZUegb9nKMhJ4Zvz6VHCtYF8DnyLbhhIEWvAho 9KAKWSl6o8LERpO3p8nLIRHh8pAsaKwDUYkUQTXpdce+04BxjJgil2EnmIyc74155PEC iskdPr3xZiISLQeIWU4xbBMLR8UTFvBRooM9hoCmNa746h0e7SLbaW0bxelm6Br/g5uP tZEA== X-Gm-Message-State: APjAAAWv5h2ZvHdzVhLDmk51omq3+Jl3s2duYpjo3C77EkSihLfM2WX7 frz3PMIOE7Z+04SLk1G+0G9ztW6Wr2s= X-Received: by 2002:ac2:5dc8:: with SMTP id x8mr18074156lfq.217.1580926087996; Wed, 05 Feb 2020 10:08:07 -0800 (PST) Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com. [209.85.167.54]) by smtp.gmail.com with ESMTPSA id t9sm108037lfl.51.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:07 -0800 (PST) Received: by mail-lf1-f54.google.com with SMTP id 9so2143569lfq.10 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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