From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) (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 69FE61B6CFE; Mon, 4 Nov 2024 12:53:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.95.11.211 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730724790; cv=none; b=HOgOno/aW5CWwM/BAE++lrkckLWkqhV9grMwgiJWLAXc8LFQmwcVaAtKPTUXog4Mtj2W6z2TkrbYV2In51QMsRctfRTtNDGvkEevhCnKwUNQ1Nb1BbvfuqbWjO+UakumaRAhZii6H1EawnZGgKe1Pr37cPR6yW7JmysLQzeNF9I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730724790; c=relaxed/simple; bh=gilSNoWQMNdGklRFQgFhfjvxiTNJuGwF0N1Xv7U5/Pk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=SVAD3oY3o9ipAH3rJQBtTVcfId0cXaA/jPjkxudLZOXFYCdVgUgMOjC1dZs0E0+DymwTN0TzkhV13Wl8UgFqHRpoj6tJDZvnC2gx3FyVS1gek+v3GxM5uyN2VFl4hufUSBfjeyrfBxywiFj+tHiSDxMfp6lhJo/u5ImFJUhNzv8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de; spf=pass smtp.mailfrom=lst.de; arc=none smtp.client-ip=213.95.11.211 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lst.de Received: by verein.lst.de (Postfix, from userid 2407) id D6983227AAF; Mon, 4 Nov 2024 13:53:02 +0100 (CET) Date: Mon, 4 Nov 2024 13:53:02 +0100 From: Christoph Hellwig To: Jason Gunthorpe Cc: Christoph Hellwig , Robin Murphy , Leon Romanovsky , Jens Axboe , Joerg Roedel , Will Deacon , Sagi Grimberg , Leon Romanovsky , Keith Busch , Bjorn Helgaas , Logan Gunthorpe , Yishai Hadas , Shameer Kolothum , Kevin Tian , Alex Williamson , Marek Szyprowski , =?iso-8859-1?B?Suly9G1l?= Glisse , Andrew Morton , Jonathan Corbet , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-rdma@vger.kernel.org, iommu@lists.linux.dev, linux-nvme@lists.infradead.org, linux-pci@vger.kernel.org, kvm@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v1 07/17] dma-mapping: Implement link/unlink ranges API Message-ID: <20241104125302.GA11168@lst.de> References: <51c5a5d5-6f90-4c42-b0ef-b87791e00f20@arm.com> <20241104091048.GA25041@lst.de> <20241104121924.GC35848@ziepe.ca> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20241104121924.GC35848@ziepe.ca> User-Agent: Mutt/1.5.17 (2007-11-01) On Mon, Nov 04, 2024 at 08:19:24AM -0400, Jason Gunthorpe wrote: > > That's a good point. Only mapped through host bridge P2P can even > > end up here, so the address is a perfectly valid physical address > > in the host. But I'm not sure if all arch_sync_dma_for_device > > implementations handle IOMMU memory fine. > > I was told on x86 if you do a cache flush operation on MMIO there is a > chance it will MCE. Recently had some similar discussions about ARM > where it was asserted some platforms may have similar. On x86 we never flush caches for DMA operations anyway, so x86 isn't really the concern here, but architectures that do cache incoherent DMA to PCIe devices. Which isn't a whole lot as most SOCs try to avoid that for PCIe even if they lack DMA coherent for lesser peripherals, but I bet there are some on arm/arm64 and maybe riscv or mips. > It would be safest to only call arch flushing calls on memory that is > mapped cachable. We can assume that a P2P target is never CPU > mapped cachable, regardless of how the DMA is routed. Yes. I.e. force DMA_ATTR_SKIP_CPU_SYNC for P2P.