From patchwork Tue Nov 14 16:43:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael J. Ruhl" X-Patchwork-Id: 10057889 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 2B4E560231 for ; Tue, 14 Nov 2017 16:43:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1D4B5297EE for ; Tue, 14 Nov 2017 16:43:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 124C92986C; Tue, 14 Nov 2017 16:43:23 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 01EA9297EE for ; Tue, 14 Nov 2017 16:43:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754750AbdKNQnV (ORCPT ); Tue, 14 Nov 2017 11:43:21 -0500 Received: from mga01.intel.com ([192.55.52.88]:19160 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753794AbdKNQnU (ORCPT ); Tue, 14 Nov 2017 11:43:20 -0500 Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Nov 2017 08:43:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,395,1505804400"; d="scan'208";a="175696975" Received: from sedona.ch.intel.com ([143.182.228.65]) by fmsmga005.fm.intel.com with ESMTP; 14 Nov 2017 08:43:20 -0800 Received: from phlsvsles11.ph.intel.com (phlsvsles11.ph.intel.com [10.228.195.43]) by sedona.ch.intel.com (8.13.6/8.14.3/Standard MailSET/Hub) with ESMTP id vAEGhJp0014210 for ; Tue, 14 Nov 2017 09:43:20 -0700 Received: from phlsvslse11.ph.intel.com (localhost [127.0.0.1]) by phlsvsles11.ph.intel.com with ESMTP id vAEGhJ65024653 for ; Tue, 14 Nov 2017 11:43:19 -0500 Subject: [PATCH v3 1/4] ibacm: Fix an incorrect expiration check for the retry timer To: linux-rdma@vger.kernel.org From: "Michael J. Ruhl" Date: Tue, 14 Nov 2017 11:43:19 -0500 Message-ID: <20171114164305.24557.96192.stgit@phlsvslse11.ph.intel.com> In-Reply-To: <20171114164006.24557.72093.stgit@phlsvslse11.ph.intel.com> References: <20171114164006.24557.72093.stgit@phlsvslse11.ph.intel.com> User-Agent: StGit/0.16 MIME-Version: 1.0 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 From: Michael J. Ruhl The acmp_process_wait_queue() checks to see if a message expiration time has passed. Because the check is for less than (<), if the timeout expires matches the current time, the check will result in a timeout value of 0, and the wait loop will spin until the next millisecond has passed. Using example values to demonstrate the issue, we can see: With '<': wait = -2106577636 (no work) wait = 2510 (message wait) (process spins) wait = 0 (expires - current time == 0) wait = 0 wait = 0 ... (1 ms of output) wait = 0 wait = -2106580147 (retry complete) wait = 2512 With '<=': wait = -2106688780 (no work) wait = 2512 ( message wait) (process sleeps) wait = -2106691293 (retry complete) wait = 2512 Expire the message if the expires is less than or equal. Reviewed-by: Mike Marciniszyn Reviewed-by: Dennis Dalessandro Signed-off-by: Michael J. Ruhl --- ibacm/prov/acmp/src/acmp.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/ibacm/prov/acmp/src/acmp.c b/ibacm/prov/acmp/src/acmp.c index 78d9a29..d707b8e 100644 --- a/ibacm/prov/acmp/src/acmp.c +++ b/ibacm/prov/acmp/src/acmp.c @@ -1507,7 +1507,7 @@ static void acmp_process_wait_queue(struct acmp_ep *ep, uint64_t *next_expire) struct ibv_send_wr *bad_wr; list_for_each_safe(&ep->wait_queue, msg, next, entry) { - if (msg->expires < time_stamp_ms()) { + if (msg->expires <= time_stamp_ms()) { list_del(&msg->entry); (void) atomic_dec(&wait_cnt); if (--msg->tries) {