From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=210.118.77.12 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796397428; b=mU9xvGnoJEEy+oXGG3uZbAmiH93gxaiM+yHiqsNRoBwGdpLHeDyl71FJistEX1ebPaRF L85U1PwYuiYolGnCLlonbQgqEOHbiNw2De7Hg3qUXMFaS4XCYPhvxw4p7Z8DTw2FYVjnY JzG3k7Z7YJGV1jK+M4IGNZPYZ3J4S1PnLvMdUpOv3Zh5JyBkWoEYPbfE4TShp1Ox+9l8r te8xWf01g79cnFEAtWFcFd+BNPIWe4Lton2TNSJQjy2mzQadpfmoek7krv0gYKvjp+Jdd kKVgP3XxSwOwBT0g5+vdwnKtMtC/wzRXDge7j9s8Wzh/jc2TcHPwnmqrRVEZN32wRpw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796397428; h=DMARC-Filter:Received:DKIM-Filter:DKIM-Signature:Received:Received: Message-ID:Date:MIME-Version:User-Agent:Subject:To:Cc: Content-Language:From:In-Reply-To:Content-Transfer-Encoding: X-CMS-MailID:X-Msg-Generator:Content-Type:X-RootMTR:X-EPHeader: X-CMS-RootMailID:References; bh=BVUbRcBQ4X66TTikOJIGKoXwJ92AZDbuZFAZqc64Zwg=; b=EPPaHcYzGrpDwvdwOXSLVQz8EN/JaOQ/kl2VHB2H0KxmoH6HeDBC0MVU9gjvprvEJIX0 bh28aPjOqyVen5sJV8G6jm5pTRzd4IN4zd/YszhBmcIDn8GDTWX+VEMxLmhHbvcRE0myE JpnStpZBlsJGCCregIdoeABnpEfAPa9P1810+K0Es9HLZSXnSr8SvfD9q+GhCRhsxwiSz DprRb6DUGgEhaIQOgfszNidQMRr/dVPA6azsjRYZi0sUO/RynsjphQAaDu2fVX49mRDaN QPF0P4dff/FdTcdiQI3Txbz2cLLvSHuu/3QNH+jSW0oCYzuRBeWygOp38Y5Nd1bAf0g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; arc=none smtp.remote-ip=210.118.77.12 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8E0EC606A322 for ; Fri, 4 Dec 2026 15:16:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 8E0EC606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20261204151650euoutp02acbb8c5c95aebb982c442b1884bdddbe~uFe1KqU8b3096130961euoutp02B for ; Fri, 4 Dec 2026 15:16:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20261204151650euoutp02acbb8c5c95aebb982c442b1884bdddbe~uFe1KqU8b3096130961euoutp02B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1796397410; bh=BVUbRcBQ4X66TTikOJIGKoXwJ92AZDbuZFAZqc64Zwg=; h=Date:Subject:To:Cc:From:In-Reply-To:References:From; b=jXsiL2UJxnuZBp18GAK/UW0y0V//+aJCp1YoVXo+EpLvGS097u5iTq3yWP+DgSL6c 4Il4m4FqfkFyr3pt5KjTohzMsbnvOwbb/dgi36c5bJSTXsUFHW4RnOMR+isjITaf0o gxD8LuCpSPTwnskv2vdybDhrIYETQgYsEsNDaEXk= Received: from eusmtip2.samsung.com (unknown [203.254.199.222]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20261204151650eucas1p13d643d9f7317813896e0ef29683a54b7~uFe06gSXH0656406564eucas1p1b; Fri, 4 Dec 2026 15:16:49 +0000 (GMT) Received: from [106.210.134.192] (unknown [106.210.134.192]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20261204151648eusmtip2d9b806f94220bd0679febfa5c7d594b6~uFez4IK_01762217622eusmtip2M; Fri, 4 Dec 2026 15:16:48 +0000 (GMT) Message-ID: <59325d7b-846e-4e5e-9c82-741f87523397@samsung.com> Date: Fri, 4 Dec 2026 16:16:48 +0100 X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Betterbird (Windows) Subject: Re: [PATCH 2/3] dma-debug: skip irrelevant buckets for partial syncs To: Robin Murphy , Juanlu Herrero , Andrew Lunn , "David S. Miller" , Jakub Kicinski , Paolo Abeni , Shuah Khan , Eric Dumazet Cc: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, iommu@lists.linux.dev Content-Language: en-US From: Marek Szyprowski In-Reply-To: <41001cf2-6304-45ff-977f-ac1b66ecf559@arm.com> Content-Transfer-Encoding: 8bit X-CMS-MailID: 20261204151650eucas1p13d643d9f7317813896e0ef29683a54b7 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20261203173915eucas1p1d54b3770b24cf04e25ef5ce565bbe100 X-EPHeader: CA X-CMS-RootMailID: 20261203173915eucas1p1d54b3770b24cf04e25ef5ce565bbe100 References: <20261110-zcrx-dma-debug-registration-v1-0-48743ea61631@fastmail.com> <20261110-zcrx-dma-debug-registration-v1-2-48743ea61631@fastmail.com> <41001cf2-6304-45ff-977f-ac1b66ecf559@arm.com> On 03.12.2026 18:38, Robin Murphy wrote: > On 2026-11-10 9:36 pm, Juanlu Herrero wrote: >> Partial syncs may start after a mapping's first hash bucket. Finding the >> mapping then requires locking earlier buckets. >> >> Keep a conservative size bound per bucket and skip those that cannot >> span the sync range. Raise the bound on insertion and reset it when the >> bucket empties. Stale larger bounds only add searches, so removal needs >> no list rescan to update the bound. >> >> This relies on ordered map publication before sync and unmapping after >> sync. The bucket lock carries earlier bound updates through later >> insertions even when the bound is unchanged. > > Doesn't this then run the risk of then mis-reporting a sync/unmap with a larger-than-mapped size? The whole point of dma-debug is to catch bad API usage, so obviously it cannot rely on callers being correct. It is an explicit choice for developers who want to check correctness and accept the massive performance impact of doing so, so any reduction of robustness/coverage for the sake of making the inherently slow thing a little less slow seems like a wrong move, and rather missing the point. If I got it right, this optimization only speeds up the lookup of the entries. When entry is found then all checks on it are still being performed and same issues are reported as without this speedup. The only thing that might be improved to ensure proper reporting of allĀ  possible API violations is to redo the full search if no entry has been found and some buckets has been skipped. Best regards -- Marek Szyprowski, PhD Samsung R&D Institute Poland