Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1607800pxb; Mon, 11 Oct 2021 09:23:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzznnKEJFnqZ5FkJsFyhecB11v35wpIJzJQBIVUWycu+0v6M6UjWdZ2KaJiD7I8ay5qEuQR X-Received: by 2002:a63:7d0f:: with SMTP id y15mr18870726pgc.446.1633969380028; Mon, 11 Oct 2021 09:23:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633969380; cv=none; d=google.com; s=arc-20160816; b=MN85UettE1wG3FN7MzJRENNo5vaqFNPu5Qw6VgkdUn/CcKF7o9OCQIddLQiWBa4OJl 1UzkCl1WPVR4biRzrYXhCCRor95e8SCZNxBftWGJybUt9WcDeLJculkpZC9mJPq3aPIT Glm62KtAHAYgjoaC1+nHE5/YEjQ5yHEuN9VY6DlyptYMtAHJohO64diLgMzM5orSeWpM 79nz/nnTbwG0EdkS2zbwX4gDmfl920z8amVTowvZvAx3AYKuK+bDzJDesNLa3WrE70f0 OduSuPhW3+R5/L7wSmh+mKHmHq2TvM+WcWGQSyZ0+jCjnIpAlTbXotL0KtfUoCHGHGEu bTCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=KvPaT3jRa1rppTzgzTJFEmeu771MJdraQYI1r/wRKUo=; b=TTADspwSc5MFQ/lQDJ2nsaqrZp7TkS3eqrgWUQy/9xjZmb+tgi8IwZaO3NIJFCfgFw eVggS4XwLzjOJTfdcTcdD3cR5juC85Nnf9zfyOI9nD5kIUlYQMwSKjJMOE1ctO7q24sl onUK87g2V9G5jjiIiqCSOVkd8GZie6QJ4jkZcsS3oR4Qr1K+vP0TbPW41r5Qts8nxsJK 0d3BBEvJ7+kLEHJWPJnUD3wtmRqhxhGnCwZFqnJjjldBOTdBxSQbTN64fCKK536anqec sSHpy+PEIE2sF5meoa1T4QWX4TVXqU48JDe0vq1lTUtiLQcdXM9tJTYijb50egsMjTi8 23gw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q2si14632819pfj.327.2021.10.11.09.22.47; Mon, 11 Oct 2021 09:23:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234640AbhJKLtK (ORCPT + 99 others); Mon, 11 Oct 2021 07:49:10 -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?