From patchwork Fri Sep 5 13:14:20 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sreedhar Kodali X-Patchwork-Id: 4852031 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 819979F2EC for ; Fri, 5 Sep 2014 13:14:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C9449201E4 for ; Fri, 5 Sep 2014 13:14:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 27847201D3 for ; Fri, 5 Sep 2014 13:14:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932187AbaIENOX (ORCPT ); Fri, 5 Sep 2014 09:14:23 -0400 Received: from e39.co.us.ibm.com ([32.97.110.160]:46783 "EHLO e39.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932184AbaIENOX (ORCPT ); Fri, 5 Sep 2014 09:14:23 -0400 Received: from /spool/local by e39.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 5 Sep 2014 07:14:22 -0600 Received: from d01dlp01.pok.ibm.com (9.56.250.166) by e39.co.us.ibm.com (192.168.1.139) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 5 Sep 2014 07:14:21 -0600 Received: from b01cxnp22036.gho.pok.ibm.com (b01cxnp22036.gho.pok.ibm.com [9.57.198.26]) by d01dlp01.pok.ibm.com (Postfix) with ESMTP id 1218A38C8046 for ; Fri, 5 Sep 2014 09:14:21 -0400 (EDT) Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by b01cxnp22036.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id s85DEL2J62128316 for ; Fri, 5 Sep 2014 13:14:21 GMT Received: from d01av02.pok.ibm.com (localhost [127.0.0.1]) by d01av02.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s85DEK6F013685 for ; Fri, 5 Sep 2014 09:14:20 -0400 Received: from ltcweb.rtp.raleigh.ibm.com (ltcweb.rtp.raleigh.ibm.com [9.37.210.204]) by d01av02.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id s85DEKh9013650; Fri, 5 Sep 2014 09:14:20 -0400 Received: from ltc.linux.ibm.com (localhost.localdomain [127.0.0.1]) by ltcweb.rtp.raleigh.ibm.com (Postfix) with ESMTP id 39240C0103; Fri, 5 Sep 2014 09:14:20 -0400 (EDT) MIME-Version: 1.0 Date: Fri, 05 Sep 2014 18:44:20 +0530 From: Sreedhar Kodali To: linux-rdma@vger.kernel.org Cc: sean.hefty@intel.com, pradeeps@linux.vnet.ibm.com Subject: [PATCH v2 2/4] rsockets: retry for completion events upon interruption Message-ID: <66c7c361d03a72de6a216fd1d6ffa0bc@imap.linux.ibm.com> X-Sender: srkodali@linux.vnet.ibm.com User-Agent: Roundcube Webmail/1.0.1 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14090513-9332-0000-0000-000001EA3CE3 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-8.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Sreedhar Kodali While waiting for a completion queue event, rsocket's logic by default bails out when interrupted. Because of this, on the passive side ongoing connection establishments are abruptly terminated without fully accepting the incoming connection requests. The solution is to modify the completion event waiting logic to ensure that it retries for the event upon interruption instead of returning with an error. This behavior is gated by a runtime parameter 'restart_onintr' with the associated configuration file so it does not affect in any way the rest of rsocket applications. Signed-off-by: Sreedhar Kodali Reviewed-by: Pradeep Satyanarayana --- --- 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/src/rsocket.c b/src/rsocket.c index 78261dc..b70d56a 100644 --- a/src/rsocket.c +++ b/src/rsocket.c @@ -115,6 +115,7 @@ static uint16_t def_rqsize = 384; static uint32_t def_mem = (1 << 17); static uint32_t def_wmem = (1 << 17); static uint32_t polling_time = 10; +static uint16_t restart_onintr = 0; /* * Immediate data format is determined by the upper bits @@ -542,6 +543,11 @@ void rs_configure(void) def_iomap_size = (uint8_t) rs_value_to_scale( (uint16_t) rs_scale_to_value(def_iomap_size, 8), 8); } + + if ((f = fopen(RS_CONF_DIR "/restart_onintr", "r"))) { + (void) fscanf(f, "%hu", &restart_onintr); + fclose(f); + } init = 1; out: pthread_mutex_unlock(&mut); @@ -1969,10 +1975,14 @@ static int rs_get_cq_event(struct rsocket *rs) if (!rs->cq_armed) return 0; +resume_get_cq_event: ret = ibv_get_cq_event(rs->cm_id->recv_cq_channel, &cq, &context); if (!ret) { ibv_ack_cq_events(rs->cm_id->recv_cq, 1); rs->cq_armed = 0; + } else if (restart_onintr == 1 && errno == EINTR) { + errno = 0; + goto resume_get_cq_event; } else if (errno != EAGAIN) { rs->state = rs_error; }