From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=202.12.124.148 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796416534; b=nVFeM1V6vczUIVOwbppN3yz20ybXm+QVECGSSY9ZFPKdoUXhDYsawpk6ss71eG6GI96c CAkILGw1yrVntAFrY1VL47PKmbHlgBHfPJoqhQ9AAD2/1UeE2bAn/lpG500AnaJ8gyv6M 1SBlqA5opfatybAUrSWR7BzDUKI+2KcM8YCNK7QfYUkXJjMRw/n720LuJXjTQUyTqosz8 8JijJP96RZ6/P6EXLL+WRoNsfJBSyA/bq9FnTCIF39R6t+Vzpqtkh05LER8Emn/lWNY+0 k3VI1NOora6PrN02l/R7qJWx5nELU9ZRFeDx9Q06otsnL+2Ui5rjoPuWa0RCbvm35/A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796416534; h=DMARC-Filter:Received:Received:DKIM-Signature:DKIM-Signature: X-DKIM2-Info:DKIM2-Signature:X-DKIM2-Info:Message-Instance: X-ME-Sender:X-ME-Received:X-ME-Proxy-Cause:X-ME-Proxy:Feedback-ID: Received:Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:Content-Transfer-Encoding: In-Reply-To; bh=k5h+tAMbd3u89wHMOkh5xreAlZ3zAJtalfdtyOBuwFs=; b=xz6V5ncKpFxiIjE4L9i5NAZbIRluem51ic1gOlqG/Q7+FIdXT3MfT/49rlnGemwuIHoE /4Kb+bn9K6Q5HJz/gQpNAeUASadT3gv0EwvGmPVa0TjCuvPx+oHDPrgRdTie4ztfn6AMu 0zpciIOynsbX11BZDhDBiqZi3+ubPU+Dpi2crBhzyWMmgecWWwGJyJt5ZpT37K8ENrBju +7pjLZfCiYeeWDWLOvIzSPTl2roP78khzR/uMaQYnn1YAFexcEqTi1oudn6lwr3t/qHZn bU5BVSP8PhTssF+G2/zLO9Y+skkOmqjJfHoEpbjkWWn8ySzwbytyXyVkD9wSht3wG6g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=fastmail.com; spf=pass smtp.mailfrom=fastmail.com; dkim=pass header.d=fastmail.com header.i=@fastmail.com header.a=rsa-sha256 header.s=fm1 header.b=LxN6hY6k; dkim=pass header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm1 header.b=y0H91X0E; arc=none smtp.remote-ip=202.12.124.148 Received: from fout-b5-smtp.messagingengine.com (fout-b5-smtp.messagingengine.com [202.12.124.148]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B99F0606A32D for ; Fri, 4 Dec 2026 20:35:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B99F0606A32D Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=fastmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fastmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=fastmail.com header.i=@fastmail.com header.a=rsa-sha256 header.s=fm1 header.b=LxN6hY6k; dkim=pass (2048-bit key, unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm1 header.b=y0H91X0E Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailfout.stl.internal (Postfix) with ESMTP id 45B491D0001A for ; Fri, 4 Dec 2026 15:35:33 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-06.internal (MEProxy); Fri, 04 Dec 2026 15:35:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.com; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1796416531; x=1796502931; bh=k5h+tAMbd3u89wHMOkh5xreAlZ3zAJtalfdtyOBuwFs=; b= LxN6hY6kY4SZcIoURUg+9CV21GU/t1O6mnECOLmLSShowcaER6nFjO+s9ls15gjT XVhBdUkjwDHO2JGlvbSVDMRJlFrX71dpeFmmHzdriYMLyds8HNuQ8BqueyNBsOAg tAezoV+I/u/izKD7j9Xy1xv8b/XOE3FHnKoQCjFfYpkwyvMbHuRSKBX8eB7yZ1uF 8xSmqFbObiJBfAe/HsuKv4hEYV6TBkWyycrDPKqocWI3VAnBO9VGZSU1lTI8DlWz F9qKfAYppgwpiAS+zrEwS9omxnjlTBp37ZcRkVj9VDpH+R3dNZYqjaCw0iNqikSi 4/lBynqH+uLl0J0qb28Pig== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1796416531; x= 1796502931; bh=k5h+tAMbd3u89wHMOkh5xreAlZ3zAJtalfdtyOBuwFs=; b=y 0H91X0E4YDMk/QIwKRtHcJ0pFyb9Gmv2LA84Txj2V0JmQVmC5qk8c8mXzZ1/Od5a kbz828B02YX+guBqObBh1lZESunjhLON9pzbu8oevQydCkVT+hZjScv+POKxcZsn m3/f19DGnpyHF4JeyHlnzSf10+wn0Fk2s57gAlCU27kGVz1hT0aePdA99FRwdPf3 MhczWixkPag2OCRPp747VD7QwsLonQV4HGsIUX5hz+Lra1ILRltwOr7jE7X9RtYN 1NdtefSJeDvlXRu8E7auttek+9GFRa9wwke0DdfppDH729HgLqCectSo4xldx8LJ R7jgugA3n0sKA3oSIqHKg== X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-09; repo=github.com/dkim2wg/interop; date=2026-11-03; sw=lmtpprox; action=sign d=fastmail.com a=rsa-sha256; DKIM2-Signature: i=1; m=1; t=1796416531; d=fastmail.com; mf=PGp1YW5sdUBmYXN0bWFpbC5jb20+; rt=PGxpbnV4LWtlcm5lbEB2Z2VyLmtlcm5lbC5vcmc+; s=fm1:rsa-sha256:bzqCBwlYKN3/ZjbUfClpX6bXc9pqU26ElKiKujilkU+XBqX tjqC0SpDly2f1RCHr152roIeRaq0eDAuc6JcUeequ+GZRFU6D6r9jMbwInfj+DN3 jVFI4wmh74Wqzi80qnGwIr1uGT48ExYgWFJkLrQr6+qCtL7gWMI3y6yYFzd/Hr3S 0l5LX3w3G5YfQFXV2Yfa9xBwqaLRnL6J7/gMEcM5izljysJLBttcjFYJmhx9PVK8 FAqRNyknwM0B4ZbAxBpGFvir4ued6rGb08HLUGX0P0L5ng+NqJrJKLt6jndFFBa1 XefEQbcLlvldgkSskPT0Qxhgtu1RWvxkFS4oUYw==; X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-09; repo=github.com/dkim2wg/interop; date=2026-11-03; sw=lmtpprox; action=mi-m=1; hc=13; hn=cc,content-disposition,content-transfer-encoding, content-type,date,feedback-id,from,in-reply-to,message-id, mime-version,references,subject,to; Message-Instance: m=1; h=sha256:fzMVG95A9Dqd+B08lgTaoNZrAHg5mAqNMbp2SncoRlk=:o+MwYD6LXLOM7KZiUES98bXq1yuOpK3qo4/lRbpoIDQ=; X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: dmFkZTEOW5Aj0TJx3AU+NVpawbNZ4BQdmjV35I5J3jjnEcxVTj7Le2nH73V4iyCDV0zK7C WGobe2bEysTIZAbIhCdZx8KP3c3N9dQ/nUnmNMFRFnSAp9W01i3eeqZPwCW25ywvrytcns bVcB0xuWnWO2sEsrni/Pcy1DzT7NzGGKIkFn3T+F1tCB3PjkqdUbPnfvSuWvF1txCK7ekK +joNXZHoJ/HFlOhl258iKJsuQznPq7eaNiKPX0J/C7X6P94LcjK+1D3QYFMl3TRDKRFbeO 07bmMmvKnUyPLHC+3nfKH2zJdxnm0qgQ91DoxGtTKBJEyftmTDGR+pRYGN1mQ0R+BX3FJF 73HJ2NimnxHvsAHchqPpX0j1dLnVGoe6ypXMpfyHOFA5xcV6fX5bVFa3PoPBShxk7qdDw5 mjiwJBu2qPqdpHo/7GCUEQjuiCeZAeiyMPJtIix2npkGNHJHENTMk307qMbMRfeh4scVQY dMnSIeNJGsc69Dhv2R3e6C0CfEoM84tLtqCRXIL/tWJhDNQA9G8mSjymflF3SDQH3Qu50e FUi21jLG0hHCmyFVFyo29F+OXE/+/fjim8k/02/1/9hbxbIp+bmoQeXuiHFBSrkgjazM2v BFNC0E3v7rbHCe1U4zzqeYQCxyyAWIHUkj8Av7Fsyq7/5TxAYtYQUEWQAi1w X-ME-Proxy: Feedback-ID: i80b64ba7:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Dec 2026 15:35:29 -0500 (EST) Date: Fri, 4 Dec 2026 12:35:29 -0800 From: Juanlu Herrero To: Marek Szyprowski Cc: Robin Murphy , Andrew Lunn , "David S. Miller" , Jakub Kicinski , Paolo Abeni , Shuah Khan , Eric Dumazet , netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, iommu@lists.linux.dev Subject: Re: [PATCH 2/3] dma-debug: skip irrelevant buckets for partial syncs Message-ID: 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> <59325d7b-846e-4e5e-9c82-741f87523397@samsung.com> 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 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <59325d7b-846e-4e5e-9c82-741f87523397@samsung.com> On Fri, Dec 04, 2026 at 04:16:48PM +0100, Marek Szyprowski wrote: > 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. > That is correct and sounds good on redoing the full search if no entry is found. I will incorporate that into v2 (along with only sending the dma-debug changes in the patchset and the net-next portion). -- Juanlu Herrero