Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp2000455imn; Mon, 1 Aug 2022 07:41:21 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sM9mcmyGTcYUWIMn6UM3pYJqM0s/ZMAF3CrHoyEVh/mR8g1aAo/wdHehJjBCkArlS3A1L1 X-Received: by 2002:a05:6402:34c8:b0:43b:e7b1:353c with SMTP id w8-20020a05640234c800b0043be7b1353cmr16342728edc.171.1659364881030; Mon, 01 Aug 2022 07:41:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659364881; cv=none; d=google.com; s=arc-20160816; b=iX2z5h0d8WSMpGJ1Gwb0pcXN1FAmJAllymQaRE2BAPsaLkrh2dpWlp3fkgFLZAXpuB wDHxcQzBAmrlX/JCdAHCYgzmKfk51LYzPDUn1gghUTegrBxUyahHeHkn0r0RuOLwlg8B 6ntmzMKkJCpxja5pkR37/XzMKa+6cRlalp8AIPnp7Cj3CH/8AvgnppT2eAnebEcarlMV lXrymN9DJ6AhU4ui4p9oTJcTasqM313w0kbDezY62Z1DILUzIgciU/hPu6PDv2x/HHuS mdQ0HxEg3mYwBNVluYy1SMQesSxuABF5EiaF5UG8p7Pe8RNW7zDRyBBInbQAFcMwsl/v NzSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=Z1q6yWbe6ZKJFIdTiO5T8PBqxZ1ZPjO7H90GXR9+67U=; b=fkd4nwe1FsU7q659mpvA0T721VDCCSjlZka5+jVLztN/W1Ccoy2efMLwv0ooDVNmyA ylV3abecaiW6WMg71WxCssD2moy5wVPRRJkwM5eQTyzMe4UngD3qmlI3PMC3avcw6RT+ V5dzXkw1KTd3mRlBf1EsuNlmYNIYKMK0edOwsVl91Tn7jvacqfu+2Hu0xkycvx7P1qwk YLfNl+Gc06DJBPNM+2CGBd6qRNYIedFJ5qHB0gTNowQeWjXzpU38UDGMpbz88fXGBTpL yYnwSJzdo1mx3fj3ViQuOuf/CCKnAriSsr/y0wXiJnV0wJ613frUcU8tKhUaWQHadQdD 9/Sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=LRpWrRhe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oz37-20020a1709077da500b007306d4b5435si3848097ejc.522.2022.08.01.07.40.51; Mon, 01 Aug 2022 07:41:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=LRpWrRhe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232539AbiHAOgj (ORCPT + 99 others); Mon, 1 Aug 2022 10:36:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231459AbiHAOgh (ORCPT ); Mon, 1 Aug 2022 10:36:37 -0400 Received: from alexa-out-sd-02.qualcomm.com (alexa-out-sd-02.qualcomm.com [199.106.114.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 070D33206B; Mon, 1 Aug 2022 07:36:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1659364596; x=1690900596; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=Z1q6yWbe6ZKJFIdTiO5T8PBqxZ1ZPjO7H90GXR9+67U=; b=LRpWrRheL3eiemN78HAwiOQSpAY+kGDEzNPodqCdoNCoX1WgxVh6d7h4 nwgXCZrTfSTRZvbPX+bmxO3qcDOj2RtFbZM3KHLyna1980JVLyaIncbZa 9hlIJjgu0u7Qa81RFgweHnpNQMzCpK0LBqGnZHfVkSd5S9OY4SKp9JsLj g=; Received: from unknown (HELO ironmsg02-sd.qualcomm.com) ([10.53.140.142]) by alexa-out-sd-02.qualcomm.com with ESMTP; 01 Aug 2022 07:36:36 -0700 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg02-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Aug 2022 07:36:35 -0700 Received: from nalasex01a.na.qualcomm.com (10.47.209.196) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Mon, 1 Aug 2022 07:36:05 -0700 Received: from [10.216.14.65] (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Mon, 1 Aug 2022 07:35:58 -0700 Message-ID: Date: Mon, 1 Aug 2022 20:05:53 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.3.2 Subject: Re: [PATCH v3 2/8] drm/msm: Take single rpm refcount on behalf of all submits Content-Language: en-US To: Rob Clark CC: freedreno , , , "Bjorn Andersson" , Jordan Crouse , Jonathan Marek , "Douglas Anderson" , Matthias Kaehlcke , Abhinav Kumar , Daniel Vetter , David Airlie , Dmitry Baryshkov , Sean Paul , References: <1659174051-27816-1-git-send-email-quic_akhilpo@quicinc.com> <20220730150952.v3.2.Ifee853f6d8217a0fdacc459092bbc9e81a8a7ac7@changeid> From: Akhil P Oommen In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/1/2022 3:45 AM, Rob Clark wrote: > On Sun, Jul 31, 2022 at 9:33 AM Akhil P Oommen wrote: >> On 7/31/2022 9:26 PM, Rob Clark wrote: >>> On Sat, Jul 30, 2022 at 2:41 AM Akhil P Oommen wrote: >>>> Instead of separate refcount for each submit, take single rpm refcount >>>> on behalf of all the submits. This makes it easier to drop the rpm >>>> refcount during recovery in an upcoming patch. >>>> >>>> Signed-off-by: Akhil P Oommen >>>> --- >>>> >>>> (no changes since v1) >>> I see no earlier version of this patch? My bad, that is incorrect. This is a new patch included in the current series. -Akhil. >>> >>>> drivers/gpu/drm/msm/msm_gpu.c | 12 ++++++++---- >>>> 1 file changed, 8 insertions(+), 4 deletions(-) >>>> >>>> diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c >>>> index c8cd9bf..e1dd3cc 100644 >>>> --- a/drivers/gpu/drm/msm/msm_gpu.c >>>> +++ b/drivers/gpu/drm/msm/msm_gpu.c >>>> @@ -663,11 +663,12 @@ static void retire_submit(struct msm_gpu *gpu, struct msm_ringbuffer *ring, >>>> mutex_lock(&gpu->active_lock); >>>> gpu->active_submits--; >>>> WARN_ON(gpu->active_submits < 0); >>>> - if (!gpu->active_submits) >>>> + if (!gpu->active_submits) { >>>> msm_devfreq_idle(gpu); >>>> - mutex_unlock(&gpu->active_lock); >>>> + pm_runtime_put_autosuspend(&gpu->pdev->dev); >>>> + } >>>> >>>> - pm_runtime_put_autosuspend(&gpu->pdev->dev); >>>> + mutex_unlock(&gpu->active_lock); >>>> >>>> msm_gem_submit_put(submit); >>>> } >>>> @@ -756,14 +757,17 @@ void msm_gpu_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit) >>>> >>>> /* Update devfreq on transition from idle->active: */ >>>> mutex_lock(&gpu->active_lock); >>>> - if (!gpu->active_submits) >>>> + if (!gpu->active_submits) { >>>> + pm_runtime_get(&gpu->pdev->dev); >>>> msm_devfreq_active(gpu); >>>> + } >>>> gpu->active_submits++; >>>> mutex_unlock(&gpu->active_lock); >>>> >>>> gpu->funcs->submit(gpu, submit); >>>> gpu->cur_ctx_seqno = submit->queue->ctx->seqno; >>>> >>>> + pm_runtime_put(&gpu->pdev->dev); >>> this looks unbalanced? >> There is another pm_runtime_get_sync at the top of this function. Just >> before hw_init(). >> https://elixir.bootlin.com/linux/v5.19-rc8/source/drivers/gpu/drm/msm/msm_gpu.c#L737 > oh, right.. sorry, I was looking at my local stack of WIP patches > which went the opposite direction and moved the runpm into just > msm_job_run().. I'll drop that one > > BR, > -R > >> -Akhil. >>> BR, >>> -R >>> >>>> hangcheck_timer_reset(gpu); >>>> } >>>> >>>> -- >>>> 2.7.4 >>>>