Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4630260yba; Tue, 30 Apr 2019 01:29:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqyzv+yqZJJaKgsbPzJaTmYvWhpV59chsb+/s309cHlC89MjomU7OFuPmY+Cmo4W1HkEVROL X-Received: by 2002:a17:902:ba8e:: with SMTP id k14mr930112pls.80.1556612992045; Tue, 30 Apr 2019 01:29:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556612992; cv=none; d=google.com; s=arc-20160816; b=HzDy2S/j5+9QmCAYVOQpz4pj8eLsV340ET4/+znpzy5Ikqqg8/f0Sp0vW5jGg3QRSY PnYui/oREsmk2eyj8CEi7PKOZx6JC/NopeDtG3zEzlMJ5/ug+P7e3MU/Huo8OFpC26XC N/8Au1cxoxbyO3Blf8/bfE4P1FCrS/eDbq8FwzRNfbip0Rfgk+AX5eS8rW0CiNtjF6LC I296cYB4pmXCCbfQgdngk2DwqAfw1hUwbggYGvPU51Z+AqjlftGDYBqYMV1x3QBmTP9W OW4o8GeKNZA/sdSci/bTPWUpgYJkk9nYkfLdME1WzOv236VXGVIPZhFNfS4veQALX34s i/jg== 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; bh=ztnwMSHtedoT9Gv7PEZNypm2kmS00QDMZIphrledsXY=; b=kNyGzUxZA2DtTUIfTkBfkm63WfX6v0oTDVKRkqdzaWjM4P8w6JWBs8kAmfHsInDZrW CEPBINtJ0k8hWOHa28JDw9Z01w/oxP1EZnL3C0/bW7OlKPCJkCzTrYvnlBpqiKUxWfJU dTo9DBvP/EcK2BkH8m/tp920tJU0625xOAxlRVhrwX9+eYVr++LAjOQjjBvQ0481Luew +bZhYej7E38EGLwgJZ9IlN/csun7kaKD4Y8CljV6B1s7FhSnjJn4No+QQeG/izt/+qT+ SLs+fFqOiW+x6I8f2mNvxykEZX8uleDnEcnAErYg2SdyR2PsNwLj+CRo7HZjNjfHHaCr +4Mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=sVSA9x2l; 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 2si23363752plc.371.2019.04.30.01.29.36; Tue, 30 Apr 2019 01:29:52 -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=@infradead.org header.s=bombadil.20170209 header.b=sVSA9x2l; 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 S1726617AbfD3I2S (ORCPT + 99 others); Tue, 30 Apr 2019 04:28:18 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:59914 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725769AbfD3I2S (ORCPT ); Tue, 30 Apr 2019 04:28:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=ztnwMSHtedoT9Gv7PEZNypm2kmS00QDMZIphrledsXY=; b=sVSA9x2lnTx39ltHEPZtds4dz YiEJNhm1B4JWAiJA5kIIQke8QAp+P/wvO+MpBgMwf/WxjFPOs6jG2rak9aVm/M3/ZdBxZWQ8Eq0M/ ppL6ZO2RZepBB8jhJQrqnBf+2+TlFCa5wiCDSdV9mUx2Bqi4zaHrvr8IGK76jyx6gZ3OCEqffBoNx +2UCQ8lh0ZVLit+1SZaRrM7rwNKZRcSpx7EHI2aacowq6goEHq2RGVSazG9OVR/uInVVLQoIZsrI7 +vDBej0JLuz1/PGPwdXuziIx5UaGdIyy/HNLAzXTGbvd3z56RtJFYqjc7l5pAqPfKlQvpwWrcgQwL RuMaM33Dw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hLO7b-00018M-Rz; Tue, 30 Apr 2019 08:28:16 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 60AFC29D2D6D8; Tue, 30 Apr 2019 10:28:14 +0200 (CEST) Date: Tue, 30 Apr 2019 10:28:14 +0200 From: Peter Zijlstra To: Andrea Parri Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Dennis Dalessandro , Mike Marciniszyn , Doug Ledford , Jason Gunthorpe , linux-rdma@vger.kernel.org Subject: Re: [PATCH 5/5] IB/hfi1: Fix improper uses of smp_mb__before_atomic() Message-ID: <20190430082814.GC2677@hirez.programming.kicks-ass.net> References: <1556568902-12464-1-git-send-email-andrea.parri@amarulasolutions.com> <1556568902-12464-6-git-send-email-andrea.parri@amarulasolutions.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1556568902-12464-6-git-send-email-andrea.parri@amarulasolutions.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 29, 2019 at 10:15:01PM +0200, Andrea Parri wrote: > This barrier only applies to the read-modify-write operations; in > particular, it does not apply to the atomic_read() primitive. > > Replace the barrier with an smp_mb(). > > Fixes: 856cc4c237add ("IB/hfi1: Add the capability for reserved operations") > Cc: stable@vger.kernel.org > Reported-by: "Paul E. McKenney" > Reported-by: Peter Zijlstra > Signed-off-by: Andrea Parri > Cc: Dennis Dalessandro > Cc: Mike Marciniszyn > Cc: Doug Ledford > Cc: Jason Gunthorpe > Cc: linux-rdma@vger.kernel.org > --- > drivers/infiniband/sw/rdmavt/qp.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/infiniband/sw/rdmavt/qp.c b/drivers/infiniband/sw/rdmavt/qp.c > index a34b9a2a32b60..b64fd151d31fb 100644 > --- a/drivers/infiniband/sw/rdmavt/qp.c > +++ b/drivers/infiniband/sw/rdmavt/qp.c > @@ -1863,11 +1863,11 @@ static inline int rvt_qp_is_avail( > u32 reserved_used; > > /* see rvt_qp_wqe_unreserve() */ I see a completely bogus comment in rvf_op_wqe_unreserve(), referring to bogus comments makes this barrier bogus too. > - smp_mb__before_atomic(); > + smp_mb(); > reserved_used = atomic_read(&qp->s_reserved_used); > if (unlikely(reserved_op)) { > /* see rvt_qp_wqe_unreserve() */ > - smp_mb__before_atomic(); This was before, but there is nothing _after_ this. Which means this barrier was complete garbage anyway. > + smp_mb(); > if (reserved_used >= rdi->dparms.reserved_operations) > return -ENOMEM; > return 0; > @@ -1882,7 +1882,7 @@ static inline int rvt_qp_is_avail( > avail = slast - qp->s_head; > > /* see rvt_qp_wqe_unreserve() */ > - smp_mb__before_atomic(); > + smp_mb(); Same as the first. > reserved_used = atomic_read(&qp->s_reserved_used); > avail = avail - 1 - > (rdi->dparms.reserved_operations - reserved_used);