Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2770131ybb; Fri, 27 Mar 2020 11:43:24 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsl0w04O/CfsxR04mEoCQ1SiF1W/FTy4/XuzHb/iPtrOMF4U3RkocQzZxIoEJsYJjU4FhmJ X-Received: by 2002:aca:f582:: with SMTP id t124mr184123oih.17.1585334603893; Fri, 27 Mar 2020 11:43:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585334603; cv=none; d=google.com; s=arc-20160816; b=mnC0peLq0mbE+P95Pp2vJ+CbyQ4nBpmQqhq1oumIlvDZdQFzcr+YW5Akx0hKoABNLA bymtgRR9TO+5msb4U9rihHVh96Cetsnxy2YyXk3Kfh3J6gH8zOzPVlJ4yYK3Zk1tzlCO 6YiZQbZUJa4wtUSzMH/YWyn6BAP8oSSfiY2hNAi+vhkjAJaSBFWF02ajMH/gyq5oBqYE t/yVwKCkMKdLbD7m2zFAJ40V0cIkdB26a4yhr4AUD5LqCz6IO//YEHFtUIKPigd0GQgT 2JqEbncp7lhb0nSRSRzWdTTl6wyY425bxBBZeAx/Hh4BSjjipewUOrqXvWCyBJqLpzrP CIdg== 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 :in-reply-to:references:mime-version:dkim-signature; bh=xc3LoiplRnf2aKZoDkeqAn+I7PpOTwp2GWQBp5c9cME=; b=kTglERwBDFGfH4/JvsZUWdbyqF+BaLb22TcJo8O+EGmM5/N5OFcnibA0P/+ryg7RKw bdl95SJSDmsBp6TE0PPr7R05ULBmNqCbDfGc/34O+9+7o+dnB0l7ORmSM1hhuY45mHeG gbvgOol/WoYiMvsPU4EwIzrmjK7Z12u9KLU60QOvv57gTL2OTux6NMZ3MAV2xF17ITqp BbZ+4mj9yaRSsIL2tmjLb8hisPyJW0xvNu7LB3ODT55YUZ5g5I32rbM2NqlqWBAyYVy2 2iAwcFOFWMOvszZYfD7W0iMOfZNNsafnfROpMESrlBOcodM4vgspah3uQJKbVAElE4sN +KDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=KbYEM+2v; 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 p9si2751945oti.202.2020.03.27.11.42.57; Fri, 27 Mar 2020 11:43:23 -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=@chromium.org header.s=google header.b=KbYEM+2v; 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 S1727336AbgC0SmU (ORCPT + 99 others); Fri, 27 Mar 2020 14:42:20 -0400 Received: from mail-vs1-f68.google.com ([209.85.217.68]:35409 "EHLO mail-vs1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726770AbgC0SmU (ORCPT ); Fri, 27 Mar 2020 14:42:20 -0400 Received: by mail-vs1-f68.google.com with SMTP id u11so6895589vsg.2 for ; Fri, 27 Mar 2020 11:42:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=xc3LoiplRnf2aKZoDkeqAn+I7PpOTwp2GWQBp5c9cME=; b=KbYEM+2vyjx2c7Pk5OCUrrNAWU8wVJP8BfLb9V1kBS3T3g9kwSbFPaih46M5o42bHE BwX800FckXQ8L0ubDF/CdkrVIPG7r4L/IuzFcu+CJKZDfw93iGrHwj2Ka1WDjoN2heic MriKZ8uwjcDbohlycFXZywHiFek01lSaL/Fho= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=xc3LoiplRnf2aKZoDkeqAn+I7PpOTwp2GWQBp5c9cME=; b=roADx8S6r5gSZTpKUUM+Jq8A55/konzoQjz9QB71TXU1xzJkE+a0Fn+tzlQP4lKwyF Nciv2UfgrOXoxSXctnLjQp6/5Uta9TEzryRLwBw6Q6s5eEnU5y4T4Up/HFgb4wRiCpxV 7SBOQ5gC3EmhdTgxxqYPB0bONhBUX1mVh4dFGDj5/8PznHp7pe6TyW4Z9V8ymdakTPHy AYQ8DlK8Q6k/sFH6N97K2tT5ikndd+leeKdezAYEEYWg46v0/AhiGyeHNw230XaJWaxC 4l3rfWoITXSambCUzQRGPjajmcEEBD3BVAGEfVLCxkHnuhg+3VQ+D3aCUo1WN8T6FBGR jnCA== X-Gm-Message-State: AGi0PuYj7zJuTSK0JoRQS94sJR7tYZPS094yiUGUWrk8GXIhyAk4KIlE LM68JW36ALstdGFfuIBb5AqcLYl7F2w= X-Received: by 2002:a67:2fd8:: with SMTP id v207mr308061vsv.233.1585334537277; Fri, 27 Mar 2020 11:42:17 -0700 (PDT) Received: from mail-ua1-f44.google.com (mail-ua1-f44.google.com. [209.85.222.44]) by smtp.gmail.com with ESMTPSA id c16sm1065352vsq.18.2020.03.27.11.42.15 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 27 Mar 2020 11:42:15 -0700 (PDT) Received: by mail-ua1-f44.google.com with SMTP id t20so3869486uao.7 for ; Fri, 27 Mar 2020 11:42:15 -0700 (PDT) X-Received: by 2002:a9f:21b8:: with SMTP id 53mr279391uac.8.1585334535095; Fri, 27 Mar 2020 11:42:15 -0700 (PDT) MIME-Version: 1.0 References: <1585244270-637-1-git-send-email-mkshah@codeaurora.org> <1585244270-637-7-git-send-email-mkshah@codeaurora.org> <8d19958d-7334-ca4e-d7ba-f5919a56b279@codeaurora.org> In-Reply-To: <8d19958d-7334-ca4e-d7ba-f5919a56b279@codeaurora.org> From: Doug Anderson Date: Fri, 27 Mar 2020 11:42:03 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v14 6/6] soc: qcom: rpmh-rsc: Allow using free WAKE TCS for active request To: Maulik Shah Cc: Stephen Boyd , Evan Green , Bjorn Andersson , LKML , linux-arm-msm , Andy Gross , Matthias Kaehlcke , Rajendra Nayak , Lina Iyer , lsrao@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 Fri, Mar 27, 2020 at 5:04 AM Maulik Shah wrote: > > > Why can't rpmh_write() > > / rpmh_write_async() / rpmh_write_batch() just always unconditionally > > mark the cache dirty? Are there really lots of cases when those calls > > are made and they do nothing? > > At rpmh.c, it doesn't know that rpmh-rsc.c worked on borrowed TCS to finish the request. > > We should not blindly mark caches dirty everytime. In message ID "5a5274ac-41f4-b06d-ff49-c00cef67aa7f@codeaurora.org" which seems to be missing from the archives, you said: > yes we should trust callers not to send duplicate data ...you can see some reference to it in my reply: https://lore.kernel.org/r/CAD=FV=VPSahhK71k_D+nfL1=5QE5sKMQT=6zzyEF7+JWMcTxsg@mail.gmail.com/ If callers are trusted to never send duplicate data then ever call to rpmh_write() will make a change. ...and thus the cache should always be marked dirty, no? Also note that since rpmh_write() to "active" also counts as a write to "wake" even those will dirty the cache. Which case are you expecting a rpmh_write() call to not dirty the cache? > > ...interestingly after your patch I guess now I guess tcs_invalidate() > > no longer needs spinlocks since it's only ever called from PM code on > > the last CPU. ...if you agree, I can always do it in my cleanup > > series. See: > > > > https://lore.kernel.org/r/CAD=FV=Xp1o68HnC2-hMnffDDsi+jjgc9pNrdNuypjQZbS5K4nQ@mail.gmail.com > > > > -Doug > > There are other RSCs which use same driver, so lets keep spinlock. It is really hard to try to write keeping in mind these "other RSCs" for which there is no code upstream. IMO we should write the code keeping in mind what is supported upstream and then when those "other RSCs" get added we can evaluate their needs. Specifically when reasoning about rpmh.c and rpmh-rsc.c I can only look at the code that's there now and decide whether it is race free or there are races. Back when I was analyzing the proposal to do rpmh_flush() all the time (not from PM code) it felt like there were a bunch of races, especially in the zero-active-TCS case. Most of the races go away when you assume that rpmh_flush() is only ever called from the PM code when nobody could be in the middle of an active transfer. If we are ever planning to call rpmh_flush() from another place we need to re-look at all those races. -Doug