Received: by 10.223.185.116 with SMTP id b49csp3001935wrg; Mon, 5 Mar 2018 12:15:04 -0800 (PST) X-Google-Smtp-Source: AG47ELuYqPSR7VsYvA9bMSo22UPLKyhLgS1fx+IhFF9BV0UtGTH1kC9L3ETOhasx+ORxYwnIMT8w X-Received: by 10.101.99.90 with SMTP id p26mr11869084pgv.135.1520280904081; Mon, 05 Mar 2018 12:15:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520280904; cv=none; d=google.com; s=arc-20160816; b=etK1TBpXHzSFiYOs8qc+FwZPi9X1cTX0XrBOAfMeFuY3LitUz+blQVna+frZ7q2D7z /o8dbbtPj/T3OUNDn3l9uzfyImZZ1Bx+kyjyD2xicrFuTJUpaD9L2vHsR81VKZax+aSO 3LmzwJjmfjUEpZq3hKSoNVaduOTPWWyqUVXtLDeVJv/u4zdbGMCAnBR0MxSLkkL/MZF3 KtVEPoIBrNzwa9trwDw9KDOCyji7glohUXkoQzJKgyelB8M0B60Cb300NTOvVxtL5hDz o+hbsXZEoZ7o5GcKGsMEbeHOwBBRBIpBcljBlpE3wfTISnZqvl6/oIkAJ97Ne9x2Y068 QfLQ== 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:arc-authentication-results; bh=+7mnJTWOfMkJjpeUXLDkM2PDBeAhey/M9kgXNWcCaZU=; b=pen6j34sZ7lDh4ZdL483fJdy+vN6sSaHKdNi7udVmOAM3FV9cOMhfdF+f1PClMMl4S uq2pRun8lpc386WdjJiS5M0BtoA7BZVjlN84RYaxkVqfx3UEYmWA1EO3MJIURtzoWvZp 1QO6hHup2H1QdvQtPQ6kRILZtxRY5QXSOLJtUYlpPxLLmKBX/pH7kB/w71Pnhk1pdlhj 5JmSF0zXW9651mbNVVvW6fk2ATWAl4KHXMrGy4i/qGentgU1WJaZ3cppzjsdiH2u0fJY wwBGVXyXpJHKnYEsCF/jSYOseSB/2Fvxqzmu0WqiRA5I9gsjx3o5vkHaBHdquifzIG3q pP1w== 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 l77si10778902pfk.210.2018.03.05.12.14.49; Mon, 05 Mar 2018 12:15:04 -0800 (PST) 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 S1752987AbeCEUNn (ORCPT + 99 others); Mon, 5 Mar 2018 15:13:43 -0500 Received: from ale.deltatee.com ([207.54.116.67]:35442 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752917AbeCEUNl (ORCPT ); Mon, 5 Mar 2018 15:13:41 -0500 Received: from guinness.priv.deltatee.com ([172.16.1.162]) by ale.deltatee.com with esmtp (Exim 4.89) (envelope-from ) id 1eswUF-0003KD-MN; Mon, 05 Mar 2018 13:13:32 -0700 To: Sagi Grimberg , Keith Busch , Oliver Cc: Jens Axboe , "linux-nvdimm@lists.01.org" , linux-rdma@vger.kernel.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, Alex Williamson , Jason Gunthorpe , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , Benjamin Herrenschmidt , Bjorn Helgaas , Max Gurtovoy , Christoph Hellwig References: <20180228234006.21093-1-logang@deltatee.com> <20180228234006.21093-8-logang@deltatee.com> <20180305160004.GA30975@localhost.localdomain> <36c78987-006a-a97f-1d18-b0a08cbea9d4@grimberg.me> From: Logan Gunthorpe Message-ID: Date: Mon, 5 Mar 2018 13:13:20 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <36c78987-006a-a97f-1d18-b0a08cbea9d4@grimberg.me> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 172.16.1.162 X-SA-Exim-Rcpt-To: hch@lst.de, maxg@mellanox.com, bhelgaas@google.com, benh@kernel.crashing.org, jglisse@redhat.com, jgg@mellanox.com, alex.williamson@redhat.com, linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-rdma@vger.kernel.org, linux-nvdimm@lists.01.org, axboe@kernel.dk, oohall@gmail.com, keith.busch@intel.com, sagi@grimberg.me 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,T_RP_MATCHES_RCVD autolearn=ham autolearn_force=no version=3.4.1 Subject: Re: [PATCH v2 07/10] 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/03/18 12:57 PM, Sagi Grimberg wrote: > Keith, while we're on this, regardless of cmb, is SQE memcopy and DB > update ordering always guaranteed? > > If you look at mlx4 (rdma device driver) that works exactly the same as > nvme you will find: > -- >                 qp->sq.head += nreq; > >                 /* >                  * Make sure that descriptors are written before >                  * doorbell record. >                  */ >                 wmb(); > >                 writel(qp->doorbell_qpn, >                        to_mdev(ibqp->device)->uar_map + > MLX4_SEND_DOORBELL); > >                 /* >                  * Make sure doorbells don't leak out of SQ spinlock >                  * and reach the HCA out of order. >                  */ >                 mmiowb(); > -- To me, it looks like the wmb() is redundant as writel should guarantee the order. (Indeed, per Sinan's comment, writel on arm64 starts with a wmb() which means, on that platform, there are two wmb() calls in a row.) The mmiowb() call, on the other hand, looks correct per my understanding of it's purpose with respect to the spinlock. Logan