Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4592300pxj; Wed, 12 May 2021 08:51:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+1NHRgh/ElrUUEQjy30cH1hPyYEry68CL5KEwFjzcHzG/Uzg1gEbZ0r9feFBQCRPnjSdI X-Received: by 2002:a17:906:e105:: with SMTP id gj5mr39678342ejb.388.1620834686069; Wed, 12 May 2021 08:51:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620834686; cv=none; d=google.com; s=arc-20160816; b=TckHF87d7CeeWrlcmIMXaauoyAI3u+5Y3OM0sdVgx6Z/L0TbEgleRx7+4PtPZ1DiJo QWbcSt78sWfQtgjC9HGCGkAUa/5QEke8aXrNJi4AzWByWcwN6RMEUd/YGsyfJ6jejfXx tCdV80ytzvjIIQDQc0ra3+3yXV0V7x54tt0uv77ahR2qPqzg3IvEFoZqxrJ4DspJBHlc LjDIl8vW2K5dyjLKsH+LMelC67ngxyPFA3FzCd/VEwQpUVL552XuIY8ZhXJk/ZrkqsJ2 lRG212NcO1dOKcoXquK9qzRyavhwcJKSrepXLy2ZXhsRg+NGKX3D251r4x328Y+56lF6 YPtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=NUNnPPr0m9tCkeDfGAtzdW9in6386jUjouQBVNeFK7I=; b=kuI+l+6jZEmEN3Q7kencPHsueCVIVXXLSq8L+bqca4ToVL7YpxoR3G0ywpLjNpI9bS TE3/HNJqpxYL2mbn5psM5LSGxnDkZOqhamYtVehkuxw9CRMEFpNuyLmS+t2fzwr3rq08 4R8dLZlJsR8MQWhRXIDWzCmkqE0lrBg2B04UfArw9VStmaLFl3pIzeLaCQRiFlCUB2/i w38SYK1N+17NxEikzFXTMN+hHzH/RNku9WA9BScLG90PDWiZ5TdUNMfIXmdhxDSjxn5c g6lFPSD1JNc9iqHZcHYcxevsl2LYqwRMxDJ195Tr6UIx2Nb1bcwIBUqVmmiq26YOwaoH RBEA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id kq6si348462ejb.103.2021.05.12.08.51.01; Wed, 12 May 2021 08:51:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237520AbhELPut (ORCPT + 99 others); Wed, 12 May 2021 11:50:49 -0400 Received: from foss.arm.com ([217.140.110.172]:42120 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234385AbhELPZB (ORCPT ); Wed, 12 May 2021 11:25:01 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2D06931B; Wed, 12 May 2021 08:23:51 -0700 (PDT) Received: from [192.168.1.179] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 051603F718; Wed, 12 May 2021 08:23:49 -0700 (PDT) Subject: Re: [PATCH -next] drm/panfrost: Fix PM reference leak in panfrost_job_hw_submit() To: Zou Wei , robh@kernel.org, tomeu.vizoso@collabora.com, airlied@linux.ie, daniel@ffwll.ch, alyssa.rosenzweig@collabora.com Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org References: <1620714551-106976-1-git-send-email-zou_wei@huawei.com> From: Steven Price Message-ID: <7ebf35ef-58c3-7bc7-f0e9-ad487bae6686@arm.com> Date: Wed, 12 May 2021 16:23:48 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <1620714551-106976-1-git-send-email-zou_wei@huawei.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/05/2021 07:29, Zou Wei wrote: > pm_runtime_get_sync will increment pm usage counter even it failed. > Forgetting to putting operation will result in reference leak here. > Fix it by replacing it with pm_runtime_resume_and_get to keep usage > counter balanced. > > Reported-by: Hulk Robot > Signed-off-by: Zou Wei Thanks for the patch, but this is actually incorrect. panfrost_job_hw_submit() is expected to unconditionally increment the pm usage counter. This is because panfrost_job_hw_submit() can (currently) never fail, so in this case the job is considered "submitted" (even though it never reaches the hardware) and it's handled by the job timeout. However this is at least the second time[1] this phantom "reference leak" has been raised, so perhaps it's time to handle this better. I'll post a patch reworking panfrost_job_hw_submit() so it can fail. Thanks, Steve [1] https://lore.kernel.org/r/20200520110504.24388-1-dinghao.liu%40zju.edu.cn > --- > drivers/gpu/drm/panfrost/panfrost_job.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/panfrost/panfrost_job.c b/drivers/gpu/drm/panfrost/panfrost_job.c > index 6003cfe..42d8dbc 100644 > --- a/drivers/gpu/drm/panfrost/panfrost_job.c > +++ b/drivers/gpu/drm/panfrost/panfrost_job.c > @@ -157,7 +157,7 @@ static void panfrost_job_hw_submit(struct panfrost_job *job, int js) > > panfrost_devfreq_record_busy(&pfdev->pfdevfreq); > > - ret = pm_runtime_get_sync(pfdev->dev); > + ret = pm_runtime_resume_and_get(pfdev->dev); > if (ret < 0) > return; > >