Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp1222226ybh; Tue, 10 Mar 2020 17:36:57 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtiiLyL4bCHAQTgGheEAXIcFVd0tg4BVYl/Nn8cxyAOV9/ez0ScPrvPiFyKdkXihm0V8zf3 X-Received: by 2002:a9d:7a59:: with SMTP id z25mr325046otm.315.1583887017353; Tue, 10 Mar 2020 17:36:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583887017; cv=none; d=google.com; s=arc-20160816; b=Z3zKWAcOcktkLaFQ6Gc3N3SAQKXu2Xqpk/F6LGRJimAaLClUSSk+TgKegSXY39GlG2 OJ4obgwNpz5fO68/nilRkT/G6OoeqkkqAdajo+cMnQ4QB5fiHXVYRgx42ygYWfeRISSj uZ64C+5zNgi9gyVlqsJ+T+THT0xHT+q6INuTgtW8dDuSTrO0EA5sahdc3xocpkxvZnxh ivKzgdMR1OT6SBTfGX9t+ftw9/43U8SIUdl6fR5a1s+WdecoTviydb5vnuoiTdLTmA+R gsP5fgKCEmakBGpYuJ0s1/cK+4Ap4t83b/mEOCE6fmhW94RiRjZG5SVIEjEFQRHmHUIe 0mwQ== 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=NxH5+n+OF84tRnMGKQoWLmnpALEgESPXC5UHvwTMSf8=; b=bacIPXAHp78pomMNrqtyT0JIVpAIdBwnmZsUYBgMAWAZpebWUKn5KD5yvO27nqKq3q 3bm7sFMLKLA71B8YWVlQgpRApZ8TOh0degx1iPZAQiIiqOp2ICN3eRN5FBYYGkKu+WMi u0ysvHiJbLjezZAVOIF1lqiGJ7idWa2rtdA9HUr73NO9cW179uqzuMq3uzVUALmYsSCk IX+AkwSCS70rLyycWAZjpYaGBQaiTAANzs/hQh1HaY7C5BD/6m7k8Mfx/rg9COwndWsx EtSzmLYHE4xCyIFH+pN71HG/l8VaYb6Kp3FLJiH84I6r6P3KJsA9hDYUEhslv19Wyiz3 P1rQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ETcU1G0+; 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 u12si245856oiv.13.2020.03.10.17.36.19; Tue, 10 Mar 2020 17:36:57 -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=ETcU1G0+; 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 S1727733AbgCKAdj (ORCPT + 99 others); Tue, 10 Mar 2020 20:33:39 -0400 Received: from mail-vk1-f196.google.com ([209.85.221.196]:36623 "EHLO mail-vk1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727648AbgCKAdj (ORCPT ); Tue, 10 Mar 2020 20:33:39 -0400 Received: by mail-vk1-f196.google.com with SMTP id a1so56544vkg.3 for ; Tue, 10 Mar 2020 17:33:38 -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=NxH5+n+OF84tRnMGKQoWLmnpALEgESPXC5UHvwTMSf8=; b=ETcU1G0+wCTWkKAAgJm34FOejXTx3bxmVvyioKYfTBLbHe7z4LICWw4054fhrE9/DC E2iS4LcBtQ7H/yswrnKl0PHhGCyyk5ThESoxcS/n30wBXy1sNgpIcC3GyEs9F5EM5va/ 9Zq3pUsAm7QSeJBR23FX2QvDu7IyeLajYzs6s= 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=NxH5+n+OF84tRnMGKQoWLmnpALEgESPXC5UHvwTMSf8=; b=AV+7GadumSbM4N5X1pb2vTBhyPwRDEg8WhmkkaBmzJuwsBfQeRCCYl7Tsp3kg9JOT+ DOiSQB7TvTBK0Jum29rq3VCZF9DkkpcQVpPknJThMFV7vcUi4ItqhS5mnUmYavLjv0sf EUpLGYhGPigDuCNJ7ecuWJnrwYJNiotu3CwlgMbkUeNS05w5+fruKf2c7mnI19vDCYqJ lGuyI0NZBq9dIYghCM+hN28mQFtnX5LK33LA+hfzfSAOkfov6ySpGV6CtHtRy3VwIiRX DYLFIdk4s/Gw/Q0U6Wi1nNxTpqCH3+rDqxOaRAfo9F5Q/PKLc63wei7VFAnZ5gl8Up26 PYCg== X-Gm-Message-State: ANhLgQ03VMhlUh153ZxPFlp9aVAH33/cMsfegRGRIOKd1VwzsaQJvDj3 lbDdbSeYvK2GiGKWBlT9pPyz0RFj+wo= X-Received: by 2002:a1f:2d4f:: with SMTP id t76mr541910vkt.58.1583886817449; Tue, 10 Mar 2020 17:33:37 -0700 (PDT) Received: from mail-vs1-f44.google.com (mail-vs1-f44.google.com. [209.85.217.44]) by smtp.gmail.com with ESMTPSA id v4sm857132vkg.17.2020.03.10.17.33.36 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 10 Mar 2020 17:33:36 -0700 (PDT) Received: by mail-vs1-f44.google.com with SMTP id a19so220567vsp.6 for ; Tue, 10 Mar 2020 17:33:36 -0700 (PDT) X-Received: by 2002:a67:e98e:: with SMTP id b14mr474974vso.106.1583886815626; Tue, 10 Mar 2020 17:33:35 -0700 (PDT) MIME-Version: 1.0 References: <20200306235951.214678-1-dianders@chromium.org> <20200306155707.RFT.6.Icf2213131ea652087f100129359052c83601f8b0@changeid> In-Reply-To: <20200306155707.RFT.6.Icf2213131ea652087f100129359052c83601f8b0@changeid> From: Doug Anderson Date: Tue, 10 Mar 2020 17:33:24 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFT PATCH 6/9] drivers: qcom: rpmh-rsc: Only use "tcs_in_use" for ACTIVE_ONLY To: Andy Gross , Bjorn Andersson , Maulik Shah Cc: Rajendra Nayak , Matthias Kaehlcke , Evan Green , Stephen Boyd , Lina Iyer , linux-arm-msm , LKML 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 6, 2020 at 4:00 PM Douglas Anderson wrote: > > From trawling through the code (see the "A lot of comments" change) I > found that "tcs_in_use" was only kept up-to-date for ACTIVE_ONLY TCSs. > ...yet tcs_is_free() was checking the variable called from > tcs_invalidate() and tcs_invalidate() is only used for non-ACTIVE_ONLY > TCSs. > > Let's change tcs_invalidate() to just check the "RSC_DRV_STATUS" > register, which was presumably the important part. > > It also feels like for ACTIVE_ONLY TCSs that it probably wasn't > important to check the "RSC_DRV_STATUS". We'll keep doing it just in > case but we'll add a warning if it ever actually mattered. > > Signed-off-by: Douglas Anderson > --- > > drivers/soc/qcom/rpmh-rsc.c | 23 +++++++++++++++++++---- > 1 file changed, 19 insertions(+), 4 deletions(-) After other RPMH email threads, it's possible that this patch isn't quite right. ...but also the code wasn't quite right before. Specifically if we have 0 active TCSs then it's possible that we've used a wake TCS to send an active-only request. That would be a case where "tcs_in_use" might be set and we'd need to make sure that tcs_invalidate() checks it. However: 1. We need to add locking to tcs_invalidate() since "tcs_in_use" is protected by drv->lock and tcs_invalidate() didn't grab that lock. 2. We should add documentation explaining the situation. I'm still waiting on overall review / testing of my series, but I'll put it on my list to address this for v2. -Doug