Received: by 10.192.165.148 with SMTP id m20csp534780imm; Wed, 25 Apr 2018 03:51:33 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/oIEDhlLmmiTkwS0yyhFtD/4Sbg6Tii7A1WkhsqV+sDPLycgxczObsqfUNKwfhI0gkiHBv X-Received: by 2002:a17:902:988b:: with SMTP id s11-v6mr28405444plp.306.1524653493310; Wed, 25 Apr 2018 03:51:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524653493; cv=none; d=google.com; s=arc-20160816; b=0R9FfYrnR/vDNJ6fM5fbhHImQnBZXga8CtbHzyYV8RQV7akuz3166jrHPeEkdVQQx2 hxk1sWEi/iyspiXCsFoTJDxund6DObIKKZk3FTU5hrEkyhpo7yVNqCBxrHumwdzwvbUm k4ptZM2GvKiWAPwvDWHe99LhbxtFohnQmZUhyLO/FlfI++p+mRcIc65Ql3++H0lDjn1k 1a5xpv6Wx/0S5h6bR4YcBKuObQ6XtN3RfIDbm4I2vLSr+xiw93MAOq8OVQSjVNgzkP06 Bc1RFrkT0VoxdLCqCC1VS2u25nh9ZSwh2tomehPEHme0Hwkg26PSqjoCVPkqJUmWiPeI +59A== 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=XLtu/uANDQJPLKfajFSIqlXEloH3CfLSDdQhxV44gT0=; b=uRestSaad5v9iUZ4et0oqcb2/+qCYuVJbFk5wvbJUearaOLyp84Rwcx23aFCH+WDu5 usZIeSIpMvTTy8C66U5U34Si/M+IZIXh8yESwCjrfNBJIBPgUaZ/JYr/z6saLtSXfwfd nC/h77voZzHiN0+c4b9LQ94yJu+P+BLwEPDNi/yqARB9NxqFkppXZMjIHe5K9Oy1SzVA aVTLFRFtWFqTt8DWo1fIR6PE0hKPF0A5TW1Oh585YNAlJSuGtvU77sUkefFS7Xklplf4 ZJS4s3oOnvVxQG6hsKdUOPid30gtzWz+6/puMDGbLZyAy70GuD4/EbLKPFXI06ZQQDjD eggw== 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 o184si1648151pga.128.2018.04.25.03.51.18; Wed, 25 Apr 2018 03:51:33 -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 S1754601AbeDYKuE (ORCPT + 99 others); Wed, 25 Apr 2018 06:50:04 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:53334 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754380AbeDYKoa (ORCPT ); Wed, 25 Apr 2018 06:44:30 -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 46A2C266; Wed, 25 Apr 2018 10:44:29 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , Sergey Gorenko , Max Gurtovoy , Leon Romanovsky , Bart Van Assche , Jason Gunthorpe , Sasha Levin Subject: [PATCH 4.14 172/183] RDMA/core: Reduce poll batch for direct cq polling Date: Wed, 25 Apr 2018 12:36:32 +0200 Message-Id: <20180425103249.422929682@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: Max Gurtovoy [ Upstream commit d3b9e8ad425cfd5b9116732e057f1b48e4d3bcb8 ] Fix warning limit for kernel stack consumption: drivers/infiniband/core/cq.c: In function 'ib_process_cq_direct': drivers/infiniband/core/cq.c:78:1: error: the frame size of 1032 bytes is larger than 1024 bytes [-Werror=frame-larger-than=] Using smaller ib_wc array on the stack brings us comfortably below that limit again. Fixes: 246d8b184c10 ("IB/cq: Don't force IB_POLL_DIRECT poll context for ib_process_cq_direct") Reported-by: Arnd Bergmann Reviewed-by: Sergey Gorenko Signed-off-by: Max Gurtovoy Signed-off-by: Leon Romanovsky Reviewed-by: Bart Van Assche Acked-by: Arnd Bergmann Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/infiniband/core/cq.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) --- a/drivers/infiniband/core/cq.c +++ b/drivers/infiniband/core/cq.c @@ -17,6 +17,7 @@ /* # of WCs to poll for with a single call to ib_poll_cq */ #define IB_POLL_BATCH 16 +#define IB_POLL_BATCH_DIRECT 8 /* # of WCs to iterate over before yielding */ #define IB_POLL_BUDGET_IRQ 256 @@ -25,18 +26,18 @@ #define IB_POLL_FLAGS \ (IB_CQ_NEXT_COMP | IB_CQ_REPORT_MISSED_EVENTS) -static int __ib_process_cq(struct ib_cq *cq, int budget, struct ib_wc *poll_wc) +static int __ib_process_cq(struct ib_cq *cq, int budget, struct ib_wc *wcs, + int batch) { int i, n, completed = 0; - struct ib_wc *wcs = poll_wc ? : cq->wc; /* * budget might be (-1) if the caller does not * want to bound this call, thus we need unsigned * minimum here. */ - while ((n = ib_poll_cq(cq, min_t(u32, IB_POLL_BATCH, - budget - completed), wcs)) > 0) { + while ((n = ib_poll_cq(cq, min_t(u32, batch, + budget - completed), wcs)) > 0) { for (i = 0; i < n; i++) { struct ib_wc *wc = &wcs[i]; @@ -48,8 +49,7 @@ static int __ib_process_cq(struct ib_cq completed += n; - if (n != IB_POLL_BATCH || - (budget != -1 && completed >= budget)) + if (n != batch || (budget != -1 && completed >= budget)) break; } @@ -72,9 +72,9 @@ static int __ib_process_cq(struct ib_cq */ int ib_process_cq_direct(struct ib_cq *cq, int budget) { - struct ib_wc wcs[IB_POLL_BATCH]; + struct ib_wc wcs[IB_POLL_BATCH_DIRECT]; - return __ib_process_cq(cq, budget, wcs); + return __ib_process_cq(cq, budget, wcs, IB_POLL_BATCH_DIRECT); } EXPORT_SYMBOL(ib_process_cq_direct); @@ -88,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, NULL); + completed = __ib_process_cq(cq, budget, cq->wc, IB_POLL_BATCH); if (completed < budget) { irq_poll_complete(&cq->iop); if (ib_req_notify_cq(cq, IB_POLL_FLAGS) > 0) @@ -108,7 +108,8 @@ 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, NULL); + completed = __ib_process_cq(cq, IB_POLL_BUDGET_WORKQUEUE, cq->wc, + IB_POLL_BATCH); if (completed >= IB_POLL_BUDGET_WORKQUEUE || ib_req_notify_cq(cq, IB_POLL_FLAGS) > 0) queue_work(ib_comp_wq, &cq->work);