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 AF56743BDD6 for ; Tue, 11 Aug 2026 10:18:13 +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=1786443512; cv=none; b=EnhTXhE2ep/uBc8PcnZ9pTi/K4tDWTEYGgpNeJ/zmAe4rELZG90Aloil4yll3LVWZi9XxfluuFvAyVrdvL7Ogurfy3RUjw6Ojs8qoJEODFEKGksL7U3PCAatT4RzzhoFLA51w/1iwx5pmeG5/Y7e9/ScpFitjln5P2VkNNQahHU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786443512; c=relaxed/simple; bh=eIGFqWwRdHzc0YJCpTSG0l4q+0hV+wtL1nhMwVIM0fw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ahl/gcq1/DZi5xHSkzl+1CNGmzct2aQa4Vz1UtDBQybslS8jkOEcgYTCszyzT1ltqR807fIiZU9U0v9MbL8fkonpW7uGo2PHJ62cQ5UCa5WtQ8vOyb05jkGfTfzA+nT5N+5HVspRIbS/9V43y/O3CPfe39ieQP7bw3ERuYgh3qs= 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=WYMbkO4j; 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="WYMbkO4j" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1786443473; bh=eIGFqWwRdHzc0YJCpTSG0l4q+0hV+wtL1nhMwVIM0fw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=WYMbkO4j8wNvXblqz9TsTRTHpgPsqiMuMH74og3prNM60jAQ5Auf1IXADuyEXTqhk S0bbVd2gtr/7ZtQq5456K+LRs0m+/tYiEPxBZHGNu/ILfdm9nu/xR/yyF9XIB76sgH jTK2rNRtEDK0XVNQTJyRPisS4pb6IGoPRXrGpLfNgyKQBED/3DoYgSdc+1bLn5Or12 5doU/LsAZbGMN6HagF+lxNVoydyk0POO0mVUqWK9289+NVfTd8GlurisYefkc9M1OT j7Ra63Fzy+RIY64RDwc/NkPpsmvoHmzZ6F+NmwV/A/52i42MKb6OlCx8ZhdTH8Q6ye zSkqQQpEA6YOQ== 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 086C817E10BE; Tue, 11 Aug 2026 12:17:53 +0200 (CEST) From: Boris Brezillon Date: Tue, 11 Aug 2026 12:17:45 +0200 Subject: [PATCH v2 11/17] 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: <20260811-panthor-unplug-fixes-v2-11-6b583e37f9ae@collabora.com> References: <20260811-panthor-unplug-fixes-v2-0-6b583e37f9ae@collabora.com> In-Reply-To: <20260811-panthor-unplug-fixes-v2-0-6b583e37f9ae@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=1786443466; l=1151; i=boris.brezillon@collabora.com; s=20260429; h=from:subject:message-id; bh=eIGFqWwRdHzc0YJCpTSG0l4q+0hV+wtL1nhMwVIM0fw=; b=z1SA76QrLdUgnR1+zNEf53fehokyNlqidR3JmCeOxIhO9FT9Hyxw8/STWywYQOUT++5VYBQ6Q LeI6D8V6YFLC6YyfibkyWxlS4SbFIJmxFuhPf28uBg9hfCPzPaCzbRt 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 a48466788f4d..acdc0dd04f8b 100644 --- a/drivers/gpu/drm/panthor/panthor_mmu.c +++ b/drivers/gpu/drm/panthor/panthor_mmu.c @@ -1466,6 +1466,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