Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752330AbeAESPA (ORCPT + 1 other); Fri, 5 Jan 2018 13:15:00 -0500 Received: from ale.deltatee.com ([207.54.116.67]:46336 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752121AbeAESO6 (ORCPT ); Fri, 5 Jan 2018 13:14:58 -0500 To: Marta Rybczynska Cc: 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, Stephen Bates , Christoph Hellwig , Jens Axboe , Keith Busch , Sagi Grimberg , Bjorn Helgaas , Jason Gunthorpe , Max Gurtovoy , Dan Williams , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , Benjamin Herrenschmidt References: <20180104190137.7654-1-logang@deltatee.com> <20180104190137.7654-10-logang@deltatee.com> <281272464.115248600.1515166226009.JavaMail.zimbra@kalray.eu> From: Logan Gunthorpe Message-ID: Date: Fri, 5 Jan 2018 11:14:38 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <281272464.115248600.1515166226009.JavaMail.zimbra@kalray.eu> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 172.16.1.162 X-SA-Exim-Rcpt-To: 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, axboe@kernel.dk, 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, mrybczyn@kalray.eu X-SA-Exim-Mail-From: logang@deltatee.com Subject: Re: [PATCH 09/12] nvme-pci: Use PCI p2pmem subsystem to manage the CMB 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 List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On 05/01/18 08:30 AM, Marta Rybczynska wrote: >> @@ -429,10 +429,7 @@ static void __nvme_submit_cmd(struct nvme_queue *nvmeq, >> { >> u16 tail = nvmeq->sq_tail; >> >> - if (nvmeq->sq_cmds_io) >> - memcpy_toio(&nvmeq->sq_cmds_io[tail], cmd, sizeof(*cmd)); >> - else >> - memcpy(&nvmeq->sq_cmds[tail], cmd, sizeof(*cmd)); >> + memcpy(&nvmeq->sq_cmds[tail], cmd, sizeof(*cmd)); >> > > Why is it always memcpy() and not memcpy_toio()? I'd expect something like > if (nvmeq->sq_cmds_is_io) > memcpy_toio(&nvmeq->sq_cmds_io[tail], cmd, sizeof(*cmd)); > else > memcpy(&nvmeq->sq_cmds[tail], cmd, sizeof(*cmd)); We're going on the assumption that memory mapped with devm_memremap_pages() can be treated as regular memory. So memcpy_toio is not necessary for P2P memory. Logan