From patchwork Fri Jun 14 13:55:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luigi Leonardi X-Patchwork-Id: 13698725 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03olkn2057.outbound.protection.outlook.com [40.92.59.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E56E64C96; Fri, 14 Jun 2024 13:55:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.92.59.57 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718373355; cv=fail; b=arbglxnGes6ZRNsnPK+SwMRrrtn7/DedZbkdmLItOavFSeA4nPLhSMZeEsBhnDC7Lb56WzOn+rhpnEZxgJsIF8ntdVgcYs5DjINQAxftrLum8zJgGanCrSK/KFObPncKdI7sirGQHgbbbSHIZvgCmeGCTzQkkKBNGsAlbWqwQcQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718373355; c=relaxed/simple; bh=MQWeVsYjgaa1zoyqnGxlHb5PMU1BCZSB7VM3+zf3TgI=; h=From:To:Cc:Subject:Date:Message-ID:Content-Type:MIME-Version; b=jo46LoGh5X7XkUW7wrS8dLVKcV2ZvNF9V8f16mok93nZaf76xEpDP++wW7iu9+1nHrJOhRkmt7d8tz+VSNyDnwBdZEPZz5ELP8ZcSA8n4T6R5o/Z+0Wq/hO1XT7GAzNJNNynt+rgxcj8GeZmGfQrUTmIS1N17vOU9ql+sGi1T4Y= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=outlook.com; spf=pass smtp.mailfrom=outlook.com; dkim=pass (2048-bit key) header.d=outlook.com header.i=@outlook.com header.b=ZefaSmTY; arc=fail smtp.client-ip=40.92.59.57 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=outlook.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=outlook.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=outlook.com header.i=@outlook.com header.b="ZefaSmTY" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FIcdaGmD1Me9q5jfv2rL6Wq9f7qpeL46mqyTzGamauNqVgE0X8F14qCAdfBZKppA2Dh5QMCszUVTotLvxjQALH/0X/pxLudW1q4EM8K72/3mOcP6BmVstR2te90DcZ3Elss8rTJbaUdw9CT4/cb8V1EO+FmQdqgZbS5A+L/Oo3ksMDmj+1X5hZhTDiB7GU/oWl0TBrqXE9ot2gnvV63lvhUauRi5reogDQvJv2l84C2AK8UM7DFUuNcVjDI6n0HyXZFpQkCyDAmmn5dpcwvfyZS3BUD+uACNH1aUQf1583i3zhHvWufxM41DPHccclcHYvZoIxiWzVHLaE+AsPeTnA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=mtyiUHbCwTSg6DT9PUgPUQc+5RLjiP+cTtilbGkT7zE=; b=Pv6b+xtUI2ztkAI7l8t2MBfQHw1idCQSrqLKgNR+g9UE1ETkSl0OfUfbqAdB0WIE24XcKGT+maDnPX0en2FxD+c9Pgnpc477v6fbNtx6y0TivD8TwWUGhJV+U/riDeuaaDeEh/hcMq09jQ5YeqOk5p3bglidg7bUMBHE2pbKufsbGBPQZNafxYL7HEQpekeGDQabITKSMkbkd5yPklzafReBtOAxlP8z/oA70LJ2YEPiCUbIR87MareBUmJjCBNpv4OaS5mo4We8J3+gx0KjJi3/H9rGsuMxB2NH6zyRoIu9DyqxYco7zZRFJJPuYRBD8mqIaOnWBX2GymQTnoz2wA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mtyiUHbCwTSg6DT9PUgPUQc+5RLjiP+cTtilbGkT7zE=; b=ZefaSmTYKHGIvwEkroAu7v0gdQYFpYGaGYCfxcFPjQ/RjOKv4g2a1SnZD6fxABBfjWcMBxAa/KtfKUuvzHWSfjGov0WoECtEC3PvNgXWWTUDt+VaZRMxKvzHrl8q9SQg5D6A99GB02Oht8Pqg43U4Ql0pLYdFQ94l/YdjkvRDNRqLEXMld0LK96K0NtqzSeFoyRINtXZLYMd5x0/mw83qrfMrUhwA729f7EwyR/Ma96xiV6oK8qTQxR7O+2bwKQHEPhLFrFL827l3TPiBJSpWoVDplN51yQn+R4yO/NwS3ti6QFHyZRVz/U/XTy/VKGUrAR8+U5r1PufG6N8zp+/5A== Received: from AS2P194MB2170.EURP194.PROD.OUTLOOK.COM (2603:10a6:20b:642::8) by PAXP194MB1469.EURP194.PROD.OUTLOOK.COM (2603:10a6:102:1a8::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.24; Fri, 14 Jun 2024 13:55:50 +0000 Received: from AS2P194MB2170.EURP194.PROD.OUTLOOK.COM ([fe80::3d63:e123:2c2f:c930]) by AS2P194MB2170.EURP194.PROD.OUTLOOK.COM ([fe80::3d63:e123:2c2f:c930%3]) with mapi id 15.20.7677.024; Fri, 14 Jun 2024 13:55:50 +0000 From: Luigi Leonardi To: sgarzare@redhat.com, edumazet@google.com, virtualization@lists.linux.dev, netdev@vger.kernel.org, kuba@kernel.org, kvm@vger.kernel.org, stefanha@redhat.com, pabeni@redhat.com, davem@davemloft.net Cc: Luigi Leonardi Subject: [PATCH net-next 0/2] vsock: avoid queuing on workqueue if possible Date: Fri, 14 Jun 2024 15:55:41 +0200 Message-ID: X-Mailer: git-send-email 2.45.2 X-TMN: [ugLNQMse1JjcisOqiZHWz6UJHgzwtyeZ] X-ClientProxiedBy: MI0P293CA0015.ITAP293.PROD.OUTLOOK.COM (2603:10a6:290:44::8) To AS2P194MB2170.EURP194.PROD.OUTLOOK.COM (2603:10a6:20b:642::8) X-Microsoft-Original-Message-ID: <20240614135543.31515-1-luigi.leonardi@outlook.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS2P194MB2170:EE_|PAXP194MB1469:EE_ X-MS-Office365-Filtering-Correlation-Id: 26c88e11-f4d1-4b90-7614-08dc8c79b2ea X-Microsoft-Antispam: BCL:0;ARA:14566002|461199025|3412199022|440099025|1710799023; X-Microsoft-Antispam-Message-Info: uvRCtkKaME1lmfWV7AxCPXjvIMLZxyl1f5j4N1FRLaqCKIS2xRgeMJJr+tBEatQjzOVvAwcyhUvxqxzcQWV6eerpqZRh9FAGeJQfRbf1csmBDG6rndh5fuV9/hBi+Z8n+meSrWTzkd9iWgv5tTKkt7SesRdjvKa1SMArJ/qTWrTU+qiYovHB2Vx2CRJ7qWluhsZSjBvaRjCLavtm0NiPrgij7AcpSg4AUx9wOhvDUiFOrMzMIapSS/jo5fZ0yl7MOGJv2/1ueLBP/KB05mlhkWqjWw2A9iS9icNg65wnZbKHxza7eU5EFM4QHu6oqOqb5Nl5tYnfTPFZMjh4sbScD8FqXTR6Y7Wa5JoZsRxn3suv7jkHAgdps12SCZsVBC5Oie6ynggF4djti0MKaM4LT+Qgskgzq03530AA17aLRSP/rXebzGLxjLNqVNGikkslOISOVr9Uj0lEDAxfcPFe8afy/KjgbEkvTu6wu7oqaHAaNR5qPTVwPE54/1WbJnIdrTEPbPvI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i0RbhpP+HFVQYG+6d/biZ4vn9ssVCQJ25sCGmRvqLvjdzVJ?= =?utf-8?q?/VydgcT29uA+6Ckn9eSDBJyV0YcyflCT5l8BmoORDkIs+eYvSnsfGVBthWO6UCZ5f?= =?utf-8?q?EYRqPmJUmxX4VSbXRHO7H/490nMUv/mmdFgLpyuOGXDKqKNVEPGq5zpzPe9Uwj8BO?= =?utf-8?q?GxgCWmwJZWbCaGMA+jl5L54rB5s7LRGsL+Sz6tVq1/+r5we9+EiaPa7a8BAMiYiuD?= =?utf-8?q?qTEsT9ICVvy39bGNIvFrDuhB8QR/vgZZCyIxM1ZQGBrf+v2tSS2wwq6fBD7ACqop7?= =?utf-8?q?KVFr5HCqhJ5hRUF/MtjhVJC21O+K6ImL585w1kM0bRy2AEm5201ihpBXVAG/6/IzG?= =?utf-8?q?yY/YcyVezAYA4kGAeXjrQMhT8kQAtoOGex3jdvYjnVZ/a57e+8Yo205QCspVNgask?= =?utf-8?q?J4qKgKajGGkeXINyhvrVElHwNppfugsB08ybApTmvFh3GQ5MLqEgsKbB3kNlN+JkP?= =?utf-8?q?9Bdl8xe5CjRKz/v6T?= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 26c88e11-f4d1-4b90-7614-08dc8c79b2ea X-MS-Exchange-CrossTenant-AuthSource: AS2P194MB2170.EURP194.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2024 13:55:50.2513 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXP194MB1469 This patch series introduces an optimization for vsock/virtio to reduce latency: When the guest sends a packet to the host, and the workqueue is empty, if there is enough space, the packet is put directly in the virtqueue. The first one contains some code refactoring. More details and some performance tests in the second patch. Marco Pinna (2): vsock/virtio: refactor virtio_transport_send_pkt_work vsock/virtio: avoid enqueue packets when work queue is empty net/vmw_vsock/virtio_transport.c | 166 +++++++++++++++++++------------ 1 file changed, 104 insertions(+), 62 deletions(-)