Received: by 10.223.185.116 with SMTP id b49csp3237411wrg; Mon, 5 Mar 2018 17:15:27 -0800 (PST) X-Google-Smtp-Source: AG47ELviy63ie7TLo5kPSlSlNmoqayCJG8saIcGTAus3HGXt2Hlh/rv19+vK7bo7QSE7Qd3BDGDt X-Received: by 2002:a17:902:6f17:: with SMTP id w23-v6mr15021194plk.336.1520298927408; Mon, 05 Mar 2018 17:15:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520298927; cv=none; d=google.com; s=arc-20160816; b=lac8fJM5NvYVZCWVCP1+SRbqhJoYpEE/sGp/nY9S4lGwWKc+akr97i+FguI7OSMZVp dNqnGZC8bbyMUIjkY+0Z2Br3C/wH3V+7wh8pQ9mRGYivoCrlZ2m07vzmbbwVSbOqrQ4j y8pK7F1jmJm+z2kcqV1wJoO8nQzlLqGDJ9tLze1SjkKUl6WB6C9qCiFtiaXMn+TccqAL WNELwuH84GYcgYfrKzton1NPgB2NJQxkCNnNaX/14N8PiK/K+pjpRJo9cnmVXxkh12w2 RkTNHEOaOXzb6yn61yMBObQZz0Pera2TfkFptoswWTWWt79+ESei1L5d6PnLBWIluyCq vEmw== 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=Y7OrRyFlb+7zvPJhoq37GfEBQ+Wa8CAV004cPCT6lhY=; b=v+qsu/udYBHQgSjS7H9L2O2r+lCmzpE4wDCiqRIb7YJ/JGsPsHV/4CyabPZ6aZrzdg PXcz8EVhMPmv+O4RyrUif89nP3ut9rfHobne4uWdgPVEFKyPThedfsGMv8NfhFVysplE 3rai4BRSKOV4rIQgPazKAdffTTEGIdq8Hdtjd5a76jwbAlOfoBqScT8fosAmw6Qk+HfI uFNE23nn8fHH1kUFrD/U9y/vd505yFKTezsKHKPlEAKODPGbT9otk9xqR4XexCIC8YqN hm4ZCcXLNJovROpy6LQkAI3zhGmewEUeAYOB4Cbb7JR9oLTv5JJFAqew61G1cNf6bgOC /GRQ== 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 u24si4883523pfh.326.2018.03.05.17.15.13; Mon, 05 Mar 2018 17:15:27 -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 S1753120AbeCFBOS (ORCPT + 99 others); Mon, 5 Mar 2018 20:14:18 -0500 Received: from ale.deltatee.com ([207.54.116.67]:37326 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753039AbeCFBOP (ORCPT ); Mon, 5 Mar 2018 20:14:15 -0500 Received: from guinness.priv.deltatee.com ([172.16.1.162]) by ale.deltatee.com with esmtp (Exim 4.89) (envelope-from ) id 1et1B7-0007dA-FC; Mon, 05 Mar 2018 18:14:06 -0700 To: Oliver Cc: Keith Busch , 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, Jens Axboe , Benjamin Herrenschmidt , Alex Williamson , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , Jason Gunthorpe , Bjorn Helgaas , Max Gurtovoy , Christoph Hellwig References: <20180228234006.21093-1-logang@deltatee.com> <20180228234006.21093-8-logang@deltatee.com> <20180305160004.GA30975@localhost.localdomain> <3f56c76d-6a5c-7c2f-5442-c9209749b598@deltatee.com> From: Logan Gunthorpe Message-ID: <416d8d27-200f-befb-1c30-14544fffcba0@deltatee.com> Date: Mon, 5 Mar 2018 18:14:02 -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: 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: hch@lst.de, maxg@mellanox.com, bhelgaas@google.com, jgg@mellanox.com, jglisse@redhat.com, alex.williamson@redhat.com, benh@kernel.crashing.org, axboe@kernel.dk, 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, keith.busch@intel.com, oohall@gmail.com 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 05:49 PM, Oliver wrote: > It's in arch/powerpc/kernel/io.c as _memcpy_toio() and it has two full barriers! > > Awesome! > > Our io.h indicates that our iomem accessors are designed to provide x86ish > strong ordering of accesses to MMIO space. The git log indicates > arch/powerpc/kernel/io.c has barely been touched in the last decade so > odds are most of that code was written in the elder days when people > were less aware of ordering issues. It might just be overly conservative > by today's standards, but maybe not (see below). Yes, that seems overly conservative. > (I'm not going to suggest ditching the lwsync trick. mpe is not going > to take that patch > without a really good reason) Well, that's pretty gross. Is this not exactly the situation mmiowb() is meant to solve? See [1]. Though, you're right in principle. Even if power was similar to other systems in this way, it's still a risk that if these pages get passed somewhere in the kernel that uses a spin lock like that without an mmiowb() call, then it's going to have a bug. For now, the risk is pretty low as we know exactly where all the p2pmem pages will be used but if it gets into other places, all bets are off. I did do some work trying to make a safe version of io-pages and also trying to change from pages to pfn_t in large areas but neither approach seemed likely to get any traction in the community, at least not in the near term. Logan [1] ACQUIRES VS I/O ACCESSES in https://www.kernel.org/doc/Documentation/memory-barriers.txt