Received: by 10.213.65.68 with SMTP id h4csp477607imn; Tue, 20 Mar 2018 07:49:55 -0700 (PDT) X-Google-Smtp-Source: AG47ELvY1ehXMaQvUXUAFZKmRM2DCPklMLbuGOPniypZJI8VaE2K/76ATcp7ptkmgL6GmdSzwwmY X-Received: by 10.99.124.1 with SMTP id x1mr12131407pgc.318.1521557395703; Tue, 20 Mar 2018 07:49:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521557395; cv=none; d=google.com; s=arc-20160816; b=s3J0O1yQWDN/Byy0FeT/JRiOceiMUagdkYI9dQnATZmVvVfG3aAXWOFPhXlaIirka2 Yqp5FQgMDqIjN+NYAy9QzYXujisN/bnwpZjaM/j7qOkVCCzjW22nb3ab8QiB4gUuDhyR jaAFwj8Z8g1+OcRB/9Rj+wS/ndOFoLh7dKUCaQfOk6HkYUAbfdefJAEtJCTC058jzTyw U5BbGQrj7otmZlsH8E7ekNkkMxUmpQXzTeYj/AcYL0zWwm9XmeAxi0a9l2tIAYFPJiyZ VqdSavUfyjP0XskdvRumpsEdSvsQLJvj8Bji7jC76vG8RnPeO0Rbmi415Scega9qHxil HVxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=hgusEvvIAXXPHJrYVAiAj0DJdO2OoeBZUwpqDPTHT30=; b=bzD1pN1huDM5mZw0s7C7y+h16gdBP4VIalcqCGnj6jtwXLbNArwuMaLrR64xDs5mPB mRJnUCzEkee/hg1WEij0i94PFZDji9vIhCngi1ROEz/SqBMfpWw++fTlrYohvFg7cWeN pdz8V4qFc3PqozIUFMgXfhkFy/XMKqUT55s9Ej5D53aCiPocH6tXos8W3bf2P320kZ09 xoGCZk6GzHXlagNwTLXgoyy/0Q1H6kgODexczojKX5EHVJmn1wxrmtPRH6jYT3GUfoPG qmizz8amTiV1vx/RtPwfzOylxccbH0LSNNj36EjNsov3ez87Cn2hEm/XZQlfQbKCqJyk 9Q4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=fWkP1bI2; 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 s10si1414632pfi.143.2018.03.20.07.49.41; Tue, 20 Mar 2018 07:49:55 -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=pass header.i=@ziepe.ca header.s=google header.b=fWkP1bI2; 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 S1751745AbeCTOsW (ORCPT + 99 others); Tue, 20 Mar 2018 10:48:22 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:34593 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751701AbeCTOsQ (ORCPT ); Tue, 20 Mar 2018 10:48:16 -0400 Received: by mail-wm0-f66.google.com with SMTP id a20so17674046wmd.1 for ; Tue, 20 Mar 2018 07:48:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=hgusEvvIAXXPHJrYVAiAj0DJdO2OoeBZUwpqDPTHT30=; b=fWkP1bI26m1Idj41gVxLOBKGmvyinxoIrFbOVM8IIcx5fNBGPKPDJM5a5C3SKT6q7Z yJ4dsJuG63drTH9edFkzw133O22ZH3hM+cVuMoybCPi7A4PA7UgVwsuo7+hRTAwAVM1B 1AIr/Zc/+JEuVFfumv5FDVmOjpROyOvNMimPF/nuwg4bZadHSH9WjTeoxrUGluzL/9d1 CjQ47w3SK2JFZDxxUznXNcf0AM6sKu46FReLvAOszCMWRlWXo1cR6s/89Yjf/VMR51GQ aVBYEuvoya+SC+izjWuhJFjCDMBLB6IaKvGjXoTDFzpLAZiF8HVLDqpNJX7xQnO0mhzE AZhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=hgusEvvIAXXPHJrYVAiAj0DJdO2OoeBZUwpqDPTHT30=; b=oRuOVnjyIw1qNJNE8GUlX4tQoqXcbmyVz/kqjW2wSihUEf+BSTbnmI9xoKnTXGO9al tp8IoBwEqvD6hKGiXqT5Qe/qRy1ul0n1iL/O0FNOGdcC+6huRr0Lfxp/hzbJ240h3/yZ 13JLsktOxifd91Xs51DUIxHeAiFAzQTHQ//R8zdLLQC5fo+S2xUs6Xdv8p8+foNQSP7x aYHVlxodmpuX4krlHSCextPF3drUijFsLZUroHZOEJzr6TjlSQ8Ssk2ES58viv62NGAL V3Zr9zz5eaYpirC370v/5U/ed40+bVSKQ2WqFYRJeLbUq99/Nm9kRd+ZBK3Aak3XcDAT nUlA== X-Gm-Message-State: AElRT7EcNSAptpwsBzO0KyfbHbZOhM+4Tp7cj2UxscXXtIa/etU26IFY IaUe/HWX0jFqnm3srVDqz76TmA== X-Received: by 10.28.19.13 with SMTP id 13mr1668755wmt.89.1521557295011; Tue, 20 Mar 2018 07:48:15 -0700 (PDT) Received: from ziepe.ca (S010614cc2056d97f.ed.shawcable.net. [174.3.196.123]) by smtp.gmail.com with ESMTPSA id l16sm4039218wma.41.2018.03.20.07.48.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Mar 2018 07:48:05 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.86_2) (envelope-from ) id 1eyIYT-00066n-8b; Tue, 20 Mar 2018 08:48:01 -0600 Date: Tue, 20 Mar 2018 08:48:01 -0600 From: Jason Gunthorpe To: Sinan Kaya Cc: linux-rdma@vger.kernel.org, timur@codeaurora.org, sulrich@codeaurora.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Selvin Xavier , Devesh Sharma , Somnath Kotur , Sriharsha Basavapatna , Doug Ledford , linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 1/6] RDMA/bnxt_re: Eliminate duplicate barriers on weakly-ordered archs Message-ID: <20180320144801.GE19744@ziepe.ca> References: <1521514068-8856-1-git-send-email-okaya@codeaurora.org> <1521514068-8856-2-git-send-email-okaya@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1521514068-8856-2-git-send-email-okaya@codeaurora.org> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 19, 2018 at 10:47:43PM -0400, Sinan Kaya wrote: > Code includes wmb() followed by writel(). writel() already has a barrier on > some architectures like arm64. > > This ends up CPU observing two barriers back to back before executing the > register write. > > Since code already has an explicit barrier call, changing writel() to > writel_relaxed(). > > Signed-off-by: Sinan Kaya > drivers/infiniband/hw/bnxt_re/qplib_rcfw.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c b/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c > index 8329ec6..4a6b981 100644 > +++ b/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c > @@ -181,10 +181,10 @@ static int __send_message(struct bnxt_qplib_rcfw *rcfw, struct cmdq_base *req, > > /* ring CMDQ DB */ > wmb(); > - writel(cmdq_prod, rcfw->cmdq_bar_reg_iomem + > - rcfw->cmdq_bar_reg_prod_off); > - writel(RCFW_CMDQ_TRIG_VAL, rcfw->cmdq_bar_reg_iomem + > - rcfw->cmdq_bar_reg_trig_off); > + writel_relaxed(cmdq_prod, rcfw->cmdq_bar_reg_iomem + > + rcfw->cmdq_bar_reg_prod_off); > + writel_relaxed(RCFW_CMDQ_TRIG_VAL, rcfw->cmdq_bar_reg_iomem + > + rcfw->cmdq_bar_reg_trig_off); Woah, this may not be safe.. The definition of writel_relaxed() is that it is fully unordered, so the above two writes may change order now. Broadcom guys would have to ack if that it is OK or not for their hardware. In general this is not an OK approach for a mechanical conversion.. Only the first writel can be convereted. You need to check all your patches to make sure there are no subsequent writel's in the places touched. Jason