Received: by 10.192.165.148 with SMTP id m20csp568892imm; Wed, 25 Apr 2018 04:25:38 -0700 (PDT) X-Google-Smtp-Source: AIpwx48U1eGZ19ahwxefR04YpLe3GKDyOyAiWBBrcKhw7WIkMgZsJ5K/KNWT+gL0ifsc1N4IXIol X-Received: by 10.167.128.207 with SMTP id a15mr27316762pfn.116.1524655538138; Wed, 25 Apr 2018 04:25:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524655538; cv=none; d=google.com; s=arc-20160816; b=0QfNIDlmUXpbwS3ma9FbTMPBDh4X4CD50YnI/JBrVN7rCdgJjABd4h9FBFK+I4O9Gd v1tcqw4+VnNiY6JSvD8hTHqeMcnXwKm0MhPmN6P5dwbukrNh7eldv9+BnWXavtZ+6Syy NrWtet60GWOnrGgCnrge1XERrbJ8ZOCyPg7HXrRZNT65yidI+YlWphHvu5trkY1TMV8O E1+AwaKdQKjpT3fatMkMyHdM6e/159rg3ru20UUrf2+9OkvB2Y3XnZn6bZrN+/BiSbok pWC0mcIol1ptXzZzFtdLjn8s8WcWPzHOWPBgwRj1VflO9MODA4jh5ETMx1IjFh6+fFXf yYFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=/crdaq9WXOtpiTRBCOsxqpmNQmZcnI4GjPHayNuDF+8=; b=NkB1znSmlJV3fogH4bpaGKKYVYH8TaiqKWyzH/AvtpD1zj6qDKFkA2Re7Hc6wq0UyZ c2UOB9vGkXI6aM+OH4nDDyfIVVnNK9BpAlbaxNGIKh05XtegnyNzlUPQSkE9tbCPwNHk CWzyMVUC7+w+fKlYlgw0sSqgD29N9WWnLeZrLFWTDuXiXluCIwaKS/hSqDyS4wbJjkwf 1ggMoxqjPyhxkXj9EqdA4UtwmuLYn2WG3GpdZk2COobH6W0VVsA9osom24rnTVsugGAg 3PiWR9a8++aOVHLWYC9MZ6/+2zAECXeX1PiiQAAJroBuCtHqa7T95ITvZuKRcQ6a0MyA qKPg== ARC-Authentication-Results: i=1; mx.google.com; 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 k66si8959914pga.118.2018.04.25.04.25.14; Wed, 25 Apr 2018 04:25:38 -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; 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 S1753621AbeDYLYP (ORCPT + 99 others); Wed, 25 Apr 2018 07:24:15 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:51760 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753537AbeDYKjE (ORCPT ); Wed, 25 Apr 2018 06:39:04 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id E3293272; Wed, 25 Apr 2018 10:39:03 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bart Van Assche , Steve Wise , Sagi Grimberg , Max Gurtovoy , Doug Ledford , Sasha Levin Subject: [PATCH 4.14 053/183] IB/cq: Dont force IB_POLL_DIRECT poll context for ib_process_cq_direct Date: Wed, 25 Apr 2018 12:34:33 +0200 Message-Id: <20180425103244.681940698@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180425103242.532713678@linuxfoundation.org> References: <20180425103242.532713678@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Sagi Grimberg [ Upstream commit 246d8b184c100e8eb6b4e8c88f232c2ed2a4e672 ] polling the completion queue directly does not interfere with the existing polling logic, hence drop the requirement. Be aware that running ib_process_cq_direct with non IB_POLL_DIRECT CQ may trigger concurrent CQ processing. This can be used for polling mode ULPs. Cc: Bart Van Assche Reported-by: Steve Wise Signed-off-by: Sagi Grimberg [maxg: added wcs array argument to __ib_process_cq] Signed-off-by: Max Gurtovoy Signed-off-by: Doug Ledford Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/infiniband/core/cq.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) --- a/drivers/infiniband/core/cq.c +++ b/drivers/infiniband/core/cq.c @@ -25,9 +25,10 @@ #define IB_POLL_FLAGS \ (IB_CQ_NEXT_COMP | IB_CQ_REPORT_MISSED_EVENTS) -static int __ib_process_cq(struct ib_cq *cq, int budget) +static int __ib_process_cq(struct ib_cq *cq, int budget, struct ib_wc *poll_wc) { int i, n, completed = 0; + struct ib_wc *wcs = poll_wc ? : cq->wc; /* * budget might be (-1) if the caller does not @@ -35,9 +36,9 @@ static int __ib_process_cq(struct ib_cq * minimum here. */ while ((n = ib_poll_cq(cq, min_t(u32, IB_POLL_BATCH, - budget - completed), cq->wc)) > 0) { + budget - completed), wcs)) > 0) { for (i = 0; i < n; i++) { - struct ib_wc *wc = &cq->wc[i]; + struct ib_wc *wc = &wcs[i]; if (wc->wr_cqe) wc->wr_cqe->done(cq, wc); @@ -60,18 +61,20 @@ static int __ib_process_cq(struct ib_cq * @cq: CQ to process * @budget: number of CQEs to poll for * - * This function is used to process all outstanding CQ entries on a - * %IB_POLL_DIRECT CQ. It does not offload CQ processing to a different - * context and does not ask for completion interrupts from the HCA. + * This function is used to process all outstanding CQ entries. + * It does not offload CQ processing to a different context and does + * not ask for completion interrupts from the HCA. + * Using direct processing on CQ with non IB_POLL_DIRECT type may trigger + * concurrent processing. * * Note: do not pass -1 as %budget unless it is guaranteed that the number * of completions that will be processed is small. */ int ib_process_cq_direct(struct ib_cq *cq, int budget) { - WARN_ON_ONCE(cq->poll_ctx != IB_POLL_DIRECT); + struct ib_wc wcs[IB_POLL_BATCH]; - return __ib_process_cq(cq, budget); + return __ib_process_cq(cq, budget, wcs); } EXPORT_SYMBOL(ib_process_cq_direct); @@ -85,7 +88,7 @@ static int ib_poll_handler(struct irq_po struct ib_cq *cq = container_of(iop, struct ib_cq, iop); int completed; - completed = __ib_process_cq(cq, budget); + completed = __ib_process_cq(cq, budget, NULL); if (completed < budget) { irq_poll_complete(&cq->iop); if (ib_req_notify_cq(cq, IB_POLL_FLAGS) > 0) @@ -105,7 +108,7 @@ static void ib_cq_poll_work(struct work_ struct ib_cq *cq = container_of(work, struct ib_cq, work); int completed; - completed = __ib_process_cq(cq, IB_POLL_BUDGET_WORKQUEUE); + completed = __ib_process_cq(cq, IB_POLL_BUDGET_WORKQUEUE, NULL); if (completed >= IB_POLL_BUDGET_WORKQUEUE || ib_req_notify_cq(cq, IB_POLL_FLAGS) > 0) queue_work(ib_comp_wq, &cq->work);