Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp148048rdb; Thu, 5 Oct 2023 21:28:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHUak2nJt+3+EKLXfQKr1itRPFf7KQ7Ei500teg5U3neDLkCQbRJdooo2hgZUrvoA7f+1Fx X-Received: by 2002:a05:6a20:1456:b0:134:73f6:5832 with SMTP id a22-20020a056a20145600b0013473f65832mr7200662pzi.16.1696566505851; Thu, 05 Oct 2023 21:28:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696566505; cv=none; d=google.com; s=arc-20160816; b=twvu4kYeiXpWT3pIffotgv3i4dtPIbtzfR7ZJvVVXzj/vE4LFb59wyGVr+NJBvL3xo s4F/3P5j01NCjKoV0bXrXOfx6JDHSknjdP2ZpQFCOHmdMJhhpOIKjUEEuWlpEBKPVkXz z6oqsB6+/Uk+34t420AzbzuJ59c1IlAbMcAb2aeiCe7GOpJYy3LviPkFUDc6VwqEsxls +1PWukcGwO9PhYDW8z8Cffpt4Wsf+vXgBwArbXYyfzgmS8T2oxRFAdzuI9uw0b95hRO9 54z7DD9+u/Xr2N6+6okycriEipUPo/4BfabSBghi1gdeZmEVrPTY990fZAJVZImYOgfi QgxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature:dkim-filter; bh=VBmYwvXPtMjKxp0JBBoGPP6lwV3PKu/EqwN3kEREnbw=; fh=2bMUyz/u8fnz0XY3l73e5OzKOqU0VbR6k2RtflDqUTw=; b=K/oIypGI1/gmOu/ZXX3oPXEO9T4hkXbysujdaaNXKSTKzR38jVDwh8788OkSwe9iAs 2L8+E+9y9WwZ26u0EFHzSgLrvW2Y93C+5Dzy8F+T9fQrPH+P8wVXnjIL3iMoCOf/FjQC VvCUdNrOTfFku6Lg8DNI8QODHp8Q99jRqhtccvZtke3S85qvRUhgDkBQ/56zH+k2TrUy RlqPDEiDeOvtFh0KPrxZjvvEu4FiI0oveVxYTKcle8f6Q/1N+zG0swdcDmseYKQWf/Qa L2qczLeJt4OoV/TKJHJA31gEk3imFr2UQ/ODHXhykOTDw0OZzKu79RpF1cOvKA4OmbPU ebIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=iBmOLzLe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id w8-20020a056a0014c800b0068fac3509a9si670814pfu.350.2023.10.05.21.28.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 21:28:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=iBmOLzLe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 2AAF282EA150; Thu, 5 Oct 2023 21:28:22 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230001AbjJFE2L (ORCPT + 99 others); Fri, 6 Oct 2023 00:28:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229953AbjJFE2J (ORCPT ); Fri, 6 Oct 2023 00:28:09 -0400 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id AF053DB; Thu, 5 Oct 2023 21:28:07 -0700 (PDT) Received: by linux.microsoft.com (Postfix, from userid 1127) id 16F1220B74C0; Thu, 5 Oct 2023 21:28:07 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 16F1220B74C0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1696566487; bh=VBmYwvXPtMjKxp0JBBoGPP6lwV3PKu/EqwN3kEREnbw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=iBmOLzLeSVS1UZvXtX6J/+6jaPe9RtlnV/ovwK3HQsua+ZuhN8XUo5YON91oE2J8+ 1s2NdXVPGbzVByTuC1Q/rSCWoZRZlhuTH2U3P6c0LlzxdlwwglsZpNl1NwgFczYKBI /8J+5EkkDNtZ+UhCpqt1aXY2H0gR2QLLfJkD5JiQ= Date: Thu, 5 Oct 2023 21:28:07 -0700 From: Saurabh Singh Sengar To: Greg KH Cc: Saurabh Singh Sengar , KY Srinivasan , Haiyang Zhang , "wei.liu@kernel.org" , Dexuan Cui , "Michael Kelley (LINUX)" , "corbet@lwn.net" , "linux-kernel@vger.kernel.org" , "linux-hyperv@vger.kernel.org" , "linux-doc@vger.kernel.org" Subject: Re: [EXTERNAL] Re: [PATCH v4 0/3] UIO driver for low speed Hyper-V devices Message-ID: <20231006042807.GA22906@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> References: <1691132996-11706-1-git-send-email-ssengar@linux.microsoft.com> <2023081215-canine-fragile-0a69@gregkh> <2023082246-lumping-rebate-4142@gregkh> <20230906122307.GA5737@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> <20230926124126.GA12048@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230926124126.GA12048@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-8.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Thu, 05 Oct 2023 21:28:22 -0700 (PDT) On Tue, Sep 26, 2023 at 05:41:26AM -0700, Saurabh Singh Sengar wrote: > On Wed, Sep 06, 2023 at 05:23:07AM -0700, Saurabh Singh Sengar wrote: > > On Tue, Aug 22, 2023 at 01:48:03PM +0200, Greg KH wrote: > > > On Mon, Aug 21, 2023 at 07:36:18AM +0000, Saurabh Singh Sengar wrote: > > > > > > > > > > > > > -----Original Message----- > > > > > From: Greg KH > > > > > Sent: Saturday, August 12, 2023 4:45 PM > > > > > To: Saurabh Sengar > > > > > Cc: KY Srinivasan ; Haiyang Zhang > > > > > ; wei.liu@kernel.org; Dexuan Cui > > > > > ; Michael Kelley (LINUX) ; > > > > > corbet@lwn.net; linux-kernel@vger.kernel.org; linux-hyperv@vger.kernel.org; > > > > > linux-doc@vger.kernel.org > > > > > Subject: [EXTERNAL] Re: [PATCH v4 0/3] UIO driver for low speed Hyper-V > > > > > devices > > > > > > > > > > On Fri, Aug 04, 2023 at 12:09:53AM -0700, Saurabh Sengar wrote: > > > > > > 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 a UIO-based > > > > > > hv_vmbus_client 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. > > > > > > > > > > Why is it faster to write userspace drivers here? Where are those new drivers, > > > > > and why can't they be proper kernel drivers? Are all hyper-v drivers going to > > > > > move to userspace now? > > > > > > > > Hi Greg, > > > > > > > > You are correct; it isn't faster. However, the developers working on these userspace > > > > drivers can concentrate entirely on the business logic of these devices. The more > > > > intricate aspects of the kernel, such as interrupt management and host communication, > > > > can be encapsulated within the uio driver. > > > > > > Yes, kernel drivers are hard, we all know that. > > > > > > But if you do it right, it doesn't have to be, saying "it's too hard for > > > our programmers to write good code for our platform" isn't exactly a > > > good endorcement of either your programmers, or your platform :) > > > > > > > The quantity of Hyper-V devices is substantial, and their numbers are consistently > > > > increasing. Presently, all of these drivers are in a development/planning phase and > > > > rely significantly on the acceptance of this UIO driver as a prerequisite. > > > > > > Don't make my acceptance of something that you haven't submitted before > > > a business decision that I need to make, that's disenginous. > > > > > > > Not all hyper-v drivers will move to userspace, but many a new slow Hyperv-V > > > > devices will use this framework and will avoid introducing a new kernel driver. We > > > > will also plan to remove some of the existing drivers like kvp/vss. > > > > > > Define "slow" please. > > > > In the Hyper-V environment, most devices, with the exception of network and storage, > > typically do not require extensive data read/write exchanges with the host. Such > > devices are considered to be 'slow' devices. > > > > > > > > > > > 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. The new driver provides this > > > > > > functionality along with a configurable ring buffer size. > > > > > > > > > > > > Moreover, this series of patches incorporates an update to the fcopy > > > > > > application, enabling it to seamlessly utilize the new interface. The > > > > > > older fcopy driver and application will be phased out gradually. > > > > > > Development of other similar userspace drivers is still underway. > > > > > > > > > > > > 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. > > > > > > > > > > You are adding a new user api with the "ring buffer" size api, which is odd for > > > > > normal UIO drivers as that's not something that UIO was designed for. > > > > > > > > > > Why not just make you own generic type uiofs type kernel api if you really > > > > > want to do all of this type of thing in userspace instead of in the kernel? > > > > > > > > Could you please elaborate more on this suggestion. I couldn't understand it > > > > completely. > > > > > > Why is uio the requirement here? Why not make your own framework to > > > write hv drivers in userspace that fits in better with the overall goal? > > > Call it "hvfs" or something like that, much like we have usbfs for > > > writing usb drivers in userspace. > > > > > > Bolting on HV drivers to UIO seems very odd as that is not what this > > > framework is supposed to be providing at all. UIO was to enable "pass > > > through" memory-mapped drivers that only wanted an interrupt and access > > > to raw memory locations in the hardware. > > > > > > Now you are adding ring buffer managment and all other sorts of things > > > just for your platform. So make it a real subsystem tuned exactly for > > > what you need and NOT try to force it into the UIO interface (which > > > should know nothing about ring buffers...) > > > > Thank you for elaborating the details. I will drop the plan to introduce a > > new UIO driver for this effort. However, I would like to know your thoughts > > on enhancing existing 'uio_hv_generic' driver to achieve the same. We > > already have 'uio_hv_generic' driver in linux kernel, which is used for > > developing userspace drivers for 'fast Hyper-V devices'. > > > > Since these newly introduced synthetic devices operate at a lower speed, > > they do not have the capability to support monitor bits. Instead, we must > > utilize the 'vmbus_setevent()' method to enable interrupts from the host. > > Earlier we made an attempt to support slow devices by uio_hv_generic : > > https://lore.kernel.org/lkml/1665685754-13971-1-git-send-email-ssengar@linux.microsoft.com/. > > At that time, the absence of userspace code (fcopy) hindered progress > > in this direction. > > > > Acknowledging your valid concerns about introducing a new UIO driver for > > Hyper-V, I propose exploring the potential to enhance the existing > > 'uio_hv_generic' driver to accommodate slower devices effectively. My > > commitment to this endeavour includes ensuring the seamless operation of > > the existing 'fcopy' functionality with the modified 'uio_hv_generic' > > driver. Additionally, I will undertake the task of removing the current > > 'fcopy' kernel driver and userspace daemon as part of this effort. > > > > Please let me know your thoughts. I look forward to your feedback and > > the opportunity to discuss this proposal further. > > Greg, > > May I know if enhancing uio_hv_generic.c to support 'slow devices' is > an accptable approach ? I'm willing to undertake this task and propose > the necessary modifications. > > - Saurabh ping > > > > > - Saurabh