Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1019223ybz; Fri, 17 Apr 2020 14:18:36 -0700 (PDT) X-Google-Smtp-Source: APiQypInyE0vhc4dZbngPMmMaUQChQgTalmZd5AIw019VRpe1njlaLDsc8C/y+7+5vPAUZkKfGGI X-Received: by 2002:a05:6402:1d1c:: with SMTP id dg28mr4633647edb.135.1587158315922; Fri, 17 Apr 2020 14:18:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587158315; cv=none; d=google.com; s=arc-20160816; b=MG1hsqal50Lg4Ul5vArfRQzahcc8hhobnRs9g+8mrVwTtpYIdq8wiVMczysWFO+WWh oltcyVnl47iH1WILcFH5gqVACW+bOCgZ+SX3TNH2XnykY+L+4mgvi+kYxH15XsmAoAIc SS5Ubx1Avm4PF6jqblOxbmFF3EmEtibauIORppubjpCBsUa05ANPOlqpXfd/z7kIjtOB Rpsp/JszH+7W8SMFReW03iY8Zf2fOKaGuphDPNiMuMmQOzKfbKvIs3yH1IOD39tTYfMB t5sLBJP/nDzdonwjEOkIo69fuiNBS6xOS+sXKVu6R1R7QA1fbBWn9zr4tLtCgUiHOVaB 7JHA== 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=iJ2fYj8faRnQWYU+YUvw2BuJTdJ8p/wj9zFiQhRecXY=; b=urOaaZI+JqZ231J0l5NoVyiu68LKjp94mwq/5zHlZRtkWXOmYOkOZLl/Cv75wukQKO 3gQsLE7ScN84NBut9OXs2D+ab6+suJdHj5m5s2b2u3cFFeAouwJbwG3ZwBzA2KM96qZ8 kLDsTzJF3KwglS36fca0n+egd9/8f/mwLDUNsm57R6QrR5VJ3eOfJodbb3cmtyCbyK2/ lqqLfcZt48Llf6ch1dtwg452RtBXDDoGvNQX3D9UM6h1m09sRwwmiEJe1wv9fZS78FZ/ PbdLgLRlOMihbEMkJvDCUsgmpuNyAbE/65ikWTiFxrO+DMj2X+ySo1p/RXygzmIwBTaK qg/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="jg0aAF/V"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id dk14si6515026ejb.124.2020.04.17.14.18.11; Fri, 17 Apr 2020 14:18:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="jg0aAF/V"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1728002AbgDQVRI (ORCPT + 99 others); Fri, 17 Apr 2020 17:17:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726420AbgDQVRI (ORCPT ); Fri, 17 Apr 2020 17:17:08 -0400 Received: from mail-ua1-x942.google.com (mail-ua1-x942.google.com [IPv6:2607:f8b0:4864:20::942]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D818DC061A0F for ; Fri, 17 Apr 2020 14:17:07 -0700 (PDT) Received: by mail-ua1-x942.google.com with SMTP id u12so1178134uau.10 for ; Fri, 17 Apr 2020 14:17:07 -0700 (PDT) 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=iJ2fYj8faRnQWYU+YUvw2BuJTdJ8p/wj9zFiQhRecXY=; b=jg0aAF/VBOEowYu593EttCPIZkn+y5RfCCJA7A9me76IkPZAsRrbd0/T/gxbhJ/Nea tWQR2GXYK9vwBRwjMNG23L4vJh1oGHmRc2CjVNncy5RDzfuzEGb8ed+0x7qWLo5t/5OA YnhUhWAj1kNKyBGVtXGLHtwZuHxHlvy5ESOgA= 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=iJ2fYj8faRnQWYU+YUvw2BuJTdJ8p/wj9zFiQhRecXY=; b=tNGhWZ6d1FUk0C49XooLausLbDIKJmTSoAeimJ3uDac09dIMEOElWAiYeHfsI4fJLw z6t9T4jTEWY+5KiSyRXi475sDoG/eCdnvskt7tr8gyxj8Qs+jqnNCwUOS95eYVQK4VND D4Lk9P49MbWwhqQHuSCadmhUPC691cJ2vACghIK2sFxDvsfYn3pXynoGihzzRW1Hwrxo hUciXC1lsRwJrXrEf++/5MibA00DSBjQnmSHQm5DuLkVhRrfXzeNUPlvMqDpjcGRn8un XXKlOASgWw5Yg/lbY+4x9EycibAvpzw4QIHk0WcFSWRNEiyee0+2LL8CVrECMUr+Y2lw LKuQ== X-Gm-Message-State: AGi0PuZBbkMTyHt1GL6iex30ZHC/d3nlZ+Y2Uu0q+g33XTDmnsmQjtL/ tlzkeqgVKVkYEw/yQnQhCL7V/sSfrX8= X-Received: by 2002:a9f:2204:: with SMTP id 4mr690185uad.87.1587158226582; Fri, 17 Apr 2020 14:17:06 -0700 (PDT) Received: from mail-vk1-f170.google.com (mail-vk1-f170.google.com. [209.85.221.170]) by smtp.gmail.com with ESMTPSA id x73sm2970281vsc.27.2020.04.17.14.17.05 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 17 Apr 2020 14:17:05 -0700 (PDT) Received: by mail-vk1-f170.google.com with SMTP id q200so730640vka.13 for ; Fri, 17 Apr 2020 14:17:05 -0700 (PDT) X-Received: by 2002:a1f:5fc3:: with SMTP id t186mr4344481vkb.92.1587158224782; Fri, 17 Apr 2020 14:17:04 -0700 (PDT) MIME-Version: 1.0 References: <1586703004-13674-1-git-send-email-mkshah@codeaurora.org> <1586703004-13674-3-git-send-email-mkshah@codeaurora.org> <158708153779.132238.7823999141480422982@swboyd.mtv.corp.google.com> In-Reply-To: <158708153779.132238.7823999141480422982@swboyd.mtv.corp.google.com> From: Doug Anderson Date: Fri, 17 Apr 2020 14:16:53 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v17 2/6] soc: qcom: rpmh: Update dirty flag only when data changes To: Stephen Boyd Cc: Maulik Shah , Bjorn Andersson , Evan Green , LKML , linux-arm-msm , Andy Gross , Matthias Kaehlcke , 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 Thu, Apr 16, 2020 at 4:59 PM Stephen Boyd wrote: > > Quoting Maulik Shah (2020-04-12 07:50:00) > > diff --git a/drivers/soc/qcom/rpmh.c b/drivers/soc/qcom/rpmh.c > > index eb0ded0..03630ae 100644 > > --- a/drivers/soc/qcom/rpmh.c > > +++ b/drivers/soc/qcom/rpmh.c > > @@ -133,26 +134,27 @@ static struct cache_req *cache_rpm_request(struct rpmh_ctrlr *ctrlr, > > > > req->addr = cmd->addr; > > req->sleep_val = req->wake_val = UINT_MAX; > > - INIT_LIST_HEAD(&req->list); > > list_add_tail(&req->list, &ctrlr->cache); > > > > existing: > > + old_sleep_val = req->sleep_val; > > + old_wake_val = req->wake_val; > > + > > switch (state) { > > case RPMH_ACTIVE_ONLY_STATE: > > - if (req->sleep_val != UINT_MAX) > > - req->wake_val = cmd->data; > > - break; > > case RPMH_WAKE_ONLY_STATE: > > req->wake_val = cmd->data; > > break; > > case RPMH_SLEEP_STATE: > > req->sleep_val = cmd->data; > > break; > > - default: > > - break; > > } > > > > - ctrlr->dirty = true; > > + ctrlr->dirty = (req->sleep_val != old_sleep_val || > > + req->wake_val != old_wake_val) && > > + req->sleep_val != UINT_MAX && > > + req->wake_val != UINT_MAX; > > Can this change ctrl->dirty from true to false? I'm worried that we need > to make this a saturating assignment instead of an assignment. > > ctrl->dirty = ctrl->dirty || (req->sleep_val != .. ); This seems like a serious problem with the current code and feels like we need a fix sooner rather than later. I'm sorry I missed it in review (and in fact, I probably suggested the exact code that's here so it's even more my fault). :( I posted: https://lore.kernel.org/r/20200417141531.1.Ia4b74158497213eabad7c3d474c50bfccb3f342e@changeid -Doug