Received: by 10.223.185.116 with SMTP id b49csp1266532wrg; Wed, 21 Feb 2018 15:26:47 -0800 (PST) X-Google-Smtp-Source: AH8x227hVYEBckOO95Q4kHEx8aZUq+UnBfrqDKfDJrGU9WdikDHvIo0NO4oRv0k87CrmLWOlHm/6 X-Received: by 10.99.94.67 with SMTP id s64mr3887032pgb.379.1519255606955; Wed, 21 Feb 2018 15:26:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519255606; cv=none; d=google.com; s=arc-20160816; b=k2QhgZ9j+2wjElhUwPKrCuepx4pcEregQWAQz6x1Q59STzvBvTXcy2aPtcyNcfGS8R HPkq+AekLhRZQKsxfgp6FNlf4IdbYVai8CWslEJUMpJwSoIH73sYf4CqM2ULQqyrXAM+ 7elebU/yxb7J0S1jR8B7iAEOoEa+urDs9jk4OMenmHh3bd8HWZHwujB5PholvFf02wJ3 TkXQrnfkzUFOagWG4d1J6V6pos/0nu4ut8f4sut1s6hXKLBSQ4OeYIh336I0qvuD/Cyc XzUAuEuW3/zi3mNv6gFkUcgwxaaEWnP7SVhpHwpl5cjdmwaJ38VbSTKr2Qel5kjWKChg 9jhg== 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=LOM+Tz0QHFEcNYheEee+YZAw+BrJD1qjxuqJuiB17B0=; b=grBwAp6kfOInSBHRvPiBzDQIfR/eZX5TzIjt2bGkDNxLdYacwODfhs4A0lv3VY/WIQ EMwuufaDcWTJz5mo7KihVVv6GaBpaGy76EYc6NyUnT/5ROTFqaiX8Y2Lt56P8UXLNvD0 q9MWE0fVqxgX3f4uCw7bK0/Yrb4SNKRnzJIhdZLTPGxhdVBW4554I9fC8yDxYCsjLDOK xA0SPq7XDWOPM9LAeRaa0Ff1028hbKUh7wAwrH0tRXoI0hPKxvKVTGBCS0Q5tyeIihwU CoboAO3yS2mRQ53Ca1RDm1QYHO1xi5SfXwJLLlhSzF3Ouz9bOccBubSKNHP/B/O20JjK ob0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=AIb903iT; 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 z69si1974941pfl.299.2018.02.21.15.26.32; Wed, 21 Feb 2018 15:26:46 -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=AIb903iT; 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 S1751376AbeBUXZg (ORCPT + 99 others); Wed, 21 Feb 2018 18:25:36 -0500 Received: from mail-ot0-f194.google.com ([74.125.82.194]:34010 "EHLO mail-ot0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751129AbeBUXZd (ORCPT ); Wed, 21 Feb 2018 18:25:33 -0500 Received: by mail-ot0-f194.google.com with SMTP id n74so2823986ota.1 for ; Wed, 21 Feb 2018 15:25:33 -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=LOM+Tz0QHFEcNYheEee+YZAw+BrJD1qjxuqJuiB17B0=; b=AIb903iTS4ozpU6qNoPPOSJok1uivCY2s1CaqWLSssTDzY4QvyqNShCZut85N/4GWd epd1pPgVpRZ/feHO2m25a8z8ie4wwCZlDrOwe5OPXYfzZu+wAiaWgIyKqrx1uj/mtTjf MmoJsn4LBbpE/fOt7K9ghU7ukn21sEdAtdQFU= 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=LOM+Tz0QHFEcNYheEee+YZAw+BrJD1qjxuqJuiB17B0=; b=q1P4HCEulFv5nFm/e1JJN9x+fP/rgiKv5zHDxSeU4lxoIwtL0PES90YOAbL3ckBiDH fdzsVqvbFGSXt+Ssx+GlXSP71kQ34RSgJ8ndsZ6I3wPvYBfhoMWLvuHfq+jwh5gSsiyp QWY3npLRDixf9xZV5J1mUHIdqX0RHLZleht1MOhMcZ9CD+y0xc8zAjLpCv1QIEJTEg2H ouWyjeMs7+vXG0/seMZoDUAbu3uwCMX2Fy2mhtlMuJO6FhJbSN3j2XW0DEBCBJ8Qaoe1 bWqJulhgDLedB4q/Quk6RpDe4OK7uW2MNuLs+UDQanpRWHp/udZc3zTglwsPg6DrHxbj CEWg== X-Gm-Message-State: APf1xPAlQ63gHVvd5Q8/gFt16UtvMbz2V1ZWYGMhu2Uj9yDd5QdJPMhx lTS8vVElDWoaDisjvkiaCX7yVFhmxgI= X-Received: by 10.157.17.199 with SMTP id y7mr3899752oty.298.1519255533267; Wed, 21 Feb 2018 15:25:33 -0800 (PST) Received: from mail-oi0-f54.google.com (mail-oi0-f54.google.com. [209.85.218.54]) by smtp.gmail.com with ESMTPSA id p10sm14932904oig.6.2018.02.21.15.25.31 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Feb 2018 15:25:32 -0800 (PST) Received: by mail-oi0-f54.google.com with SMTP id c12so2422634oic.7 for ; Wed, 21 Feb 2018 15:25:31 -0800 (PST) X-Received: by 10.202.245.73 with SMTP id t70mr3130545oih.135.1519255531264; Wed, 21 Feb 2018 15:25:31 -0800 (PST) MIME-Version: 1.0 Received: by 10.157.14.33 with HTTP; Wed, 21 Feb 2018 15:24:50 -0800 (PST) In-Reply-To: <20180215173507.10989-10-ilina@codeaurora.org> References: <20180215173507.10989-1-ilina@codeaurora.org> <20180215173507.10989-10-ilina@codeaurora.org> From: Evan Green Date: Wed, 21 Feb 2018 15:24:50 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 09/10] drivers: qcom: rpmh: add support for batch RPMH request 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 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. > @@ -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. -Evan