Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp805899imm; Tue, 15 May 2018 09:25:13 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqjDyFIlSYP8vuF3int8VDveO0XUyhI8npxg2KAunC5NosM1lS/zWSmB995ZKnnyKmeZRcT X-Received: by 2002:a17:902:c6b:: with SMTP id 98-v6mr4977844pls.270.1526401513253; Tue, 15 May 2018 09:25:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526401513; cv=none; d=google.com; s=arc-20160816; b=eyJ1Wo0biKLQUVURGT5m8wHJUPYpjYZpgE0P22bObmyDubol5emfRIgQHrUvS5CQui i/DZ9k84RdFIMlBesel5nqgimdrs/3aL+4ysdvKu8MVmi7c8+dA+Ik1j9DDHMXS4nz8b 7FSjVej0KPtAz+vxeuhqxBKhiWfjz0pRG2W8kRGS5kd1j4Rm5D1rN6ddzS/nwfON7b82 t66qJm1KOXJyQTOra4i+2eavpx9feS+JoaFhsOXtHFBn1T5tPbLTW7nWScaOxk5ecr3h YcL/DPHx/+AvwlApipuUy8JbY1JQyGBi1afo3ZoHEAJ5GRI/pRVmGWdIe1yNd2cyYldW 74FA== 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=mHORDL9pJjYxerFRjMJJYm1ixRE/EOjPz/Vd4sw4V00=; b=Pb6Ozk0bv7rmzoWTz30NmCL5YtNWEZRQUylbACN1IIiJog6aX65lPAEs83Uv8dyJh1 JfU0rMwHO39qRWMUshhuYn9zi9whpve70k1efIDHPXvPov3VFyrG71noHlmlu+Bpq6FY LZJYID167FpoUQaMMZx2lDXf/gxcUWTwm0h0dFiGbxIDH1xYjtWxTvzBvdA3LAIQE8CR 7Sgc9wwT1+QjyrirpSLbf17VyRXfIACXOYK8/Nezv+gDOlRn9gfuDxXwKEUp+cg+YFhx 0kIq057NiK+l5bkTAIgnSSMWdTZdqK26wNtRQDa7D+TDe1MlbUfys5D5FvtY+Z88Xp8X 5g5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=K377GJI5; dkim=pass header.i=@codeaurora.org header.s=default header.b=Jehvbzpq; 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 s13-v6si334593plq.464.2018.05.15.09.24.59; Tue, 15 May 2018 09:25:13 -0700 (PDT) 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=K377GJI5; dkim=pass header.i=@codeaurora.org header.s=default header.b=Jehvbzpq; 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 S932119AbeEOQXd (ORCPT + 99 others); Tue, 15 May 2018 12:23:33 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:43618 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753984AbeEOQX3 (ORCPT ); Tue, 15 May 2018 12:23:29 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 88AB160540; Tue, 15 May 2018 16:23:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1526401408; bh=a2ala584LEbEgDHq2IHSxwfUEsrGycGGlgupw8oSF0o=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=K377GJI5bkiEzFZSarP04KaAPyxZsyaAEYnD5fJDqDC9Z3DrUFHNhw3fH8icBlaJS II9z/dPHpzqv7y54dxWNgGbnSGx3B/sB0RsqgUodZNUhVHvnuBb0Yg20RkF2+uPIhX AlBIYShjAn2PXxyGRLmfUCSi/7kHJ0Hc2ZmByO0M= 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 6C56660540; Tue, 15 May 2018 16:23:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1526401407; bh=a2ala584LEbEgDHq2IHSxwfUEsrGycGGlgupw8oSF0o=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=JehvbzpqgRYY6ZLLhGyqGdYEdN91o6UfzZm61OrKCy6ySE+yXKN0yb2Nvq/6tIlEU PjIYOguAJ3WCeaHTHuc6jFpHEWYKtJNukOy1fjQTG3ePAlul5JHRyHFZiB7AbggbLn kgYyHhUOSuO2j34WmLlO5ldwB5t3kpd+oVwbr7Uk= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 6C56660540 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, 15 May 2018 10:23:26 -0600 From: Lina Iyer To: Doug Anderson Cc: Andy Gross , David Brown , linux-arm-msm@vger.kernel.org, "open list:ARM/QUALCOMM SUPPORT" , Rajendra Nayak , Bjorn Andersson , LKML , Stephen Boyd , Evan Green , Matthias Kaehlcke , rplsssn@codeaurora.org Subject: Re: [PATCH v8 09/10] drivers: qcom: rpmh: add support for batch RPMH request Message-ID: <20180515162326.GA28489@codeaurora.org> References: <20180509170159.29682-1-ilina@codeaurora.org> <20180509170159.29682-10-ilina@codeaurora.org> <20180514195929.GA22950@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.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 15 2018 at 09:52 -0600, Doug Anderson wrote: >Hi, > >On Mon, May 14, 2018 at 12:59 PM, Lina Iyer wrote: > >>>> /** >>>> @@ -77,12 +82,14 @@ struct rpmh_request { >>>> * @cache: the list of cached requests >>>> * @lock: synchronize access to the controller data >>>> * @dirty: was the cache updated since flush >>>> + * @batch_cache: Cache sleep and wake requests sent as batch >>>> */ >>>> struct rpmh_ctrlr { >>>> struct rsc_drv *drv; >>>> struct list_head cache; >>>> spinlock_t lock; >>>> bool dirty; >>>> + const struct rpmh_request *batch_cache[RPMH_MAX_BATCH_CACHE]; >>> >>> >>> I'm pretty confused about why the "batch_cache" is separate from the >>> normal cache. As far as I can tell the purpose of the two is the same >>> but you have two totally separate code paths and data structures. >>> >> Due to a hardware limitation, requests made by bus drivers must be set >> up in the sleep and wake TCS first before setting up the requests from >> other drivers. Bus drivers use batch mode for any and all RPMH >> communication. Hence their request are the only ones in the batch_cache. > >This is totally not obvious and not commented. Why not rename to >"priority" instead of "batch"? > >If the only requirement is that these come first, that's still no >reason to use totally separate code paths and mechanisms. These >requests can still use the same data structures / functions and just >be ordered to come first, can't they? ...or given a boolean >"priority" and you can do two passes through your queue: one to do the >priority ones and one to do the secondary ones. > > The bus requests have a certain order and cannot be mutated by the RPMH driver. It has to be maintained in the TCS in the same order. Also, the bus requests have quite a churn during the course of an usecase. They are setup and invalidated often. It is faster to have them separate and invalidate the whole lot of the batch_cache instead of intertwining them with requests from other drivers and then figuring out which all must be invalidated and rebuilt when the next batch requests comes in. Remember, that requests may come from any driver any time and therefore will be mangled if we use the same data structure. So to be faster and to avoid having mangled requests in the TCS, I have kept the data structures separate. >>>> + spin_unlock_irqrestore(&ctrlr->lock, flags); >>>> + >>>> + return ret; >>>> +} >>> >>> >>> As part of my overall confusion about why the batch cache is different >>> than the normal one: for the normal use case you still call >>> rpmh_rsc_write_ctrl_data() for things you put in your cache, but you >>> don't for the batch cache. I still haven't totally figured out what >>> rpmh_rsc_write_ctrl_data() does, but it seems strange that you don't >>> do it for the batch cache but you do for the other one. >>> >>> >> flush_batch does write to the controller using >> rpmh_rsc_write_ctrl_data() > >My confusion is that they happen at different times. As I understand it: > >* For the normal case, you immediately calls >rpmh_rsc_write_ctrl_data() and then later do the rest of the work. > >* For the batch case, you call both later. > >Is there a good reason for this, or is it just an arbitrary >difference? If there's a good reason, it should be documented. > > In both the cases, the requests are cached in the rpmh library and are only sent to the controller only when the flushed. I am not sure the work is any different. The rpmh_flush() flushes out batch requests and then the requests from other drivers. Thanks, Lina