From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2CD2740C5A0 for ; Tue, 19 May 2026 09:06:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779181571; cv=none; b=a30PnVk8nhCSUcvkZAV6kyc0zUxdyEW58QzxC+JxLUHs9PUephKk7NO8qdBXnSEyYcKnehV+cviZwyd0tWl2Qnd3NE24HvkMKyrGnfjBTaBIUFZse6wCdaLXDBYuly61lbLUg6Vwl1IkIURiYR8DF8u/qei/MvbdQ/JIOSNQWI0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779181571; c=relaxed/simple; bh=MV15nxOHFor4yNcSn+17krF+1oXD5USMzBTrCNx+2tw=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=FCYOPhHsj21U3LCBJRToECyOettmif+aBnGS4FUtr1LHV0m9JrerRo+zSupRw/4+hqkzIb/59I/CJrb5AfrhiX8d6HpSmrosxMCi6Ars6YBXbAlhivoXMA7J+yc00bLRipX6EnP84kTSioCK4gUtg5sxIcE5C3zOAOYsSbjoCOg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=HfWl10cH; arc=none smtp.client-ip=209.85.128.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HfWl10cH" Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-488a88aeec9so38958795e9.2 for ; Tue, 19 May 2026 02:06:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779181568; x=1779786368; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=3KzuyoCOkwbfj6tR36TDJK9gqiV5pxoB5tBNWM4bdEA=; b=HfWl10cH2taJ3g8GMs7Ic+tb+Nn7VpSNN4I4kfvyk/IDdxTWcXI7HZA5PmBGlOVb+4 5ClWns3TyeqVJxZ40bRJDgLnpfviBR98RZ3KluSaa2zlkk1/tkzFP+mYwbscrmpMuRiR i8FZ9yFCXb050qe7bu7R4hhlg8zl3HepCnr3MrMB+Jp4GzZFN34kY18JpWurqJlgHdOF arVquSTVomkKFRaCNsoLWVeKsFYgvbdky13c/ua+t4sFC0kkccj5JwRp2X5cPAELAe48 qxYe4+pSlDhnai9b7BJYP3+0xVR0Z7K8aDcHnBSvYdPPiDHF6y9rdJU5/81asSo3xxSF kKlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779181568; x=1779786368; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=3KzuyoCOkwbfj6tR36TDJK9gqiV5pxoB5tBNWM4bdEA=; b=KqJ+Q/kIq5cXTeLCBkxK7KuhnnN+iGUnf28GR/oFEwuNWxMBzEpUO8lTVmmWFulu3i l/FUzkoOsMpDF1Bv/QvZG+tVRrD+UoraGh1QtplH8r4SG5J3ev7FD2pBPfkRWiux259U 8AxdF/x0bcXOR+cENJ6NUBM77hyAvPbpCNQ1BeYb/uONYbMkm/ljePaq9DABOKSrttfa y5sqUY8IJzEjdpMsSrgIqxVXIlP331nIXH8pW2lSw5BD2RdhzKmQm1DOJjbFRYW5q/7o lHrOfe53Z4oDak/04/vsuaU3q78J1DZ3hqmJFG3OgaXAASh8tGHDA9dcfCbaqfIaZNMT afDw== X-Forwarded-Encrypted: i=1; AFNElJ8YxJ/6KyMg2tf9XV2Vc3+qsBU8Jv3HUpWYimVjv2Qp2zpfRnhLOBRgBETfskXjnIGyc0JlxIdAith7NNk=@vger.kernel.org X-Gm-Message-State: AOJu0Yzzhp7Cg2qgxSEHO4+iZtUrd3XJuj0BxVULM0rGZOx1ExfBRiZu 1vbZke45l73bRD/aEuCRi027t8FDoO65Y7orarrQ1477vq8voznhiBey X-Gm-Gg: Acq92OHu7qsgBCAbufSs8aTKx/gpNxh+o+vOlJqqPNVOQ1aZKvv+x7mnG1y7X8GhAAl j0H8ATJt7W8U+YVVsj6UfsYrLWswZH/Q+H6JSo4uiXvhLdLhCR54E/ggerLc0J7AwsNyL5BSsR1 yvJSNoQXRXc2669ZbZcFL9OyyAgIGi+8nEuyiCXYY7YMw3xoyVabThH5dMJwKwk8s5akrCTRz50 iY+9sjg8scIhQ7jMb5B8W4Q44b3DYyLwX7IU4WMs3WQKcu6cxr4T617mUIJBTzUSNrz8xXDZylq Lsz1TRY7oVRh8gUElXWl/nagBtY+o540UyyA1maDVwvjjdsPBlo8mZ7o1aIugXC+VPPtHGkT+pH 7fH6T932ovHmMmAjlHF9rrfJ8N3DqGZzsHbswWHaIikHP/cmVDEcr9/VfWMn0EpGjhLv2hohPHX bQGFITLUCx49SfUJZ4VS8fWcyUolUDXzVEthoWpSQm9Dbp2pCZZQuPT71gR5nTCs72 X-Received: by 2002:a05:600c:4e02:b0:483:2c98:4368 with SMTP id 5b1f17b1804b1-48fe6322416mr301618735e9.18.1779181568347; Tue, 19 May 2026 02:06:08 -0700 (PDT) Received: from pumpkin (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48febe74a53sm103879765e9.27.2026.05.19.02.06.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2026 02:06:07 -0700 (PDT) Date: Tue, 19 May 2026 10:06:06 +0100 From: David Laight To: Mikhail Gavrilov Cc: Leon Romanovsky , m.szyprowski@samsung.com, hch@lst.de, robin.murphy@arm.com, djbw@kernel.org, akpm@linux-foundation.org, catalin.marinas@arm.com, harry@kernel.org, ming.lei@redhat.com, iommu@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH] dma-debug: skip cacheline overlap tracking on cache-coherent architectures Message-ID: <20260519100606.6b3c91e3@pumpkin> In-Reply-To: References: <20260518113251.64844-1-mikhail.v.gavrilov@gmail.com> <20260518121047.GR33515@unreal> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; arm-unknown-linux-gnueabihf) 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: quoted-printable On Mon, 18 May 2026 17:23:15 +0500 Mikhail Gavrilov wrote: > On Mon, May 18, 2026 at 5:10=E2=80=AFPM Leon Romanovsky = wrote: > > > > I would say this reproducer is incorrect. From what I recall, the only = two > > legitimate use cases for cacheline overlap are virtio and RDMA. =20 >=20 > The wild trace in the commit message is NVMe block I/O -- neither virtio > nor RDMA: >=20 > add_dma_entry -> debug_dma_map_phys -> dma_map_phys -> > blk_dma_map_iter_start -> nvme_map_data >=20 > The block layer submits many concurrent in-flight requests; small > kmalloc'd buffers naturally land in the same cacheline under high IOPS, Isn't there a flag to kmalloc() that indicates the buffers will be used for dma and mustn't share a cache line with anything else writable. (Which means the size must be rounded up to a multiple of the cache line size.) For DMA_FROM_DEVICE it is important that the cpu doesn't dirty the cache lines. This is probably worse on systems with 256 byte cache lines. -- David > which is incidental rather than intentional overlap. Ming Lei's report > linked in the commit message [1] enumerates additional non-virtio / > non-RDMA cases hitting the same WARN: liburing iopoll tests, raid1, > dm-thin and other storage utilities. >=20 > > The first intentionally relies on it for small allocations, and the sec= ond exports the > > cachelines to the user space and cannot operate on non=E2=80=91coherent= architectures. =20 >=20 > The reproducer isn't claiming to be either of those. It deterministically > reaches the same state-based gate the wild NVMe trace hits > (!is_cache_clean && overlap > 7, with direction !=3D DMA_TO_DEVICE, after > the v2 coherent-arch / SWIOTLB-bounce suppressions are evaluated). Since > that gate has no subsystem-specific term, any caller -- synthetic or real > -- reaching it with those state values triggers the same WARN. >=20 > If the broader concern is that the block layer should opt into your > coherency-attribute work rather than relying on debug-side suppression, > that's a reasonable longer-term direction. But it's additive: even with > opt-in adoption, the WARN remains a false positive on coherent arches > for callers that don't annotate -- which is exactly what v2 (3d48c9fd78dd) > already established for the sibling "cacheline tracking EEXIST" err_print= k. >=20 > [1] https://lore.kernel.org/all/ZwxzdWmYcBK27mUs@fedora/ >=20