All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lucas Stach <l.stach@pengutronix.de>
To: etnaviv@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org,
	Russell King <linux+etnaviv@armlinux.org.uk>,
	Christian Gmeiner <christian.gmeiner@gmail.com>,
	kernel@pengutronix.de, patchwork-lst@pengutronix.de
Subject: [PATCH 2/8] drm/etnaviv: put submit prev MMU context when it exists
Date: Fri, 20 Aug 2021 22:18:24 +0200	[thread overview]
Message-ID: <20210820201830.2005563-2-l.stach@pengutronix.de> (raw)
In-Reply-To: <20210820201830.2005563-1-l.stach@pengutronix.de>

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 <l.stach@pengutronix.de>
Tested-by: Michael Walle <michael@walle.cc>
---
 drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
index c8b9b0cc4442..c1b9c5cbed11 100644
--- 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(struct etnaviv_gem_submit *submit)
 		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);
 	}
 
-- 
2.30.2


  reply	other threads:[~2021-08-20 20:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-20 20:18 [PATCH 1/8] drm/etnaviv: return context from etnaviv_iommu_context_get Lucas Stach
2021-08-20 20:18 ` Lucas Stach [this message]
2021-08-20 20:18 ` [PATCH 3/8] drm/etnaviv: stop abusing mmu_context as FE running marker Lucas Stach
2021-08-20 20:18 ` [PATCH 4/8] drm/etnaviv: keep MMU context across runtime suspend/resume Lucas Stach
2021-08-20 20:18 ` [PATCH 5/8] drm/etnaviv: exec and MMU state is lost when resetting the GPU Lucas Stach
2021-08-20 20:18 ` [PATCH 6/8] drm/etnaviv: fix MMU context leak on GPU reset Lucas Stach
2021-08-20 20:18 ` [PATCH 7/8] drm/etnaviv: reference MMU context when setting up hardware state Lucas Stach
2021-08-24  7:24   ` Christian Gmeiner
2021-08-24  7:54     ` Lucas Stach
2021-08-24  8:51       ` Christian Gmeiner
2021-08-20 20:18 ` [PATCH 8/8] drm/etnaviv: add missing MMU context put when reaping MMU mapping Lucas Stach
2021-08-26 12:00   ` Christian Gmeiner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210820201830.2005563-2-l.stach@pengutronix.de \
    --to=l.stach@pengutronix.de \
    --cc=christian.gmeiner@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=etnaviv@lists.freedesktop.org \
    --cc=kernel@pengutronix.de \
    --cc=linux+etnaviv@armlinux.org.uk \
    --cc=patchwork-lst@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.