From patchwork Mon Mar 9 06:50:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Mattias_R=C3=B6nnblom?= X-Patchwork-Id: 66374 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 13286A052E; Mon, 9 Mar 2020 07:52:43 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 766491C030; Mon, 9 Mar 2020 07:51:57 +0100 (CET) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80043.outbound.protection.outlook.com [40.107.8.43]) by dpdk.org (Postfix) with ESMTP id 87AC41BFF9 for ; Mon, 9 Mar 2020 07:51:47 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JA1/cmVcjTjH3fZeT1XzXMZQbuDs3QefW8oORtW34jsjeKFljHjT0vcI7Q32bNvU4hdIEfYi6jdz29cTOJS934QBWUbJz8QE1qnPU1JWwwp7ZIBRKUD2y33ifB935/jrMJm7+7KQkdq1naAvSKE0OB29R5ureR/JGrt9D9JlVPezYYECrct3/2eNnf5YM7vUX68GnUcVrD2c7b5CPf4U8r1Klt/6jgr9iodgb7czSrFdGNHprOyIZHUR/BtVYD4EqrbowHwTK5vRQn8EAsVoT1eLQHKGN1H9hnKImMFbPezpkbFpgcEo0v4/Ckxu2PO659MVrOIbrHidBk1vxolKTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tsoqNto0JVw5YaNJuoTlN/Tewx+qYxRVFbCPlo5Ij7E=; b=QY+KvEQYkEnsf88VJQG3pxyl/h1Xc9ngPPYVY71CV2MFC3ojqy+2WNdJUH+vNXtbNixx1KnwdGthkC72lUbCgHpyLPDH5FP8kaVhXmlzY3H13h2avi8h3gLg7C9ezpGhMbW9ypK+KsJgxu7nElR4cUPAkggxQvewJHM1llHBH2PrSrB8sZt3KFwYbLN+WwufUuhQEJr/uS8FatOYJ1eeQph0hr+8Gi1w5HjaNoTuHYHVKKoq06rXZl8kFBVgITJs9+9n941YXFsrit9yDta2AoP/TK37fxuyaXB85QaIiQpBdl7NApeuZf5jkvR4QAixmOTtllsypjj7qVNJfpmy8g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 192.176.1.74) smtp.rcpttodomain=arm.com smtp.mailfrom=ericsson.com; dmarc=pass (p=reject sp=none pct=100) action=none header.from=ericsson.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericsson.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tsoqNto0JVw5YaNJuoTlN/Tewx+qYxRVFbCPlo5Ij7E=; b=JCu0K/WQ0MRahJkKgIbFJBOonj55htlJyOa8OQGWi7uARMT2u4O4EPwETwOHvftR4q7e9jhNC4yKp4Ge9DDXtAKNmnPRXBHierfMPq6prJSNy0kpLgyDbiEWPRD/UPjyv62x3G/tGDWcbb+YNFCPsF2doRvvHLltKgbNNoNT+ms= Received: from AM6PR0202CA0071.eurprd02.prod.outlook.com (2603:10a6:20b:3a::48) by AM0PR07MB4450.eurprd07.prod.outlook.com (2603:10a6:208:7a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2814.9; Mon, 9 Mar 2020 06:51:46 +0000 Received: from HE1EUR02FT025.eop-EUR02.prod.protection.outlook.com (2603:10a6:20b:3a:cafe::ac) by AM6PR0202CA0071.outlook.office365.com (2603:10a6:20b:3a::48) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2793.16 via Frontend Transport; Mon, 9 Mar 2020 06:51:46 +0000 Authentication-Results: spf=pass (sender IP is 192.176.1.74) smtp.mailfrom=ericsson.com; arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=pass action=none header.from=ericsson.com; Received-SPF: Pass (protection.outlook.com: domain of ericsson.com designates 192.176.1.74 as permitted sender) receiver=protection.outlook.com; client-ip=192.176.1.74; helo=oa.msg.ericsson.com; Received: from oa.msg.ericsson.com (192.176.1.74) by HE1EUR02FT025.mail.protection.outlook.com (10.152.10.79) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2793.11 via Frontend Transport; Mon, 9 Mar 2020 06:51:46 +0000 Received: from ESESBMB503.ericsson.se (153.88.183.170) by ESESBMR504.ericsson.se (153.88.183.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Mon, 9 Mar 2020 07:51:43 +0100 Received: from selio1a020.lmera.ericsson.se (153.88.183.153) by smtp.internal.ericsson.com (153.88.183.186) with Microsoft SMTP Server id 15.1.1713.5 via Frontend Transport; Mon, 9 Mar 2020 07:51:43 +0100 Received: from breslau.lmera.ericsson.se (breslau.lmera.ericsson.se [150.132.109.241]) by selio1a020.lmera.ericsson.se (8.15.1+Sun/8.15.1) with ESMTP id 0296pgIL024126; Mon, 9 Mar 2020 07:51:43 +0100 (CET) From: =?utf-8?q?Mattias_R=C3=B6nnblom?= To: CC: , , , =?utf-8?q?Mattias_R=C3=B6nnblom?= Date: Mon, 9 Mar 2020 07:50:59 +0100 Message-ID: <20200309065106.23800-2-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200309065106.23800-1-mattias.ronnblom@ericsson.com> References: <20200309065106.23800-1-mattias.ronnblom@ericsson.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:192.176.1.74; IPV:; CTRY:SE; EFV:NLI; SFV:NSPM; SFS:(10009020)(4636009)(346002)(39860400002)(376002)(396003)(136003)(199004)(189003)(107886003)(6916009)(54906003)(316002)(36756003)(478600001)(4326008)(70206006)(70586007)(356004)(2906002)(6666004)(2616005)(956004)(336012)(8676002)(246002)(5660300002)(86362001)(8936002)(26005)(186003)(1076003)(7636002)(21314003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR07MB4450; H:oa.msg.ericsson.com; FPR:; SPF:Pass; LANG:en; PTR:office365.se.ericsson.net; A:1; MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f55fde8f-378e-4e66-f53e-08d7c3f655b2 X-MS-TrafficTypeDiagnostic: AM0PR07MB4450: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-Forefront-PRVS: 0337AFFE9A X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZHOmzmdDusv1j9yTiq1y02n+nyFT96fIz6Jh6nYoVMZwVFtlMyWrj9bDn/FruGw/MWegTeBg7uaiYvV7mBj4x9QsLfsl4mWGGFoT7raOQYBEZbElBV+t/3GrWW0gq3BPY/2Zu8P/A0e3WZj9u1pmsUZ5ZJdP3bb9d2Tj72BDjGlMX9PUYm/l21GcavSe/XRBVNOx34VZsxWkZe8lMARDnSnpC1uKTaO7JUicYpC67/w8f41qkY5KHne+nRfxkLXJhcMi2mWnJdys/1ygr+AOO9j3waRTKVB2KTaAxvNUXXeMhN3WhVXcxEYkA9I+T6FWNNmULfYhsu90DYSCGBp5AdSbKuyLVcgoLuGdd+e+imZ35QGz3atZJKXoQtytw/Ho1UFTG+hY2opn+6ew1My6c3LYFjMCeDaJpRLEn3yiGu6UJkuWAhYS4AS6XbHhKQ4CVV2Q97y1MDVBhKuiUFTeG7BEeJjdLrVJNWNk/fAiXDoJIJioqp8YBPF85ipeCTos X-OriginatorOrg: ericsson.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2020 06:51:46.3036 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f55fde8f-378e-4e66-f53e-08d7c3f655b2 X-MS-Exchange-CrossTenant-Id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=92e84ceb-fbfd-47ab-be52-080c6b87953f; Ip=[192.176.1.74]; Helo=[oa.msg.ericsson.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR07MB4450 Subject: [dpdk-dev] [PATCH 1/8] event/dsw: reduce latency in low-load situations X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" In DSW, in case a port can't produce any events for the application to consume, the port is considered idle. To slightly reduce wall-time latency, flush the port's output buffer in case of such an empty dequeue. Signed-off-by: Mattias Rönnblom --- drivers/event/dsw/dsw_event.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/event/dsw/dsw_event.c b/drivers/event/dsw/dsw_event.c index 296adea18..7f1f29218 100644 --- a/drivers/event/dsw/dsw_event.c +++ b/drivers/event/dsw/dsw_event.c @@ -1245,11 +1245,11 @@ dsw_event_dequeue_burst(void *port, struct rte_event *events, uint16_t num, * seem to improve performance. */ dsw_port_record_seen_events(port, events, dequeued); - } - /* XXX: Assuming the port can't produce any more work, - * consider flushing the output buffer, on dequeued == - * 0. - */ + } else /* Zero-size dequeue means a likely idle port, and thus + * we can afford trading some efficiency for a slightly + * reduced event wall-time latency. + */ + dsw_port_flush_out_buffers(dsw, port); #ifdef DSW_SORT_DEQUEUED dsw_stable_sort(events, dequeued, sizeof(events[0]), dsw_cmp_event); From patchwork Mon Mar 9 06:51:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Mattias_R=C3=B6nnblom?= X-Patchwork-Id: 66372 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 79BA5A052E; Mon, 9 Mar 2020 07:52:20 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 83CA41C01B; Mon, 9 Mar 2020 07:51:54 +0100 (CET) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20050.outbound.protection.outlook.com [40.107.2.50]) by dpdk.org (Postfix) with ESMTP id D37201BFF2 for ; Mon, 9 Mar 2020 07:51:45 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IYLEnEHXGAkTQxhM1DGFC2CKgMpl3XyOWDg34RyVOuNiPKSOOhTUYZfn0k0/cJwn+l2/bdGELhGNacBcJn4J/JtPYSNt5c2Wt9Efa1T25VcvQJgYHWEG23FuqYr2x0z6vc3CvhLNhsIUyTLhlZt4YQUJ8afNmwhKfbJdyZgxl0SWUNrtGcXvlThTJbICQqsE9YXL68Jx63buUqpwbjFNPk2TAJmoBLD1Ed6bn1QTbt5oNleMnw5Xf0ze5mGFrJc8CS/XQFTKcSzYLMPZdIYXDzHsK8/ZZBY3gPuEXytRMTYR7YR8LvCPbKF1H+N7jfsV/HSy+5/zyt9Qo4By1tZ5DA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+zxR5MeBiafQlyD91402zq+ZEEeyA/xVsApYjGntd4k=; b=c3mZmtQDV8wQU5ieEf4aGEqMbo0qinqQ2lD5khtxS90D3GJueYkmZK0kBYScfTTtekyrLAXGkasaDsnhowaTrpb1zmSOXQ4j/EHiFaqzZrc6Ilcapi9euLPMZAkXzg0D94oBrMoriw6S28y5dM+SGA28+GFfnu9FUyoxVC7+GokENXzwjYDj81p8zFxO2ShxNvPw4d8W6pu/SqhYw8jFdTWAhfJzbcdj6I27x65Cir4Pz123yzijN+PmKwIQDvEe5lLNhReRf+bBEBgs/6hWuuHERhxQuMNqVdcF7eorF+rnms5qBgBypObYa3vWrC79Ah27iwMfgrOwUbUPmekO/g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 192.176.1.74) smtp.rcpttodomain=arm.com smtp.mailfrom=ericsson.com; dmarc=pass (p=reject sp=none pct=100) action=none header.from=ericsson.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericsson.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+zxR5MeBiafQlyD91402zq+ZEEeyA/xVsApYjGntd4k=; b=CQy6uC/MVqTf4icS7vXETT32BgiFrTujF+zniV4xWYuI975QkN3jFPBwk02oOeSRbO2+mwr/VOLijeGfgtJY+zGGtrbo6DttFdCQ8bW1A9pMhBvA3RIuQstY4weNOB8Tkd/4yrAW84+rvbQYiC5JzGr7N0deUqSl68sJkljBbjo= Received: from AM6PR05CA0024.eurprd05.prod.outlook.com (2603:10a6:20b:2e::37) by VI1PR07MB4333.eurprd07.prod.outlook.com (2603:10a6:802:65::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2814.9; Mon, 9 Mar 2020 06:51:44 +0000 Received: from AM5EUR02FT046.eop-EUR02.prod.protection.outlook.com (2603:10a6:20b:2e:cafe::d6) by AM6PR05CA0024.outlook.office365.com (2603:10a6:20b:2e::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2793.15 via Frontend Transport; Mon, 9 Mar 2020 06:51:44 +0000 Authentication-Results: spf=pass (sender IP is 192.176.1.74) smtp.mailfrom=ericsson.com; arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=pass action=none header.from=ericsson.com; Received-SPF: Pass (protection.outlook.com: domain of ericsson.com designates 192.176.1.74 as permitted sender) receiver=protection.outlook.com; client-ip=192.176.1.74; helo=oa.msg.ericsson.com; Received: from oa.msg.ericsson.com (192.176.1.74) by AM5EUR02FT046.mail.protection.outlook.com (10.152.8.221) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2793.11 via Frontend Transport; Mon, 9 Mar 2020 06:51:43 +0000 Received: from ESESSMB503.ericsson.se (153.88.183.164) by ESESBMR506.ericsson.se (153.88.183.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Mon, 9 Mar 2020 07:51:43 +0100 Received: from ESESSMB501.ericsson.se (153.88.183.162) by ESESSMB503.ericsson.se (153.88.183.164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Mon, 9 Mar 2020 07:51:42 +0100 Received: from selio1a020.lmera.ericsson.se (153.88.183.153) by smtp.internal.ericsson.com (153.88.183.189) with Microsoft SMTP Server id 15.1.1713.5 via Frontend Transport; Mon, 9 Mar 2020 07:51:42 +0100 Received: from breslau.lmera.ericsson.se (breslau.lmera.ericsson.se [150.132.109.241]) by selio1a020.lmera.ericsson.se (8.15.1+Sun/8.15.1) with ESMTP id 0296pgIM024126; Mon, 9 Mar 2020 07:51:43 +0100 (CET) From: =?utf-8?q?Mattias_R=C3=B6nnblom?= To: CC: , , , =?utf-8?q?Mattias_R=C3=B6nnblom?= Date: Mon, 9 Mar 2020 07:51:00 +0100 Message-ID: <20200309065106.23800-3-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200309065106.23800-1-mattias.ronnblom@ericsson.com> References: <20200309065106.23800-1-mattias.ronnblom@ericsson.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:192.176.1.74; IPV:; CTRY:SE; EFV:NLI; SFV:NSPM; SFS:(10009020)(4636009)(396003)(39860400002)(136003)(376002)(346002)(199004)(189003)(66574012)(336012)(1076003)(2616005)(956004)(8676002)(7636002)(8936002)(107886003)(478600001)(6916009)(86362001)(246002)(26005)(36756003)(6666004)(186003)(356004)(4326008)(2906002)(5660300002)(54906003)(316002)(70586007)(70206006); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR07MB4333; H:oa.msg.ericsson.com; FPR:; SPF:Pass; LANG:en; PTR:office365.se.ericsson.net; A:1; MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a33cfe55-1357-422e-194e-08d7c3f65450 X-MS-TrafficTypeDiagnostic: VI1PR07MB4333: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-Forefront-PRVS: 0337AFFE9A X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3ZvMWjLk9l9KOcyqbfgnm/RiHKoL7w97yxp4GOHZ+esKA1HRUmYUanHDD9bWUJ+nVyyqD+oiq343D8NXhDUg9ncnM8G1qJ7IhRpr4MzAieg2A+gl5RbirBxNwENPYWyalGgcvmz/730ETlxqd6HFjvT8ALLvhN1SvlIbQ9QdtjWGWybwKKkccMcdE7ifmYz2FgaRzWcIACBK3h5BEqz4J7/2hCoUNRmBKNYQv37MpeRmmfbC7pV+DzgyrVYnFkTfwb9zoBF7VxFwJ8LZZZsuh/AGYDlkTjRXFPJQFx334YUZmsxlqLmvYPUvNQHiXjypexJOd/Kfh0UYBvXAkU5XqErb3F1ESfyZysrSvtAAX1e4A0MG4MZoGg0Cw0u/uz8v+AemrTAB9fYoGEg+inzKD/BFnAJPzDFMVwd6VYg1MVVagmU8FNnGtbhZCThrEIuN X-OriginatorOrg: ericsson.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2020 06:51:43.9470 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a33cfe55-1357-422e-194e-08d7c3f65450 X-MS-Exchange-CrossTenant-Id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=92e84ceb-fbfd-47ab-be52-080c6b87953f; Ip=[192.176.1.74]; Helo=[oa.msg.ericsson.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR07MB4333 Subject: [dpdk-dev] [PATCH 2/8] event/dsw: reduce max flows to speed up load balancing X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Reduce the maximum number of DSW flows from 32k to 8k, to be able rebalance load faster. Signed-off-by: Mattias Rönnblom --- drivers/event/dsw/dsw_evdev.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/event/dsw/dsw_evdev.h b/drivers/event/dsw/dsw_evdev.h index 5c7b6108d..dc44bce81 100644 --- a/drivers/event/dsw/dsw_evdev.h +++ b/drivers/event/dsw/dsw_evdev.h @@ -19,8 +19,20 @@ #define DSW_MAX_EVENTS (16384) -/* Code changes are required to allow more flows than 32k. */ -#define DSW_MAX_FLOWS_BITS (15) +/* Multiple 24-bit flow ids will map to the same DSW-level flow. The + * number of DSW flows should be high enough make it unlikely that + * flow ids of several large flows hash to the same DSW-level flow. + * Such collisions will limit parallism and thus the number of cores + * that may be utilized. However, configuring a large number of DSW + * flows might potentially, depending on traffic and actual + * application flow id value range, result in each such DSW-level flow + * being very small. The effect of migrating such flows will be small, + * in terms amount of processing load redistributed. This will in turn + * reduce the load balancing speed, since flow migration rate has an + * upper limit. Code changes are required to allow > 32k DSW-level + * flows. + */ +#define DSW_MAX_FLOWS_BITS (13) #define DSW_MAX_FLOWS (1<<(DSW_MAX_FLOWS_BITS)) #define DSW_MAX_FLOWS_MASK (DSW_MAX_FLOWS-1) From patchwork Mon Mar 9 06:51:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Mattias_R=C3=B6nnblom?= X-Patchwork-Id: 66376 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 14E12A052E; Mon, 9 Mar 2020 07:53:03 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 53CFC1C068; Mon, 9 Mar 2020 07:52:00 +0100 (CET) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20087.outbound.protection.outlook.com [40.107.2.87]) by dpdk.org (Postfix) with ESMTP id A76EC1BFF2 for ; Mon, 9 Mar 2020 07:51:48 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N/oU9AMHHXRgTeVNYt8l3LC6XltPixFwPpgrpDRzOcDVrMFU/pgNT6kP8VYKyAIJ28kS7ZSY6faSAw23j/udNvjnyy1Cao2MQjz6lW5+nYiuV/tW+ycBYhC8JR9zsB/ZeTHYw+m/Fl8UBuvPm/lhys29sp3HJrsH4KBImzwKnTcatD7hV/TJgr1Hydj/tF7G559nMGi8N/fG8U2AnOg04zlzHDmhpK0VSATvMWgG4+wHDS2nSBdCV96gJ2AasrnDUPs7+cGLYbyyDBqwRheRW8W9LcswQgaQZbl43tRwcdNVQyn4PqztyO45e6yiQUZAIPelZ1AEm27kF+KjbP3rgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=y0JGTKrbjFOgiyDI8YIq8II5oc3jlMbSL767cx9CLuw=; b=NFQm7CIU6MmuGw0Sh9Gwz0YfxzEuXfN5PjeQzsT+utwlPU6UHduF68R0nvAKY4A0KPvDHeun3GNCopGvAnOAWWG+DsNwZ7dg0tBzzCFg1rGHYLe/nIJwS3/d/5FzwSRvEWDGkFJYZfv7thtVIpYbeR5n3Ih3AJR+AssFjiEBnkYI1O/zjJ0eAzWPlcY4yz7GPENnNvxnu0hl9CX7SZ7ahSp6G1pht1EpyFxBk6dNJqzKv9eX5LDohLwn5WkuYier8KjV26KAGo1xjQaA5IDr+MnHKzBZPMg0Znzq2xEQZQX4972naEgC90cTSIC1PTBa2HjCIHEuVvoz4elP7Uavgw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 192.176.1.74) smtp.rcpttodomain=arm.com smtp.mailfrom=ericsson.com; dmarc=pass (p=reject sp=none pct=100) action=none header.from=ericsson.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericsson.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=y0JGTKrbjFOgiyDI8YIq8II5oc3jlMbSL767cx9CLuw=; b=GxU3hq5DD5hEDHXEDRE9IcFo6EWGtwSCOuwpLBLiM50MtK07ro97I2zkaQI9CzmJzOadRo+gsP7SK8f1tcMiuU/B3e9da2V9RHISPQg5M42W7ivA2C31+zgz2lov7RWqD1g/wcDr86gvW6LrdpA8iJA0N4qKl4ioTjORJqVkZpo= Received: from AM6P192CA0004.EURP192.PROD.OUTLOOK.COM (2603:10a6:209:83::17) by AM6PR0702MB3574.eurprd07.prod.outlook.com (2603:10a6:209:3::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2814.10; Mon, 9 Mar 2020 06:51:47 +0000 Received: from VE1EUR02FT033.eop-EUR02.prod.protection.outlook.com (2603:10a6:209:83:cafe::2e) by AM6P192CA0004.outlook.office365.com (2603:10a6:209:83::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2793.11 via Frontend Transport; Mon, 9 Mar 2020 06:51:47 +0000 Authentication-Results: spf=pass (sender IP is 192.176.1.74) smtp.mailfrom=ericsson.com; arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=pass action=none header.from=ericsson.com; Received-SPF: Pass (protection.outlook.com: domain of ericsson.com designates 192.176.1.74 as permitted sender) receiver=protection.outlook.com; client-ip=192.176.1.74; helo=oa.msg.ericsson.com; Received: from oa.msg.ericsson.com (192.176.1.74) by VE1EUR02FT033.mail.protection.outlook.com (10.152.12.99) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2793.11 via Frontend Transport; Mon, 9 Mar 2020 06:51:47 +0000 Received: from ESESBMB503.ericsson.se (153.88.183.170) by ESESSMR501.ericsson.se (153.88.183.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Mon, 9 Mar 2020 07:51:44 +0100 Received: from ESESBMB504.ericsson.se (153.88.183.171) by ESESBMB503.ericsson.se (153.88.183.170) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Mon, 9 Mar 2020 07:51:43 +0100 Received: from selio1a020.lmera.ericsson.se (153.88.183.153) by smtp.internal.ericsson.com (153.88.183.187) with Microsoft SMTP Server id 15.1.1713.5 via Frontend Transport; Mon, 9 Mar 2020 07:51:42 +0100 Received: from breslau.lmera.ericsson.se (breslau.lmera.ericsson.se [150.132.109.241]) by selio1a020.lmera.ericsson.se (8.15.1+Sun/8.15.1) with ESMTP id 0296pgIN024126; Mon, 9 Mar 2020 07:51:43 +0100 (CET) From: =?utf-8?q?Mattias_R=C3=B6nnblom?= To: CC: , , , =?utf-8?q?Mattias_R=C3=B6nnblom?= Date: Mon, 9 Mar 2020 07:51:01 +0100 Message-ID: <20200309065106.23800-4-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200309065106.23800-1-mattias.ronnblom@ericsson.com> References: <20200309065106.23800-1-mattias.ronnblom@ericsson.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:192.176.1.74; IPV:; CTRY:SE; EFV:NLI; SFV:NSPM; SFS:(10009020)(4636009)(396003)(136003)(346002)(376002)(39860400002)(199004)(189003)(4326008)(36756003)(6916009)(7636002)(6666004)(356004)(8676002)(107886003)(8936002)(246002)(70586007)(86362001)(316002)(336012)(70206006)(2616005)(26005)(54906003)(186003)(2906002)(956004)(30864003)(5660300002)(478600001)(66574012)(1076003)(461764006); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR0702MB3574; H:oa.msg.ericsson.com; FPR:; SPF:Pass; LANG:en; PTR:office365.se.ericsson.net; A:1; MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3ed41f05-75f3-48ab-1ddd-08d7c3f65680 X-MS-TrafficTypeDiagnostic: AM6PR0702MB3574: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-Forefront-PRVS: 0337AFFE9A X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Kx1PnDdjr60dDRCwJhwm56aLdWMwbs+Ohzwg4QKB1PWj3BD4558gWAX3eH/M16LL7Xj87M44yehToraz6UZsBg2zUKLRSTgU44e8hdsKq06PiMq/ikJ3P5gFMR7AZ3CQ0gmEaC2RJXdddMmlyEs1vOz5gQ9iuxNR9uz3IXfhVq5GxGXZijUXR7SwzJmTtXhyhwXsKGaQHew40+HDmYe1n1X6N928kjjGIwHmdW88KHZQ+0LQrY2IAppB3TIW47LqCYyq8D36oggh3nnvEKtv2gb1P6MwqdOg2ZQ4dcD7kVluFldNxpBcAI8cK8lAspBHbhHP8Je6N8W1XpP3qJvx9vEW7mcvJmSo6wJbPbWCxR+xNjM0zVXQqmnBKR+WL6Coi18rSkWQqdKuR/Lvf5xMiiHdjdvPqipOSmWZ4ALbr2bd0NkTRKU5JFbb/5L4JiE7VEOb0HJCoGBJ4efA40qfwViC5r5N0euUSeZkQ2pLtY1y1KCJWHaO44m+aCFEtWyC X-OriginatorOrg: ericsson.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2020 06:51:47.6041 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3ed41f05-75f3-48ab-1ddd-08d7c3f65680 X-MS-Exchange-CrossTenant-Id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=92e84ceb-fbfd-47ab-be52-080c6b87953f; Ip=[192.176.1.74]; Helo=[oa.msg.ericsson.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR0702MB3574 Subject: [dpdk-dev] [PATCH 3/8] event/dsw: extend statistics X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Extend DSW xstats. To allow visualization of migrations, track the number flow immigrations in "port__immigrations". The "port__migrations" retains legacy semantics, but is renamed "port__emigrations". Expose the number of events currently undergoing processing (i.e. pending releases) at a particular port. Signed-off-by: Mattias Rönnblom --- drivers/event/dsw/dsw_evdev.h | 16 ++-- drivers/event/dsw/dsw_event.c | 131 +++++++++++++++++---------------- drivers/event/dsw/dsw_xstats.c | 17 +++-- 3 files changed, 91 insertions(+), 73 deletions(-) diff --git a/drivers/event/dsw/dsw_evdev.h b/drivers/event/dsw/dsw_evdev.h index dc44bce81..2c7f9efa3 100644 --- a/drivers/event/dsw/dsw_evdev.h +++ b/drivers/event/dsw/dsw_evdev.h @@ -162,18 +162,20 @@ struct dsw_port { uint64_t total_busy_cycles; /* For the ctl interface and flow migration mechanism. */ - uint64_t next_migration; + uint64_t next_emigration; uint64_t migration_interval; enum dsw_migration_state migration_state; - uint64_t migration_start; - uint64_t migrations; - uint64_t migration_latency; + uint64_t emigration_start; + uint64_t emigrations; + uint64_t emigration_latency; - uint8_t migration_target_port_id; - struct dsw_queue_flow migration_target_qf; + uint8_t emigration_target_port_id; + struct dsw_queue_flow emigration_target_qf; uint8_t cfm_cnt; + uint64_t immigrations; + uint16_t paused_flows_len; struct dsw_queue_flow paused_flows[DSW_MAX_PAUSED_FLOWS]; @@ -187,11 +189,13 @@ struct dsw_port { uint16_t seen_events_idx; struct dsw_queue_flow seen_events[DSW_MAX_EVENTS_RECORDED]; + uint64_t enqueue_calls; uint64_t new_enqueued; uint64_t forward_enqueued; uint64_t release_enqueued; uint64_t queue_enqueued[DSW_MAX_QUEUES]; + uint64_t dequeue_calls; uint64_t dequeued; uint64_t queue_dequeued[DSW_MAX_QUEUES]; diff --git a/drivers/event/dsw/dsw_event.c b/drivers/event/dsw/dsw_event.c index 7f1f29218..69cff7aa2 100644 --- a/drivers/event/dsw/dsw_event.c +++ b/drivers/event/dsw/dsw_event.c @@ -385,12 +385,12 @@ dsw_retrieve_port_loads(struct dsw_evdev *dsw, int16_t *port_loads, } static bool -dsw_select_migration_target(struct dsw_evdev *dsw, - struct dsw_port *source_port, - struct dsw_queue_flow_burst *bursts, - uint16_t num_bursts, int16_t *port_loads, - int16_t max_load, struct dsw_queue_flow *target_qf, - uint8_t *target_port_id) +dsw_select_emigration_target(struct dsw_evdev *dsw, + struct dsw_port *source_port, + struct dsw_queue_flow_burst *bursts, + uint16_t num_bursts, int16_t *port_loads, + int16_t max_load, struct dsw_queue_flow *target_qf, + uint8_t *target_port_id) { uint16_t source_load = port_loads[source_port->id]; uint16_t i; @@ -598,39 +598,39 @@ dsw_port_flush_paused_events(struct dsw_evdev *dsw, } static void -dsw_port_migration_stats(struct dsw_port *port) +dsw_port_emigration_stats(struct dsw_port *port) { - uint64_t migration_latency; + uint64_t emigration_latency; - migration_latency = (rte_get_timer_cycles() - port->migration_start); - port->migration_latency += migration_latency; - port->migrations++; + emigration_latency = (rte_get_timer_cycles() - port->emigration_start); + port->emigration_latency += emigration_latency; + port->emigrations++; } static void -dsw_port_end_migration(struct dsw_evdev *dsw, struct dsw_port *port) +dsw_port_end_emigration(struct dsw_evdev *dsw, struct dsw_port *port) { - uint8_t queue_id = port->migration_target_qf.queue_id; - uint16_t flow_hash = port->migration_target_qf.flow_hash; + uint8_t queue_id = port->emigration_target_qf.queue_id; + uint16_t flow_hash = port->emigration_target_qf.flow_hash; port->migration_state = DSW_MIGRATION_STATE_IDLE; port->seen_events_len = 0; - dsw_port_migration_stats(port); + dsw_port_emigration_stats(port); if (dsw->queues[queue_id].schedule_type != RTE_SCHED_TYPE_PARALLEL) { dsw_port_remove_paused_flow(port, queue_id, flow_hash); dsw_port_flush_paused_events(dsw, port, queue_id, flow_hash); } - DSW_LOG_DP_PORT(DEBUG, port->id, "Migration completed for queue_id " + DSW_LOG_DP_PORT(DEBUG, port->id, "Emigration completed for queue_id " "%d flow_hash %d.\n", queue_id, flow_hash); } static void -dsw_port_consider_migration(struct dsw_evdev *dsw, - struct dsw_port *source_port, - uint64_t now) +dsw_port_consider_emigration(struct dsw_evdev *dsw, + struct dsw_port *source_port, + uint64_t now) { bool any_port_below_limit; struct dsw_queue_flow *seen_events = source_port->seen_events; @@ -640,7 +640,7 @@ dsw_port_consider_migration(struct dsw_evdev *dsw, int16_t source_port_load; int16_t port_loads[dsw->num_ports]; - if (now < source_port->next_migration) + if (now < source_port->next_emigration) return; if (dsw->num_ports == 1) @@ -649,25 +649,25 @@ dsw_port_consider_migration(struct dsw_evdev *dsw, if (seen_events_len < DSW_MAX_EVENTS_RECORDED) return; - DSW_LOG_DP_PORT(DEBUG, source_port->id, "Considering migration.\n"); + DSW_LOG_DP_PORT(DEBUG, source_port->id, "Considering emigration.\n"); /* Randomize interval to avoid having all threads considering - * migration at the same in point in time, which might lead to - * all choosing the same target port. + * emigration at the same in point in time, which might lead + * to all choosing the same target port. */ - source_port->next_migration = now + + source_port->next_emigration = now + source_port->migration_interval / 2 + rte_rand() % source_port->migration_interval; if (source_port->migration_state != DSW_MIGRATION_STATE_IDLE) { DSW_LOG_DP_PORT(DEBUG, source_port->id, - "Migration already in progress.\n"); + "Emigration already in progress.\n"); return; } /* For simplicity, avoid migration in the unlikely case there * is still events to consume in the in_buffer (from the last - * migration). + * emigration). */ if (source_port->in_buffer_len > 0) { DSW_LOG_DP_PORT(DEBUG, source_port->id, "There are still " @@ -719,52 +719,56 @@ dsw_port_consider_migration(struct dsw_evdev *dsw, } /* The strategy is to first try to find a flow to move to a - * port with low load (below the migration-attempt + * port with low load (below the emigration-attempt * threshold). If that fails, we try to find a port which is * below the max threshold, and also less loaded than this * port is. */ - if (!dsw_select_migration_target(dsw, source_port, bursts, num_bursts, - port_loads, - DSW_MIN_SOURCE_LOAD_FOR_MIGRATION, - &source_port->migration_target_qf, - &source_port->migration_target_port_id) + if (!dsw_select_emigration_target(dsw, source_port, bursts, num_bursts, + port_loads, + DSW_MIN_SOURCE_LOAD_FOR_MIGRATION, + &source_port->emigration_target_qf, + &source_port->emigration_target_port_id) && - !dsw_select_migration_target(dsw, source_port, bursts, num_bursts, - port_loads, - DSW_MAX_TARGET_LOAD_FOR_MIGRATION, - &source_port->migration_target_qf, - &source_port->migration_target_port_id)) + !dsw_select_emigration_target(dsw, source_port, bursts, num_bursts, + port_loads, + DSW_MAX_TARGET_LOAD_FOR_MIGRATION, + &source_port->emigration_target_qf, + &source_port->emigration_target_port_id)) return; DSW_LOG_DP_PORT(DEBUG, source_port->id, "Migrating queue_id %d " "flow_hash %d from port %d to port %d.\n", - source_port->migration_target_qf.queue_id, - source_port->migration_target_qf.flow_hash, - source_port->id, source_port->migration_target_port_id); + source_port->emigration_target_qf.queue_id, + source_port->emigration_target_qf.flow_hash, + source_port->id, + source_port->emigration_target_port_id); /* We have a winner. */ source_port->migration_state = DSW_MIGRATION_STATE_PAUSING; - source_port->migration_start = rte_get_timer_cycles(); + source_port->emigration_start = rte_get_timer_cycles(); /* No need to go through the whole pause procedure for * parallel queues, since atomic/ordered semantics need not to * be maintained. */ - if (dsw->queues[source_port->migration_target_qf.queue_id].schedule_type - == RTE_SCHED_TYPE_PARALLEL) { - uint8_t queue_id = source_port->migration_target_qf.queue_id; - uint16_t flow_hash = source_port->migration_target_qf.flow_hash; - uint8_t dest_port_id = source_port->migration_target_port_id; + if (dsw->queues[source_port->emigration_target_qf.queue_id]. + schedule_type == RTE_SCHED_TYPE_PARALLEL) { + uint8_t queue_id = + source_port->emigration_target_qf.queue_id; + uint16_t flow_hash = + source_port->emigration_target_qf.flow_hash; + uint8_t dest_port_id = + source_port->emigration_target_port_id; /* Single byte-sized stores are always atomic. */ dsw->queues[queue_id].flow_to_port_map[flow_hash] = dest_port_id; rte_smp_wmb(); - dsw_port_end_migration(dsw, source_port); + dsw_port_end_emigration(dsw, source_port); return; } @@ -775,12 +779,12 @@ dsw_port_consider_migration(struct dsw_evdev *dsw, dsw_port_flush_out_buffers(dsw, source_port); dsw_port_add_paused_flow(source_port, - source_port->migration_target_qf.queue_id, - source_port->migration_target_qf.flow_hash); + source_port->emigration_target_qf.queue_id, + source_port->emigration_target_qf.flow_hash); dsw_port_ctl_broadcast(dsw, source_port, DSW_CTL_PAUS_REQ, - source_port->migration_target_qf.queue_id, - source_port->migration_target_qf.flow_hash); + source_port->emigration_target_qf.queue_id, + source_port->emigration_target_qf.flow_hash); source_port->cfm_cnt = 0; } @@ -808,6 +812,9 @@ dsw_port_handle_unpause_flow(struct dsw_evdev *dsw, struct dsw_port *port, rte_smp_rmb(); + if (dsw_schedule(dsw, queue_id, paused_flow_hash) == port->id) + port->immigrations++; + dsw_port_ctl_enqueue(&dsw->ports[originating_port_id], &cfm); dsw_port_flush_paused_events(dsw, port, queue_id, paused_flow_hash); @@ -816,10 +823,10 @@ dsw_port_handle_unpause_flow(struct dsw_evdev *dsw, struct dsw_port *port, #define FORWARD_BURST_SIZE (32) static void -dsw_port_forward_migrated_flow(struct dsw_port *source_port, - struct rte_event_ring *dest_ring, - uint8_t queue_id, - uint16_t flow_hash) +dsw_port_forward_emigrated_flow(struct dsw_port *source_port, + struct rte_event_ring *dest_ring, + uint8_t queue_id, + uint16_t flow_hash) { uint16_t events_left; @@ -868,9 +875,9 @@ static void dsw_port_move_migrating_flow(struct dsw_evdev *dsw, struct dsw_port *source_port) { - uint8_t queue_id = source_port->migration_target_qf.queue_id; - uint16_t flow_hash = source_port->migration_target_qf.flow_hash; - uint8_t dest_port_id = source_port->migration_target_port_id; + uint8_t queue_id = source_port->emigration_target_qf.queue_id; + uint16_t flow_hash = source_port->emigration_target_qf.flow_hash; + uint8_t dest_port_id = source_port->emigration_target_port_id; struct dsw_port *dest_port = &dsw->ports[dest_port_id]; dsw_port_flush_out_buffers(dsw, source_port); @@ -880,8 +887,8 @@ dsw_port_move_migrating_flow(struct dsw_evdev *dsw, dsw->queues[queue_id].flow_to_port_map[flow_hash] = dest_port_id; - dsw_port_forward_migrated_flow(source_port, dest_port->in_ring, - queue_id, flow_hash); + dsw_port_forward_emigrated_flow(source_port, dest_port->in_ring, + queue_id, flow_hash); /* Flow table update and migration destination port's enqueues * must be seen before the control message. @@ -907,7 +914,7 @@ dsw_port_handle_confirm(struct dsw_evdev *dsw, struct dsw_port *port) port->migration_state = DSW_MIGRATION_STATE_FORWARDING; break; case DSW_MIGRATION_STATE_UNPAUSING: - dsw_port_end_migration(dsw, port); + dsw_port_end_emigration(dsw, port); break; default: RTE_ASSERT(0); @@ -987,7 +994,7 @@ dsw_port_bg_process(struct dsw_evdev *dsw, struct dsw_port *port) dsw_port_consider_load_update(port, now); - dsw_port_consider_migration(dsw, port, now); + dsw_port_consider_emigration(dsw, port, now); port->ops_since_bg_task = 0; } diff --git a/drivers/event/dsw/dsw_xstats.c b/drivers/event/dsw/dsw_xstats.c index c3f5db89c..d332a57b6 100644 --- a/drivers/event/dsw/dsw_xstats.c +++ b/drivers/event/dsw/dsw_xstats.c @@ -84,16 +84,17 @@ dsw_xstats_port_get_queue_dequeued(struct dsw_evdev *dsw, uint8_t port_id, return dsw->ports[port_id].queue_dequeued[queue_id]; } -DSW_GEN_PORT_ACCESS_FN(migrations) +DSW_GEN_PORT_ACCESS_FN(emigrations) +DSW_GEN_PORT_ACCESS_FN(immigrations) static uint64_t dsw_xstats_port_get_migration_latency(struct dsw_evdev *dsw, uint8_t port_id, uint8_t queue_id __rte_unused) { - uint64_t total_latency = dsw->ports[port_id].migration_latency; - uint64_t num_migrations = dsw->ports[port_id].migrations; + uint64_t total_latency = dsw->ports[port_id].emigration_latency; + uint64_t num_emigrations = dsw->ports[port_id].emigrations; - return num_migrations > 0 ? total_latency / num_migrations : 0; + return num_emigrations > 0 ? total_latency / num_emigrations : 0; } static uint64_t @@ -110,6 +111,8 @@ dsw_xstats_port_get_event_proc_latency(struct dsw_evdev *dsw, uint8_t port_id, DSW_GEN_PORT_ACCESS_FN(inflight_credits) +DSW_GEN_PORT_ACCESS_FN(pending_releases) + static uint64_t dsw_xstats_port_get_load(struct dsw_evdev *dsw, uint8_t port_id, uint8_t queue_id __rte_unused) @@ -136,14 +139,18 @@ static struct dsw_xstats_port dsw_port_xstats[] = { false }, { "port_%u_queue_%u_dequeued", dsw_xstats_port_get_queue_dequeued, true }, - { "port_%u_migrations", dsw_xstats_port_get_migrations, + { "port_%u_emigrations", dsw_xstats_port_get_emigrations, false }, { "port_%u_migration_latency", dsw_xstats_port_get_migration_latency, false }, + { "port_%u_immigrations", dsw_xstats_port_get_immigrations, + false }, { "port_%u_event_proc_latency", dsw_xstats_port_get_event_proc_latency, false }, { "port_%u_inflight_credits", dsw_xstats_port_get_inflight_credits, false }, + { "port_%u_pending_releases", dsw_xstats_port_get_pending_releases, + false }, { "port_%u_load", dsw_xstats_port_get_load, false }, { "port_%u_last_bg", dsw_xstats_port_get_last_bg, From patchwork Mon Mar 9 06:51:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Mattias_R=C3=B6nnblom?= X-Patchwork-Id: 66373 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id C4A3FA052E; Mon, 9 Mar 2020 07:52:31 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2A1FD1C028; Mon, 9 Mar 2020 07:51:56 +0100 (CET) Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70058.outbound.protection.outlook.com [40.107.7.58]) by dpdk.org (Postfix) with ESMTP id 4F29A1BFF3 for ; Mon, 9 Mar 2020 07:51:46 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XKrTL193v1O4Pd0Xy8ka7HH/rqR9Pd9cGHv+JS8XtuFVNUeu7fjz5hsp992VfZLlo2xKSfCdGeBqmAYEHM32LjfZab4SGjzCQHdfffc7IA0JuQRSC9F5e3NF6N6DHlY57bHRVPZiA3wr8zbQL9JtQWvQdWHtMUHEeNPE3pT6g8xYiuvbP4ecf74NfJtSr0JIafL2D+bFhlwwtO7QCaU+zBWheZcJztlPs5dZ5UaL3rs0X9v846MNyYBTHRCqfN947kNLMdHpHJPTe+rzypBUp+PbYnTl7D7TZLG0IJyNdRMYdwbXVisa0zpiMfe72kpH7omBZQGoTd2O0fdLqg8Baw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ukOEtM3lDK2oodX6FT7Jmx10OuT/UuARfNtrhpazi8Q=; b=KgGJTNvfp1ymku/XTM1e0q1JP3rwsPRkRAq1/7g4fwrmj2UIab5ZYriAou6gGpdggTGfwkj5CUAuKs46OJ2qmyTkruuEuAPTpFwypWw0t1SWJxvkj6NnzDjMZP6d+a7oXEqRZSNlALuXhlrsqsx/yRmC60i2SUGVmHRSoZkZ+U8W5lQma3y++xGcZi42qRXxLux0HYyPq4ZJRPm6z9BpQd/ZZWBqa53BmQQ8iW9F1BxOC2VOkqlDWso+WSbxdfkctpXwMnIfxlBZDO7EC8BPoe1jtPWCR5ezLuQ5uT0bMJg+euPxaMclYTPfnu/lIq7DictElgP05IUDdyRmayE5wA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 192.176.1.74) smtp.rcpttodomain=arm.com smtp.mailfrom=ericsson.com; dmarc=pass (p=reject sp=none pct=100) action=none header.from=ericsson.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericsson.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ukOEtM3lDK2oodX6FT7Jmx10OuT/UuARfNtrhpazi8Q=; b=Z7hVB2qPvpO0CIxr88660y7jGt6cYs57qGiruKBBKFLOPjRTxMYUI7wnrNPeSHtrZpMe0fe5bzpvfoqkHUkeyrLdS2rzo2C5GMRhQIFIecILj3wodCfb7klOv4pYj9W0StRPB8gVWHYZQLNlS4GEbgZ7tIgZAohwQC+BT/I2+Jw= Received: from AM6PR05CA0022.eurprd05.prod.outlook.com (2603:10a6:20b:2e::35) by DB7PR07MB5879.eurprd07.prod.outlook.com (2603:10a6:10:58::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2814.9; Mon, 9 Mar 2020 06:51:44 +0000 Received: from AM5EUR02FT046.eop-EUR02.prod.protection.outlook.com (2603:10a6:20b:2e:cafe::e8) by AM6PR05CA0022.outlook.office365.com (2603:10a6:20b:2e::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2793.16 via Frontend Transport; Mon, 9 Mar 2020 06:51:44 +0000 Authentication-Results: spf=pass (sender IP is 192.176.1.74) smtp.mailfrom=ericsson.com; arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=pass action=none header.from=ericsson.com; Received-SPF: Pass (protection.outlook.com: domain of ericsson.com designates 192.176.1.74 as permitted sender) receiver=protection.outlook.com; client-ip=192.176.1.74; helo=oa.msg.ericsson.com; Received: from oa.msg.ericsson.com (192.176.1.74) by AM5EUR02FT046.mail.protection.outlook.com (10.152.8.221) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2793.11 via Frontend Transport; Mon, 9 Mar 2020 06:51:44 +0000 Received: from ESESSMB503.ericsson.se (153.88.183.164) by ESESBMR506.ericsson.se (153.88.183.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Mon, 9 Mar 2020 07:51:43 +0100 Received: from selio1a020.lmera.ericsson.se (153.88.183.153) by smtp.internal.ericsson.com (153.88.183.191) with Microsoft SMTP Server id 15.1.1713.5 via Frontend Transport; Mon, 9 Mar 2020 07:51:43 +0100 Received: from breslau.lmera.ericsson.se (breslau.lmera.ericsson.se [150.132.109.241]) by selio1a020.lmera.ericsson.se (8.15.1+Sun/8.15.1) with ESMTP id 0296pgIO024126; Mon, 9 Mar 2020 07:51:43 +0100 (CET) From: =?utf-8?q?Mattias_R=C3=B6nnblom?= To: CC: , , , =?utf-8?q?Mattias_R=C3=B6nnblom?= Date: Mon, 9 Mar 2020 07:51:02 +0100 Message-ID: <20200309065106.23800-5-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200309065106.23800-1-mattias.ronnblom@ericsson.com> References: <20200309065106.23800-1-mattias.ronnblom@ericsson.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:192.176.1.74; IPV:; CTRY:SE; EFV:NLI; SFV:NSPM; SFS:(10009020)(4636009)(396003)(39860400002)(376002)(346002)(136003)(199004)(189003)(26005)(6666004)(356004)(107886003)(186003)(8936002)(336012)(8676002)(246002)(5660300002)(86362001)(6916009)(70586007)(70206006)(2906002)(4326008)(316002)(54906003)(7636002)(36756003)(66574012)(478600001)(1076003)(2616005)(30864003)(956004); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR07MB5879; H:oa.msg.ericsson.com; FPR:; SPF:Pass; LANG:en; PTR:office365.se.ericsson.net; A:1; MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6be29bab-5ef8-4944-6798-08d7c3f654da X-MS-TrafficTypeDiagnostic: DB7PR07MB5879: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-Forefront-PRVS: 0337AFFE9A X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5L33wre5FAWZ2wKOSJxoOxZcZwvjhPNdOpLDLmZPTwWauH/ziy+BHojHgFZtIEYjCtdM8UYSR4MF2sgqTD0WiXnYs6gIF4YcLRjiYW2i9pesCvioUZOY9VK+Rzk1+LMkVMm2UEXLKDUXuDsc/8wLZ7Uj7D/F/1u2rGs0xaSEYPNSi5bpMZcXWzrFa/FS/E353Hi06wTYJrO+EUx7KELNqWxIKs74CFo9rx5qzbdtHetThYCF636noAnY7IWdSW/MZbZirfGawxDHceUxuYUg6Tz91KGeekakGZL3Qr8Ky4k6L/+w9FcE932kfoi1hLF2M2OaQJJdYbqd4iYx1fKXchvbNkPZDVT5v8Zw3ti1jP30YLvYnSGqMMzfW7lHft0UZ/FQthFN5rq+S5wVyHghfOvf02snc4NDQTd0GAp2C7Tp4O3xup9yM+9kgP/BaAqS X-OriginatorOrg: ericsson.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2020 06:51:44.8624 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6be29bab-5ef8-4944-6798-08d7c3f654da X-MS-Exchange-CrossTenant-Id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=92e84ceb-fbfd-47ab-be52-080c6b87953f; Ip=[192.176.1.74]; Helo=[oa.msg.ericsson.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR07MB5879 Subject: [dpdk-dev] [PATCH 4/8] event/dsw: improve migration mechanism X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Allowing moving multiple flows in one migration transaction, to rebalance load more quickly. Introduce a threshold to avoid migrating flows between ports with very similar load. Simplify logic for selecting which flow to migrate. The aim is now to move flows in such a way that the receiving port is as lightly-loaded as possible (after receiving the flow), while still migrating enough flows from the source port to reduce its load. This is essentially how legacy strategy work as well, but the code is more readable. Signed-off-by: Mattias Rönnblom --- drivers/event/dsw/dsw_evdev.h | 15 +- drivers/event/dsw/dsw_event.c | 541 +++++++++++++++++++++------------- 2 files changed, 343 insertions(+), 213 deletions(-) diff --git a/drivers/event/dsw/dsw_evdev.h b/drivers/event/dsw/dsw_evdev.h index 2c7f9efa3..ced40ef8d 100644 --- a/drivers/event/dsw/dsw_evdev.h +++ b/drivers/event/dsw/dsw_evdev.h @@ -93,11 +93,14 @@ #define DSW_MIGRATION_INTERVAL (1000) #define DSW_MIN_SOURCE_LOAD_FOR_MIGRATION (DSW_LOAD_FROM_PERCENT(70)) #define DSW_MAX_TARGET_LOAD_FOR_MIGRATION (DSW_LOAD_FROM_PERCENT(95)) +#define DSW_REBALANCE_THRESHOLD (DSW_LOAD_FROM_PERCENT(3)) #define DSW_MAX_EVENTS_RECORDED (128) +#define DSW_MAX_FLOWS_PER_MIGRATION (8) + /* Only one outstanding migration per port is allowed */ -#define DSW_MAX_PAUSED_FLOWS (DSW_MAX_PORTS) +#define DSW_MAX_PAUSED_FLOWS (DSW_MAX_PORTS*DSW_MAX_FLOWS_PER_MIGRATION) /* Enough room for paus request/confirm and unpaus request/confirm for * all possible senders. @@ -170,8 +173,10 @@ struct dsw_port { uint64_t emigrations; uint64_t emigration_latency; - uint8_t emigration_target_port_id; - struct dsw_queue_flow emigration_target_qf; + uint8_t emigration_target_port_ids[DSW_MAX_FLOWS_PER_MIGRATION]; + struct dsw_queue_flow + emigration_target_qfs[DSW_MAX_FLOWS_PER_MIGRATION]; + uint8_t emigration_targets_len; uint8_t cfm_cnt; uint64_t immigrations; @@ -244,8 +249,8 @@ struct dsw_evdev { struct dsw_ctl_msg { uint8_t type; uint8_t originating_port_id; - uint8_t queue_id; - uint16_t flow_hash; + uint8_t qfs_len; + struct dsw_queue_flow qfs[DSW_MAX_FLOWS_PER_MIGRATION]; } __rte_aligned(4); uint16_t dsw_event_enqueue(void *port, const struct rte_event *event); diff --git a/drivers/event/dsw/dsw_event.c b/drivers/event/dsw/dsw_event.c index 69cff7aa2..21c102275 100644 --- a/drivers/event/dsw/dsw_event.c +++ b/drivers/event/dsw/dsw_event.c @@ -189,58 +189,75 @@ dsw_port_ctl_dequeue(struct dsw_port *port, struct dsw_ctl_msg *msg) static void dsw_port_ctl_broadcast(struct dsw_evdev *dsw, struct dsw_port *source_port, - uint8_t type, uint8_t queue_id, uint16_t flow_hash) + uint8_t type, struct dsw_queue_flow *qfs, + uint8_t qfs_len) { uint16_t port_id; struct dsw_ctl_msg msg = { .type = type, .originating_port_id = source_port->id, - .queue_id = queue_id, - .flow_hash = flow_hash + .qfs_len = qfs_len }; + memcpy(msg.qfs, qfs, sizeof(struct dsw_queue_flow) * qfs_len); + for (port_id = 0; port_id < dsw->num_ports; port_id++) if (port_id != source_port->id) dsw_port_ctl_enqueue(&dsw->ports[port_id], &msg); } -static bool -dsw_port_is_flow_paused(struct dsw_port *port, uint8_t queue_id, - uint16_t flow_hash) +static __rte_always_inline bool +dsw_is_queue_flow_in_ary(const struct dsw_queue_flow *qfs, uint16_t qfs_len, + uint8_t queue_id, uint16_t flow_hash) { uint16_t i; - for (i = 0; i < port->paused_flows_len; i++) { - struct dsw_queue_flow *qf = &port->paused_flows[i]; - if (qf->queue_id == queue_id && - qf->flow_hash == flow_hash) + for (i = 0; i < qfs_len; i++) + if (qfs[i].queue_id == queue_id && + qfs[i].flow_hash == flow_hash) return true; - } + return false; } +static __rte_always_inline bool +dsw_port_is_flow_paused(struct dsw_port *port, uint8_t queue_id, + uint16_t flow_hash) +{ + return dsw_is_queue_flow_in_ary(port->paused_flows, + port->paused_flows_len, + queue_id, flow_hash); +} + static void -dsw_port_add_paused_flow(struct dsw_port *port, uint8_t queue_id, - uint16_t paused_flow_hash) +dsw_port_add_paused_flows(struct dsw_port *port, struct dsw_queue_flow *qfs, + uint8_t qfs_len) { - port->paused_flows[port->paused_flows_len] = (struct dsw_queue_flow) { - .queue_id = queue_id, - .flow_hash = paused_flow_hash + uint8_t i; + + for (i = 0; i < qfs_len; i++) { + struct dsw_queue_flow *qf = &qfs[i]; + + DSW_LOG_DP_PORT(DEBUG, port->id, + "Pausing queue_id %d flow_hash %d.\n", + qf->queue_id, qf->flow_hash); + + port->paused_flows[port->paused_flows_len] = *qf; + port->paused_flows_len++; }; - port->paused_flows_len++; } static void -dsw_port_remove_paused_flow(struct dsw_port *port, uint8_t queue_id, - uint16_t paused_flow_hash) +dsw_port_remove_paused_flow(struct dsw_port *port, + struct dsw_queue_flow *target_qf) { uint16_t i; for (i = 0; i < port->paused_flows_len; i++) { struct dsw_queue_flow *qf = &port->paused_flows[i]; - if (qf->queue_id == queue_id && - qf->flow_hash == paused_flow_hash) { + if (qf->queue_id == target_qf->queue_id && + qf->flow_hash == target_qf->flow_hash) { uint16_t last_idx = port->paused_flows_len-1; if (i != last_idx) port->paused_flows[i] = @@ -251,30 +268,37 @@ dsw_port_remove_paused_flow(struct dsw_port *port, uint8_t queue_id, } } +static void +dsw_port_remove_paused_flows(struct dsw_port *port, + struct dsw_queue_flow *qfs, uint8_t qfs_len) +{ + uint8_t i; + + for (i = 0; i < qfs_len; i++) + dsw_port_remove_paused_flow(port, &qfs[i]); + +} + static void dsw_port_flush_out_buffers(struct dsw_evdev *dsw, struct dsw_port *source_port); static void -dsw_port_handle_pause_flow(struct dsw_evdev *dsw, struct dsw_port *port, - uint8_t originating_port_id, uint8_t queue_id, - uint16_t paused_flow_hash) +dsw_port_handle_pause_flows(struct dsw_evdev *dsw, struct dsw_port *port, + uint8_t originating_port_id, + struct dsw_queue_flow *paused_qfs, + uint8_t qfs_len) { struct dsw_ctl_msg cfm = { .type = DSW_CTL_CFM, - .originating_port_id = port->id, - .queue_id = queue_id, - .flow_hash = paused_flow_hash + .originating_port_id = port->id }; - DSW_LOG_DP_PORT(DEBUG, port->id, "Pausing queue_id %d flow_hash %d.\n", - queue_id, paused_flow_hash); - /* There might be already-scheduled events belonging to the * paused flow in the output buffers. */ dsw_port_flush_out_buffers(dsw, port); - dsw_port_add_paused_flow(port, queue_id, paused_flow_hash); + dsw_port_add_paused_flows(port, paused_qfs, qfs_len); /* Make sure any stores to the original port's in_ring is seen * before the ctl message. @@ -284,47 +308,11 @@ dsw_port_handle_pause_flow(struct dsw_evdev *dsw, struct dsw_port *port, dsw_port_ctl_enqueue(&dsw->ports[originating_port_id], &cfm); } -static void -dsw_find_lowest_load_port(uint8_t *port_ids, uint16_t num_port_ids, - uint8_t exclude_port_id, int16_t *port_loads, - uint8_t *target_port_id, int16_t *target_load) -{ - int16_t candidate_port_id = -1; - int16_t candidate_load = DSW_MAX_LOAD; - uint16_t i; - - for (i = 0; i < num_port_ids; i++) { - uint8_t port_id = port_ids[i]; - if (port_id != exclude_port_id) { - int16_t load = port_loads[port_id]; - if (candidate_port_id == -1 || - load < candidate_load) { - candidate_port_id = port_id; - candidate_load = load; - } - } - } - *target_port_id = candidate_port_id; - *target_load = candidate_load; -} - struct dsw_queue_flow_burst { struct dsw_queue_flow queue_flow; uint16_t count; }; -static inline int -dsw_cmp_burst(const void *v_burst_a, const void *v_burst_b) -{ - const struct dsw_queue_flow_burst *burst_a = v_burst_a; - const struct dsw_queue_flow_burst *burst_b = v_burst_b; - - int a_count = burst_a->count; - int b_count = burst_b->count; - - return a_count - b_count; -} - #define DSW_QF_TO_INT(_qf) \ ((int)((((_qf)->queue_id)<<16)|((_qf)->flow_hash))) @@ -363,8 +351,6 @@ dsw_sort_qfs_to_bursts(struct dsw_queue_flow *qfs, uint16_t qfs_len, current_burst->count++; } - qsort(bursts, num_bursts, sizeof(bursts[0]), dsw_cmp_burst); - return num_bursts; } @@ -384,44 +370,158 @@ dsw_retrieve_port_loads(struct dsw_evdev *dsw, int16_t *port_loads, return below_limit; } +static int16_t +dsw_flow_load(uint16_t num_events, int16_t port_load) +{ + return ((int32_t)port_load * (int32_t)num_events) / + DSW_MAX_EVENTS_RECORDED; +} + +static int16_t +dsw_evaluate_migration(int16_t source_load, int16_t target_load, + int16_t flow_load) +{ + int32_t res_target_load; + int32_t imbalance; + + if (target_load > DSW_MAX_TARGET_LOAD_FOR_MIGRATION) + return -1; + + imbalance = source_load - target_load; + + if (imbalance < DSW_REBALANCE_THRESHOLD) + return -1; + + res_target_load = target_load + flow_load; + + /* If the estimated load of the target port will be higher + * than the source port's load, it doesn't make sense to move + * the flow. + */ + if (res_target_load > source_load) + return -1; + + /* The more idle the target will be, the better. This will + * make migration prefer moving smaller flows, and flows to + * lightly loaded ports. + */ + return DSW_MAX_LOAD - res_target_load; +} + +static bool +dsw_is_serving_port(struct dsw_evdev *dsw, uint8_t port_id, uint8_t queue_id) +{ + struct dsw_queue *queue = &dsw->queues[queue_id]; + uint16_t i; + + for (i = 0; i < queue->num_serving_ports; i++) + if (queue->serving_ports[i] == port_id) + return true; + + return false; +} + static bool dsw_select_emigration_target(struct dsw_evdev *dsw, - struct dsw_port *source_port, - struct dsw_queue_flow_burst *bursts, - uint16_t num_bursts, int16_t *port_loads, - int16_t max_load, struct dsw_queue_flow *target_qf, - uint8_t *target_port_id) + struct dsw_queue_flow_burst *bursts, + uint16_t num_bursts, uint8_t source_port_id, + int16_t *port_loads, uint16_t num_ports, + uint8_t *target_port_ids, + struct dsw_queue_flow *target_qfs, + uint8_t *targets_len) { - uint16_t source_load = port_loads[source_port->id]; + int16_t source_port_load = port_loads[source_port_id]; + struct dsw_queue_flow *candidate_qf; + uint8_t candidate_port_id; + int16_t candidate_weight = -1; + int16_t candidate_flow_load; uint16_t i; + if (source_port_load < DSW_MIN_SOURCE_LOAD_FOR_MIGRATION) + return false; + for (i = 0; i < num_bursts; i++) { - struct dsw_queue_flow *qf = &bursts[i].queue_flow; + struct dsw_queue_flow_burst *burst = &bursts[i]; + struct dsw_queue_flow *qf = &burst->queue_flow; + int16_t flow_load; + uint16_t port_id; - if (dsw_port_is_flow_paused(source_port, qf->queue_id, - qf->flow_hash)) + if (dsw_is_queue_flow_in_ary(target_qfs, *targets_len, + qf->queue_id, qf->flow_hash)) continue; - struct dsw_queue *queue = &dsw->queues[qf->queue_id]; - int16_t target_load; + flow_load = dsw_flow_load(burst->count, source_port_load); - dsw_find_lowest_load_port(queue->serving_ports, - queue->num_serving_ports, - source_port->id, port_loads, - target_port_id, &target_load); + for (port_id = 0; port_id < num_ports; port_id++) { + int16_t weight; - if (target_load < source_load && - target_load < max_load) { - *target_qf = *qf; - return true; + if (port_id == source_port_id) + continue; + + if (!dsw_is_serving_port(dsw, port_id, qf->queue_id)) + continue; + + weight = dsw_evaluate_migration(source_port_load, + port_loads[port_id], + flow_load); + + if (weight > candidate_weight) { + candidate_qf = qf; + candidate_port_id = port_id; + candidate_weight = weight; + candidate_flow_load = flow_load; + } } } - DSW_LOG_DP_PORT(DEBUG, source_port->id, "For the %d flows considered, " - "no target port found with load less than %d.\n", - num_bursts, DSW_LOAD_TO_PERCENT(max_load)); + if (candidate_weight < 0) + return false; - return false; + DSW_LOG_DP_PORT(DEBUG, source_port_id, "Selected queue_id %d " + "flow_hash %d (with flow load %d) for migration " + "to port %d.\n", candidate_qf->queue_id, + candidate_qf->flow_hash, + DSW_LOAD_TO_PERCENT(candidate_flow_load), + candidate_port_id); + + port_loads[candidate_port_id] += candidate_flow_load; + port_loads[source_port_id] -= candidate_flow_load; + + target_port_ids[*targets_len] = candidate_port_id; + target_qfs[*targets_len] = *candidate_qf; + (*targets_len)++; + + return true; +} + +static void +dsw_select_emigration_targets(struct dsw_evdev *dsw, + struct dsw_port *source_port, + struct dsw_queue_flow_burst *bursts, + uint16_t num_bursts, int16_t *port_loads) +{ + struct dsw_queue_flow *target_qfs = source_port->emigration_target_qfs; + uint8_t *target_port_ids = source_port->emigration_target_port_ids; + uint8_t *targets_len = &source_port->emigration_targets_len; + uint8_t i; + + for (i = 0; i < DSW_MAX_FLOWS_PER_MIGRATION; i++) { + bool found; + + found = dsw_select_emigration_target(dsw, bursts, num_bursts, + source_port->id, + port_loads, dsw->num_ports, + target_port_ids, + target_qfs, + targets_len); + if (!found) + break; + } + + if (*targets_len == 0) + DSW_LOG_DP_PORT(DEBUG, source_port->id, + "For the %d flows considered, no target port " + "was found.\n", num_bursts); } static uint8_t @@ -562,7 +662,7 @@ dsw_port_buffer_event(struct dsw_evdev *dsw, struct dsw_port *source_port, static void dsw_port_flush_paused_events(struct dsw_evdev *dsw, struct dsw_port *source_port, - uint8_t queue_id, uint16_t paused_flow_hash) + const struct dsw_queue_flow *qf) { uint16_t paused_events_len = source_port->paused_events_len; struct rte_event paused_events[paused_events_len]; @@ -572,7 +672,7 @@ dsw_port_flush_paused_events(struct dsw_evdev *dsw, if (paused_events_len == 0) return; - if (dsw_port_is_flow_paused(source_port, queue_id, paused_flow_hash)) + if (dsw_port_is_flow_paused(source_port, qf->queue_id, qf->flow_hash)) return; rte_memcpy(paused_events, source_port->paused_events, @@ -580,7 +680,7 @@ dsw_port_flush_paused_events(struct dsw_evdev *dsw, source_port->paused_events_len = 0; - dest_port_id = dsw_schedule(dsw, queue_id, paused_flow_hash); + dest_port_id = dsw_schedule(dsw, qf->queue_id, qf->flow_hash); for (i = 0; i < paused_events_len; i++) { struct rte_event *event = &paused_events[i]; @@ -588,8 +688,8 @@ dsw_port_flush_paused_events(struct dsw_evdev *dsw, flow_hash = dsw_flow_id_hash(event->flow_id); - if (event->queue_id == queue_id && - flow_hash == paused_flow_hash) + if (event->queue_id == qf->queue_id && + flow_hash == qf->flow_hash) dsw_port_buffer_non_paused(dsw, source_port, dest_port_id, event); else @@ -598,33 +698,94 @@ dsw_port_flush_paused_events(struct dsw_evdev *dsw, } static void -dsw_port_emigration_stats(struct dsw_port *port) +dsw_port_emigration_stats(struct dsw_port *port, uint8_t finished) { - uint64_t emigration_latency; + uint64_t flow_migration_latency; - emigration_latency = (rte_get_timer_cycles() - port->emigration_start); - port->emigration_latency += emigration_latency; - port->emigrations++; + flow_migration_latency = + (rte_get_timer_cycles() - port->emigration_start); + port->emigration_latency += (flow_migration_latency * finished); + port->emigrations += finished; } static void -dsw_port_end_emigration(struct dsw_evdev *dsw, struct dsw_port *port) +dsw_port_end_emigration(struct dsw_evdev *dsw, struct dsw_port *port, + uint8_t schedule_type) { - uint8_t queue_id = port->emigration_target_qf.queue_id; - uint16_t flow_hash = port->emigration_target_qf.flow_hash; + uint8_t i; + struct dsw_queue_flow left_qfs[DSW_MAX_FLOWS_PER_MIGRATION]; + uint8_t left_port_ids[DSW_MAX_FLOWS_PER_MIGRATION]; + uint8_t left_qfs_len = 0; + uint8_t finished; + + for (i = 0; i < port->emigration_targets_len; i++) { + struct dsw_queue_flow *qf = &port->emigration_target_qfs[i]; + uint8_t queue_id = qf->queue_id; + uint8_t queue_schedule_type = + dsw->queues[queue_id].schedule_type; + uint16_t flow_hash = qf->flow_hash; + + if (queue_schedule_type != schedule_type) { + left_port_ids[left_qfs_len] = + port->emigration_target_port_ids[i]; + left_qfs[left_qfs_len] = *qf; + left_qfs_len++; + continue; + } + + DSW_LOG_DP_PORT(DEBUG, port->id, "Migration completed for " + "queue_id %d flow_hash %d.\n", queue_id, + flow_hash); + + if (queue_schedule_type == RTE_SCHED_TYPE_ATOMIC) { + dsw_port_remove_paused_flow(port, qf); + dsw_port_flush_paused_events(dsw, port, qf); + } + } - port->migration_state = DSW_MIGRATION_STATE_IDLE; - port->seen_events_len = 0; + finished = port->emigration_targets_len - left_qfs_len; - dsw_port_emigration_stats(port); + if (finished > 0) + dsw_port_emigration_stats(port, finished); - if (dsw->queues[queue_id].schedule_type != RTE_SCHED_TYPE_PARALLEL) { - dsw_port_remove_paused_flow(port, queue_id, flow_hash); - dsw_port_flush_paused_events(dsw, port, queue_id, flow_hash); + for (i = 0; i < left_qfs_len; i++) { + port->emigration_target_port_ids[i] = left_port_ids[i]; + port->emigration_target_qfs[i] = left_qfs[i]; } + port->emigration_targets_len = left_qfs_len; - DSW_LOG_DP_PORT(DEBUG, port->id, "Emigration completed for queue_id " - "%d flow_hash %d.\n", queue_id, flow_hash); + if (port->emigration_targets_len == 0) { + port->migration_state = DSW_MIGRATION_STATE_IDLE; + port->seen_events_len = 0; + } +} + +static void +dsw_port_move_parallel_flows(struct dsw_evdev *dsw, + struct dsw_port *source_port) +{ + uint8_t i; + + for (i = 0; i < source_port->emigration_targets_len; i++) { + struct dsw_queue_flow *qf = + &source_port->emigration_target_qfs[i]; + uint8_t queue_id = qf->queue_id; + + if (dsw->queues[queue_id].schedule_type == + RTE_SCHED_TYPE_PARALLEL) { + uint8_t dest_port_id = + source_port->emigration_target_port_ids[i]; + uint16_t flow_hash = qf->flow_hash; + + /* Single byte-sized stores are always atomic. */ + dsw->queues[queue_id].flow_to_port_map[flow_hash] = + dest_port_id; + } + } + + rte_smp_wmb(); + + dsw_port_end_emigration(dsw, source_port, RTE_SCHED_TYPE_PARALLEL); } static void @@ -678,9 +839,9 @@ dsw_port_consider_emigration(struct dsw_evdev *dsw, source_port_load = rte_atomic16_read(&source_port->load); if (source_port_load < DSW_MIN_SOURCE_LOAD_FOR_MIGRATION) { DSW_LOG_DP_PORT(DEBUG, source_port->id, - "Load %d is below threshold level %d.\n", - DSW_LOAD_TO_PERCENT(source_port_load), - DSW_LOAD_TO_PERCENT(DSW_MIN_SOURCE_LOAD_FOR_MIGRATION)); + "Load %d is below threshold level %d.\n", + DSW_LOAD_TO_PERCENT(source_port_load), + DSW_LOAD_TO_PERCENT(DSW_MIN_SOURCE_LOAD_FOR_MIGRATION)); return; } @@ -697,16 +858,9 @@ dsw_port_consider_emigration(struct dsw_evdev *dsw, return; } - /* Sort flows into 'bursts' to allow attempting to migrating - * small (but still active) flows first - this it to avoid - * having large flows moving around the worker cores too much - * (to avoid cache misses, among other things). Of course, the - * number of recorded events (queue+flow ids) are limited, and - * provides only a snapshot, so only so many conclusions can - * be drawn from this data. - */ num_bursts = dsw_sort_qfs_to_bursts(seen_events, seen_events_len, bursts); + /* For non-big-little systems, there's no point in moving the * only (known) flow. */ @@ -718,33 +872,11 @@ dsw_port_consider_emigration(struct dsw_evdev *dsw, return; } - /* The strategy is to first try to find a flow to move to a - * port with low load (below the emigration-attempt - * threshold). If that fails, we try to find a port which is - * below the max threshold, and also less loaded than this - * port is. - */ - if (!dsw_select_emigration_target(dsw, source_port, bursts, num_bursts, - port_loads, - DSW_MIN_SOURCE_LOAD_FOR_MIGRATION, - &source_port->emigration_target_qf, - &source_port->emigration_target_port_id) - && - !dsw_select_emigration_target(dsw, source_port, bursts, num_bursts, - port_loads, - DSW_MAX_TARGET_LOAD_FOR_MIGRATION, - &source_port->emigration_target_qf, - &source_port->emigration_target_port_id)) - return; - - DSW_LOG_DP_PORT(DEBUG, source_port->id, "Migrating queue_id %d " - "flow_hash %d from port %d to port %d.\n", - source_port->emigration_target_qf.queue_id, - source_port->emigration_target_qf.flow_hash, - source_port->id, - source_port->emigration_target_port_id); + dsw_select_emigration_targets(dsw, source_port, bursts, num_bursts, + port_loads); - /* We have a winner. */ + if (source_port->emigration_targets_len == 0) + return; source_port->migration_state = DSW_MIGRATION_STATE_PAUSING; source_port->emigration_start = rte_get_timer_cycles(); @@ -753,71 +885,58 @@ dsw_port_consider_emigration(struct dsw_evdev *dsw, * parallel queues, since atomic/ordered semantics need not to * be maintained. */ + dsw_port_move_parallel_flows(dsw, source_port); - if (dsw->queues[source_port->emigration_target_qf.queue_id]. - schedule_type == RTE_SCHED_TYPE_PARALLEL) { - uint8_t queue_id = - source_port->emigration_target_qf.queue_id; - uint16_t flow_hash = - source_port->emigration_target_qf.flow_hash; - uint8_t dest_port_id = - source_port->emigration_target_port_id; - - /* Single byte-sized stores are always atomic. */ - dsw->queues[queue_id].flow_to_port_map[flow_hash] = - dest_port_id; - rte_smp_wmb(); - - dsw_port_end_emigration(dsw, source_port); - + /* All flows were on PARALLEL queues. */ + if (source_port->migration_state == DSW_MIGRATION_STATE_IDLE) return; - } /* There might be 'loopback' events already scheduled in the * output buffers. */ dsw_port_flush_out_buffers(dsw, source_port); - dsw_port_add_paused_flow(source_port, - source_port->emigration_target_qf.queue_id, - source_port->emigration_target_qf.flow_hash); + dsw_port_add_paused_flows(source_port, + source_port->emigration_target_qfs, + source_port->emigration_targets_len); dsw_port_ctl_broadcast(dsw, source_port, DSW_CTL_PAUS_REQ, - source_port->emigration_target_qf.queue_id, - source_port->emigration_target_qf.flow_hash); + source_port->emigration_target_qfs, + source_port->emigration_targets_len); source_port->cfm_cnt = 0; } static void dsw_port_flush_paused_events(struct dsw_evdev *dsw, struct dsw_port *source_port, - uint8_t queue_id, uint16_t paused_flow_hash); + const struct dsw_queue_flow *qf); static void -dsw_port_handle_unpause_flow(struct dsw_evdev *dsw, struct dsw_port *port, - uint8_t originating_port_id, uint8_t queue_id, - uint16_t paused_flow_hash) +dsw_port_handle_unpause_flows(struct dsw_evdev *dsw, struct dsw_port *port, + uint8_t originating_port_id, + struct dsw_queue_flow *paused_qfs, + uint8_t qfs_len) { + uint16_t i; struct dsw_ctl_msg cfm = { .type = DSW_CTL_CFM, - .originating_port_id = port->id, - .queue_id = queue_id, - .flow_hash = paused_flow_hash + .originating_port_id = port->id }; - DSW_LOG_DP_PORT(DEBUG, port->id, "Un-pausing queue_id %d flow_hash %d.\n", - queue_id, paused_flow_hash); - - dsw_port_remove_paused_flow(port, queue_id, paused_flow_hash); + dsw_port_remove_paused_flows(port, paused_qfs, qfs_len); rte_smp_rmb(); - if (dsw_schedule(dsw, queue_id, paused_flow_hash) == port->id) - port->immigrations++; - dsw_port_ctl_enqueue(&dsw->ports[originating_port_id], &cfm); - dsw_port_flush_paused_events(dsw, port, queue_id, paused_flow_hash); + for (i = 0; i < qfs_len; i++) { + struct dsw_queue_flow *qf = &paused_qfs[i]; + + if (dsw_schedule(dsw, qf->queue_id, qf->flow_hash) == port->id) + port->immigrations++; + + dsw_port_flush_paused_events(dsw, port, qf); + } } #define FORWARD_BURST_SIZE (32) @@ -872,31 +991,37 @@ dsw_port_forward_emigrated_flow(struct dsw_port *source_port, } static void -dsw_port_move_migrating_flow(struct dsw_evdev *dsw, - struct dsw_port *source_port) +dsw_port_move_emigrating_flows(struct dsw_evdev *dsw, + struct dsw_port *source_port) { - uint8_t queue_id = source_port->emigration_target_qf.queue_id; - uint16_t flow_hash = source_port->emigration_target_qf.flow_hash; - uint8_t dest_port_id = source_port->emigration_target_port_id; - struct dsw_port *dest_port = &dsw->ports[dest_port_id]; + uint8_t i; dsw_port_flush_out_buffers(dsw, source_port); rte_smp_wmb(); - dsw->queues[queue_id].flow_to_port_map[flow_hash] = - dest_port_id; + for (i = 0; i < source_port->emigration_targets_len; i++) { + struct dsw_queue_flow *qf = + &source_port->emigration_target_qfs[i]; + uint8_t dest_port_id = + source_port->emigration_target_port_ids[i]; + struct dsw_port *dest_port = &dsw->ports[dest_port_id]; + + dsw->queues[qf->queue_id].flow_to_port_map[qf->flow_hash] = + dest_port_id; - dsw_port_forward_emigrated_flow(source_port, dest_port->in_ring, - queue_id, flow_hash); + dsw_port_forward_emigrated_flow(source_port, dest_port->in_ring, + qf->queue_id, qf->flow_hash); + } /* Flow table update and migration destination port's enqueues * must be seen before the control message. */ rte_smp_wmb(); - dsw_port_ctl_broadcast(dsw, source_port, DSW_CTL_UNPAUS_REQ, queue_id, - flow_hash); + dsw_port_ctl_broadcast(dsw, source_port, DSW_CTL_UNPAUS_REQ, + source_port->emigration_target_qfs, + source_port->emigration_targets_len); source_port->cfm_cnt = 0; source_port->migration_state = DSW_MIGRATION_STATE_UNPAUSING; } @@ -914,7 +1039,8 @@ dsw_port_handle_confirm(struct dsw_evdev *dsw, struct dsw_port *port) port->migration_state = DSW_MIGRATION_STATE_FORWARDING; break; case DSW_MIGRATION_STATE_UNPAUSING: - dsw_port_end_emigration(dsw, port); + dsw_port_end_emigration(dsw, port, + RTE_SCHED_TYPE_ATOMIC); break; default: RTE_ASSERT(0); @@ -936,15 +1062,14 @@ dsw_port_ctl_process(struct dsw_evdev *dsw, struct dsw_port *port) if (dsw_port_ctl_dequeue(port, &msg) == 0) { switch (msg.type) { case DSW_CTL_PAUS_REQ: - dsw_port_handle_pause_flow(dsw, port, - msg.originating_port_id, - msg.queue_id, msg.flow_hash); + dsw_port_handle_pause_flows(dsw, port, + msg.originating_port_id, + msg.qfs, msg.qfs_len); break; case DSW_CTL_UNPAUS_REQ: - dsw_port_handle_unpause_flow(dsw, port, - msg.originating_port_id, - msg.queue_id, - msg.flow_hash); + dsw_port_handle_unpause_flows(dsw, port, + msg.originating_port_id, + msg.qfs, msg.qfs_len); break; case DSW_CTL_CFM: dsw_port_handle_confirm(dsw, port); @@ -967,7 +1092,7 @@ dsw_port_bg_process(struct dsw_evdev *dsw, struct dsw_port *port) { if (unlikely(port->migration_state == DSW_MIGRATION_STATE_FORWARDING && port->pending_releases == 0)) - dsw_port_move_migrating_flow(dsw, port); + dsw_port_move_emigrating_flows(dsw, port); /* Polling the control ring is relatively inexpensive, and * polling it often helps bringing down migration latency, so From patchwork Mon Mar 9 06:51:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Mattias_R=C3=B6nnblom?= X-Patchwork-Id: 66370 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3D804A052E; Mon, 9 Mar 2020 07:51:59 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0C8511BFFC; Mon, 9 Mar 2020 07:51:51 +0100 (CET) Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60048.outbound.protection.outlook.com [40.107.6.48]) by dpdk.org (Postfix) with ESMTP id 59CD81BFF4 for ; Mon, 9 Mar 2020 07:51:46 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e34LsBVMXX2hTGsWm/+c3my1IL+oKD3eV1o+Dp+KLJ77bYB/SetD4Q7WOVR3hZJbVh3j83v9DWxaH0MFNlfUvGjx7csAC5zEkaoWwT/7SwEwqSgZvOmTWmKOE+42zBwYatvqxUltLPgV2HkBwKFLury/tPC+19dRRhYu4/a9s4X0iCqnbi2uB2K/E+4tNrOnUDCWwr4Cm7ae6OBMeuGeKWftLzXkL38r2jiINls7o38JE6CqzQ161XZwPPLog407XDMpy197llt2dq2wCLtNgmNlXwdo5Xm3u3KUykMnlcsRDsHUoFhqn/yNDszNKSyrpCOp6qfg43QkA2Mn/0atiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tmMDB4HlN9TnEZ2sxA6Oc9RrwKRf5RWn7jk+v49xADo=; b=kzVpwrAVMnC3U1HgyJNjy3P9+CloRpKWmI2dTC88F+YNTfC18rIyrGRM4wvs0K3vNUgeC360UWVYHb14uHfvu0oX+ejna03MmzHz5VscJnCVk4qWlEWqPRlC9RGyyuoSspvz3qLOFF+DCOqqcJhPcxZ+ISTbmENuPku7UkO+jf88jbiA+q1oY299bnO1DF1bCwOtnrljAFz41X6ztBRKo82UmOjuTHshQI3CSAuBbNRcw0DitzKOGK7Tv3zqhona3iiVHXQi2okDtQwSm+MdgaivWXRhNuRbyTJ9qIz/eDWPB6lPsSMAwEHq4Z3X4uf++lHi4Nq0x6YDXYTExoy1wg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 192.176.1.74) smtp.rcpttodomain=arm.com smtp.mailfrom=ericsson.com; dmarc=pass (p=reject sp=none pct=100) action=none header.from=ericsson.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericsson.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tmMDB4HlN9TnEZ2sxA6Oc9RrwKRf5RWn7jk+v49xADo=; b=aeHXnDKPB+hVnfUb4Cq8xK+TOq1jlM5HM+msTwfzXE5MVERugrRODXrDQRHl0l1jfxldgKUSkMg3tE3og65Up6FdKdJH2F9Zlva9J4KoLIdU5sMuPVBrSZCxJaWi/DGlTvS0bGfkn1a5ehK6YIMPVQQ59KY/nhRIMYC19Sn7+q4= Received: from AM6PR05CA0033.eurprd05.prod.outlook.com (2603:10a6:20b:2e::46) by DB6PR0701MB2311.eurprd07.prod.outlook.com (2603:10a6:4:5e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2814.10; Mon, 9 Mar 2020 06:51:45 +0000 Received: from AM5EUR02FT046.eop-EUR02.prod.protection.outlook.com (2603:10a6:20b:2e:cafe::ea) by AM6PR05CA0033.outlook.office365.com (2603:10a6:20b:2e::46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2793.15 via Frontend Transport; Mon, 9 Mar 2020 06:51:45 +0000 Authentication-Results: spf=pass (sender IP is 192.176.1.74) smtp.mailfrom=ericsson.com; arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=pass action=none header.from=ericsson.com; Received-SPF: Pass (protection.outlook.com: domain of ericsson.com designates 192.176.1.74 as permitted sender) receiver=protection.outlook.com; client-ip=192.176.1.74; helo=oa.msg.ericsson.com; Received: from oa.msg.ericsson.com (192.176.1.74) by AM5EUR02FT046.mail.protection.outlook.com (10.152.8.221) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2793.11 via Frontend Transport; Mon, 9 Mar 2020 06:51:45 +0000 Received: from ESESBMB503.ericsson.se (153.88.183.170) by ESESBMR506.ericsson.se (153.88.183.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Mon, 9 Mar 2020 07:51:44 +0100 Received: from ESESSMB503.ericsson.se (153.88.183.164) by ESESBMB503.ericsson.se (153.88.183.170) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Mon, 9 Mar 2020 07:51:43 +0100 Received: from selio1a020.lmera.ericsson.se (153.88.183.153) by smtp.internal.ericsson.com (153.88.183.191) with Microsoft SMTP Server id 15.1.1713.5 via Frontend Transport; Mon, 9 Mar 2020 07:51:43 +0100 Received: from breslau.lmera.ericsson.se (breslau.lmera.ericsson.se [150.132.109.241]) by selio1a020.lmera.ericsson.se (8.15.1+Sun/8.15.1) with ESMTP id 0296pgIP024126; Mon, 9 Mar 2020 07:51:43 +0100 (CET) From: =?utf-8?q?Mattias_R=C3=B6nnblom?= To: CC: , , , =?utf-8?q?Mattias_R=C3=B6nnblom?= Date: Mon, 9 Mar 2020 07:51:03 +0100 Message-ID: <20200309065106.23800-6-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200309065106.23800-1-mattias.ronnblom@ericsson.com> References: <20200309065106.23800-1-mattias.ronnblom@ericsson.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:192.176.1.74; IPV:; CTRY:SE; EFV:NLI; SFV:NSPM; SFS:(10009020)(4636009)(396003)(39860400002)(136003)(346002)(376002)(199004)(189003)(6666004)(356004)(4326008)(70586007)(2906002)(8676002)(336012)(5660300002)(478600001)(7636002)(70206006)(316002)(246002)(26005)(8936002)(186003)(86362001)(54906003)(107886003)(66574012)(6916009)(1076003)(2616005)(956004)(36756003); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR0701MB2311; H:oa.msg.ericsson.com; FPR:; SPF:Pass; LANG:en; PTR:office365.se.ericsson.net; A:1; MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a02fc77d-9b69-4ae5-6dcb-08d7c3f6551f X-MS-TrafficTypeDiagnostic: DB6PR0701MB2311: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-Forefront-PRVS: 0337AFFE9A X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ei2CAiXGtht/1pxaV0Hz4ZY3wjmpGgUh5H2BEdeZ2AcOeZXC0TCjNUUoX7EtJ0tERe3C0ff2DIcIorajbsvOqYgp1pCm944l2YD1Vqj2CPSJd0ojvH5Oip251z0/OK+JyjVyJONYunAVjm5Rx8V7acUgEFNOupw2rE2hpiuSH6z207up1O60DO/eK+8dM+Pjx32wUg1KrpuARq11Kf9D6SU8qXqV4W/yuUvoXL2NBzHkEbtdclJRHTLwpJNdXTyFUHzACbtewGyWXJzj+ZOvB+bkggN1EX5Wg9LQmo0FAaxVEBTvS0Ds1hdYnz8mBf+T0AEmdtPLKYejl6GEWN0F6YAD7AGT6ryCmk8onRkzmyDO2YPMf+UA65mE4lQI8OvDQKfpyruQiKu9SFbkuCWXSo7mLXqXfUQ9E14co220WZKQ53g0+/t4mB0/G2MuhUmo X-OriginatorOrg: ericsson.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2020 06:51:45.3088 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a02fc77d-9b69-4ae5-6dcb-08d7c3f6551f X-MS-Exchange-CrossTenant-Id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=92e84ceb-fbfd-47ab-be52-080c6b87953f; Ip=[192.176.1.74]; Helo=[oa.msg.ericsson.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0701MB2311 Subject: [dpdk-dev] [PATCH 5/8] event/dsw: avoid migration waves in large systems X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" DSW limits the rate of migrations on a per-port basis. Hence, as the number of cores grows, so does the total migration capacity. In high core-count systems, this allows for a situation where flows are migrated to a lightly loaded port which recently already received a number of new flows (from other ports). The processing load generated by these new flows may not yet be reflected in the lightly loaded port's load estimate. The result is that the previously lightly loaded port is now overloaded. This patch adds a rough estimate of the size of the inbound migrations to a particular port, which can be factored into the migration logic, avoiding the above problem. Signed-off-by: Mattias Rönnblom --- drivers/event/dsw/dsw_evdev.c | 1 + drivers/event/dsw/dsw_evdev.h | 2 ++ drivers/event/dsw/dsw_event.c | 18 ++++++++++++++++-- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/drivers/event/dsw/dsw_evdev.c b/drivers/event/dsw/dsw_evdev.c index 7798a38ad..e796975df 100644 --- a/drivers/event/dsw/dsw_evdev.c +++ b/drivers/event/dsw/dsw_evdev.c @@ -62,6 +62,7 @@ dsw_port_setup(struct rte_eventdev *dev, uint8_t port_id, port->ctl_in_ring = ctl_in_ring; rte_atomic16_init(&port->load); + rte_atomic32_init(&port->immigration_load); port->load_update_interval = (DSW_LOAD_UPDATE_INTERVAL * rte_get_timer_hz()) / US_PER_S; diff --git a/drivers/event/dsw/dsw_evdev.h b/drivers/event/dsw/dsw_evdev.h index ced40ef8d..6cb77cfc4 100644 --- a/drivers/event/dsw/dsw_evdev.h +++ b/drivers/event/dsw/dsw_evdev.h @@ -220,6 +220,8 @@ struct dsw_port { /* Estimate of current port load. */ rte_atomic16_t load __rte_cache_aligned; + /* Estimate of flows currently migrating to this port. */ + rte_atomic32_t immigration_load __rte_cache_aligned; } __rte_cache_aligned; struct dsw_queue { diff --git a/drivers/event/dsw/dsw_event.c b/drivers/event/dsw/dsw_event.c index 21c102275..f87656703 100644 --- a/drivers/event/dsw/dsw_event.c +++ b/drivers/event/dsw/dsw_event.c @@ -160,6 +160,11 @@ dsw_port_load_update(struct dsw_port *port, uint64_t now) (DSW_OLD_LOAD_WEIGHT+1); rte_atomic16_set(&port->load, new_load); + + /* The load of the recently immigrated flows should hopefully + * be reflected the load estimate by now. + */ + rte_atomic32_set(&port->immigration_load, 0); } static void @@ -362,7 +367,13 @@ dsw_retrieve_port_loads(struct dsw_evdev *dsw, int16_t *port_loads, uint16_t i; for (i = 0; i < dsw->num_ports; i++) { - int16_t load = rte_atomic16_read(&dsw->ports[i].load); + int16_t measured_load = rte_atomic16_read(&dsw->ports[i].load); + int32_t immigration_load = + rte_atomic32_read(&dsw->ports[i].immigration_load); + int32_t load = measured_load + immigration_load; + + load = RTE_MIN(load, DSW_MAX_LOAD); + if (load < load_limit) below_limit = true; port_loads[i] = load; @@ -491,6 +502,9 @@ dsw_select_emigration_target(struct dsw_evdev *dsw, target_qfs[*targets_len] = *candidate_qf; (*targets_len)++; + rte_atomic32_add(&dsw->ports[candidate_port_id].immigration_load, + candidate_flow_load); + return true; } @@ -503,7 +517,7 @@ dsw_select_emigration_targets(struct dsw_evdev *dsw, struct dsw_queue_flow *target_qfs = source_port->emigration_target_qfs; uint8_t *target_port_ids = source_port->emigration_target_port_ids; uint8_t *targets_len = &source_port->emigration_targets_len; - uint8_t i; + uint16_t i; for (i = 0; i < DSW_MAX_FLOWS_PER_MIGRATION; i++) { bool found; From patchwork Mon Mar 9 06:51:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Mattias_R=C3=B6nnblom?= X-Patchwork-Id: 66369 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 48BD9A052E; Mon, 9 Mar 2020 07:51:50 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 99FB01BFF3; Mon, 9 Mar 2020 07:51:49 +0100 (CET) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2082.outbound.protection.outlook.com [40.107.21.82]) by dpdk.org (Postfix) with ESMTP id 6262A1BFF6 for ; Mon, 9 Mar 2020 07:51:47 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZI43zo23YO8yIUv3cEeNbhAa8W8wBilExxxSs50Fk/z5trZXu9C+z+rqzipVwjvd4VRTmUX9Orfn/6QbKpHPzEStzpiUZfXTv2Zsx6Gt633fSNLT1fmLxpQS8tz0jMS5RalCLxjsh54kZ3MxDeZuSebJl2O7AKxm9dHBl07evfSUsbqqQ5KgzGuiDTA7u6MXjMyReer5EjUS9OnrCWtVmAr2+mCIJXbJp7TsnstIYd4I2BBHczgIfAr3JpFLtdjAEurOnAbr0pK/f1JsK8xTeOJsq9EEInCjldZ9cQqWQ3MY9WN+L46aMZHTMk4ZLRELlB435wcroFn7On9IlccgrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=p7DGPeKoaad100b7MBlkuD0DMlHlH5UJYahOBhVzRo0=; b=MbvORM1z306EBFcDjhACvkivfzw+5kf2r8FfVidGsIVRaJb+/jkbVcEKniciC8Po2sMdHzwFze5MchUDmSv+nJSwbqhoTkiK6400kKZrJaDZProtlQyFrdLODlayfRL9XOlq9YP025xxZ5l4I6fQYCw7VvHT1ox/bMZ2aI51PhnEoApYMTQrvAFdxI1yefPiJTHC6Z9wUWROHdUPxZpQXWV6iIvdwZtX9Efj5wF1hPAkx/3x46DoN1vU5hEzEyFWtguxe21ny/niYyVgFMdCuIrLEpgf6b94g5r1DskAdZXe/7ucYnmJowdUy0kIjpJYicdNMg89XNEJIL+PBN5RvQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 192.176.1.74) smtp.rcpttodomain=arm.com smtp.mailfrom=ericsson.com; dmarc=pass (p=reject sp=none pct=100) action=none header.from=ericsson.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericsson.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=p7DGPeKoaad100b7MBlkuD0DMlHlH5UJYahOBhVzRo0=; b=tR3IeGyEllWBZGlk6viPGEXLnm73BOote/sB/UHJvTOY/sYmvP0TJJSI7j6/vSQHTfL762U5aCScwFFWnyfZtjaDsjMV7UKxGOzARLaXRP85MKv5zGowbPfEESWTmkCFtf8objkPj6t0CAk0n0EFos5GjoBb6ocq5tjpzWxlNOs= Received: from AM0PR06CA0006.eurprd06.prod.outlook.com (2603:10a6:208:ab::19) by DB6PR0701MB2455.eurprd07.prod.outlook.com (2603:10a6:4:61::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2814.11; Mon, 9 Mar 2020 06:51:46 +0000 Received: from AM5EUR02FT038.eop-EUR02.prod.protection.outlook.com (2603:10a6:208:ab:cafe::9b) by AM0PR06CA0006.outlook.office365.com (2603:10a6:208:ab::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2793.16 via Frontend Transport; Mon, 9 Mar 2020 06:51:46 +0000 Authentication-Results: spf=pass (sender IP is 192.176.1.74) smtp.mailfrom=ericsson.com; arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=pass action=none header.from=ericsson.com; Received-SPF: Pass (protection.outlook.com: domain of ericsson.com designates 192.176.1.74 as permitted sender) receiver=protection.outlook.com; client-ip=192.176.1.74; helo=oa.msg.ericsson.com; Received: from oa.msg.ericsson.com (192.176.1.74) by AM5EUR02FT038.mail.protection.outlook.com (10.152.9.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2793.11 via Frontend Transport; Mon, 9 Mar 2020 06:51:44 +0000 Received: from ESESBMB504.ericsson.se (153.88.183.171) by ESESSMR504.ericsson.se (153.88.183.126) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Mon, 9 Mar 2020 07:51:44 +0100 Received: from ESESSMB502.ericsson.se (153.88.183.163) by ESESBMB504.ericsson.se (153.88.183.171) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Mon, 9 Mar 2020 07:51:43 +0100 Received: from selio1a020.lmera.ericsson.se (153.88.183.153) by smtp.internal.ericsson.com (153.88.183.190) with Microsoft SMTP Server id 15.1.1713.5 via Frontend Transport; Mon, 9 Mar 2020 07:51:43 +0100 Received: from breslau.lmera.ericsson.se (breslau.lmera.ericsson.se [150.132.109.241]) by selio1a020.lmera.ericsson.se (8.15.1+Sun/8.15.1) with ESMTP id 0296pgIQ024126; Mon, 9 Mar 2020 07:51:43 +0100 (CET) From: =?utf-8?q?Mattias_R=C3=B6nnblom?= To: CC: , , , =?utf-8?q?Mattias_R=C3=B6nnblom?= Date: Mon, 9 Mar 2020 07:51:04 +0100 Message-ID: <20200309065106.23800-7-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200309065106.23800-1-mattias.ronnblom@ericsson.com> References: <20200309065106.23800-1-mattias.ronnblom@ericsson.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:192.176.1.74; IPV:; CTRY:SE; EFV:NLI; SFV:NSPM; SFS:(10009020)(4636009)(376002)(396003)(346002)(136003)(39860400002)(199004)(189003)(316002)(1076003)(107886003)(246002)(26005)(956004)(2616005)(54906003)(186003)(4744005)(86362001)(6666004)(8936002)(5660300002)(36756003)(7636002)(8676002)(478600001)(70206006)(70586007)(356004)(336012)(2906002)(6916009)(4326008); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR0701MB2455; H:oa.msg.ericsson.com; FPR:; SPF:Pass; LANG:en; PTR:office365.se.ericsson.net; A:1; MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 66989b1c-5135-4cea-6f95-08d7c3f65550 X-MS-TrafficTypeDiagnostic: DB6PR0701MB2455: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3276; X-Forefront-PRVS: 0337AFFE9A X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: E/pfomC7JTOr1jh66gc18rmN1qkpc9Y3ggY6VLsm1EvDyvsCOYNQKbRPh6HEMD764GPRZU1jrxwqFGusNitE//W5N6H+0V+p40HEhoLuSD3DuGF/mSxJt+qdtpzAMuk2U931NCut1lTiraFBHng3BJq5JzWBPr4hgkO6TXri2riIo5lLC3S4cLhbd6zcRnX8R6ToU/xBsnd+o6iweSPcUNQKSCYdPm2EeB8CIHoDuXGhn+KqmcIhd7ST7tZf126GNUzxgWZpQtr7SjhmbzvMxgeSa4txa6R/ili+jVybR5gNrPIQVhz9nDKh8/zIIjPDyadwW9X5/p5SI4xl816yYpMpFP8pai2SVvGBOdfp30bNVvMR/r7NqobDUigrdCnhLeosCohlQEoIE6VU8aLAWc+ifVjFySn/seCdHGvxOkr01y1Fi5PvGsPwybA3acSJ X-OriginatorOrg: ericsson.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2020 06:51:44.4220 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 66989b1c-5135-4cea-6f95-08d7c3f65550 X-MS-Exchange-CrossTenant-Id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=92e84ceb-fbfd-47ab-be52-080c6b87953f; Ip=[192.176.1.74]; Helo=[oa.msg.ericsson.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0701MB2455 Subject: [dpdk-dev] [PATCH 6/8] event/dsw: remove redundant control ring poll X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On dequeue, polling the control ring once is enough. Fixes: f6257b22e767 ("event/dsw: add load balancing") Suggested-by: Ola Liljedahl Signed-off-by: Mattias Rönnblom --- drivers/event/dsw/dsw_event.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/event/dsw/dsw_event.c b/drivers/event/dsw/dsw_event.c index f87656703..bb06df803 100644 --- a/drivers/event/dsw/dsw_event.c +++ b/drivers/event/dsw/dsw_event.c @@ -1331,11 +1331,6 @@ static uint16_t dsw_port_dequeue_burst(struct dsw_port *port, struct rte_event *events, uint16_t num) { - struct dsw_port *source_port = port; - struct dsw_evdev *dsw = source_port->dsw; - - dsw_port_ctl_process(dsw, source_port); - if (unlikely(port->in_buffer_len > 0)) { uint16_t dequeued = RTE_MIN(num, port->in_buffer_len); From patchwork Mon Mar 9 06:51:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Mattias_R=C3=B6nnblom?= X-Patchwork-Id: 66377 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1DC93A052E; Mon, 9 Mar 2020 07:53:20 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 16F881BFF4; Mon, 9 Mar 2020 07:52:03 +0100 (CET) Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60089.outbound.protection.outlook.com [40.107.6.89]) by dpdk.org (Postfix) with ESMTP id 790891C002 for ; Mon, 9 Mar 2020 07:51:52 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QDnbTtdNa1MonUJDeeafOQBznssaGcNWT9Wq9Huly7fhXXfIjJSY+HhiQCfGdzX7RUMpCKuDrJt5IIJ5iuGNh0S4fKCR0N2oyajYDFa9COZjyBLuz4d6eJb7On2szTShzOTuzhsGSooxESiZnGFcnRQ3tvkvOKSR0zuiw9iWlIVazSqTC8BeMNVTq6mNy4zZq4FUh4k1mnzukUDrK1PNz0GvpMQ1rcbSZSUuyabg/Va7nZbLnCS+cgcd/SZs2z9Q+zFmaXzufV+qMxH7gTuDQvJOP9HxBINKCSjJA+8i7F8GnxH9ESVAbHUaNYm33kQxUfRTrikCXjxxaKZRh6SOmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4hXlF0Ntdwl5BfpK3RMTZfyx5WPhzi8CRQfvlPJAu08=; b=DKA7hRxwAZjxQsd6H8/EqSk7JnBTGxJYk1PEZlUEj/fO6sPLrawiEUm1h52jmWZkAvuR1A9prh1rrvtc3X+N/CCN4MFMWfx/f8AVFytMDJ5Nzc8j625FdgGfHHUKTnZbh/z3Nxi/RuvMK4nKrUetRxkfCe22WSdv5RjIs63YZEITMgImt/cymRCxQ5PB9wobHiFV5d1PTr6O5cZzsnvY9oxD/nTHhru7DUefLj37envETHZWEb7NEfNO4YdqJASXOA7HPM0Z96LGlgjKOBkkPvtmnfnWlrGFSdPefW+6lli7MvzOqvu78dBk5iFEtZvw3/azdmECMraxte11Op6Iyg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 192.176.1.74) smtp.rcpttodomain=arm.com smtp.mailfrom=ericsson.com; dmarc=pass (p=reject sp=none pct=100) action=none header.from=ericsson.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericsson.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4hXlF0Ntdwl5BfpK3RMTZfyx5WPhzi8CRQfvlPJAu08=; b=kA4vsmo/LxCWKZ7Iz8xvKwMwmSRZNbtfWR2JnWDze18Iw3uFQmAGRx3Aes9YYB9bZXv4QYQN+SSVBy50/3JDOPhj4NKRkXzv4stkkcqDjyyRflShZ8QgAWtQc93oBOKXs6b50K1R7PcViAI2iqgVRwuGauxEaod4xzVx/SnoZM4= Received: from AM0PR02CA0021.eurprd02.prod.outlook.com (2603:10a6:208:3e::34) by VI1PR07MB6432.eurprd07.prod.outlook.com (2603:10a6:800:137::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2814.9; Mon, 9 Mar 2020 06:51:51 +0000 Received: from HE1EUR02FT045.eop-EUR02.prod.protection.outlook.com (2603:10a6:208:3e:cafe::10) by AM0PR02CA0021.outlook.office365.com (2603:10a6:208:3e::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2793.15 via Frontend Transport; Mon, 9 Mar 2020 06:51:51 +0000 Authentication-Results: spf=pass (sender IP is 192.176.1.74) smtp.mailfrom=ericsson.com; arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=pass action=none header.from=ericsson.com; Received-SPF: Pass (protection.outlook.com: domain of ericsson.com designates 192.176.1.74 as permitted sender) receiver=protection.outlook.com; client-ip=192.176.1.74; helo=oa.msg.ericsson.com; Received: from oa.msg.ericsson.com (192.176.1.74) by HE1EUR02FT045.mail.protection.outlook.com (10.152.11.238) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2793.11 via Frontend Transport; Mon, 9 Mar 2020 06:51:51 +0000 Received: from ESESSMB503.ericsson.se (153.88.183.164) by ESESSMR502.ericsson.se (153.88.183.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Mon, 9 Mar 2020 07:51:44 +0100 Received: from selio1a020.lmera.ericsson.se (153.88.183.153) by smtp.internal.ericsson.com (153.88.183.191) with Microsoft SMTP Server id 15.1.1713.5 via Frontend Transport; Mon, 9 Mar 2020 07:51:43 +0100 Received: from breslau.lmera.ericsson.se (breslau.lmera.ericsson.se [150.132.109.241]) by selio1a020.lmera.ericsson.se (8.15.1+Sun/8.15.1) with ESMTP id 0296pgIR024126; Mon, 9 Mar 2020 07:51:43 +0100 (CET) From: =?utf-8?q?Mattias_R=C3=B6nnblom?= To: CC: , , , =?utf-8?q?Mattias_R=C3=B6nnblom?= Date: Mon, 9 Mar 2020 07:51:05 +0100 Message-ID: <20200309065106.23800-8-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200309065106.23800-1-mattias.ronnblom@ericsson.com> References: <20200309065106.23800-1-mattias.ronnblom@ericsson.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:192.176.1.74; IPV:; CTRY:SE; EFV:NLI; SFV:NSPM; SFS:(10009020)(4636009)(39860400002)(346002)(136003)(376002)(396003)(199004)(189003)(356004)(6666004)(6916009)(2906002)(5660300002)(478600001)(2616005)(956004)(86362001)(70586007)(70206006)(246002)(186003)(316002)(54906003)(8676002)(36756003)(8936002)(107886003)(1076003)(4326008)(26005)(4744005)(7636002)(336012); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR07MB6432; H:oa.msg.ericsson.com; FPR:; SPF:Pass; LANG:en; PTR:office365.se.ericsson.net; A:1; MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5f836b74-65e8-430c-c009-08d7c3f658c0 X-MS-TrafficTypeDiagnostic: VI1PR07MB6432: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4941; X-Forefront-PRVS: 0337AFFE9A X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KT12q2O5HyKX0MYnan2N53klHfnMJqSkD+WcnIJ8no0/FdYeJet7C2JDUrC4zKzOUaGIkqaYnc8/nDxhn1nHLP5qrQeMtIKm2tzS/jtwUKhM8tlbHsa0XCeHowFXGOc198LwM/N3Ut0rrfZ9ZAtXeVguLYMlwhn9WMdiqJSOFgYAPdh1Dq25ADsCCK9+uoS+INFTngFdvthpzixKi33HDIasbbHUtNAWaknKru6fkcEN9qzLo0/TImBp/DTUOsnK54pLgrsx2shwNU7OxafPj8Mv5yfvaWJF9Cjj9P1/PlOF/yaqJ/VYx0QMq2L6JosOBCyESnFS1FPpQD3QzVk1Evj/MpLqW5/Fs5iD6pG64SE+XVLCmuCUKfqSKT1PAYMk5o/yhuWFd60KBbo9ehTkrAhX9wD1lVZMDX28wLAJlG9dIgn79EUThTr/0C/9+a8V X-OriginatorOrg: ericsson.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2020 06:51:51.4342 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5f836b74-65e8-430c-c009-08d7c3f658c0 X-MS-Exchange-CrossTenant-Id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=92e84ceb-fbfd-47ab-be52-080c6b87953f; Ip=[192.176.1.74]; Helo=[oa.msg.ericsson.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR07MB6432 Subject: [dpdk-dev] [PATCH 7/8] event/dsw: remove unnecessary read barrier X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Remove unnecessary read barrier (and misleading comment) on control message dequeue. Fixes: f6257b22e767 ("event/dsw: add load balancing") Suggested-by: Ola Liljedahl Signed-off-by: Mattias Rönnblom --- drivers/event/dsw/dsw_event.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/event/dsw/dsw_event.c b/drivers/event/dsw/dsw_event.c index bb06df803..73a9d38cb 100644 --- a/drivers/event/dsw/dsw_event.c +++ b/drivers/event/dsw/dsw_event.c @@ -1068,11 +1068,6 @@ dsw_port_ctl_process(struct dsw_evdev *dsw, struct dsw_port *port) { struct dsw_ctl_msg msg; - /* So any table loads happens before the ring dequeue, in the - * case of a 'paus' message. - */ - rte_smp_rmb(); - if (dsw_port_ctl_dequeue(port, &msg) == 0) { switch (msg.type) { case DSW_CTL_PAUS_REQ: From patchwork Mon Mar 9 06:51:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Mattias_R=C3=B6nnblom?= X-Patchwork-Id: 66375 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id C8E20A052E; Mon, 9 Mar 2020 07:52:53 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EE9D01C044; Mon, 9 Mar 2020 07:51:58 +0100 (CET) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20066.outbound.protection.outlook.com [40.107.2.66]) by dpdk.org (Postfix) with ESMTP id BA06F1BFFB for ; Mon, 9 Mar 2020 07:51:47 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M59Ms7q0dNG9GCQGocM/58dLtGKPPQWDa1/8fkJklY9KymuLF8W4jzBinh3OJYrBWwft4dPxiMIHxwxeBFas/KUwzuJcox+O+bMcnPEk5O1+WAAMcBVQHMqQJQnlvKotDTYfKUe+X0QJZkpAYyuU76ZgG80kuuPapVZSGoBci1zj1yK8r3gRe+ImcqxIFxCocqSi4DYLF/MEAedqL1enuDOzrZ9AmH9ifdsjtTM9Ev5vI/bq2+GDb9phIrX9+ksv5NwsxRj2qpOlkkMTvgGQ0sPSWnhZCnieDIp3YFCe6u4vC48cfZShHFn+xn2uKnUBLAlKQxmVfH4PhLT9b2A1qA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=N1CBtpf0tfHF9UhxJu/7kZa6F9qQkQaWr93qjIPCTGg=; b=GzA1zbs8LULzGQC8sP1RxFjjBJoRN3rUI9Wvs44UiMatLuSqFEFWE9XChZEoF8KBKVDgPFN2bpOHwJJMMwd5ieAhr83Q2Vr9L5TPxK/g1kxhmqCttsvHQFyhlDvhY2+hF4fWYRoc26zBdI2JjhRMbnZxr2v/H/OqY/oT9EUorKGHluFdWcLoludzyEDlQpI3e1gl1n1YvzalbYkhwEUg3BcRIiqCH3g3cI0GvLNqDSrENpVCoaAsrvb7FYnq3AFxNOzESsSM7UUchythryUZvAzucovaZUtCBC2SWaxEQ06H+N5nhfZZcTZCkr3ucW5n6/TOvAZIvCFvEayJxIEjRg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 192.176.1.74) smtp.rcpttodomain=arm.com smtp.mailfrom=ericsson.com; dmarc=pass (p=reject sp=none pct=100) action=none header.from=ericsson.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericsson.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=N1CBtpf0tfHF9UhxJu/7kZa6F9qQkQaWr93qjIPCTGg=; b=A3/vEelIEe467fFq9l1kM3iaN//WJagZu+z8Z1hsWtm+bd/96zXQolaJjb3YWSNH4G7l0EEKI7a3aIms8MDcUDB6KzATqP2sg3FX5Da2Ec2L0imNngFQ+BsOCugW3kB8a0qfCdyAIjiK0m6Kt74WPi1UzIJ41QbTsX3kUt7iP2M= Received: from AM6P195CA0002.EURP195.PROD.OUTLOOK.COM (2603:10a6:209:81::15) by AM0PR07MB5603.eurprd07.prod.outlook.com (2603:10a6:208:100::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2793.5; Mon, 9 Mar 2020 06:51:45 +0000 Received: from VE1EUR02FT021.eop-EUR02.prod.protection.outlook.com (2603:10a6:209:81:cafe::14) by AM6P195CA0002.outlook.office365.com (2603:10a6:209:81::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2793.15 via Frontend Transport; Mon, 9 Mar 2020 06:51:45 +0000 Authentication-Results: spf=pass (sender IP is 192.176.1.74) smtp.mailfrom=ericsson.com; arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=pass action=none header.from=ericsson.com; Received-SPF: Pass (protection.outlook.com: domain of ericsson.com designates 192.176.1.74 as permitted sender) receiver=protection.outlook.com; client-ip=192.176.1.74; helo=oa.msg.ericsson.com; Received: from oa.msg.ericsson.com (192.176.1.74) by VE1EUR02FT021.mail.protection.outlook.com (10.152.12.111) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2793.11 via Frontend Transport; Mon, 9 Mar 2020 06:51:45 +0000 Received: from ESESSMB503.ericsson.se (153.88.183.164) by ESESBMR505.ericsson.se (153.88.183.201) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Mon, 9 Mar 2020 07:51:44 +0100 Received: from ESESSMB501.ericsson.se (153.88.183.162) by ESESSMB503.ericsson.se (153.88.183.164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Mon, 9 Mar 2020 07:51:43 +0100 Received: from selio1a020.lmera.ericsson.se (153.88.183.153) by smtp.internal.ericsson.com (153.88.183.189) with Microsoft SMTP Server id 15.1.1713.5 via Frontend Transport; Mon, 9 Mar 2020 07:51:43 +0100 Received: from breslau.lmera.ericsson.se (breslau.lmera.ericsson.se [150.132.109.241]) by selio1a020.lmera.ericsson.se (8.15.1+Sun/8.15.1) with ESMTP id 0296pgIS024126; Mon, 9 Mar 2020 07:51:44 +0100 (CET) From: =?utf-8?q?Mattias_R=C3=B6nnblom?= To: CC: , , , =?utf-8?q?Mattias_R=C3=B6nnblom?= Date: Mon, 9 Mar 2020 07:51:06 +0100 Message-ID: <20200309065106.23800-9-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200309065106.23800-1-mattias.ronnblom@ericsson.com> References: <20200309065106.23800-1-mattias.ronnblom@ericsson.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:192.176.1.74; IPV:; CTRY:SE; EFV:NLI; SFV:NSPM; SFS:(10009020)(4636009)(136003)(346002)(39860400002)(376002)(396003)(199004)(189003)(54906003)(8676002)(4326008)(26005)(478600001)(1076003)(316002)(66574012)(246002)(336012)(107886003)(7636002)(186003)(956004)(6916009)(6666004)(356004)(5660300002)(70586007)(70206006)(86362001)(8936002)(36756003)(2906002)(2616005); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR07MB5603; H:oa.msg.ericsson.com; FPR:; SPF:Pass; LANG:en; PTR:office365.se.ericsson.net; A:1; MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0e879517-b452-4738-773c-08d7c3f654f4 X-MS-TrafficTypeDiagnostic: AM0PR07MB5603: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4714; X-Forefront-PRVS: 0337AFFE9A X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JpL6y4vGHD2g+glEaanufsIdG+VLs78shzlTiYJ4bkQxZ1ADXG9rIkFCWpiwIe8d00YdX1j/2yzIorCUPRQTUV9rn3Ni6X6REY5vH1EWc3qrNa1/9k4aqcVsr6xCJ9KdfIvtC6psjBe2EME4IjPMebp30EZ2wBk7lF8ERNW8CTkpLqyAX4UBNB6YhYX85NnJGZLFEBJL5RA/6HDUpW6QI8bRRZeDpCSt2VbmeTxqn4PSN+zjGYtPyHVkZiehQdKYRUuy3Gkzqt6gTDsvFCY5XxstNpHzAcFSk9a+IVvb3J3D8A4f9tCpFWzECwplNWhaC+ddNhmCfy6sBpZa52RftfwOmcu7UIFxrCH4swD/xBtHMNOOcFRy6SkU2U7x7SyRcSnk0MTLfkSmUyQiPF/4GeW9D/6z4oNV5Yeso/Fw58fiF5VEEqRQ+wgyjni/LWw0 X-OriginatorOrg: ericsson.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2020 06:51:45.0082 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0e879517-b452-4738-773c-08d7c3f654f4 X-MS-Exchange-CrossTenant-Id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=92e84ceb-fbfd-47ab-be52-080c6b87953f; Ip=[192.176.1.74]; Helo=[oa.msg.ericsson.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR07MB5603 Subject: [dpdk-dev] [PATCH 8/8] event/dsw: add port busy cycles xstats X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" DSW keeps an internal port load estimate, used by the load balancing mechanism. As a side effect, it keeps track of the total number of busy cycles since startup. This metric is indirectly exposed in the form of DSW xstats' "port__event_proc_latency", which is the total number of busy cycles divided by the total number of events processed on a particular port. An external application can take (event_latency * dequeued) to go back to busy_cycles. One reason for doing this is to measure the port's load during a longer time period, without resorting to sampling "port__load". However, as the number dequeued events grows, a rounding error in event_latency renders the application-calculated busy_cycles inaccurate. Thus, it makes sense to directly expose the number of busy cycles as a DSW xstats, even though it might seem redundant. Signed-off-by: Mattias Rönnblom --- drivers/event/dsw/dsw_xstats.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/event/dsw/dsw_xstats.c b/drivers/event/dsw/dsw_xstats.c index d332a57b6..e8e92183e 100644 --- a/drivers/event/dsw/dsw_xstats.c +++ b/drivers/event/dsw/dsw_xstats.c @@ -109,6 +109,13 @@ dsw_xstats_port_get_event_proc_latency(struct dsw_evdev *dsw, uint8_t port_id, return dequeued > 0 ? total_busy_cycles / dequeued : 0; } +static uint64_t +dsw_xstats_port_get_busy_cycles(struct dsw_evdev *dsw, uint8_t port_id, + uint8_t queue_id __rte_unused) +{ + return dsw->ports[port_id].total_busy_cycles; +} + DSW_GEN_PORT_ACCESS_FN(inflight_credits) DSW_GEN_PORT_ACCESS_FN(pending_releases) @@ -147,6 +154,8 @@ static struct dsw_xstats_port dsw_port_xstats[] = { false }, { "port_%u_event_proc_latency", dsw_xstats_port_get_event_proc_latency, false }, + { "port_%u_busy_cycles", dsw_xstats_port_get_busy_cycles, + false }, { "port_%u_inflight_credits", dsw_xstats_port_get_inflight_credits, false }, { "port_%u_pending_releases", dsw_xstats_port_get_pending_releases,