Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp409016lqz; Sat, 30 Mar 2024 01:52:29 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUIVCQRWiDuGw7JGFpSLK9a3jC+DjCsFbcShmAL6b5nYuSUEJ9wySMN34m5r9nt9BUuzt+J2faMHqC4BRWSNgvnsPQxSAqd2pPgfXiwkg== X-Google-Smtp-Source: AGHT+IFWDpEQF7Ldjl44s4Ygyq3vVsYcnhY3t5BHWvRiz7Nh+5uVwYDTK3IqYepFi/+wrWPFAJR/ X-Received: by 2002:a17:906:13c8:b0:a4e:f44:f73e with SMTP id g8-20020a17090613c800b00a4e0f44f73emr3141292ejc.13.1711788748924; Sat, 30 Mar 2024 01:52:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711788748; cv=pass; d=google.com; s=arc-20160816; b=hqGk3ta41hGA6ny+YAxUcE5nWL5JQZ/C3ryjEDABy3PDun2rdJT24mvyGlCQeXRCho NfCMUS6UJBo7zgoyak8ROvHKDdrNFNkilXO3daHBaP7NhfHqVTkYDMHoeTEf2Leu7Ftl qpRw0/Ls+8xuOJ1EJbFG2DfSRxJCEocmz2TS0mlN7OGVitrBcgK1OGJHG+JyIH30Mhxu ZY9nerUNR9i4ElEGgAwqd40nF4m5YI1nBKc8nd2wufhMmmO182v7cUpqq8CRrlKxu4Jk fJ9s1fJHN81+hBRnfCQS4GZMDhoBYu4l3M/9G+LIXkXCTtbi3biZ1MLx9gZ89GPa7P6e t3AQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=8puHhFaRoHPGCN/sdnJNUraQ8Q4JE618tAdms8BFwkE=; fh=G7JxRLuAY0NBTYbETpCYR0Pmy65SV5uiYdZRLRjOZ3s=; b=mLVERDeZRMvjT2qAxWVt4uNHJ/K0hWLvtdsZJhXS9F9IWzZOUb5DZH07Ez+MsR9rE6 h+tOVdsm+o+2mVN4uRuviiJgKfSp4hFEuk2+6S/bXeSjJCGjPG1hAk7fBjrQgzAF9vVZ 4/4tpGR3NWcYeWbRjcT32tWE4/LDWpiieFFExssLvdX9I2TnGJWF4TwWyDC2PCo//znc n01rQkBqCxALx/zevydZk3oAksKU5ov9mu7gTRtaqIx9AqtF4h67lbNoJTcbZ3VYAQUz 2hXXndk3Vbe8jxVI51jsLfZ4TBuXNuwL2NaMPpI7Kx71nJ8V+E/ucDVGHioMoJrsxATq Z80Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=NyHX7vQW; arc=pass (i=1 spf=pass spfdomain=linux.microsoft.com dkim=pass dkdomain=linux.microsoft.com dmarc=pass fromdomain=linux.microsoft.com); spf=pass (google.com: domain of linux-kernel+bounces-125625-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-125625-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id o1-20020a170906288100b00a4e5088a952si229583ejd.815.2024.03.30.01.52.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Mar 2024 01:52:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-125625-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=NyHX7vQW; arc=pass (i=1 spf=pass spfdomain=linux.microsoft.com dkim=pass dkdomain=linux.microsoft.com dmarc=pass fromdomain=linux.microsoft.com); spf=pass (google.com: domain of linux-kernel+bounces-125625-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-125625-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 7C6121F21A14 for ; Sat, 30 Mar 2024 08:52:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 25B3EBE6E; Sat, 30 Mar 2024 08:52:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b="NyHX7vQW" Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AE013179; Sat, 30 Mar 2024 08:52:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=13.77.154.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711788731; cv=none; b=ZH49r47SavfphWkGdR4MoYyKPU1fvUdxVBD7xlUNySJa5UjlJZa/ShcZauO9vMtywngnp91uhOR/YNSrA0ohsPOcqLCkxBQONUvWb3Gikpm40+5lSBplJWpypBrs3nGgD4GePeqb8JS9ax3j2yvS2+FYqIZGccD/gJEXXd/Wh6U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711788731; c=relaxed/simple; bh=6Nb6SgKfewUOuo0DEqOezQ1dxeAzhkO65ZKQrCKQ5us=; h=From:To:Cc:Subject:Date:Message-Id; b=NHcHP9BBRkjobWex4EGSDsJNx5gpka2s8aBKq0v7s6VFy5elu3hQJPIbybM1hKwONqAAGZd6+DlTZpB4lI7aTwHVh7MorqRqgmwafEBr8NaeH4SJTiabdnlRUShbCqIZbUPrsp8OUfwvF67F5U5AweST3HVC4MBszH8QistzOGc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com; spf=pass smtp.mailfrom=linux.microsoft.com; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b=NyHX7vQW; arc=none smtp.client-ip=13.77.154.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.microsoft.com Received: from linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net (linux.microsoft.com [13.77.154.182]) by linux.microsoft.com (Postfix) with ESMTPSA id 2762C20E7034; Sat, 30 Mar 2024 01:52:08 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 2762C20E7034 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1711788728; bh=8puHhFaRoHPGCN/sdnJNUraQ8Q4JE618tAdms8BFwkE=; h=From:To:Cc:Subject:Date:From; b=NyHX7vQWPvUvmmv393gznGq+5oN0piMl7YsmNFS1ovy2rjoLFcWMl0v1x6qzdSv9E 5XFlelGcR17lFMn6cPNdeiqEYAhX9ZMIaI+xOHp4dhDXxN51RtVyTJuvqDNnDwWj0m ANLIiDLdWjHFNs13/FchZmn2aUBSGUcw8oKWTZbo= From: Saurabh Sengar To: kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org Cc: longli@microsoft.com, ssengar@microsoft.com Subject: [PATCH v3 0/7] Low speed Hyper-V devices support Date: Sat, 30 Mar 2024 01:51:56 -0700 Message-Id: <1711788723-8593-1-git-send-email-ssengar@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Hyper-V is adding multiple low speed "speciality" synthetic devices. Instead of writing a new kernel-level VMBus driver for each device, make the devices accessible to user space through UIO-based uio_hv_generic driver. Each device can then be supported by a user space driver. This approach optimizes the development process and provides flexibility to user space applications to control the key interactions with the VMBus ring buffer. The new synthetic devices are low speed devices that don't support VMBus monitor bits, and so they must use vmbus_setevent() to notify the host of ring buffer updates. These new devices also have smaller ring buffer sizes which requires to add support for variable ring buffer sizes. Moreover, this patch series adds a new implementation of the fcopy application that uses the new UIO driver. The older fcopy driver and application will be phased out gradually. Development of other similar userspace drivers is still underway. Efforts have been made previously to implement this solution earlier. Here are the discussions related to those attempts: Attempt 1: Upgrade uio_hv_generic to cater to Hyper-V slow devices. But this was rejected due to use of module parameters. https://lore.kernel.org/lkml/1665575806-27990-1-git-send-email-ssengar@linux.microsoft.com/ Attempt 2: Enable interrupt for low speed VMBus devices in uio_hv_generic and was rejected due to unavailability of userspace driver for it. https://lore.kernel.org/lkml/Y05bdCWBs0miLjOu@kroah.com/ Attempt 3: Wrote a new UIO driver but was rejected due to its complexity. https://lore.kernel.org/lkml/1691132996-11706-1-git-send-email-ssengar@linux.microsoft.com/ [V3] - Put a check in tools Makefile to avoid compilation of vmbus_bufring library on ARM64 platform. [V2] - Went through internal review, got few reviewed-by from Long Li. - Added more details in cover letter for previous attempts. - Added more details in commit messages. - Added comments for preferred ring sizes and there values. - Removed need_sign arg from vmbus_txbr_write - Change (4 * 4096) to 0x4000 for ring buffer size. - Removed some unnecessary type casting. - Removed rte_smp_rwmb as its duplicate of rte_compiler_barrier. - Added more comment for rte_compiler_barrierx. - Mentioned in file copyright header that this code is copied. - Changed the print from "Registration failed" to "Signal to host failed". - Fixed mask for rx buffer interrupt to 0 before waiting for interrupt. Saurabh Sengar (7): Drivers: hv: vmbus: Add utility function for querying ring size uio_hv_generic: Query the ringbuffer size for device uio_hv_generic: Enable interrupt for low speed VMBus devices tools: hv: Add vmbus_bufring tools: hv: Add new fcopy application based on uio driver Drivers: hv: Remove fcopy driver uio_hv_generic: Remove use of PAGE_SIZE drivers/hv/Makefile | 2 +- drivers/hv/channel_mgmt.c | 15 +- drivers/hv/hv_fcopy.c | 427 ---------------------------- drivers/hv/hv_util.c | 12 - drivers/hv/hyperv_vmbus.h | 5 + drivers/uio/uio_hv_generic.c | 19 +- include/linux/hyperv.h | 2 + tools/hv/Build | 3 +- tools/hv/Makefile | 14 +- tools/hv/hv_fcopy_daemon.c | 266 ------------------ tools/hv/hv_fcopy_uio_daemon.c | 490 +++++++++++++++++++++++++++++++++ tools/hv/vmbus_bufring.c | 318 +++++++++++++++++++++ tools/hv/vmbus_bufring.h | 158 +++++++++++ 13 files changed, 1006 insertions(+), 725 deletions(-) delete mode 100644 drivers/hv/hv_fcopy.c delete mode 100644 tools/hv/hv_fcopy_daemon.c create mode 100644 tools/hv/hv_fcopy_uio_daemon.c create mode 100644 tools/hv/vmbus_bufring.c create mode 100644 tools/hv/vmbus_bufring.h -- 2.34.1