Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3024997imj; Mon, 11 Feb 2019 12:30:30 -0800 (PST) X-Google-Smtp-Source: AHgI3Ia2dZ12T2V2rMiAy2oa5ZZ+5LzVg4BJScnHL5uM4rlvIIrFIPESUQXLnQTz2NpTXEClg7M3 X-Received: by 2002:a63:535c:: with SMTP id t28mr86063pgl.128.1549917030215; Mon, 11 Feb 2019 12:30:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549917030; cv=none; d=google.com; s=arc-20160816; b=DfWUjrplMfjytTSSsKfUyFiamlui4DzT99e9WQzrDDgri1LYjtWa+vNoL461XlvGeV /beJrQavk0TarbyxevCMIt1gwuEc6jZJGwrHlRlMw/SdIRrIkjzm6hOq1r/8Vb/L9Ps2 PTJqpy8Bb5lmsBGzKMYKOZVrVvfANMMAZnJ54DD0229hpFd1QEtpMvLbk4hM2oGAGs1y NMpaif0YsuRIbrd0tEVbQW0BsPxfvbtB8cAOYygVd3MAlqTxQ/gZHeUcLz14n1of2Ucr VpSO0T2RgZLyU9PrLuSnh4a6lHkFflOKZb8KccOvcJdoqHWo9mH4y8pDXzZ0SYrWueBx asVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=Nj5+4EqD3IH7EqzU3cYCkHLND8mMcw71VzW0DiV0fZc=; b=kIVV0/L+4MJKDzt7/2RFIogbNkCzIKyNIJGhd5Q2UgZNH+KFujaftkntta58u5LPRP qJ2u7KDgnaHbGV5jRwTMpAle9K9z0V/Df7TOLgY68tVQ/A+V8NQc7c+WJ9ODOrHV5tKi CsXUMTUoRaqyGWqJDbDsw3PatEQt+S46DZMAp43cWINR9KboU5InXPt7eAHnf726/yW6 Z0YyDsaFxfmHXG2oeZ8qmoFIILUAV+518HUKs91n1F4JgkUiCpST32WVkY4gshoSzHae JVDPkyvbf9duj7Xtoqom+DV+a3gY5hMNQyy1wTCJ6N+6vjGZh4Nm+1PFIzEZLOp4eJYR q5Hg== 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 s129si10174829pgs.121.2019.02.11.12.30.14; Mon, 11 Feb 2019 12:30:30 -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 S1730355AbfBKRMH (ORCPT + 99 others); Mon, 11 Feb 2019 12:12:07 -0500 Received: from mail-qt1-f196.google.com ([209.85.160.196]:45834 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726244AbfBKRMH (ORCPT ); Mon, 11 Feb 2019 12:12:07 -0500 Received: by mail-qt1-f196.google.com with SMTP id e5so12954543qtr.12; Mon, 11 Feb 2019 09:12:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Nj5+4EqD3IH7EqzU3cYCkHLND8mMcw71VzW0DiV0fZc=; b=p/+hSZXTNW9GPM1Xgx4JYWDfrTjh4AFaXGNjyCvtuMHIIgIdvn8S5TPRGroJlQ1QVg 1Ab4nhZ6gzAmFckH4dTb1DqiIBpBl+9WfoqvgcMoejqLynaQl3JilJM3sZlOixggTzIf liBLWsRj1FM8HkYixRGScmHdEA+4FR1rKMkIwYyCTYGpaN6OmDEK0yS6HzRUarSFnebn gqFwurm5GANVUch6QAjhN3CeXjdDM/GB6PRjfVOMjnN2D3Chorww0TVddbwmoPXpaWWD TAUjs31BbNhMS2AiMnszsYmpGB3AStL586rqaV+VdF+F+FHuelEcHBocc9l8xZ5D0A98 DaUQ== X-Gm-Message-State: AHQUAuYbvLCir8SL62TqKz2OjAhvl+kUrgeAhTzjlvknIsc7GnWuZxfW KxA343RBUwjJERx/5NCATsZJvESl0qbDUZvmXAk= X-Received: by 2002:a0c:e98f:: with SMTP id z15mr8420739qvn.115.1549905125915; Mon, 11 Feb 2019 09:12:05 -0800 (PST) MIME-Version: 1.0 References: <20190109210706.GA27268@linux.ibm.com> <20190109210748.29074-5-paulmck@linux.ibm.com> <20190211153043.GC32385@fuggles.cambridge.arm.com> In-Reply-To: <20190211153043.GC32385@fuggles.cambridge.arm.com> From: Arnd Bergmann Date: Mon, 11 Feb 2019 18:11:48 +0100 Message-ID: Subject: Re: [PATCH RFC LKMM 5/7] docs/memory-barriers.txt: Enforce heavy ordering for port I/O accesses To: Will Deacon Cc: "Paul E. McKenney" , Linux Kernel Mailing List , linux-arch , Ingo Molnar , Alan Stern , Andrea Parri , Peter Zijlstra , Boqun Feng , Nicholas Piggin , David Howells , j.alglave@ucl.ac.uk, luc.maranget@inria.fr, Matthew Wilcox , Benjamin Herrenschmidt , David Laight , "open list:DOCUMENTATION" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 11, 2019 at 4:30 PM Will Deacon wrote: > Given the lack of Intel response here, I went away to do some digging. > As evidenced by the commit message, there is certainly an understanding > amongst some developers that inX/outX() are strongly ordered on x86 and > this was re-enforced by Linus in March last year: > > https://www.mail-archive.com/linuxppc-dev@lists.ozlabs.org/msg131212.html > > It was this information on which I based my patch. The Intel SDM is not > quite as assertive in its claims. > > However, it has also occurred to me that this patch is actually missing > the point. memory-barriers.txt should be documenting the *Linux* memory > model, not the x86 one, and so the port accessors should be defined to > have the same ordering semantics as the MMIO accessors. If this wasn't > the case, then macros such as ioreadX() and iowriteX() would be unusable > in portable driver code. My interpretation of the ioreadX() and iowriteX() semantics is that they only guarantee readl()/writel() barrier semantics, even though they may in fact provide stronger barriers for PIO on architectures that use CONFIG_GENERIC_IOMAP (which falls back to inX()/outX()). > The inX/outX implementation in asm-generic would > also be bogus, despite being widely used. They likely are. The asm-generic files tend to provide a generic abstraction as much as that is possible, but without having access to the architecture specific semantics, they raditionally don't know what should be done here. We now have __io_pbw()/__io_paw()/ __io_pbr()/__io_par() to let architectures get it right, but that is a fairly recent addition, so nothing other than riscv defines them today. To make things worse, a lot of machines are unable to provide __io_paw(), e.g. when all bus writes are posted. Arnd