From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) (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 8C4403C3441 for ; Fri, 3 Apr 2026 17:22:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.112 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775236969; cv=pass; b=fZ3nvHZJpAw+jiHZOwUq4RT7A+YaBWGMPVLl9rm3vbpEEHcFeNStz8aGfOvxRtpOYM8gEhJUiLy3BmoD0HyBTp1yMi2XfWBlpjTXLIOkhCm7ILYSOY/QcWAaSHkkkUYLYEFLF2VZi63ikbPZfCMhD2E52KVewJi6P5ccbF8M/ks= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775236969; c=relaxed/simple; bh=Ikyz6vliHBfoSApfLArGzjxZhkqXl3dw8qQh5m5FT6U=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=dbH26ZqZ4Ayt7uUSz517L5n0R8K9NNK8lNPytanZNzXAiXfLufKFGg60+SD46yjbv2YFynp/73du32EEfdZCVy53fuB9WzwSvMl6U3s729FE0vkIjXaIZJJgEeexy3VOmru/tuui75fdY2fNSjeu1mZsFuS1PBgm8MiFeBjcB6o= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (1024-bit key) header.d=collabora.com header.i=adrian.larumbe@collabora.com header.b=MuzZ0ng1; arc=pass smtp.client-ip=136.143.188.112 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 (1024-bit key) header.d=collabora.com header.i=adrian.larumbe@collabora.com header.b="MuzZ0ng1" ARC-Seal: i=1; a=rsa-sha256; t=1775236952; cv=none; d=zohomail.com; s=zohoarc; b=Ux1MSI7RO7z6+MayDfZvQZ1+dODRAiXFP7GDbx/bSEV2HfZy/jy5BR9JRxeIsNhM0JcX3PObC21cVLRkSEPltuIck2R8j3iBeLW5/vbBTQFr5xSRpIYFjtGvwrlsD0ccPkMStYsAdM2238i0njp60BkJmRpG1GX9mRpdmOeh4es= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1775236952; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=vRUsC1H5z3NiCu+ghOqmz9h78BmqCxGb07TwGXEbdFE=; b=gyQ2JctFRcIWRj1QyzveOcBJRI8SKfetUTxTMo6lepc4mjGaN1wsw3ZtFnX5kpfX0NM3Uz3FqviY+OrBrtd5WyC9mDuJWkZ5KWslTWd7uSwWvOK/S1EY4klzbyMRGyUh50DmgSIK1UlgIA9IkWHlURvcj9G9RubxWQ0XS9LEffM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=adrian.larumbe@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1775236952; s=zohomail; d=collabora.com; i=adrian.larumbe@collabora.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To; bh=vRUsC1H5z3NiCu+ghOqmz9h78BmqCxGb07TwGXEbdFE=; b=MuzZ0ng1wGK7/fIYKq0r3p3v4gs8t8ZA58wB1Pozz/adTZg36fuz7gQa2wM0o3bY aiyLM6zrWVMSs5hw9paBEIGastd1bh417Qap5kpTt5kQwOBMLVdfWKknWg+ScHD3h/L AP7LGtIkxjp0mOkmUKmzkLbDVKT/glPLKduyqXLA= Received: by mx.zohomail.com with SMTPS id 1775236950108268.1638942039027; Fri, 3 Apr 2026 10:22:30 -0700 (PDT) From: =?UTF-8?q?Adri=C3=A1n=20Larumbe?= To: linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, Steven Price , Boris Brezillon , kernel@collabora.com, =?UTF-8?q?Adri=C3=A1n=20Larumbe?= , Liviu Dudau , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter Subject: [PATCH 1/2] drm/panthor: Extend VM locked region for remap case to be a superset Date: Fri, 3 Apr 2026 18:21:11 +0100 Message-ID: <20260403172116.3424075-1-adrian.larumbe@collabora.com> X-Mailer: git-send-email 2.53.0 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: 8bit In the event of an sm_step_remap() that leads to a partial unmap of a transparent huge page, the new locked region required by an extended unmap might not be a superset of the original one. Then, if it leaves a portion of the initially requested one out, the ensuing map will trigger a warning. Signed-off-by: Adrián Larumbe Fixes: 8e7460eac786 ("drm/panthor: Support partial unmaps of huge pages") --- drivers/gpu/drm/panthor/panthor_mmu.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/gpu/drm/panthor/panthor_mmu.c b/drivers/gpu/drm/panthor/panthor_mmu.c index fa8b31df85c9..2b96359d3b94 100644 --- a/drivers/gpu/drm/panthor/panthor_mmu.c +++ b/drivers/gpu/drm/panthor/panthor_mmu.c @@ -1709,6 +1709,19 @@ static int panthor_vm_lock_region(struct panthor_vm *vm, u64 start, u64 size) start + size <= vm->locked_region.start + vm->locked_region.size) return 0; + /* sm_step_remap() may need a locked region that isn't a strict superset + * of the original one because of having to extend unmap boundaries beyond + * it to deal with partial unmaps of transparent huge pages. What we want + * in those cases is to lock the union of both regions. + */ + if (vm->locked_region.size) { + u64 end = start + size; + + start = min(start, vm->locked_region.start); + size = max(vm->locked_region.start + + vm->locked_region.size, end) - start; + } + mutex_lock(&ptdev->mmu->as.slots_lock); if (vm->as.id >= 0 && size) { /* Lock the region that needs to be updated */ base-commit: fb42964e2a76f68a5fb581d382b5d2be2d5bda9b -- 2.53.0