Received: by 10.192.165.156 with SMTP id m28csp1627352imm; Tue, 17 Apr 2018 02:39:00 -0700 (PDT) X-Google-Smtp-Source: AIpwx4862Oz144v855iNzCYTkRRPdepem7IaZ2le2vnqmwzMd9r13QRH+kYCSaT/xmMZWFjPwMKJ X-Received: by 10.98.160.68 with SMTP id r65mr1294408pfe.235.1523957940854; Tue, 17 Apr 2018 02:39:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523957940; cv=none; d=google.com; s=arc-20160816; b=tmDj4K5QRIsmNjyfodEPdf7sQcQMQAUIKAGIfcmXwVeoh0jchQiKd+Mk5qTZV8mm+G yCTYtCj1kX1pkfG0j9dTLNFTfIcVclcP9czbpHcLmjmHrvWtLIIIPboEGULEYSYiso3L gXR9g7j/Zr+gZcx9Q6u59OBkyNI3I50aWp8zHT7VKq71C3V1jk8K+ZoTnPwEcNznL2Ly LIxgxWHF+B2ryds0jWDol2MXf7T5G1fdRfjs3+TkYCoIo1rsqvpSqjZT1zzKjmGIsoM6 dGTrZRIVCqOmtGw9h0ZNXrnC7m7vuplG4AtQK8CKve9aAf5G3mlr+7Zg52kgpsC4cEex aXmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :dkim-signature:arc-authentication-results; bh=UK5bb8EyfWXjDtATuvP+QjzAPzEV8g9ERey1tU0DL14=; b=nZl7eE8DB6YVcqqKULhY7owNpFJpy/x7/HClsr3ewxYoU9nAZiuOeolPuuP1kKW91F m4Ez3VPQZ1AANILw2GC2nSC4kA6gkIcc/nUWuIb0cz7njMHG4AUGpP/OAfjRdl4u+O3R qI5TsiP4GUqMnE+5AuwRG94eU3OfNTjCAXRonzwCtX/DtT85MZw77ORQSQIvdZOxSXC6 59QJnuxF4cc/PoYAjpTU5dvQSONICam5TU+eIj1BCpOKcNjzfcK82BUdHO6aD0GF9h5Q QQ7mOn7WLIGHVdBA1v/A1X4m/bgHW3UWrGv95v1A2QYxtll1nb3umP6oiWs+ruJAqE+5 HDLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@hansenpartnership.com header.s=20151216 header.b=iKx2ENFV; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=hansenpartnership.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s22-v6si4344992plp.216.2018.04.17.02.38.46; Tue, 17 Apr 2018 02:39:00 -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; dkim=fail header.i=@hansenpartnership.com header.s=20151216 header.b=iKx2ENFV; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=hansenpartnership.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752659AbeDQJhn (ORCPT + 99 others); Tue, 17 Apr 2018 05:37:43 -0400 Received: from bedivere.hansenpartnership.com ([66.63.167.143]:49588 "EHLO bedivere.hansenpartnership.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751211AbeDQJhk (ORCPT ); Tue, 17 Apr 2018 05:37:40 -0400 Received: from localhost (localhost [127.0.0.1]) by bedivere.hansenpartnership.com (Postfix) with ESMTP id 631688EE264; Tue, 17 Apr 2018 02:37:39 -0700 (PDT) Received: from bedivere.hansenpartnership.com ([127.0.0.1]) by localhost (bedivere.hansenpartnership.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id PHlny5JYO23N; Tue, 17 Apr 2018 02:37:39 -0700 (PDT) Received: from [192.168.0.46] (cpc91566-seac25-2-0-cust518.7-2.cable.virginm.net [86.0.94.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by bedivere.hansenpartnership.com (Postfix) with ESMTPSA id 18D978EE0E2; Tue, 17 Apr 2018 02:37:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=hansenpartnership.com; s=20151216; t=1523957859; bh=h1GP6zKFGnPBy0ZeyllCutlNl/ypAYzHJt7/9/vqVbw=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=iKx2ENFVYipZudhfaIuG24RRKBD2NfclvaSUdYYDcxEGvCGN9Q204j64n8xq5sxZ0 RfhE19HLspvHIr+6DaCYPdnJ6Jtju6LJ8HTGWIuUCxy+AHZiPJViTwzv+74bpr8dfh +4xf7smwdqYxcWzHxmrZXEgj12UqwBvDGfSYq8ZA= Message-ID: <1523957852.3250.9.camel@HansenPartnership.com> Subject: Re: [PATCH v2 2/2] parisc: define stronger ordering for the default readX() From: James Bottomley To: Sinan Kaya , linux-parisc@vger.kernel.org, arnd@arndb.de, timur@codeaurora.org, sulrich@codeaurora.org Cc: linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Helge Deller , Philippe Ombredanne , Kate Stewart , Thomas Gleixner , Greg Kroah-Hartman , linux-kernel@vger.kernel.org Date: Tue, 17 Apr 2018 10:37:32 +0100 In-Reply-To: <1523938133-3224-2-git-send-email-okaya@codeaurora.org> References: <1523938133-3224-1-git-send-email-okaya@codeaurora.org> <1523938133-3224-2-git-send-email-okaya@codeaurora.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.22.6 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2018-04-17 at 00:08 -0400, Sinan Kaya wrote: > parisc architecture seems to be mapping readX() and readX_relaxed() > APIs > to __raw_readX() API. > > __raw_readX() API doesn't provide any kind of ordering guarantees. > commit 032d59e1cde9 ("io: define stronger ordering for the default > readX() > implementation") changed asm-generic implementation to use a more > conservative approach towards the readX() API. I don't follow your logic here. function calls (even inline ones) are sequence points and the compiler guarantees volatile variables are stable before sequencing, so these two rules strictly compile order the raw_read/write because the address is volatile. > Place a barrier() after the register read so that compiler doesn't > optimize across the regiter operation. barrier() provides exactly the same guarantees as the sequence point/volatile already above, so it seems to be completely unnecessary. Perhaps if you gave an example of the actual problem you're trying to fix we could assess if it affects parisc. James > Signed-off-by: Sinan Kaya > --- >  arch/parisc/include/asm/io.h | 23 +++++++++++++++++++---- >  1 file changed, 19 insertions(+), 4 deletions(-) > > diff --git a/arch/parisc/include/asm/io.h > b/arch/parisc/include/asm/io.h > index 2ec6405..e04c4ef 100644 > --- a/arch/parisc/include/asm/io.h > +++ b/arch/parisc/include/asm/io.h > @@ -179,19 +179,34 @@ static inline void __raw_writeq(unsigned long > long b, volatile void __iomem *add >   >  static inline unsigned char readb(const volatile void __iomem *addr) >  { > - return __raw_readb(addr); > + unsigned char ret; > + > + ret = __raw_readb(addr); > + barrier(); > + return ret; >  } >  static inline unsigned short readw(const volatile void __iomem > *addr) >  { > - return le16_to_cpu((__le16 __force) __raw_readw(addr)); > + unsigned short ret; > + > + ret = le16_to_cpu((__le16 __force) __raw_readw(addr)); > + barrier(); > + return ret; >  } >  static inline unsigned int readl(const volatile void __iomem *addr) >  { > - return le32_to_cpu((__le32 __force) __raw_readl(addr)); > + unsigned int ret; > + ret = le32_to_cpu((__le32 __force) __raw_readl(addr)); > + barrier(); > + return ret; >  } >  static inline unsigned long long readq(const volatile void __iomem > *addr) >  { > - return le64_to_cpu((__le64 __force) __raw_readq(addr)); > + unsigned long long ret; > + > + ret = le64_to_cpu((__le64 __force) __raw_readq(addr)); > + barrier(); > + return ret; >  } >   >  static inline void writeb(unsigned char b, volatile void __iomem > *addr)