From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bali.collaboradmins.com (bali.collaboradmins.com [148.251.105.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7B696456E08 for ; Tue, 4 Aug 2026 10:10:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.251.105.195 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785838209; cv=none; b=ZiLzLq3CD6Bs7lmncXEAgBx96/NRfCoryY52JtqFAw+1jcCxTBTZ1OVTCg5ClbwPcxsx9/rL2/SvqlHItuIAJn7v62v2P3khlJkQaUjMzje3eMsQwqXRTwDpeeQlU4zeAXE7CwmAlh11NKh2TCUEo5VWqw6nOxc0qQiHyVK+cOw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785838209; c=relaxed/simple; bh=RvHXpuZkvPZY2gpIgfn5uNsN8J9DCecmCGZwPoCSsFg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=NaHdPvwBq1eQhbVApSqqSf+4zgRgKiUKOqdHkKS1l8kEgoPOgQI9J0MhDtxiHjeokajr3VHv93+9danVw7LR7abt8LWQOJZXgBrv7bTzUJWbb56auiNMD0EzY1R73xc1s8M5pGi9+sGhUHNz35emt4zzqbIBVI+2iBthNwNbuRw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=oCF/cfJc; arc=none smtp.client-ip=148.251.105.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="oCF/cfJc" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1785838199; bh=RvHXpuZkvPZY2gpIgfn5uNsN8J9DCecmCGZwPoCSsFg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=oCF/cfJcl6vyl5mZwhKaGnggWneqWt09JhjKBSUw68wsqE8j5BS5mEGsH48EnnWZ5 MmJSwRBivQVcuhryffDsT4EPVc2mXx8JbAQlOspflfUej4zfJsCv+NCG3GCeH4adrQ 6o6Zj+KwhaesCavnD0c9UiCeLWgtTRqh1s/Wsuq+uC4TfoTHXAyo4BTzP+8Av3AFQb ddzrXHdWxgOFIqABmK9Fdc9A2/v05Qn4MHAmM7ktn2Cbz7nrSHNGvGfzM6oaocs7m3 HhiOh8MszHODgb6+APsqDaoYBRw5gM5AsCix0eZ4g9sT7xO6gHW7PibNqoMW4MU8ew D6VlMARkaj6CQ== Received: from fedora-21.home (unknown [100.64.0.11]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: bbrezillon) by bali.collaboradmins.com (Postfix) with ESMTPSA id 27B0A17E10F1; Tue, 04 Aug 2026 12:09:59 +0200 (CEST) From: Boris Brezillon Date: Tue, 04 Aug 2026 12:09:48 +0200 Subject: [PATCH 09/12] drm/panthor: Don't pre-allocate VMAs or page tables when preparing a full VM unmap Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260804-panthor-unplug-fixes-v1-9-abbbd2d41b13@collabora.com> References: <20260804-panthor-unplug-fixes-v1-0-abbbd2d41b13@collabora.com> In-Reply-To: <20260804-panthor-unplug-fixes-v1-0-abbbd2d41b13@collabora.com> To: Steven Price , Liviu Dudau Cc: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Boris Brezillon X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1785838194; l=1151; i=boris.brezillon@collabora.com; s=20260429; h=from:subject:message-id; bh=RvHXpuZkvPZY2gpIgfn5uNsN8J9DCecmCGZwPoCSsFg=; b=QM8EMCXOVN/5GrmH1bGT4TXjDpDLBezEXKm4I/KyGMshzbRnrAFScnTSfL0nS4sQZ2m+BHDpa fbahScv2wmRDSHhOc6q1Bl3/BkWtl7lHghyL+fbqJOPKfx/V46bjFB3 X-Developer-Key: i=boris.brezillon@collabora.com; a=ed25519; pk=eN+ORdOgQY7d5U+0kA8h5bf67XdD8bhKbjD/TCHexSY= In the cleanup path, we unmap the full VA range to make sure things are clean before the VM is released. I'd rather not fail on memory allocation in that path, so let's make sure panthor_vm_pgtable_prepare_unmap_op_ctx() doesn't allocate VMAs or page tables when the unmap range matches the VM virtual address range. Signed-off-by: Boris Brezillon --- drivers/gpu/drm/panthor/panthor_mmu.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/panthor/panthor_mmu.c b/drivers/gpu/drm/panthor/panthor_mmu.c index 1264c3ffa832..2ad8b15de0da 100644 --- a/drivers/gpu/drm/panthor/panthor_mmu.c +++ b/drivers/gpu/drm/panthor/panthor_mmu.c @@ -1484,6 +1484,10 @@ static int panthor_as_prepare_unmap_op_ctx(struct panthor_as_op_ctx *op_ctx, op_ctx->va.addr = va; op_ctx->flags = DRM_PANTHOR_VM_BIND_OP_TYPE_UNMAP; + /* Unmap on the whole VM range don't need new VMAs or page tables. */ + if (va == as->base.mm_start && size == as->base.mm_range) + return 0; + /* Pre-allocate L3 page tables to account for the split-2M-block * situation on unmap. */ -- 2.55.0