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 6/8] drm/etnaviv: fix MMU context leak on GPU reset
Date: Fri, 20 Aug 2021 22:18:28 +0200	[thread overview]
Message-ID: <20210820201830.2005563-6-l.stach@pengutronix.de> (raw)
In-Reply-To: <20210820201830.2005563-1-l.stach@pengutronix.de>

After a reset the GPU is no longer using the MMU context and may be
restarted with a different context. While the mmu_state proeprly was
cleared, the context wasn't unreferenced, leading to a memory leak.

Cc: stable@vger.kernel.org # 5.4
Reported-by: Michael Walle <michael@walle.cc>
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 9c710924df6b..f420c4f14657 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
@@ -571,6 +571,8 @@ static int etnaviv_hw_reset(struct etnaviv_gpu *gpu)
 
 	gpu->fe_running = false;
 	gpu->exec_state = -1;
+	if (gpu->mmu_context)
+		etnaviv_iommu_context_put(gpu->mmu_context);
 	gpu->mmu_context = NULL;
 
 	return 0;
-- 
2.30.2


  parent 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 ` [PATCH 2/8] drm/etnaviv: put submit prev MMU context when it exists Lucas Stach
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 ` Lucas Stach [this message]
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-6-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.