Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2353492pxb; Mon, 20 Sep 2021 19:51:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzDZYgE0kzTbQiSUPe5PTQRDKjPTAVFq9BJCqSn0dPtL5/oajhJMBIQ3AjPMvNc2FiPGO/W X-Received: by 2002:a92:cb49:: with SMTP id f9mr19986209ilq.119.1632192710972; Mon, 20 Sep 2021 19:51:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632192710; cv=none; d=google.com; s=arc-20160816; b=i4+obzGLvTfV8jRCtwpnZN/yjKqSOLjACXl+4P8U99r0AzpH/2YPaMgcmFKKb0LIPz l4xNKLdD8Ifcfht6vjQlVplcgbUJLHmawCe4k6cOjC9yKFzFXO9wqIZYHv5+SG/QoY/X KjBcO44nkiW32V3d5yvBKC8DAUfjZkOUMdDV19YUwVrLOyOokO354HcJ5cvkJ4QzvAnl k4oppVjomcH7VkHQyIPxVD/19rdCozaT2kMmbgKE7WmghN7qiRjEHbeas2WOboGmHQ5e 0q0Zccti3yNScQ8tutv/p5Lm3Z7m7MBN5kTJuQPtaUf8lKNKD8C1IW3KRS5GRmNtuEr2 V++A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=LNIHrp7FX/JzPvLGkfDs9Id8YTl+aioDSakhdf0DV5Y=; b=gXPSu3wiGUZxrdp5eHjHk0cg5C/4w6tJlCZ9ZWCbQ0ZHY72vfvZn3tIX5cVQFogejB a1y/rDww0w9pXNfjwyFPF2FRsyaRJcunhJ72Ir0VfeOhTM2zoKyGvoA5wL30dyf04FXP QfbcxFvCAZEZTqRcrc+tm2PpJ/7i4o5yhzuJ5bxVnKVtm85xcNrt+6d8f4r1Vh1n2Als eeybpvPR4IASunCIgMVUkxDBaHc0rUis4yiMBf2PJcykLNOrywNVlOkVGh/bpk2K1bVI 0A1+b7Hi3DLgUk87y+rdXd7MHznHdbaaFrmX4FQ3i4nmRjesxbKeMvc4+u3mDqiqDq6f RX0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=J5VeojLj; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g17si13422423ilr.112.2021.09.20.19.51.38; Mon, 20 Sep 2021 19:51:50 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=J5VeojLj; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353891AbhITSpT (ORCPT + 99 others); Mon, 20 Sep 2021 14:45:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:56476 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382499AbhITSka (ORCPT ); Mon, 20 Sep 2021 14:40:30 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id DA7E76147F; Mon, 20 Sep 2021 17:31:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632159081; bh=0riqdmja0mAB96sZTmyNskyimcXEmYFrkIokWKWV/qo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J5VeojLj2zlXwzVwM1h4L/C5lh2xIM5JmOrwaJO4yEWNbRq6dso07VAAn3hUlBL2U Z/5RSD7Uu0su/Pkyhi0Ve+QWBYU9cRjNt7S/bX8oU1V9dP78vEFqc8RatYB1wj6JE1 6FD3o1lUvRxhwBBwPqX6Esmp/niRiBnZpRHGlWVw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lucas Stach , Michael Walle , Marek Vasut , Christian Gmeiner Subject: [PATCH 5.14 025/168] drm/etnaviv: put submit prev MMU context when it exists Date: Mon, 20 Sep 2021 18:42:43 +0200 Message-Id: <20210920163922.474363483@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163921.633181900@linuxfoundation.org> References: <20210920163921.633181900@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lucas Stach commit cda7532916f7bc860b36a1806cb8352e6f63dacb upstream. The prev context is the MMU context at the time of the job queueing in hardware. As a job might be queued multiple times due to recovery after a GPU hang, we need to make sure to put the stale prev MMU context from a prior queuing, to avoid the reference and thus the MMU context leaking. Cc: stable@vger.kernel.org # 5.4 Signed-off-by: Lucas Stach Tested-by: Michael Walle Tested-by: Marek Vasut Reviewed-by: Christian Gmeiner Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c @@ -1368,6 +1368,8 @@ struct dma_fence *etnaviv_gpu_submit(str gpu->mmu_context = etnaviv_iommu_context_get(submit->mmu_context); etnaviv_gpu_start_fe_idleloop(gpu); } else { + if (submit->prev_mmu_context) + etnaviv_iommu_context_put(submit->prev_mmu_context); submit->prev_mmu_context = etnaviv_iommu_context_get(gpu->mmu_context); }