Received: by 10.213.65.68 with SMTP id h4csp481363imn; Tue, 20 Mar 2018 07:55:37 -0700 (PDT) X-Google-Smtp-Source: AG47ELveN0zjiNep+IfE4qySxZzMOFBszVbL3VDUOgIxbdssp7uKYrm9GPh8OkJhcrEbJbVwKK59 X-Received: by 2002:a17:902:5845:: with SMTP id f5-v6mr17244474plj.164.1521557737887; Tue, 20 Mar 2018 07:55:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521557737; cv=none; d=google.com; s=arc-20160816; b=fDX0Bqc/TdcUrf4l/TwzjQalGfLtFS5JtkfNpTYnRNHIo51Kt/PUge0XgK8l86NPCY Gns2WSM8GzBNr10fupKuHiZjfSe8/3VgsrJLRAB/kKNr9ns+mwvPexMHgHjUEZeJkB9k PSa2JtdLip+TRLz/ZAnrutWaH8RC0/tlBWnjbQ65g0MI/RjXG40gPEChnr82LqvkvhUR cEN6w1duD8Tk00E4WE1wVHHINoyL7rbbx8X+3lmpeGSDcsSjIFsMPOlCNxzIW8ldqe/V 4TtiAtk/h3/BWRX16Hc9fswZVO/AdUMCJc1kjPHmr5ADNkHGZSJCdBzBaCOBWO/PPr+L 5MgA== 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=6ALRJJc8X0z75BsGsMqwQqI1oOXYCligkjEZA4hPE/c=; b=xMygcrjZ1kAFRzp/R/yC46G0dcZoNPNQu8afkquIM3IJ0KACAHf24EuR/xiV73odJ7 qd3OxeCXF0Bwf6BYtA37zwsHbTiDcLvZsRqXlSS88YcGCvIVkBViXQ8k8W5baYJu9huT rn5c13jfdNalySis8T2M7TYhezN1dS6UW7a0xyR5ixi9puJ4OyJZt32NwX2No37/nKNi V5wkewnzjh3B4yKogdd2wiIE7o/JgcT9sn4WkKEgaYm3/p3z+xUl/aQkhuDzdeAP8eLA 6YjjTL3RCk/uNsGcdOEpgXpursC8fA3si3A2ugpC0C2jxt0qB5icStRaGRYk4bi1udAn osRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=I4Absu05; 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 y2-v6si1682936plh.649.2018.03.20.07.55.23; Tue, 20 Mar 2018 07:55:37 -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=I4Absu05; 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 S1751521AbeCTOyZ (ORCPT + 99 others); Tue, 20 Mar 2018 10:54:25 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:44948 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751269AbeCTOyV (ORCPT ); Tue, 20 Mar 2018 10:54:21 -0400 Received: by mail-wr0-f196.google.com with SMTP id u46so1987672wrc.11 for ; Tue, 20 Mar 2018 07:54:20 -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=6ALRJJc8X0z75BsGsMqwQqI1oOXYCligkjEZA4hPE/c=; b=I4Absu05eAwrFpRbf6dnYrqu5X1XlKxcZ4DciETJTKGWPZkdGilsdPPv6sb//84taM PGMTVCYdaDbZYcuwwvBvCaFAUq+4WmSw41ij2wpwPweujEyMn8fsHQmUQXysv2OtL/EZ QbHJtqtFBKpFPeaoDwquUJSLtkKosvNKf5hS+cbLn4XmsRrfe5+rmVq9Wvag8zoyXxWi wBFoMKv0q2TGDOPqWXYPY8wWgjpp+gKkYZu3HrBzDUywR+2sJfpN5zM4i2ZI4rmF54hd rK2LgJE9OTLDAAnYeDY7/uzuttiTaOSEIOeqMuSClez4A5x6ZAR8VYD7V5fM5xdaHT1D 3SPw== 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=6ALRJJc8X0z75BsGsMqwQqI1oOXYCligkjEZA4hPE/c=; b=KCnEuY+/52wj/a4fPv0JkhLw4FGchiYYRv+V1EkVq6AYn1ShhGCS0kjPrWwRAMnH8Z SBoMkcdtw6uezof7rsngfox96y94vdgCScxsFG9X0XBlHXfas+iKiTNri4IChQnnXnnb czwsSZSfKt3BVySy/oE3/pkBSDPFLpeh1EA8ET5UmMww8UirCczNDPRyX4wkDNJowAvE YEFtZ5yD/KJsLCcbOWLgjuwd7tnp1cyH+Cyiy3DtF83emUfzqW1jQynAiJDZo0ztA+03 lOqkOxhi1ou+IJF84mrgozoa/24bqRn9X4I6+InedfmexLfxEKc0pDDHYf2cKj5/jrrs VH9w== X-Gm-Message-State: AElRT7EoYkW2FvFntqaO38OxFgVcM1IIQo6w1qFxr3OII9mNGI30QGm5 X4nUlCxMu5HkhD8cvGZsTu/5bM3aIu4= X-Received: by 10.223.152.80 with SMTP id v74mr12586446wrb.163.1521557659997; Tue, 20 Mar 2018 07:54:19 -0700 (PDT) Received: from ziepe.ca (S010614cc2056d97f.ed.shawcable.net. [174.3.196.123]) by smtp.gmail.com with ESMTPSA id t196sm894662wme.35.2018.03.20.07.54.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Mar 2018 07:54:17 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.86_2) (envelope-from ) id 1eyIeT-0006BO-RX; Tue, 20 Mar 2018 08:54:13 -0600 Date: Tue, 20 Mar 2018 08:54:13 -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, Faisal Latif , Doug Ledford , linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 5/6] IB/nes: Eliminate duplicate barriers on weakly-ordered archs Message-ID: <20180320145413.GH19744@ziepe.ca> References: <1521514068-8856-1-git-send-email-okaya@codeaurora.org> <1521514068-8856-6-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-6-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:47PM -0400, Sinan Kaya wrote: > Code includes barrier() 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. > > Create a new wrapper function with relaxed write operator. Use the new > wrapper when a write is following a barrier(). > > Signed-off-by: Sinan Kaya > drivers/infiniband/hw/nes/nes.h | 5 +++++ > drivers/infiniband/hw/nes/nes_hw.c | 21 ++++++++++++++------- > drivers/infiniband/hw/nes/nes_mgt.c | 15 ++++++++++----- > drivers/infiniband/hw/nes/nes_nic.c | 2 +- > drivers/infiniband/hw/nes/nes_utils.c | 3 ++- > drivers/infiniband/hw/nes/nes_verbs.c | 5 +++-- > 6 files changed, 35 insertions(+), 16 deletions(-) > > diff --git a/drivers/infiniband/hw/nes/nes.h b/drivers/infiniband/hw/nes/nes.h > index 00c27291..85e007d 100644 > +++ b/drivers/infiniband/hw/nes/nes.h > @@ -387,6 +387,11 @@ static inline void nes_write_indexed(struct nes_device *nesdev, u32 reg_index, u > spin_unlock_irqrestore(&nesdev->indexed_regs_lock, flags); > } > > +static inline void nes_write32_relaxed(void __iomem *addr, u32 val) > +{ > + writel_relaxed(val, addr); > +} This wrapper is pointless, let us not add more.. > static inline void nes_write32(void __iomem *addr, u32 val) > { > writel(val, addr); > diff --git a/drivers/infiniband/hw/nes/nes_hw.c b/drivers/infiniband/hw/nes/nes_hw.c > index 18a7de1..568e17d 100644 > +++ b/drivers/infiniband/hw/nes/nes_hw.c > @@ -1257,7 +1257,8 @@ int nes_destroy_cqp(struct nes_device *nesdev) > > barrier(); > /* Ring doorbell (5 WQEs) */ > - nes_write32(nesdev->regs+NES_WQE_ALLOC, 0x05800000 | nesdev->cqp.qp_id); > + nes_write32_relaxed(nesdev->regs+NES_WQE_ALLOC, > + 0x05800000 | nesdev->cqp.qp_id); barrier() is not strong enough to order writel, so this doesn't seem right? It is probably noteven strong enough for what this driver thinks it is doing.. This driver is essentially dead and broken, probably just don't change it. Jason