From patchwork Wed Jan 9 12:48:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhu Yanjun X-Patchwork-Id: 10754055 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-2.web.codeaurora.org (Postfix) with ESMTP id 52F1914DE for ; Wed, 9 Jan 2019 12:44:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 42E9827D0E for ; Wed, 9 Jan 2019 12:44:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 373A227EE2; Wed, 9 Jan 2019 12:44:12 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY 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 D1C5627D0E for ; Wed, 9 Jan 2019 12:44:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730467AbfAIMoL (ORCPT ); Wed, 9 Jan 2019 07:44:11 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:34948 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730211AbfAIMoK (ORCPT ); Wed, 9 Jan 2019 07:44:10 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id x09ChqD0074488; Wed, 9 Jan 2019 12:44:03 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id; s=corp-2018-07-02; bh=00uSJPP8my7jveVNhkShv/FFPa+YPPt1wYthVwwNtYU=; b=oY8FTJFGoF2wXo5j3p36wkwcT82ADRhOyXwOOoqVwJr4MXIUYiqqWvC2bBYSpeMzICTz HHhKQTkjRLaJ51Z9v0xxQfSFVpIrzdc2LtToWfBdGaT+v/BQqjj0GGvAFWZE5jsGRAJG ds7egQfHkcG3kOTarLjRZ3IV8YD8DmDn/2XP+QN33Bq+K5xH5EJXYqyL4dXRm7X15PtT +XjtMgsOseX3oxW3UsGrOkUbE3/n6lOPrYs4s+LUkRztjXowXzx9uY+2sfmqP2T47oTi qfMZzjnC3OVntX8h8Q9+GO53SqQC7E26R8A5avVDLOkrTMf9Ca6WIla5J78yMY4SgvtJ xw== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2130.oracle.com with ESMTP id 2ptm0u94qy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 09 Jan 2019 12:44:03 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id x09Ci2qR005469 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 9 Jan 2019 12:44:02 GMT Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x09Ci19i017782; Wed, 9 Jan 2019 12:44:01 GMT Received: from shipfan.cn.oracle.com (/10.113.210.105) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 09 Jan 2019 04:44:01 -0800 From: Zhu Yanjun To: monis@mellanox.com, dledford@redhat.com, jgg@ziepe.ca, linux-rdma@vger.kernel.org Subject: [PATCH 1/1] IB: rxe: replace spin lock with bitops in rxe cq Date: Wed, 9 Jan 2019 07:48:42 -0500 Message-Id: <1547038122-22236-1-git-send-email-yanjun.zhu@oracle.com> X-Mailer: git-send-email 2.7.4 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9130 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=739 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1901090107 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 It is a common way to use bitops to indicate the state. So replace spin lock with bitops. Signed-off-by: Zhu Yanjun --- drivers/infiniband/sw/rxe/rxe_cq.c | 14 +++----------- drivers/infiniband/sw/rxe/rxe_verbs.h | 4 +++- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/infiniband/sw/rxe/rxe_cq.c b/drivers/infiniband/sw/rxe/rxe_cq.c index a57276f..7b34d04 100644 --- a/drivers/infiniband/sw/rxe/rxe_cq.c +++ b/drivers/infiniband/sw/rxe/rxe_cq.c @@ -69,14 +69,9 @@ int rxe_cq_chk_attr(struct rxe_dev *rxe, struct rxe_cq *cq, static void rxe_send_complete(unsigned long data) { struct rxe_cq *cq = (struct rxe_cq *)data; - unsigned long flags; - spin_lock_irqsave(&cq->cq_lock, flags); - if (cq->is_dying) { - spin_unlock_irqrestore(&cq->cq_lock, flags); + if (test_bit(RXE_CQ_IS_DYING, &cq->is_dying)) return; - } - spin_unlock_irqrestore(&cq->cq_lock, flags); cq->ibcq.comp_handler(&cq->ibcq, cq->ibcq.cq_context); } @@ -105,7 +100,7 @@ int rxe_cq_from_init(struct rxe_dev *rxe, struct rxe_cq *cq, int cqe, if (uresp) cq->is_user = 1; - cq->is_dying = false; + clear_bit(RXE_CQ_IS_DYING, &cq->is_dying); tasklet_init(&cq->comp_task, rxe_send_complete, (unsigned long)cq); @@ -169,11 +164,8 @@ int rxe_cq_post(struct rxe_cq *cq, struct rxe_cqe *cqe, int solicited) void rxe_cq_disable(struct rxe_cq *cq) { - unsigned long flags; - spin_lock_irqsave(&cq->cq_lock, flags); - cq->is_dying = true; - spin_unlock_irqrestore(&cq->cq_lock, flags); + set_bit(RXE_CQ_IS_DYING, &cq->is_dying); } void rxe_cq_cleanup(struct rxe_pool_entry *arg) diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.h b/drivers/infiniband/sw/rxe/rxe_verbs.h index 74e0480..ba3f726 100644 --- a/drivers/infiniband/sw/rxe/rxe_verbs.h +++ b/drivers/infiniband/sw/rxe/rxe_verbs.h @@ -84,13 +84,15 @@ struct rxe_cqe { }; }; +#define RXE_CQ_IS_DYING 0 + struct rxe_cq { struct rxe_pool_entry pelem; struct ib_cq ibcq; struct rxe_queue *queue; spinlock_t cq_lock; u8 notify; - bool is_dying; + unsigned long is_dying; int is_user; struct tasklet_struct comp_task; };