Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3973727pxf; Tue, 16 Mar 2021 02:29:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwbb8ow+3I/+sbrxVgLvbbfj+9rAJLPKoOo8tRywz1FTu9sFUw3fMqVWIJfz+Qo4JHEyg4e X-Received: by 2002:a17:906:4705:: with SMTP id y5mr28882897ejq.119.1615886975575; Tue, 16 Mar 2021 02:29:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615886975; cv=none; d=google.com; s=arc-20160816; b=oZlSM9/BnoIQGFXfCTO5wp4vmDBPxcABPpxDJ+g4WxRMItLReFAZeauUmLGMm5eSeS tZwunA5zar7rJR33YAIS7ibq5or07J/F+t4hjDBY979Fi+n3UddgOTm8G2cZUOl6ki7F VyC0yJVpX3LB2WBT0loii+O+mE+p+RZEzQL99zVfErkxApdQjAw8egAp5prLmkAaEePK ISFnXJKIWtI6lw2J8EYp8cAwwnGKiN1fKA34w3isae2Gw562+DsOLU46fJm6clspM4qA XtPrm5xEE9FuzFSB5mWX3xRBBZwyhSOOB78pRkbQSD8ngmcLkFw5Ry1mFoNntat9vqIe jtpg== 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=nL1RF1w20lkcMDGT3EbiyHD4v65BigX6gZs+6zv/mBc=; b=J5iVa9Jft5526Iunqg3Z9cZpjO81pq3+iFLq2nSfS5F/Z6hk7Ncuy0H04N/Rz6LMl4 cYrqwnl5b6hfaM26u4H2J3pkkBWHqmb0vBU0TrWDEdiKsjpLwwe4Vab/h5AliJjR2weN mXn/PEXi2TDd0XWvXu6VZpIGoXFBRU4xXv3rQdahSBvI5GiQ2YToWYFpa7t+o+LgcwAQ Ly9dR1PS/utY7/jBw85o12eH4iiNiH6wn9FOvSmg51lejTWUwWRgc/9WVgujTfis6DyX tobrog4fn9kEkMCf+Nc4XBoJDicVJeBDZag88E9ph90NarhgGjm/DdJLkmKbcR3UDaus c2oA== 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 do7si13458758ejc.307.2021.03.16.02.29.13; Tue, 16 Mar 2021 02:29:35 -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 S233620AbhCPIAo (ORCPT + 99 others); Tue, 16 Mar 2021 04:00:44 -0400 Received: from verein.lst.de ([213.95.11.211]:58883 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231510AbhCPIAR (ORCPT ); Tue, 16 Mar 2021 04:00:17 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id 75A4D68C4E; Tue, 16 Mar 2021 09:00:09 +0100 (CET) Date: Tue, 16 Mar 2021 09:00:08 +0100 From: Christoph Hellwig To: Logan Gunthorpe Cc: Ira Weiny , linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, linux-pci@vger.kernel.org, linux-mm@kvack.org, iommu@lists.linux-foundation.org, Stephen Bates , Christoph Hellwig , Dan Williams , Jason Gunthorpe , Christian =?iso-8859-1?Q?K=F6nig?= , Ira Weiny , John Hubbard , Don Dutile , Matthew Wilcox , Daniel Vetter , Jakowski Andrzej , Minturn Dave B , Jason Ekstrand , Dave Hansen , Xiong Jianxin Subject: Re: [RFC PATCH v2 07/11] dma-mapping: Add flags to dma_map_ops to indicate PCI P2PDMA support Message-ID: <20210316080008.GC15949@lst.de> References: <20210311233142.7900-1-logang@deltatee.com> <20210311233142.7900-8-logang@deltatee.com> <20210313023657.GC3402637@iweiny-DESK2.sc.intel.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 Mon, Mar 15, 2021 at 10:33:13AM -0600, Logan Gunthorpe wrote: > >> + return !ops || ops->flags & DMA_F_PCI_P2PDMA_SUPPORTED; > > > > Is this logic correct? I would have expected. > > > > return (ops && ops->flags & DMA_F_PCI_P2PDMA_SUPPORTED); > > > If ops is NULL then the operations in kernel/dma/direct.c are used and > support is added to those in patch 6. So it is correct as written. It is not quite that easy. There also is the bypass flag and for the specific case where that is ignored the code needs a really good comment. And to assist that formatted so that it makes sense. The above line is indeed highly confusing even if it ends up being correct.