Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp1641747imn; Sun, 31 Jul 2022 15:45:48 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tThZNAQCfV3HGr7DSuZNTyH53HnhSzg3/f+3u7+3yHxL3A2vAdI8NUypbg+gXEMC6zz58E X-Received: by 2002:aa7:c9cd:0:b0:43b:247d:bedc with SMTP id i13-20020aa7c9cd000000b0043b247dbedcmr13519061edt.291.1659307548264; Sun, 31 Jul 2022 15:45:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659307548; cv=none; d=google.com; s=arc-20160816; b=Pv+BKLJ9ebyg9DGT2amB6FVdhrmky9EUQlxiQNPmVGiXgn1TM5ReI4qeLjq91CkPQq BK4kO4cpjflW4L11vjZuaCrFvMUGuvHOCt3GPeexiGjKlZl/KV1uCrLC9sIudaE3Tdq9 /Aw+sQkHo1xAvFmBYjg4OyrvGz+ry2E2tLfwviIOlFYPic41v7qRwaq7rLBKCfUeI8TO x7ZwdQOZQ/HSWE7QNvldgI3yuDbRj1qTh/Ou3pfC7hPMQqcnQ2TJ6tlbjbWXMpr44U72 9KzHYHt7VNEnAMPjZOrW+CTiyTghN0WQvZp1qcS5JqeqoLiS38iTh3bD3iMek6fQb2w+ q9Gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=JhTc/o85aa/gNSXM1E2WlhOm4hoCmf8aYbOpvTqzACg=; b=WRie/OLu35bsz6ycw5hZyissIvpWnv5N/Y505303lqagbmetpiL6fzCL8YPwvH8j6V fkYs8n0xp3O+Xh8ZdK12TxMh9ddGN71uxwNmwHDqu0vfPhhvWuPLoPEfYKCnzNKD6r9g NPI8/szqGkGQ51UNPY4+jnbWBKol0rq/u7PAb/bcBH5sbsGpJj5c23nhBFek4piSJrsb TxVNpwbd2rf18CSrQm++CGmNk3Od+7jiVMitptJY8QkWIcXU6FcqCMnzIPMSjiSJD/vn DrEBqJrmk7PC7vc02JXYtlAy3ASdr76pKGhN48jM8TtU5Tr2p49Sr9TdGDYa7TQgl3fu 4WKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=IYcyUZyl; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qk12-20020a1709077f8c00b0072b95dee668si1471058ejc.489.2022.07.31.15.45.22; Sun, 31 Jul 2022 15:45:48 -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=@gmail.com header.s=20210112 header.b=IYcyUZyl; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238443AbiGaWP3 (ORCPT + 99 others); Sun, 31 Jul 2022 18:15:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229710AbiGaWP1 (ORCPT ); Sun, 31 Jul 2022 18:15:27 -0400 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE628B2C; Sun, 31 Jul 2022 15:15:26 -0700 (PDT) Received: by mail-lf1-x12d.google.com with SMTP id bq11so9574523lfb.5; Sun, 31 Jul 2022 15:15:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=JhTc/o85aa/gNSXM1E2WlhOm4hoCmf8aYbOpvTqzACg=; b=IYcyUZylduzwRAWXYDunqrHsrpEt1tyMI6KfAyQj2u1aW7Jxfnw074RjZ9Qmkgdm3N 9RNJImzPJX4mezXXmy7NYqTkxLev4LQGq4gwOpL4LxjbKTvL5xpwFXGuW3nmAKTZdN96 7hXJ/isn1PiMCoP00zX+uiqg3sqESxr8CHhcLE/0yN/Cr0RkaK1uN5eQoX/J3pVkJs69 uMDj87BXk35CXEZ1qI1eb/G9Go4iJ61eNwBj1HEG//jZtfG9sCko1UejSMQ1BbQ1kXv/ 3IBnG8u4PEJxwWklKhY4vEBZ8xRjuWwTC6QTwYH6/82yuqkV1rK83iA8RXDn186T1/cX lOTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=JhTc/o85aa/gNSXM1E2WlhOm4hoCmf8aYbOpvTqzACg=; b=LDqq9bLuGJiWgsVHz/sYnLA+QCTickheA9adZ0Jhay+ILbrGWgKMFYYJMa6cpoF0VY hZzMPY9aulbylADa2R7uX1oftQgoZVKebN39di9OTOLcMEqRffeVWdlAtqkJzTUdU4vO wK0QmpuG7c/EYpTNEAxl+jO3dfnnIp4ptpBvLWfH4cEV9+34RpUPjifN89e5TU5n689M Hups69LOBZ2LTapX4GhcwYk1Mi24u3A7KK5ArHr/ZsfuCstC6mNEDJirfcKxxHRY0QP2 ahGldPSXxLynhwbC6yY2LhQVRTCFIwpy7E4K7zPk7IfDdsEhP6xM5uKQVfNjj+97jSnm 5ceA== X-Gm-Message-State: AJIora8pBwL2CRzSHh2S8iXVwWWi+Wkx+AI2RbmsxEnVVOlOzdRETAL2 M5gl9sbc0hhuztW/MMYnX3ESJc1ocze4HpaqlJlPVcn1 X-Received: by 2002:a05:6512:1307:b0:47f:baa4:52c5 with SMTP id x7-20020a056512130700b0047fbaa452c5mr4437991lfu.103.1659305724920; Sun, 31 Jul 2022 15:15:24 -0700 (PDT) MIME-Version: 1.0 References: <1659174051-27816-1-git-send-email-quic_akhilpo@quicinc.com> <20220730150952.v3.2.Ifee853f6d8217a0fdacc459092bbc9e81a8a7ac7@changeid> In-Reply-To: From: Rob Clark Date: Sun, 31 Jul 2022 15:15:49 -0700 Message-ID: Subject: Re: [PATCH v3 2/8] drm/msm: Take single rpm refcount on behalf of all submits To: Akhil P Oommen Cc: freedreno , dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, Bjorn Andersson , Jordan Crouse , Jonathan Marek , Douglas Anderson , Matthias Kaehlcke , Abhinav Kumar , Daniel Vetter , David Airlie , Dmitry Baryshkov , Sean Paul , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 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? > > > >> 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 > >> >