Received: by 10.213.65.68 with SMTP id h4csp124263imn; Wed, 21 Mar 2018 14:04:44 -0700 (PDT) X-Google-Smtp-Source: AG47ELu46i9VpiXEg1Ode1rStvCNLNFt4WpCY9XcgCy7zcbzjCPxAwlm9aXlSKsaIGWU50/InaJZ X-Received: by 10.98.172.3 with SMTP id v3mr5586712pfe.140.1521666284242; Wed, 21 Mar 2018 14:04:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521666284; cv=none; d=google.com; s=arc-20160816; b=np9oo/AN50/P55cVTb/GPrS3BS09MIvFO/7eT4tKs5SPd4K/O3eqog6lchNqfrl2/S 4SmCY170wz2ZxFEf5b+f8sLJ1Mriv4uFlwZKl3KQsHG0ig741zqXwdKRn8NGh9/0FSny moHIJM3GfD3qfRU7GvqIDqHgp2GyAKkhgUme8Cs/NnST/k4yaO822dz4vltP27r2omg7 B7XlpC4MXPZLqqeNADFok8VbS87g/X7cnzM9MIRa5yz/QWn6pqCMYknKrCfEmZiYsYQD vUXC6kruc/rHb+MwNYV40SuPB/78f8qJw/uS6bnI2ImzH8fXvCpcUUyDP+RlQzWOL7JG KiBg== 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=rH0fcYRo3+nTmWaZByX049xgUQf7jTYz15d1dPysQhM=; b=rzgi3/zt9DROhY64ZRcv15RBdgH2uu+3VnrD7nVWZGVpOB6fsk1JXlJXcpgqTshrSg xBoFRXXi+hv59AR5fIV/sp/4a4CjSESWNqf5PP2DdvNKy4qJ2V8MBTNzI0UjKAvQI+G7 NS2yCuKOoxbWwwhxPCGu1/pGOHyuKAIESDNdbGfKTaO5rhSR6DK4/ROHjfySAI9EGVZf d4sfdy+EsEJ3JtezuyHlUePczbnWXQi/BzPeyD3zKdftEOs6S6wXHtO717Jw2dd/bQ8z Ka4X4/c4brsNNwEeROf0VtwjevLyFgs4OlK41fwinn+HIhiplTvYB4C3zzLIxbG7OSyz +tdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=g81rfrk6; dkim=pass header.i=@codeaurora.org header.s=default header.b=dk0+/s6B; 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 j8-v6si4554845plk.426.2018.03.21.14.04.28; Wed, 21 Mar 2018 14:04:44 -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=g81rfrk6; dkim=pass header.i=@codeaurora.org header.s=default header.b=dk0+/s6B; 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 S1753433AbeCUVBz (ORCPT + 99 others); Wed, 21 Mar 2018 17:01:55 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:58830 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753209AbeCUVBv (ORCPT ); Wed, 21 Mar 2018 17:01:51 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 02FCA60C66; Wed, 21 Mar 2018 21:01:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1521666111; bh=2ibmD4NKYUkbHxGGRnSLWpbOxbuhWlOLK1s3RSmCC6U=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=g81rfrk6zUmDdLYCHv0jhzaDQkUBpxb++T4jfZjV53OnAXbkpLJYPv2mTmLih/zN2 ufXD38iMvKVr8hfpmSV/hcgCfQBfc5o8YE6JQ7IcaW6bVA9V4O5MWvcywzoIZ3jbpb o782fMGtx1ulD+wO7bCii69dwK7JiYukZdRtykRM= 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.56] (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 ABBA760C54; Wed, 21 Mar 2018 21:01:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1521666110; bh=2ibmD4NKYUkbHxGGRnSLWpbOxbuhWlOLK1s3RSmCC6U=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=dk0+/s6B90adSUs4kCnyoweVOd1nZ+BWQ2Yhubu3yw2OGKs5M8J8FQuCSyOq7Yuuk QP6y98EjY0yKq/EfLs1tR/fANVJzxkbtiHsXhsj2q5qIt3xAWF9Xm+4mQpZHe1cZPb f/O77H/YA706dA8YxtDP3Ouc1WnfIYMS8IgPFi6Q= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org ABBA760C54 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 3/6] RDMA/i40iw: 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 , Shiraz Saleem , Doug Ledford , linux-kernel@vger.kernel.org References: <1521514068-8856-1-git-send-email-okaya@codeaurora.org> <1521514068-8856-4-git-send-email-okaya@codeaurora.org> <20180321200253.GA21453@ziepe.ca> From: Sinan Kaya Message-ID: <596af6f5-3668-2545-4d79-b7b8c6713444@codeaurora.org> Date: Wed, 21 Mar 2018 16:01:48 -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: <20180321200253.GA21453@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/21/2018 3:02 PM, Jason Gunthorpe wrote: > On Mon, Mar 19, 2018 at 10:47:45PM -0400, Sinan Kaya wrote: >> diff --git a/drivers/infiniband/hw/i40iw/i40iw_uk.c b/drivers/infiniband/hw/i40iw/i40iw_uk.c >> index 8afa5a6..7f0ebed 100644 >> +++ b/drivers/infiniband/hw/i40iw/i40iw_uk.c >> @@ -723,7 +723,7 @@ static void i40iw_cq_request_notification(struct i40iw_cq_uk *cq, >> >> wmb(); /* make sure WQE is populated before valid bit is set */ >> >> - writel(cq->cq_id, cq->cqe_alloc_reg); >> + writel_relaxed(cq->cq_id, cq->cqe_alloc_reg); >> } > > Ah, this one is probably not OK, i40iw_cq_request_notification is > called here: > > spin_lock_irqsave(&iwcq->lock, flags); > ukcq->ops.iw_cq_request_notification(ukcq, cq_notify); > spin_unlock_irqrestore(&iwcq->lock, flags); > > So this needs to add mmmiomb(); to keep the same semantics. > > Generally I think you need to be very careful to ensure that any > conversion to _relaxed isn't contained by a spinlock, or the mmiomb() > is present. > > Maybe even do a first series with this obviously correct pattern: > > wmb(); > writel() -> writel_relaxed() > writel() -> writel_relaxed() > [..] > mmiowmb(); Good catch. I changed it as follows: +++ b/drivers/infiniband/hw/i40iw/i40iw_uk.c @@ -723,7 +723,8 @@ static void i40iw_cq_request_notification(struct i40iw_cq_uk *cq, wmb(); /* make sure WQE is populated before valid bit is set */ - writel(cq->cq_id, cq->cqe_alloc_reg); + writel_relaxed(cq->cq_id, cq->cqe_alloc_reg); + mmiowb(); } > > 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.