Received: by 10.223.185.116 with SMTP id b49csp2165224wrg; Thu, 22 Feb 2018 09:06:53 -0800 (PST) X-Google-Smtp-Source: AH8x2250qFVweuKCrZsA7iugDMgQjUSywwoe1YriOmdgPZzAWBzbiyeidcQPr6AaaNgo4rpFEWYR X-Received: by 2002:a17:902:14b:: with SMTP id 69-v6mr7322484plb.209.1519319213038; Thu, 22 Feb 2018 09:06:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519319213; cv=none; d=google.com; s=arc-20160816; b=lEZ80aaK7xqJjURGXE5LxdAyduKYxNern1gwFJXMmMLMt+Gr1gcs5uMruMnwq2G86f MZs7sACxwh6wZ6OTfajjc3E9AZeIIUgRrztUCRnhy7Ve7or6Cs9/I++ceNQ52CelTlUd i/DAxFAZda6juPLoeFdIpTh3vceFIQW+hA3r/lOXWMscAEBg5yReSkwZA5X9BRbJkU23 cSuJTgEQx9+px8GlBi2N2BkVPA27lXumKGaKF8YM4bDJObRDPAQBiD/O4nU5GSoFuqYJ tE59EpsRvghsZXyLCwQ7GTsI1zYgs37uLBrAmcogJ2zTjGH68MN7RhM1imcPJFXzqTXv FeCg== 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=Owr0ISMgMbUL3ZUOMZDGw4c3o4l4zqa6HhctQg/7CaU=; b=cd3FIgVASM56kk2yqE4ZRzqBOU8bxtC5lQ4itTpNkmoIydPRvEvFqSr606j/r2jCiU 9XtYw0RLpW6UeTQiBG5vTRXSZjq84l81UzLuTVlLWFC/Sy+W5/oYnGq1L8xReeikSE3O ZorabtFO8maE185Q6peiBIJvy3fH8qP2MlqnApDvdrURcVeP2vgKaR4FlNUWQMSAT4u5 fr8JvLf67EWur/d5lY+H4//8cFIRoOQx9LpVtw+8lp+WP/GRzgx4NKtUe2VLLoF/5BXB HravujBg7JbWZ/2pWu3PXX967KDN3/4vc62oLurgffocRSbUSdM4BQMTYPzCMwrCzScM 3aTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=OkYE0NHV; dkim=pass header.i=@codeaurora.org header.s=default header.b=OkYE0NHV; 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 c81si311078pfe.342.2018.02.22.09.06.37; Thu, 22 Feb 2018 09:06:53 -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=OkYE0NHV; dkim=pass header.i=@codeaurora.org header.s=default header.b=OkYE0NHV; 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 S933400AbeBVREz (ORCPT + 99 others); Thu, 22 Feb 2018 12:04:55 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:44552 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933197AbeBVREx (ORCPT ); Thu, 22 Feb 2018 12:04:53 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id CE6BD6081C; Thu, 22 Feb 2018 17:04:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1519319092; bh=kFFMWFGRNy+1zJfy8znuzmVyHgUdjvHAPSp6SatyViQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=OkYE0NHVIbcbKqvu4U2y1V9uLZZDW/PhdrV+w7gT0E1gTaeYPfvuOAvH1v16z0ky5 V8BsDt81WOELA0fB0WoBSuA4sf3SuqX/sod58v0w2e1arreM6asBIV1CLlZW/cOplB TgdhNWDu3SqWj6kAuVwJuEKNifl/U416wUh/kUsc= 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 466716021C; Thu, 22 Feb 2018 17:04:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1519319092; bh=kFFMWFGRNy+1zJfy8znuzmVyHgUdjvHAPSp6SatyViQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=OkYE0NHVIbcbKqvu4U2y1V9uLZZDW/PhdrV+w7gT0E1gTaeYPfvuOAvH1v16z0ky5 V8BsDt81WOELA0fB0WoBSuA4sf3SuqX/sod58v0w2e1arreM6asBIV1CLlZW/cOplB TgdhNWDu3SqWj6kAuVwJuEKNifl/U416wUh/kUsc= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 466716021C 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: Thu, 22 Feb 2018 17:04:51 +0000 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 v2 09/10] drivers: qcom: rpmh: add support for batch RPMH request Message-ID: <20180222170451.GB7098@codeaurora.org> References: <20180215173507.10989-1-ilina@codeaurora.org> <20180215173507.10989-10-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 Wed, Feb 21 2018 at 23:25 +0000, Evan Green wrote: >Hello Lina, > >On Thu, Feb 15, 2018 at 9:35 AM, Lina Iyer wrote: >> Platform drivers need make a lot of resource state requests at the same >> time, say, at the start or end of an usecase. It can be quite >> inefficient to send each request separately. Instead they can give the >> RPMH library a batch of requests to be sent and wait on the whole >> transaction to be complete. >> >> rpmh_write_batch() is a blocking call that can be used to send multiple >> RPMH command sets. Each RPMH command set is set asynchronously and the >> API blocks until all the command sets are complete and receive their >> tx_done callbacks. >> >> Signed-off-by: Lina Iyer >> --- >> drivers/soc/qcom/rpmh.c | 150 ++++++++++++++++++++++++++++++++++++++++++++++++ >> include/soc/qcom/rpmh.h | 8 +++ >> 2 files changed, 158 insertions(+) >> >> diff --git a/drivers/soc/qcom/rpmh.c b/drivers/soc/qcom/rpmh.c >> index dff4c46be3af..6f60bb9a4dfa 100644 >> --- a/drivers/soc/qcom/rpmh.c >> +++ b/drivers/soc/qcom/rpmh.c >[...] >> @@ -394,6 +537,11 @@ int rpmh_flush(struct rpmh_client *rc) >> } >> spin_unlock_irqrestore(&rpm->lock, flags); >> >> + /* First flush the cached batch requests */ >> + ret = flush_batch(rc); >> + if (ret) >> + return ret; >> + >> /* >> * Nobody else should be calling this function other than system PM,, >> * hence we can run without locks. This comment and the comment in the header of this function. >> @@ -438,6 +586,8 @@ int rpmh_invalidate(struct rpmh_client *rc) >> if (IS_ERR_OR_NULL(rc)) >> return -EINVAL; >> >> + invalidate_batch(rc); >> + > >Similarly to my comments in patch 7, aren't there races here with >adding new elements? After flush_batch, but before invalidate_batch, >somebody could call cache_batch, which would add new things on the end >of the array. These new items would be clobbered by invalidate_batch, >without having been flushed first. > Flush is a system PM function and is not called by drivers and is not expected to run conncurrently with other threads using the RPMH library. Thanks, Lina