From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=210.118.77.11 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796397428; b=TyZF7gvYp42b7nBMY6jJqfmlKpc66GDLHdeYUVWZA0s1EPTbJD2V1MG+qa/Oj476bXNA uEb8tCgJjkXTBD4vtaqgB1n5lHYT/4gWadwxCzzaMuDG0Iu6gdCVOBHv90eJJ35XF5epk hxMnC6uJsW32D8zBgl1/4SdkVJPy8f5mHJF3Z8ebJLkGpz0ayv6roSR7RnfdBtK+Wzn1R mLocBsEtk3g0n4OGuXtlHeM1/dNT3gFbleXR6a6G5doUeLx/jrwmDwvlt+UowCbGlnVb8 O8h+9moGyGQHEQrQsHKgXJXbj7diZG4QBdGlvBVHhCQXSQU6xEsnJiIykwkQxGn19lg== 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=oF1A2ANfQBge88cangehjsawOzB1TwXnIf+kp2z0Pt3bQPlw1SqTRo4gFpgGfM4SqH4c FpSLt6NsGqUx8CiLlcccwianqijnx5neuRhqq8SrG2tF+xxN29Y7ExeWd2U68TCODQoWf X19qsfZQncSyTNOuN8NOrOgyj5r7eiJdUxUFjhUA4r2WPbtwzNErbzgGc0meq1HMzLm+O XBvssEN3oYxowzMbshakUfDLUP5wquN+L/O4JJY+vxWgo7FHsY49fnAd4Sc/xCHevkq4c zUAymOqVnpePC5o7e/ydhH/RQvwsMD2BaopW2tV33RyrRcHrnA/ryqT/89g7uX5KCWQ== 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.11 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) (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 969C6606A32F for ; Fri, 4 Dec 2026 15:16:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 969C6606A32F 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 mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20261204151650euoutp01d08ddb1090790c7c8822edbc4daeb323~uFe1KvQNp1475014750euoutp01Z for ; Fri, 4 Dec 2026 15:16:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20261204151650euoutp01d08ddb1090790c7c8822edbc4daeb323~uFe1KvQNp1475014750euoutp01Z 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: linux-kernel@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