Received: by 10.223.185.116 with SMTP id b49csp4348954wrg; Tue, 6 Mar 2018 14:13:54 -0800 (PST) X-Google-Smtp-Source: AG47ELuqr+4lHCF8OyX3mGNLYWmU/XXrSaweS69AaB9qzRYSN4Xn1S0GxzgZZGXFeWP/tsV/cZf5 X-Received: by 2002:a17:902:7009:: with SMTP id y9-v6mr18006358plk.395.1520374434412; Tue, 06 Mar 2018 14:13:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520374434; cv=none; d=google.com; s=arc-20160816; b=J4YC+XJBBMv4ijdSG/s7Ic1fCXmo/jHhB5uMst057ovUcV5U+7c5rZSRzUfb/+tdBg 1FHDyMD7xMFHeH81cyEzvJO5BHUiURxSqlibbt7mXQlPSIu7e51CylZtF22WyFgkwGJZ qZcg8gVjP9oWRl8SFczE5E6rhs4gHRfuK866U2VNrMToiKhqasGDg9Gc7WwyCk3U5SXh YvxpXqNc27PAwhwMGqEkHRkBQMd1xcc7nP3/OwD+p6zQ9LJUTuIgdxu51FqHwU1MbpL2 5TOZYvry2H4FKoC8kAhhLB74h+JjwpQOPUCcEFZS5uIRbLwtAreWSZfU9w53P7esbTdT Ho3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dmarc-filter:dkim-signature:dkim-signature :arc-authentication-results; bh=ceyfEi/+dM82LoNErImsdg50C6neHktF0GPzvQwCAQ8=; b=gqxbcbyep0ygVY31ys7Pq8HX8YqBDcebZLoUEjhAQYWZKvYTMrSMN2iB/vRBf20oDG MoV5jcuQEd9GJR50Qsup2aDzybEpCRNjZK7QPb1hw2dm6s/g71a4YnfschiDLY8XAsci 7zH92sMGudJ+41gWjCnJHZFhEbfaTpPCiBfrYdH2+BLGBjQvbrGuodi75YuICHK36nGR ju1tUJGXZJpz3INexzfpuAzOcJDoy4ldTkmvEun4CNTalmYfU/4BuWSwT4zHGa8hBYU4 dEpvJXPORrm8XlZhW8YWvsBq3eDIb1iEEd5cinrD9WKHGLPkBbmj++OXItLaVVUelkZ8 Ue+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=IOzhjSB1; dkim=pass header.i=@codeaurora.org header.s=default header.b=IOzhjSB1; 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 g1-v6si5426238plt.54.2018.03.06.14.13.40; Tue, 06 Mar 2018 14:13:54 -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=@codeaurora.org header.s=default header.b=IOzhjSB1; dkim=pass header.i=@codeaurora.org header.s=default header.b=IOzhjSB1; 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 S1754128AbeCFWMm (ORCPT + 99 others); Tue, 6 Mar 2018 17:12:42 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:56464 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753805AbeCFWMk (ORCPT ); Tue, 6 Mar 2018 17:12:40 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id AA2B160721; Tue, 6 Mar 2018 22:12:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1520374359; bh=u4PpMB9D4xIh8OGLXK33dnP0yV7DicVMuH5M83QW69I=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=IOzhjSB17x4KLC9/2grjg5Q25EijBUvYcUgJF3L6Ul3rIGhmUHZZNF0tE+r4aVWeu 8RyH2HcMzsIoUwq8hfv19wHpb7zfWGBC1AJiqePcBAdc2Jv/T6YlP/IgweMtVYZ0Vn 2DNPzO/b91oIT3N/QTDuiofOtgtgg4WwtZdIg9B8= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from localhost (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: ilina@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id D047C6016D; Tue, 6 Mar 2018 22:12:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1520374359; bh=u4PpMB9D4xIh8OGLXK33dnP0yV7DicVMuH5M83QW69I=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=IOzhjSB17x4KLC9/2grjg5Q25EijBUvYcUgJF3L6Ul3rIGhmUHZZNF0tE+r4aVWeu 8RyH2HcMzsIoUwq8hfv19wHpb7zfWGBC1AJiqePcBAdc2Jv/T6YlP/IgweMtVYZ0Vn 2DNPzO/b91oIT3N/QTDuiofOtgtgg4WwtZdIg9B8= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org D047C6016D Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=ilina@codeaurora.org Date: Tue, 6 Mar 2018 15:12:38 -0700 From: Lina Iyer To: Evan Green 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 Subject: Re: [PATCH v3 07/10] drivers: qcom: rpmh: cache sleep/wake state requests Message-ID: <20180306221238.GG4930@codeaurora.org> References: <20180302164317.10554-1-ilina@codeaurora.org> <20180302164317.10554-8-ilina@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.3 (2018-01-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 05 2018 at 13:45 -0700, Evan Green wrote: >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. > Fair point. Will take care of it. >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, Lina