Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4074573yba; Mon, 29 Apr 2019 13:17:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqytur+yIlG8A//X2oL4JpI4ro/knXC+On8K3gQdJ+AYZwyHCoeJLzYybb61alzdb5MGxqGN X-Received: by 2002:aa7:9109:: with SMTP id 9mr22386801pfh.244.1556569076021; Mon, 29 Apr 2019 13:17:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556569076; cv=none; d=google.com; s=arc-20160816; b=SxQaBgCu32FJ06uNwOTP72EDmQKRIcHlqTOavSuTFR5bidzXktn7xoKPzFyt7XqLt9 jf3JF8qlcSQSvKWJypZ71hxMlPzI1dMT2TiiW3coK8TUM7jenDxm/xCta4e623IpQlwb YUeFM9GRigYFK7sy0Qxy53xdDsmb6SYSZw4uPKJVlo6di+ag/BcZxFR6PHzBd1ptAWuM D1VgmfPrye3dN+Y2hJqsIp3KNPfrm1/lrGsDv/yn7AHCrxiRyqrjCpkg84kcDIc3f2T5 BGq4Y4qPEetTTUpKOHj88lS4XnnOcXqtmNdRmQz1xCbP93Kq5lvB6wwk383RaDAWHO4E nTJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=3D2hgpqHMF7kzr2+nWYXGMvBMFX9zuYhDVKkxyQa+jY=; b=ahXJRcQt4grGaSu2qpFoPFqbsCmHidYn2iS8a5yOEWSA+5jAhYwo/FxTglvSZLR+xK i/Ihjk5Np8wKjV3rrM/N8fGU1Vp8o+vBit6t8OJTOHJCEHT6hDO4wlR4seyDNGcPYaO0 cPPcBD+Yjp21HVGNn8/UlKYcBRn7r1WrdOyee5EQgX2JDg6Jsh/LrM8sWkpuYY10vzBr Ftg0c5X7A3fAugAG8eAY9plLvqp4OpaalQKW/dHBVmNk131awTSPmx2Q4NWZ7Ikdk8LP b8wIi2sQgKosXTZkVqbv00P/8pmTsm9zWlm/vFqWxOsHzSqge7RvcNwRCWvHC/EAA2kF ErSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ZTXwB3qQ; 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 s7si21906361pgr.287.2019.04.29.13.17.40; Mon, 29 Apr 2019 13:17:56 -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=@amarulasolutions.com header.s=google header.b=ZTXwB3qQ; 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 S1729466AbfD2UQL (ORCPT + 99 others); Mon, 29 Apr 2019 16:16:11 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:36123 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729454AbfD2UQJ (ORCPT ); Mon, 29 Apr 2019 16:16:09 -0400 Received: by mail-wm1-f67.google.com with SMTP id h18so922304wml.1 for ; Mon, 29 Apr 2019 13:16:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=3D2hgpqHMF7kzr2+nWYXGMvBMFX9zuYhDVKkxyQa+jY=; b=ZTXwB3qQ3O7GgJpoToBUHpQ/1MjEQUYs6ONq7YMdNVpznk/xHw0iTQZgXhtw4H5bzj OpteffM67ha2r2JufThqCE1IJdb2vlnl1HYfvU8Nh/T7d1wzyYZoQF64jz2jwpwhw89i QwrP3wAzWWOQ2n4ka4fbW0Ulv+5+mukpZEJiM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=3D2hgpqHMF7kzr2+nWYXGMvBMFX9zuYhDVKkxyQa+jY=; b=jrhQqz6gg4N65qSAFA2m0LTf2AtvZVcgG146TrNnWMDnPwvLkqOpzxyPAoc2ptbsSF jLmq+eXRJXebxG4uUF6BIVqc5CYBgmj0pjrBu8JWeNjgTFHlp+ni8rRnxy0Wn7hUomTL Nmy5jaYMUlnFoe9omClYMXW+KDfmaTUbJYoAK4UOj3LzoTnOHpC1LARRgqDQ5PdfX5ep eLFFoYM4arfcA/1Cl2ZejY/sVOQN9gXKJm6JrVKCfiOkfkV46fKKx+zI/CJiSKXY0HJ7 Eh+64OJhjj9Ub4GTmsJkJhzSGm/BP8VGdVDmYxKZgM1i0ig8DZAx5IESUQCWyB58w/4B X9Vg== X-Gm-Message-State: APjAAAUYHQaulcZNTrA4Yh3DtbCiS1gWtBwUPYtZbtHJaaPX0r/6Rb/4 zTZkYK2UBqwsLZ/mGyYcb8Czr4lcBfk= X-Received: by 2002:a1c:a384:: with SMTP id m126mr487272wme.99.1556568966933; Mon, 29 Apr 2019 13:16:06 -0700 (PDT) Received: from localhost.localdomain (ip-93-97.sn2.clouditalia.com. [83.211.93.97]) by smtp.gmail.com with ESMTPSA id k6sm22864019wrd.20.2019.04.29.13.16.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 29 Apr 2019 13:16:06 -0700 (PDT) From: Andrea Parri To: linux-kernel@vger.kernel.org Cc: Andrea Parri , stable@vger.kernel.org, Dennis Dalessandro , Mike Marciniszyn , Doug Ledford , Jason Gunthorpe , linux-rdma@vger.kernel.org Subject: [PATCH 5/5] IB/hfi1: Fix improper uses of smp_mb__before_atomic() Date: Mon, 29 Apr 2019 22:15:01 +0200 Message-Id: <1556568902-12464-6-git-send-email-andrea.parri@amarulasolutions.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1556568902-12464-1-git-send-email-andrea.parri@amarulasolutions.com> References: <1556568902-12464-1-git-send-email-andrea.parri@amarulasolutions.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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() */ - 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(); + 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(); reserved_used = atomic_read(&qp->s_reserved_used); avail = avail - 1 - (rdi->dparms.reserved_operations - reserved_used); -- 2.7.4