Received: by 10.213.65.68 with SMTP id h4csp504638imn; Tue, 20 Mar 2018 08:24:58 -0700 (PDT) X-Google-Smtp-Source: AG47ELtlZByV7DumZHeohD4ParlwrqQ/iQTO30WVr6NZHwFcBp+iwKNcFlNP7D8jA9jrntCXfu8H X-Received: by 2002:a17:902:3041:: with SMTP id u59-v6mr16634329plb.115.1521559498632; Tue, 20 Mar 2018 08:24:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521559498; cv=none; d=google.com; s=arc-20160816; b=sIh+oovWsdx6Bsn9Svfa55T7BovHoiS1a/yy1p4vltCwuXI9zT9fMpEO6AOWuckUmr Qdksx/6vBD+QmXyZwPu5w/eGbN9KrGu4XEPkRQQ/1gHGYYBEjHoiHK1zXBXGK7S/aKuX OP8/bMxSBTLs8KASWf2MqapTF+bN4T9YFjgtmZKtf/J86M2eEcrGNNg7s/srhpL5AO3H v+WOStmWHZuXr8mTisnD8g2/q1V1Op+5ko9pBAAYcmH5d9inNnkhARtT4MTu2M0bG/WQ 94CiLojznUcMD0sUMWcyveBsBxtBH3tEDGoDNWW7M8BsAlhCDMHLv5ALrL7XZLGDPjlG 0KBw== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dmarc-filter :dkim-signature:dkim-signature:arc-authentication-results; bh=db2vOq8jYFtt22Yep/JgvpbQs+aGSlNtHP0Lu/EL8QM=; b=0hPOWn/bluTvdz/a4dtajr0wPbVlR8sWv583oAKzZ458UwYfuoNmeaQWFGWzXL+tkf 4thg5N3lXt4kmHi8n7D3dxrG0490f8+OkY2w5ALA9PHSUYckAcSPcpR0X9kxCYVNrEKi RHkBQe3zI8Q6x3JNwBBhv8ft85vaaKqBKW1Urcl5Qd5W1xtVGseJZiP/qFSYgOET2yxX 6A7c0j4QiGYqe5TxvVNFTZY9L0xBDD+7KVqqSuS6BPDrYQux1Lo3WT3Ath/qeCsHq9Mz dZVaMFx4CS5rJTLEiT4GlveLTAgJjRq5WMM+7pyAlod9dONacs1XfK72i0+1kj3zEwYU wGJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=hDaB8yfQ; dkim=pass header.i=@codeaurora.org header.s=default header.b=BIi1QDfZ; 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 v65si1096883pgv.807.2018.03.20.08.24.44; Tue, 20 Mar 2018 08:24:58 -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=@codeaurora.org header.s=default header.b=hDaB8yfQ; dkim=pass header.i=@codeaurora.org header.s=default header.b=BIi1QDfZ; 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 S1751714AbeCTPXW (ORCPT + 99 others); Tue, 20 Mar 2018 11:23:22 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:47506 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751022AbeCTPXT (ORCPT ); Tue, 20 Mar 2018 11:23:19 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 4D41B60C54; Tue, 20 Mar 2018 15:23:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1521559399; bh=ndZ/dvrg58z0MDBEF0Nv7UXPGZbNdq7ji4qCUEeSOko=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=hDaB8yfQ3YmJZN4mPNeMwPga8Pfpa70CkdrtmrF1teWDWUytnJVCmW5RhaVk6tKEJ 9PNvsgsJjxKlECecC6nLF9i6W09lXyjltMZ42o7xvHSnlA/9Di0BK0pwIlhWjtufKf y9oBhO7eVsni1mkxy6UBzkwssJsf8IgZRJgr4U50= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from [10.177.68.48] (pat_11.qualcomm.com [192.35.156.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: okaya@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 9D7A6602FC; Tue, 20 Mar 2018 15:23:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1521559398; bh=ndZ/dvrg58z0MDBEF0Nv7UXPGZbNdq7ji4qCUEeSOko=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=BIi1QDfZYkvshKGmoTUVl0NGFaYEZkF69hERVlWdHjT9nVRncxlPl8axSSwFzQZ7M ODCizdUqxe/jdjrTvwjSFHEattVtyGlzEV6pNoPA+7CnueArRBQg0fvo/48jmOzATj zyWeEfNZx3tlyke5JjbF6/Ou88NVYSPxF0hAFfCE= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 9D7A6602FC Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=okaya@codeaurora.org Subject: Re: [PATCH v4 5/6] IB/nes: Eliminate duplicate barriers on weakly-ordered archs To: Jason Gunthorpe 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 References: <1521514068-8856-1-git-send-email-okaya@codeaurora.org> <1521514068-8856-6-git-send-email-okaya@codeaurora.org> <20180320145413.GH19744@ziepe.ca> From: Sinan Kaya Message-ID: <3b96019a-2b3b-374a-453e-0553fb04c0a7@codeaurora.org> Date: Tue, 20 Mar 2018 10:23:16 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180320145413.GH19744@ziepe.ca> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/20/2018 9:54 AM, Jason Gunthorpe wrote: > 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. Just for the sake of other changes in netdev directory and my education... barrier() on ARM is a wmb(). It should be a compiler barrier on intel. You are saying barrier() should have been a wmb(), right? I have gone through similar exercise on netdev directory and changed barrier() writel() to barrier() writel_relaxed() Do you see any problem with this? If the goal is to make memory changes observable to the hardware, it should have been, right not barrier()? wmb() writel_relaxed() > > Jason > -- Sinan Kaya Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc. Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.