Received: by 10.213.65.68 with SMTP id h4csp2182973imn; Sun, 8 Apr 2018 21:55:22 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/a7K8nOT7EEf3pfoFq+DW7YEUeEecIaz8OslmgrSLjdaF9FNxneXpFKmE/Vu4NJElvNzOJ X-Received: by 10.101.77.13 with SMTP id i13mr24331415pgt.70.1523249721938; Sun, 08 Apr 2018 21:55:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523249721; cv=none; d=google.com; s=arc-20160816; b=011Ql+7C3k7NaqJ22ByVt06GSQ5oIgboIjELt51XHjWyjUJXTFWAkVuOqV3tPF7Q2P aatoWnqErXdwtIEpC9iiJ0VtryxGGV8gpoXRwBsvqD2HE6rt6jKQBj6IMrOQEvsW3j5m pqe8kCeJgnp8k8wNsYFHZQjtdIE5nOt7JE+P+39EX/BaMZ/w+xBkhvQja2iyriDV8LYW vf4QMhImtUbVYVbpw2Nt6fGqZYiNoJEV5SdOVOUxk9qkEffgh76g95ZdyuzsDLXHE1Eo QUvuC4nhraWpP9aqLbpFRp4mcNrRYhV+q6SKCLY7Q1tg9C7BYyz+0T8/fePm534DX4me DmyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=PereLzsXEdUjym93YLzmOTMTpS3AP4xqRZM6UXrmLzg=; b=uXMytowsIqxxiIVM0RoPTTpIW5TuYdluf4KudVShQzRVaE1LHCisToX1C1eEdno7v/ C++cbTWkuSCpIqxtLbCsj7DIikUF1rsBiFCwwUHAkUWzPUdkxRgMSnRW/6L+jMmiAHMi AZgVzCQWGK8DOqY79zE0RvHE+cLKdWwDVyYa8xWwolDvSxqVFAfYRx+k9LGnZgPyP/kF yn2nbNRBNTr7xQP9LFfpBV7MDin023q0mZ2e6aTxxbXpRwsYi/Soe+VfGD8GHrPkvO/J 77zMz7OJzyTy1vKOdhP5QSW/ZfQ4PMXMNEu51AKK8yqsvtxub9mTg42o5DJjiCSFOS8s Tzgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=Q2dSo/YD; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j22-v6si10386239pli.712.2018.04.08.21.54.45; Sun, 08 Apr 2018 21:55:21 -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; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=Q2dSo/YD; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753356AbeDIAR7 (ORCPT + 99 others); Sun, 8 Apr 2018 20:17:59 -0400 Received: from mail-bl2nam02on0131.outbound.protection.outlook.com ([104.47.38.131]:5451 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753289AbeDIARz (ORCPT ); Sun, 8 Apr 2018 20:17:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=PereLzsXEdUjym93YLzmOTMTpS3AP4xqRZM6UXrmLzg=; b=Q2dSo/YDkNRzmLWVxoU3n8t2NCi/0doR8RmNZWSPeTGn37WuzpNGv6fpKJMOgJ17Utmv+q0QncFIv4ghewgkIL7IhczvISANpuG/C7/dY9D1C/7Dc7luJx84z6Qo2+2CvYtPYykh3vzSjCmOhzRUoindBfVPhyDoPk+vHWvtmeo= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1048.namprd21.prod.outlook.com (52.132.128.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.0; Mon, 9 Apr 2018 00:17:48 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059%2]) with mapi id 15.20.0696.003; Mon, 9 Apr 2018 00:17:48 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Sagi Grimberg , Bart Van Assche , Max Gurtovoy , Doug Ledford , Sasha Levin Subject: [PATCH AUTOSEL for 4.15 045/189] IB/cq: Don't force IB_POLL_DIRECT poll context for ib_process_cq_direct Thread-Topic: [PATCH AUTOSEL for 4.15 045/189] IB/cq: Don't force IB_POLL_DIRECT poll context for ib_process_cq_direct Thread-Index: AQHTz5ggeRLup7dywkGCbGMSiDnHhw== Date: Mon, 9 Apr 2018 00:17:21 +0000 Message-ID: <20180409001637.162453-45-alexander.levin@microsoft.com> References: <20180409001637.162453-1-alexander.levin@microsoft.com> In-Reply-To: <20180409001637.162453-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB1048;7:rUai3MeZsVwebQi5HSLaWMXbjitEpnbV2ZtAZ2bqwRE3XHPy5PHScm0skhAnn5Mwvy/rEzqKL4Jbr7z6q4kDtQV0mEoE+0VVFWKQ59j3k3doq4fpGdTCXt6PR+GlHJizZ78fDH3RsOA/E4hoKQtK+Q0k2yprf7g3T3ApYuLoBI7sCRoCyDHf28vHccGafu38h83fvlBA7lIRRqJLDy3ls/wpLO1h/X5cb407fa72MH3ZF/4v5lriC+4gy5RR38HL;20:e1P9pYZGmRz+4Fs5IDDh8FWUwSW4gI9W533wxSqCoyXRMkCqKu4VFgTJCCM1eC/7fm2+0MjduGFkOn+B2YnEILDCRhi6a+icNN5bHCLyLwz/qYqIExCEFThkutJwNLJmhohZFLoYv3nBezGkeyw3FomsXPTh2zDJGlKvgzWD3YI= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: 26b48037-43a0-41df-d384-08d59daf5341 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB1048; x-ms-traffictypediagnostic: DM5PR2101MB1048: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(3231221)(944501327)(52105095)(3002001)(10201501046)(6055026)(61426038)(61427038)(6041310)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(6072148)(201708071742011);SRVR:DM5PR2101MB1048;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB1048; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(366004)(39380400002)(376002)(39860400002)(346002)(396003)(189003)(199004)(86362001)(1076002)(99286004)(6116002)(110136005)(3846002)(54906003)(22452003)(3280700002)(105586002)(2906002)(76176011)(4326008)(6512007)(6436002)(6486002)(3660700001)(6666003)(7736002)(86612001)(25786009)(2900100001)(14454004)(97736004)(53936002)(107886003)(68736007)(102836004)(36756003)(6506007)(26005)(186003)(106356001)(305945005)(5250100002)(72206003)(478600001)(2501003)(10290500003)(81166006)(5660300001)(8676002)(66066001)(316002)(81156014)(2616005)(10090500001)(11346002)(446003)(476003)(8936002)(486006)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB1048;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: ELRwVXzljYTvfIDUe8z3v2tZs4Ms0IdrwwhrXP2lWzWMRxX0NYk3+AI/iqrzCRljaXqHlmmOvFAGZ3dXiJn/AHY+s66wFyJf0R4nK6MSwFX/9aYXaEUOnp52BdLFAS7Jc06ovQm9Xx8MtjnRxdgeBJIqpf9y8j7Q9KwJoGpcX7NpcxgoahLw9Qs/MQoduHaWcYLJPkvoqeBUJ4TpxSch28FuAsyA8Pia0FDT4cnmpbS02klns8A+2cRme1O08pT7j8Ae4aKIpkOjr49WOphtRB+LYBR7o9jxCyefJ4iypCnK1rkuxrok7TplRQXn9VXbEcIHQ0N1wmLxZd60HzzSUQMqmQZXq4rV8lcLhisT01WUTQaN9sg8jrMltwFl329oUPtPSA7nq0HLvYLnUgSF77KxxyNXaE/hSc2IKQeC/+o= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 26b48037-43a0-41df-d384-08d59daf5341 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:17:21.4478 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1048 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/infiniband/core/cq.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/drivers/infiniband/core/cq.c b/drivers/infiniband/core/cq.c index f2ae75fa3128..c8c5a5a7f433 100644 --- 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) =20 -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 *pol= l_wc) { int i, n, completed =3D 0; + struct ib_wc *wcs =3D poll_wc ? : cq->wc; =20 /* * budget might be (-1) if the caller does not @@ -35,9 +36,9 @@ static int __ib_process_cq(struct ib_cq *cq, int budget) * minimum here. */ while ((n =3D ib_poll_cq(cq, min_t(u32, IB_POLL_BATCH, - budget - completed), cq->wc)) > 0) { + budget - completed), wcs)) > 0) { for (i =3D 0; i < n; i++) { - struct ib_wc *wc =3D &cq->wc[i]; + struct ib_wc *wc =3D &wcs[i]; =20 if (wc->wr_cqe) wc->wr_cqe->done(cq, wc); @@ -60,18 +61,20 @@ static int __ib_process_cq(struct ib_cq *cq, int budget= ) * @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 !=3D IB_POLL_DIRECT); + struct ib_wc wcs[IB_POLL_BATCH]; =20 - return __ib_process_cq(cq, budget); + return __ib_process_cq(cq, budget, wcs); } EXPORT_SYMBOL(ib_process_cq_direct); =20 @@ -85,7 +88,7 @@ static int ib_poll_handler(struct irq_poll *iop, int budg= et) struct ib_cq *cq =3D container_of(iop, struct ib_cq, iop); int completed; =20 - completed =3D __ib_process_cq(cq, budget); + completed =3D __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 *work) struct ib_cq *cq =3D container_of(work, struct ib_cq, work); int completed; =20 - completed =3D __ib_process_cq(cq, IB_POLL_BUDGET_WORKQUEUE); + completed =3D __ib_process_cq(cq, IB_POLL_BUDGET_WORKQUEUE, NULL); if (completed >=3D IB_POLL_BUDGET_WORKQUEUE || ib_req_notify_cq(cq, IB_POLL_FLAGS) > 0) queue_work(ib_comp_wq, &cq->work); --=20 2.15.1