From patchwork Wed Dec 20 17:50:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan Tan X-Patchwork-Id: 10126157 X-Patchwork-Delegate: jgg@ziepe.ca Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3D64160390 for ; Wed, 20 Dec 2017 17:50:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2CFA4289FD for ; Wed, 20 Dec 2017 17:50:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2151728D1C; Wed, 20 Dec 2017 17:50:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 57A9A289FD for ; Wed, 20 Dec 2017 17:50:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755346AbdLTRuN (ORCPT ); Wed, 20 Dec 2017 12:50:13 -0500 Received: from mail-sn1nam01on0077.outbound.protection.outlook.com ([104.47.32.77]:26279 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755292AbdLTRuM (ORCPT ); Wed, 20 Dec 2017 12:50:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=onevmw.onmicrosoft.com; s=selector1-vmware-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=vEt081Jr2RCZe2qt62o1C/vNkfSTzotfaBehAhkxoEk=; b=FmRBbvflbnirIr8UP4pXCd17nQVoyAl/t6nVaqBpu0++kgOA3MWSO4nae4JzMkjZ8kyeCaQF1URU3p6zJnEEZfzHfXZP/sAj4jA+lbkpYsNdRVlYC/ITiIGAEojOt8cVcR9AUyd5gHeuYrCWVjUZj7ZSvmY3sM3s+vQhzwHJ23Q= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=bryantan@vmware.com; Received: from bryantan-devbox.prom.eng.vmware.com.prom.eng.vmware.com (208.91.1.34) by CY1PR05MB2777.namprd05.prod.outlook.com (10.167.18.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.282.3; Wed, 20 Dec 2017 17:50:10 +0000 Date: Wed, 20 Dec 2017 09:50:01 -0800 From: Bryan Tan To: linux-rdma@vger.kernel.org Subject: [PATCH v2 for-rc 2/4] RDMA/vmw_pvrdma: Use refcount_dec_and_test to avoid warning Message-ID: <20171220174956.GA20571@bryantan-devbox.prom.eng.vmware.com.prom.eng.vmware.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20171220174748.GA18149@bryantan-devbox.prom.eng.vmware.com.prom.eng.vmware.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Originating-IP: [208.91.1.34] X-ClientProxiedBy: MWHPR20CA0040.namprd20.prod.outlook.com (10.172.102.154) To CY1PR05MB2777.namprd05.prod.outlook.com (10.167.18.23) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8fdb10ce-42c5-46bf-37ff-08d547d21d5e X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060); SRVR:CY1PR05MB2777; X-Microsoft-Exchange-Diagnostics: 1; CY1PR05MB2777; 3:zZMisXXf9t0SQ8Z+eQvbEnFEo+y+MoQPFX56Ilt2zatokW4hZ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ij7qn7gXEVZF0IoW+oDzXDUwNC9vTtHwwepIlfbf2B/DWd4zS1fp+TZ/q81IX/4ZosT/iDP2xoUxYASQKv87IDNO+5N0NKN+iMve0LpJLSbWlTBSkU+lju1CXvVCtslSxsf8HmZekGmvVYvbweOo8OZNFMreOJzxLn5QdhFRSEo81xx1+uSe9KUi3JE80hqfT1MajanEH4pZmgP0VTz0C3EiCyxtiIKO6LdjmPYx2niP+IIoC/gmj4bHfrtPYLGoMYAeqcYndy27HNRUyFe+XBH7YLaSwVlga; 4:dmgjnJeopRY+NbTy4Iesx1nq3Im+D3tAKbQp/OJVcTri6au9/qZ2zMLd6PYYu1bQvNGCCyMBuoqgWZ8Q4wvgwU/57VIkVbHSn6hIdExlrSVR4xGyc32tZ8xWmGlS00i9zY95jjqvEt065FKrGIP52Cb1fEPr69nz4MwLfD8TWWttVOqVy5KSTMPp2lzc+Gu7trSbZ3LlCYB6S9977wNlnRz/CLxDpYk4EBefd9mHX7w5XnL8sjQetbNiZt9rC95ctQAE0zUvPKFz6mRwnRhM9VIwWZ5Y4yVRYk5HU4K3+HFxiDCYVzlVkW6LZyINdNK2 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(61668805478150); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(5005006)(8121501046)(10201501046)(3002001)(3231023)(93006095)(93001095)(6041268)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:CY1PR05MB2777; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:CY1PR05MB2777; X-Forefront-PRVS: 0527DFA348 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(979002)(39860400002)(39380400002)(366004)(376002)(346002)(396003)(199004)(189003)(16586007)(478600001)(33656002)(52116002)(58126008)(23726003)(316002)(50466002)(16526018)(59450400001)(8676002)(305945005)(97736004)(386003)(6916009)(2906002)(86362001)(83506002)(6116002)(1076002)(2950100002)(6666003)(8936002)(7696005)(68736007)(105586002)(47776003)(66066001)(2361001)(81156014)(25786009)(3846002)(81166006)(55016002)(7736002)(5660300001)(106356001)(53936002)(2351001)(18370500001)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR05MB2777; H:bryantan-devbox.prom.eng.vmware.com.prom.eng.vmware.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: vmware.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR05MB2777; 23:2a7OxAdp/XfvN2zYtR14SSPBln9zqq9m0LsEujSXc?= =?us-ascii?Q?7J5CrkkHi7jZoHmhgQ1hFPRm7lybQJWMXGlSE7uFpRM5N5+WdGoiG704KPIN?= =?us-ascii?Q?vnM34ismyJVVOxq0PQs9SOl+i3488Q3vcdVoDAp8MRLS7clzMpqPZf+uRhCb?= =?us-ascii?Q?zjtQuGljd970oOzMrmTcl6raWqLAx4TYsiWi5IRBc8Gyx+dZnn7TMiJ1BH8L?= =?us-ascii?Q?ZQtOLdbEWwdafglzH81UpYv0ZqlAn99ZRiMiUb05bTuvy/dCBlXPcq4b+aIO?= =?us-ascii?Q?kVWJY4xJVA76Pohj59166+/KMmHqmx/12ZgDA/4pte++KCGLwIIZUhPclbOD?= =?us-ascii?Q?LeZM0/ssEXPXhZGGBzVW5VThdBquuYKYMgaoxEffcyOPGn2meD9ECxYLBGuY?= =?us-ascii?Q?FNemVzZO24/3Qqnm8ShM9TKg92LNmjUs1a/hv2/VIe1l5GyOzIujcAbLWcGL?= =?us-ascii?Q?1kJKkmAjOvoHA8PugUbGih2PV++u1DvKZFfCsvUz77F7T1lvOYxAdGSM21VT?= =?us-ascii?Q?aYLpDkzwqW/r1Wd43nTP3zAzmXq3NB5qLwE39W2Sczb/SV4dAQ07lp4GTAH8?= =?us-ascii?Q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NJwi2z2tpwgDdle4Yr0cilp/fvZP418ppYYRoGMTUNBQvmVLLJKRqV2WMXpljT+qE4S00nuJ53fniBeWOP834Ysj9NsJ+4b0nlIoV5LOoTifK/5qaFAhW1tnDd+C2Y1oNQIEPftMYTZOW04+k4SdjYMA=; 5:1TZlh9+W3+e2IYq9WWBQncaMddNZ6AEjKP/rwcYE7IqFD2O+PV4ZytPg//DIBr1elugaaVrjJQcmzt8sdOa7T8OXcZBIG9kutz8KpaPQureb1JsY4sdfxn9pLoELdgFDMuShuYdPPcuUDxWN+68U+DUIuWNGn8PEVuWCjnPPV5Q=; 24:LaWt72F4MhE4pCU5SZKSwXNSC0gUM0RE14jTeGpK5cbyLLcQZKJ6VwlkcbHFD5If6XVCupSeRSda1S4Pp2DoRD7J6rXMhhDWQjiqGq0NOO0=; 7:p1wE7Y1/HmkVzpy0mcKwWXXf+LJgu+SdraaxQ18yCJXnlOhBYuuXv+LvSF/QaR4YIoxT+Qdqc7QTCGLTkUd9u3ib6pILLQG2N+oQgxMVagf25r8BWLM3rZoBKn/ZcWtNkD530wPKcwW9e40nOOpWmKKlH08BJGsDYgz4Xtl0TWwBjnNvw+QnVVdiDbAtP30gjwKbl1QidHHzzkDKMwAbIZOqxiIqqFDVJ4jAo0W1LtA78CrcIK8INuF2bi4NELvJ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR05MB2777; 20:BhwJsj4u65XPpIQVsQDpufMmPRm7cOEb4UiUEniK7MHJb4S+NZVGEgRoaasEb1+olEB1/VCSkoiG7yMS3b5UYmC8mhA0M9HAoDsW32VFncpa+JH+8bZErdsLBeJHsOwSLX6tI9J2z2NeiDQrURhqvpErUvtfWpIG29kPxvOpKUc= X-OriginatorOrg: vmware.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Dec 2017 17:50:10.2023 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8fdb10ce-42c5-46bf-37ff-08d547d21d5e X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR05MB2777 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP refcount_dec generates a warning when the operation causes the refcount to hit zero. Avoid this by using refcount_dec_and_test. Fixes: 8b10ba783c9d ("RDMA/vmw_pvrdma: Add shared receive queue support") Reviewed-by: Adit Ranadive Reviewed-by: Aditya Sarwade Reviewed-by: Jorgen Hansen Signed-off-by: Bryan Tan Reviewed-by: Leon Romanovsky --- drivers/infiniband/hw/vmw_pvrdma/pvrdma_srq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_srq.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_srq.c index 826ccb8..a2b1a3c 100644 --- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_srq.c +++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_srq.c @@ -236,8 +236,8 @@ static void pvrdma_free_srq(struct pvrdma_dev *dev, struct pvrdma_srq *srq) dev->srq_tbl[srq->srq_handle] = NULL; spin_unlock_irqrestore(&dev->srq_tbl_lock, flags); - refcount_dec(&srq->refcnt); - wait_event(srq->wait, !refcount_read(&srq->refcnt)); + if (!refcount_dec_and_test(&srq->refcnt)) + wait_event(srq->wait, !refcount_read(&srq->refcnt)); /* There is no support for kernel clients, so this is safe. */ ib_umem_release(srq->umem);