From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7680EC433EF for ; Mon, 11 Oct 2021 11:47:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5C18260E0B for ; Mon, 11 Oct 2021 11:47:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236034AbhJKLtL (ORCPT ); Mon, 11 Oct 2021 07:49:11 -0400 Received: from verein.lst.de ([213.95.11.211]:37037 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231659AbhJKLtJ (ORCPT ); Mon, 11 Oct 2021 07:49:09 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id F16AD68B05; Mon, 11 Oct 2021 13:47:06 +0200 (CEST) Date: Mon, 11 Oct 2021 13:47:06 +0200 From: Christoph Hellwig To: Karsten Graul Cc: Robin Murphy , Gerald Schaefer , Hamza Mahfooz , Christoph Hellwig , Dan Williams , Ioana Ciornei , Jeremy Linton , "linux-kernel@vger.kernel.org" , Marek Szyprowski , "iommu@lists.linux-foundation.org" , "netdev@vger.kernel.org" , linux-s390 Subject: Re: DPAA2 triggers, [PATCH] dma debug: report -EEXIST errors in add_dma_entry Message-ID: <20211011114706.GA16350@lst.de> References: <20210518125443.34148-1-someguy@effective-light.com> <20210914154504.z6vqxuh3byqwgfzx@skbuf> <185e7ee4-3749-4ccb-6d2e-da6bc8f30c04@linux.ibm.com> <20211001145256.0323957a@thinkpad> <20211006151043.61fe9613@thinkpad> <4a96b583-1119-8b26-cc85-f77a6b4550a2@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 07, 2021 at 12:59:32PM +0200, Karsten Graul wrote: > In our case its really that a buffer is mapped twice for 2 different devices which we use in SMC to provide failover capabilities. We see that -EEXIST is returned when a buffer is mapped for the second device. Since there is a maximum of 2 parallel mappings we never see the warning shown by active_cacheline_inc_overlap() because we don't exceed ACTIVE_CACHELINE_MAX_OVERLAP. Mapping something twice is possible, but needs special care. Basically one device always needs to do the first mapping and the other one needs to use DMA_ATTR_SKIP_CPU_SYNC to opt out of the coherency protocol. So we have two TODO items here: 1) the driver needs to use the above scheme and 2) this dma-debug check needs to understand DMA_ATTR_SKIP_CPU_SYNC. Can I trick you into doing both?