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 EF6BC125A9 for ; Mon, 13 Apr 2026 15:53:31 +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=1776095613; cv=pass; b=q3x2TCAknqizn60VkBCvSYO2wpepBCMVw7CccsIDNYQxBUKqBzVmnH4CE2vrWvK/GwrOCrZMKmu9kjQx7FVjhlikqhJG5IEWNALt1t7jSYYN0PTJx8r1KwIl7iYmHlgUKOJrqawWNiqbRcUTLXABGVY5/soJqynOO5iWrH6zlsw= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776095613; c=relaxed/simple; bh=RMpzQjZ4j3Ff9OUFyYr/+RyzWUegt076cv0cncw9ryU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=RNigoUoIQevZmu1IrpDZcE0iWF60GRBAfCG7aym9ehSG1dQPX0gM0HQDXjpiksV9dtWZ449Bf7osPZG9OSt7Qzu94TS1LmWN0LYab+UqE5c051pStZeJrvjeZWUR06g4MjlJgg7+ZC/E7KGyq12jqRTXctSOOkU3NPbTdM9NFcU= 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=GedZnhB/; 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="GedZnhB/" ARC-Seal: i=1; a=rsa-sha256; t=1776095595; cv=none; d=zohomail.com; s=zohoarc; b=NLUtMYbmgECZYfWfaXRo+dxXgOi3MfM+oPXpiIorrwXPrCqDe7rZqsVFciXfcJmOhh2MBM8c77uAerF1S6WlIdHdedVZFkrsPtx52oWy57dvrFxBCoj1nCxYIdptnjUnUJmBSdZebjdB8Fz224IY5WA/U3Lmz/ZVT4mlwjQGz7o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776095595; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=I6DQ0vYPJ7ac4o64pgQkVxvLcCeNatTbss17UFduNBg=; b=IQhMcqqnoSVsGx6rWcWxUWa4yVG+c+vF3IT5jaKNnxBgsJNRkckGQVDouwV3gNWIL/BfdkociVCBvJ8p9u994m8I8kEzAbfu5ejEUhZ5nKJUceYFSpcuVPR9AG6hHzFby27ZxlZfHVhzjR/ZA/2pKkkfGGly0j/VE8MaacNFqN4= 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=1776095595; s=zohomail; d=collabora.com; i=adrian.larumbe@collabora.com; h=Date:Date:From:From:To:To:Cc:Cc:Subject:Subject:Message-ID:References:MIME-Version:Content-Type:Content-Transfer-Encoding:In-Reply-To:Message-Id:Reply-To; bh=I6DQ0vYPJ7ac4o64pgQkVxvLcCeNatTbss17UFduNBg=; b=GedZnhB/f+Lo5Ksg+aQkUT9K7zIEbFAMW7gaFK/k7vnSW6Fu9zqvrhc5ceKsAO/A 2MbUXEKV1wHL6hwFLu6QbBDCO7SDJOS4BdiSU8D6m5b4/WZM9OqPhMuZcWvObRgooWT ABAfAtcS6O6BtlsyVnNwjibiWkUd7Jn5qzZ04xqs= Received: by mx.zohomail.com with SMTPS id 1776095592323461.8737533352952; Mon, 13 Apr 2026 08:53:12 -0700 (PDT) Date: Mon, 13 Apr 2026 16:53:08 +0100 From: =?utf-8?Q?Adri=C3=A1n?= Larumbe To: linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, Steven Price , Boris Brezillon , kernel@collabora.com, Liviu Dudau , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter Subject: Re: [PATCH v2 1/2] drm/panthor: Extend VM locked region for remap case to be a superset Message-ID: References: <20260408191228.537625-1-adrian.larumbe@collabora.com> 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-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20260408191228.537625-1-adrian.larumbe@collabora.com> Queued to drm-misc-fixes. On 08.04.2026 20:12, Adrián Larumbe wrote: > 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") > Reviewed-by: Boris Brezillon > --- > drivers/gpu/drm/panthor/panthor_mmu.c | 19 +++++++++++++++++++ > 1 file changed, 19 insertions(+) > > diff --git a/drivers/gpu/drm/panthor/panthor_mmu.c b/drivers/gpu/drm/panthor/panthor_mmu.c > index fa8b31df85c9..bd41c892beb7 100644 > --- a/drivers/gpu/drm/panthor/panthor_mmu.c > +++ b/drivers/gpu/drm/panthor/panthor_mmu.c > @@ -1709,6 +1709,25 @@ 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. The new region must > + * always overlap with the original one, because the upper and lower unmap > + * boundaries in a remap operation can only shift up or down respectively, > + * but never otherwise. > + */ > + if (vm->locked_region.size) { > + u64 end = max(vm->locked_region.start + vm->locked_region.size, > + start + size); > + > + drm_WARN_ON_ONCE(&vm->ptdev->base, (start + size <= vm->locked_region.start) || > + (start >= vm->locked_region.start + vm->locked_region.size)); > + > + start = min(start, vm->locked_region.start); > + size = end - start; > + } > + > mutex_lock(&ptdev->mmu->as.slots_lock); > if (vm->as.id >= 0 && size) { > /* Lock the region that needs to be updated */ > -- > 2.53.0 Adrian Larumbe