Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp4127301imm; Tue, 25 Sep 2018 11:49:01 -0700 (PDT) X-Google-Smtp-Source: ACcGV62Jfjz+Y8KJOB0hGQLSKKZmckTzPEn+jf5YI5YQ+K9AY6vRULq9xfjchqn09sBfpwQla36j X-Received: by 2002:a62:8247:: with SMTP id w68-v6mr2334561pfd.215.1537901341933; Tue, 25 Sep 2018 11:49:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537901341; cv=none; d=google.com; s=arc-20160816; b=o6uSYZJePt36kTb5kx6iE/5bJnprqiHGHqZGzgd2zwdOWqr1ypONVVdd9ix8zY4WYS IoEvSqrRSjfx9N7xvTAoDO0RT/hRjoMIgF5YiWDbpeqiI1yG0IlcrGl8I3TR9TPhP3ry CT+9yQFXPDSK1XnqIqdF1gwXvn0Rg9tTi6AHC9V2NBm45oYyYno6iaclPs98WSmlV8G4 mesGgMQ4wSq+03y/biaI1U1dVEOKqwu4nx3AJ+aQM6R59BSEdVC4GziP5WVI29WtlbUR 1E6TOZgPq2O6xKhp4fqiY+NFS3yxwHiTo9cf8kcdVtm4qWpwyZU/YhOvwuZrgDFE9oCd 2h/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to; bh=CCrACqUqmpK++8CqrX3uwXWAF8Hq6lYJro88vTf+4Os=; b=vSbeZ2/O/KuJgWGoSxkS2VtPePOYqQS9Z9Uc3UaDi7JGuH0AdeJ7Z/24V5O1wPkLWm JqEM/Ed/4KpVIxB6RnnmbGcsdrPBh2zurQs/nPhJTjV4pX05aSQBOgjftcuEOqz2ICgd CmEX9Ues7uQBF4NCBMVwppWHat1xgKv8Ttoh4wPH/kclm5pRO9Acpz6oapD1K9jGEJIY /lKR/S0USsyV3PP9530g55yQ9dHrYPN/lst5s/NvsSOnqMQrQGOuB10HQZT7A6dYWyaz S9cxm0jzmjDddM8woLY3RIVC++fv+5Pyww6W5bhESpiZK3c3DiUMK6HZG8+tMBzCndUa 5PiA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v12-v6si2615308pfm.341.2018.09.25.11.48.46; Tue, 25 Sep 2018 11:49:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727664AbeIZAzp (ORCPT + 99 others); Tue, 25 Sep 2018 20:55:45 -0400 Received: from ale.deltatee.com ([207.54.116.67]:44110 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726944AbeIZAzo (ORCPT ); Tue, 25 Sep 2018 20:55:44 -0400 Received: from guinness.priv.deltatee.com ([172.16.1.162]) by ale.deltatee.com with esmtp (Exim 4.89) (envelope-from ) id 1g4sM0-0004QW-G5; Tue, 25 Sep 2018 12:46:37 -0600 To: Bart Van Assche , linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-nvme@lists.infradead.org, linux-rdma@vger.kernel.org, linux-nvdimm@lists.01.org, linux-block@vger.kernel.org Cc: Stephen Bates , Christoph Hellwig , Keith Busch , Sagi Grimberg , Bjorn Helgaas , Jason Gunthorpe , Max Gurtovoy , Dan Williams , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , Benjamin Herrenschmidt , Alex Williamson , =?UTF-8?Q?Christian_K=c3=b6nig?= , Jens Axboe References: <20180925162231.4354-1-logang@deltatee.com> <20180925162231.4354-4-logang@deltatee.com> <1537896805.11137.25.camel@acm.org> From: Logan Gunthorpe Message-ID: <18e5d3f2-c56b-645b-ac96-f0d861d12cc2@deltatee.com> Date: Tue, 25 Sep 2018 12:46:30 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 In-Reply-To: <1537896805.11137.25.camel@acm.org> Content-Type: text/plain; charset=UTF-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 172.16.1.162 X-SA-Exim-Rcpt-To: axboe@kernel.dk, christian.koenig@amd.com, alex.williamson@redhat.com, benh@kernel.crashing.org, jglisse@redhat.com, dan.j.williams@intel.com, maxg@mellanox.com, jgg@mellanox.com, bhelgaas@google.com, sagi@grimberg.me, keith.busch@intel.com, hch@lst.de, sbates@raithlin.com, linux-block@vger.kernel.org, linux-nvdimm@lists.01.org, linux-rdma@vger.kernel.org, linux-nvme@lists.infradead.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, bvanassche@acm.org X-SA-Exim-Mail-From: logang@deltatee.com X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on ale.deltatee.com X-Spam-Level: X-Spam-Status: No, score=-8.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, GREYLIST_ISWHITE autolearn=ham autolearn_force=no version=3.4.1 Subject: Re: [PATCH v7 03/13] PCI/P2PDMA: Add PCI p2pmem DMA mappings to adjust the bus offset X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018-09-25 11:33 a.m., Bart Van Assche wrote: >> + /* >> + * p2pdma mappings are not compatible with devices that use >> + * dma_virt_ops. If the upper layers do the right thing >> + * this should never happen because it will be prevented >> + * by the check in pci_p2pdma_add_client() >> + */ >> + if (WARN_ON_ONCE(IS_ENABLED(CONFIG_DMA_VIRT_OPS) && >> + dev->dma_ops == &dma_virt_ops)) >> + return 0; > > Are you assuming that the compiler will optimize out the dev->dma_ops > == &dma_virt_ops test if CONFIG_DMA_VIRT_OPS=n such that no reference to the > dma_virt_ops symbol appears in the object file? Are you sure all compilers > and compiler versions that are used to build the Linux kernel will do that? Hmm, I can't say for certain but I would definitely expect any sane compiler to do so. It's a fairly obvious optimization and the kbuild robot is happy with it. I just did a test compile on 4.9 (which is the earliest compiler version I have readily available) and it worked fine. The minimum gcc the kernel supports is 4.6 right now. I've also done a similar test on godbolt.org[1] and can't find any compiler version that doesn't work. Logan [1] https://godbolt.org/z/d5Mhee