Received: by 10.223.185.116 with SMTP id b49csp3028568wrg; Mon, 5 Mar 2018 12:46:19 -0800 (PST) X-Google-Smtp-Source: AG47ELuoubBX0aoV6y3YDt3XQb+kBaiI3tcKRKaRJcakkze4Z0ZNECocWXGU+T86XszT2qXcNkXc X-Received: by 2002:a17:902:7608:: with SMTP id k8-v6mr14059592pll.95.1520282779222; Mon, 05 Mar 2018 12:46:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520282779; cv=none; d=google.com; s=arc-20160816; b=RjoFA4qd43GtFWcP17HA5915jx2NLPd9NyFZqg1u+naGBpVZjj/a04Hubwy6xZGknv mz9HSk7r9oWrmZw02S+TaxQCt+Y2ZH87IzFNfCJcmqtS8VDMASy06ClDoCHMuYVfzQ5J KN64j9pne2ZtZivm3WSVuGgnhi2YXFsRTgoUAV+bgViI00yCeDERbo8rryrLiOFuun7N 5TELFqONIvE3I6/eby5A6oQmJHS4kA1vxnLFs1sm+GzsXsJUwGhNZgXqZo762UsI8aI/ 0Gd0DsPDT2vKjS+vza5u/j0bklV9KVfzhviCgeDV9zIfRMZVdNaI+QxChJH5nCI28jt3 Ibhg== 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 :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=GxCq2CJKforFb9++D6VNzR9475PAUWnofiOKSDEL/O0=; b=x9YqO5i0rgFWr2BdZFzDmvR0l3qbgjhZG28EBQdCkNJNppeILFWRUg6UJbLSXPU8gS d57lNGwc2qRNseNh2sOVGDlWBPJD00D1ADovjHzIvkydm8s1Oxl060y2GpTFlusVk2xX q9qM/CoHGxSChA1ZXUnSlz12xD5r7DhFKo9CRShNtlMhiiOkxFQqAnz03fZ/K19Ccgfr to3InE94dt9dnQnxGJcgCl3PaEM5R64rngdRdfM5zTo9ZcoRw8V7Jk8kDg4wkMI6WlBz nkynxfQHLaizy58qRN5QM+OY4sUDu4ZkxfN9o9oBFQd4ZkW85jDKrB9ninvaElhZ6r+Y XK3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=m4GATxND; 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 g11-v6si9822516plt.580.2018.03.05.12.46.05; Mon, 05 Mar 2018 12:46:19 -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=m4GATxND; 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 S1753032AbeCEUpO (ORCPT + 99 others); Mon, 5 Mar 2018 15:45:14 -0500 Received: from mail-ot0-f193.google.com ([74.125.82.193]:37356 "EHLO mail-ot0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752931AbeCEUpM (ORCPT ); Mon, 5 Mar 2018 15:45:12 -0500 Received: by mail-ot0-f193.google.com with SMTP id t2so16274889otj.4 for ; Mon, 05 Mar 2018 12:45:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=GxCq2CJKforFb9++D6VNzR9475PAUWnofiOKSDEL/O0=; b=m4GATxNDJKK3s7AzaOhHB9BseSeQqtBJC2MCcO8H2FIbhZfQRVLyaNk1hB4FOCLZXd EeAH+ufYeUMS45OOZK31222hjq1pZlzpbtGZe5M5TS5fD7ujA1qCtr5ygAzrULiaq1s+ EfjfzTfC38KIfq5OVQZ7YBs5DO+FBa2XsSW/c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=GxCq2CJKforFb9++D6VNzR9475PAUWnofiOKSDEL/O0=; b=exXOjbWw1EKuIOph4Mut1TJYuobmhRUOGiMzDJ0FQwJoq0DEgqPlHOGnR3MXWDWHcd o3mgcOvlPzVQW388kgoNHIC74y9oaf2lr9s/iTygTmKhAqI1r7xL3SozSbnzGuU7GVAX iBMvD9AtwDn9K85PxtQtleKO9O5SInDc4STRk5Ls6MHzM0zBoURBQ02fJV0t1iVPngwo bCEo7U/0IRbWruxnbkFaWpjPeBpAfBx6sXEcS6kx1Fm5awF58o67S0cNTCLFj41NouQA O9lKmQzve7lV/XW/6WKeFbjcMgoonuyFeeVIzjlhY7nVDf0LWriESb3OF6Q3YMOTJ5+T icgQ== X-Gm-Message-State: APf1xPBOU+lTPzOaAv1AUzsr7+Uv0PGMtTnNLcIeZfQAxcSNvyMUQeUb e0btdLgIf56xptJXxBOAmzHI5S0dDnU= X-Received: by 10.157.50.245 with SMTP id u108mr10559195otb.181.1520282711477; Mon, 05 Mar 2018 12:45:11 -0800 (PST) Received: from mail-oi0-f45.google.com (mail-oi0-f45.google.com. [209.85.218.45]) by smtp.gmail.com with ESMTPSA id z68sm5403015oig.37.2018.03.05.12.45.09 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Mar 2018 12:45:10 -0800 (PST) Received: by mail-oi0-f45.google.com with SMTP id t185so13123441oif.6 for ; Mon, 05 Mar 2018 12:45:09 -0800 (PST) X-Received: by 10.202.170.208 with SMTP id t199mr10076266oie.5.1520282708799; Mon, 05 Mar 2018 12:45:08 -0800 (PST) MIME-Version: 1.0 Received: by 10.157.14.33 with HTTP; Mon, 5 Mar 2018 12:44:28 -0800 (PST) In-Reply-To: <20180302164317.10554-8-ilina@codeaurora.org> References: <20180302164317.10554-1-ilina@codeaurora.org> <20180302164317.10554-8-ilina@codeaurora.org> From: Evan Green Date: Mon, 5 Mar 2018 12:44:28 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3 07/10] drivers: qcom: rpmh: cache sleep/wake state requests To: Lina Iyer Cc: Andy Gross , David Brown , linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, Rajendra Nayak , Bjorn Andersson , linux-kernel@vger.kernel.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 Hi Lina, On Fri, Mar 2, 2018 at 8:43 AM, Lina Iyer wrote: > Active state requests are sent immediately to the mailbox controller, > while sleep and wake state requests are cached in this driver to avoid > taxing the mailbox controller repeatedly. The cached values will be sent > to the controller when the rpmh_flush() is called. > > Generally, flushing is a system PM activity and may be called from the > system PM drivers when the system is entering suspend or deeper sleep > modes during cpuidle. > > Also allow invalidating the cached requests, so they may be re-populated > again. > > Signed-off-by: Lina Iyer > --- > > Changes in v3: > - Remove locking for flush function > - Improve comments > --- > drivers/soc/qcom/rpmh.c | 208 +++++++++++++++++++++++++++++++++++++++++++++++- > include/soc/qcom/rpmh.h | 10 +++ > 2 files changed, 217 insertions(+), 1 deletion(-) > > diff --git a/drivers/soc/qcom/rpmh.c b/drivers/soc/qcom/rpmh.c > index d95ea3fa8b67..8a04009075b8 100644 > --- a/drivers/soc/qcom/rpmh.c > +++ b/drivers/soc/qcom/rpmh.c [...] > + > +/** > + * rpmh_invalidate: Invalidate all sleep and active sets > + * sets. > + * > + * @rc: The RPMh handle got from rpmh_get_dev_channel > + * > + * Invalidate the sleep and active values in the TCS blocks. > + */ > +int rpmh_invalidate(struct rpmh_client *rc) > +{ > + struct rpmh_ctrlr *rpm = rc->ctrlr; > + int ret; > + unsigned long flags; > + > + if (IS_ERR_OR_NULL(rc)) > + return -EINVAL; > + > + spin_lock_irqsave(&rpm->lock, flags); > + rpm->dirty = true; > + spin_unlock_irqrestore(&rpm->lock, flags); Thanks for removing the locking from the flush path. I was hoping to see the locking removed around this statement as well. The way I understand it, all of the racy bits are attempting to set dirty to true, so you don't need a lock to protect multiple threads from setting the same value. The only time dirty is read or cleared is in the single-threaded PM path, so there are no potentially dangerous interactions. If no one has any other comments on the series, then I don't need to hold everything up based on this one tweak alone. But if you end up spinning it again for other reasons, consider making this change as well. Thanks, -Evan