Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp774650imm; Tue, 15 May 2018 09:00:59 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpBXiZknEj725NOg0bU79RdeOELqlOb609ZzEWRhHE76Fy0Zwm5dnoggLs/L4Jvd8Q0vJav X-Received: by 2002:a17:902:24c7:: with SMTP id l7-v6mr15289603plg.327.1526400059260; Tue, 15 May 2018 09:00:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526400059; cv=none; d=google.com; s=arc-20160816; b=DksdZCANXcNJTG1T4FJBb8KX/nMbZT/ElNqewuTq2Lj9DVvzHPgimU0ce8F6gJdbVJ 8pKcd8q5810OmXCeUcWldBU93AHy8SGpA9vOncgrBMYjss7v/ZKMegLgJLKIIarMuKRU h+daOdbO6GTN1blmhMt8jIRC75u0gdLp6L0jWME4ch9R5vihe5XbZ1baSkyo5VAF9Hgn GrPC0jMIlEo+/SRzMHT7vsnh9pvPpN79/L2IK+4pXFvxVvMz7bbMefKD/jkFIZ3r42+z lCkMbr1pCm0ecK+v/vszM3vUrKaRV8dRa9LHpW705QY5JiK7D0JdTx03Es+5nOjilfUP zZQA== 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:dkim-signature :arc-authentication-results; bh=0ZaGjE3qsEFrKb1NlrXeVM6X3P5FSBtg6UUiNDbg3DA=; b=oOlejSqkEYlSlfPvyA+DqNEgbHY/9HcxIm2Qplh6/bV2n+bMZkdnWVdMUaj0918Qok IHpfenNzoHbY9Ns4I2NB9b3IsRiwriUtF5Px9Ib26fqW0QKT7IadpU7ZqkkFIDxjMRTt vmxIwxGE1n4Ycqi+oLXp8DgBazjQR4v0xYiZVaoGeGwPHguRfKhG/nxnOwGccefTzi+h NuHa/Htt6wbE1xRyJY5EDNAAnQ1zDt9JIUZ6A8/CtoEP0EJXCRjeeGaVJuW/Lh9I0zgi qhn5l5dhhQ8Z6Im/iEdTl1PKqEM5+sT9rVp0pEMMG1oOyQixeTjClSt+1EMtsdbGGWme MqOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@google.com header.s=20161025 header.b=hYCcbg76; dkim=fail header.i=@chromium.org header.s=google header.b=hjRbM70K; 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=fail (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 s13-v6si278090plq.464.2018.05.15.09.00.33; Tue, 15 May 2018 09:00:59 -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=fail header.i=@google.com header.s=20161025 header.b=hYCcbg76; dkim=fail header.i=@chromium.org header.s=google header.b=hjRbM70K; 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=fail (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754437AbeEOPww (ORCPT + 99 others); Tue, 15 May 2018 11:52:52 -0400 Received: from mail-ua0-f195.google.com ([209.85.217.195]:39706 "EHLO mail-ua0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753274AbeEOPwu (ORCPT ); Tue, 15 May 2018 11:52:50 -0400 Received: by mail-ua0-f195.google.com with SMTP id v17-v6so459789uak.6 for ; Tue, 15 May 2018 08:52:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=0ZaGjE3qsEFrKb1NlrXeVM6X3P5FSBtg6UUiNDbg3DA=; b=hYCcbg76UtpGGjCRalrEsUCaKFEYuwmc5VFF7Y2DAs87CRj4Q+HjTXXk0CKDtermma rvVhy2cDAz8Hn68ADS4W7blZnEdB+EVm2Zis3rhoXSh3xbxgEKJtCIT1b2dQ901B/FBM OUdohCbx58ptl/nFt53MyuNtAu+3+qGhBAZ82Gxr9P/mdmOphMT/VRU8QpX/bFCvHxCI 3e7UtxIX22mgp0dzj0ucuNlv1G6Z9tslUG550q5h+GRfFi9ToYOGsf6m7ywEEU/X4blg kGlURvXnaTBOy53ZCaXG/vF5FeUWdU0neVf/mf7TFBFJIfmDmIJu6k+bkRbzJ8XAgEZP PEKw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=0ZaGjE3qsEFrKb1NlrXeVM6X3P5FSBtg6UUiNDbg3DA=; b=hjRbM70KlxvVjPCVTWAkoKCjP5fdIqIaJgJVYAaTRIg5aIEVYoRlaNOKWLwODleh0c 3YgGpk2R6g8gYscJFJr2TIjqi2ALZjZLtjKsI5rJX4XQnHEunW3V+uQh7ZEKCyJNylXp cAn1JFOWmODkokd2w3Yxi7TvI2/zQZrJDlnHI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=0ZaGjE3qsEFrKb1NlrXeVM6X3P5FSBtg6UUiNDbg3DA=; b=UKn8dXnHwkwopUBm53qzweXsI10bHA6VSG8kIQmbfacs5O8pgQ43FH1Me4+tqkiwGN UcJKZsvr9Qkid6LDp/IV41Q80tgS3D+YQ+TiRH25rCEKtwJN002KCNmJcm2xjvCiOrxN AN+m97HItqS50309bSeWbazn5VZ/bZBkP94pPIHjZTXJcmD07X03UG+PFq714UmQ7xBN 4FR1NCu7mH30z6WJ/7X36NHzBuMlBpgpt9KTHhy45Js2+7S24WasndpYOc2+Sl/CJ7Wo WzWAJggLNlpG6w3f/DQKYycNa2AKfrtWLJx4MTZIfI0OzotespXQ7SCoTGyN5JyRh6cv tBzw== X-Gm-Message-State: ALKqPwe4TLF+nYwstTJllwvNkZXzA17m0zMgprGWOzy3oCUGBFyIrWxj QJGxtvaVIZ/zKlV2mK+9yr6LyTZiggBKM3IvDgmsDQ== X-Received: by 2002:ab0:708c:: with SMTP id m12-v6mr16676788ual.191.1526399568645; Tue, 15 May 2018 08:52:48 -0700 (PDT) MIME-Version: 1.0 Received: by 10.31.48.82 with HTTP; Tue, 15 May 2018 08:52:47 -0700 (PDT) In-Reply-To: <20180514195929.GA22950@codeaurora.org> References: <20180509170159.29682-1-ilina@codeaurora.org> <20180509170159.29682-10-ilina@codeaurora.org> <20180514195929.GA22950@codeaurora.org> From: Doug Anderson Date: Tue, 15 May 2018 08:52:47 -0700 X-Google-Sender-Auth: sRd4u2CFJCyier1GBGTsCOvgP6g Message-ID: Subject: Re: [PATCH v8 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, "open list:ARM/QUALCOMM SUPPORT" , Rajendra Nayak , Bjorn Andersson , LKML , Stephen Boyd , Evan Green , Matthias Kaehlcke , rplsssn@codeaurora.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, 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. >>> + 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. -Doug