From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1A1A2A04FA; Sun, 2 Feb 2020 21:38:20 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 193311BFCC; Sun, 2 Feb 2020 21:38:19 +0100 (CET) Received: from mail-lf1-f66.google.com (mail-lf1-f66.google.com [209.85.167.66]) by dpdk.org (Postfix) with ESMTP id 9A5781BFC1 for ; Sun, 2 Feb 2020 21:38:17 +0100 (CET) Received: by mail-lf1-f66.google.com with SMTP id f24so8279044lfh.3 for ; Sun, 02 Feb 2020 12:38:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version :content-transfer-encoding; bh=cBm7EBZkl8jqMjmInrjw/ZgIYJxUGjSOl+nNuKJhhSI=; b=e0ezilhUgTYYWlCXl+y0HxKn8Fz24EXmrisvcTqoW7Nue3bI+BdSQHPMza2KN4x+H7 Ki4sEoAESaxl+CqefrgZV6VoHO0dkLwZJIzjU9ZFUn2+0fSrYwcf2IiAjutAw1IjoZfW uQdHNU72zouYnIpDL32JfsxhiY9riWoXpANXbkf1u9/JEwB8a4/PxusmHfK3BzsXVMbT euUYXQnd7/o+jnsoocyAzEEvHq5NdatAtSaQ3UUESZg8gxg14SvNDZus4sYuk0FhG809 aa+g1iYlZOLXO93plUE/W48FwmncE7Ar/oUUJ9CKkyPkL1PRIeUoTmC9h5tAu+JLnSqa cDNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-transfer-encoding; bh=cBm7EBZkl8jqMjmInrjw/ZgIYJxUGjSOl+nNuKJhhSI=; b=SP2Qv8WQ5Uk5Xgg+nb+8Pjl6oOuCpKZ7ofrOYdBMHyiiOdrpGTi1nfzUMEUYYf42/Q elhpALB3fT9wei4BbOcmpTSWfsPhI92D6+MkMinubt/vASCpiDPRGqxDTcmSduyafMSr 5h0l4kXsK+Mvo76KiY8XPNZKG7bGfqyaRDBN7autdZ6pZfCvUMNK/WxJiH+oEzJS/fn8 Ez8KiEF1nIzI2vbtSgJ0OOTVz6KrNSLvhq2bQfl+Oi7nOLwTnslzwROvgUbi7LUeVqzU 0eMJkdzN4K1ZOzQvLFGxGKL4RMp6mUP+H7fWJ5UsfMMx1dmZi2BQ2YXOF35Zko09eaQ7 B8Dw== X-Gm-Message-State: APjAAAUlUEryz0M9uQAuScICLk9PlvPXcuWrTpseR5QR4W5Dt6WDIjWD v2sqF+vhFYblpoKLksX7K2vTE1oth1w= X-Google-Smtp-Source: APXvYqxb0Vs40zy5q/ve+tjaGGFaIAbOYiIzPPb1Lvq55WdLk8WvvmkJNAsLbKHjU5o3y/mwnu/aUg== X-Received: by 2002:ac2:5f74:: with SMTP id c20mr10419529lfc.15.1580675896654; Sun, 02 Feb 2020 12:38:16 -0800 (PST) Received: from Sovereign (broadband-37-110-65-23.ip.moscow.rt.ru. [37.110.65.23]) by smtp.gmail.com with ESMTPSA id a8sm6664787ljb.38.2020.02.02.12.38.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Feb 2020 12:38:15 -0800 (PST) Date: Sun, 2 Feb 2020 23:37:36 +0300 From: Dmitry Kozliuk To: dev@dpdk.org Cc: Thomas Monjalon , Pallavi Kadam , Anatoly Burakov , Ranjit Menon , Harini.Ramakrishnan@microsoft.com, Stephen Hemminger Message-ID: <20200202233736.74bdf47f@Sovereign> X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: [dpdk-dev] Windows Support Plan 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" Hi everyone! Where do I find a high-level plan of comprehensive Windows support: design decisions, implementation order, etc? Information on the subject is very scarce, one may think it is abandoned. Googling for "site:dpdk.org/ml/archives/dev/ windows" yields only two pages of disjoint messages. I learned about "netuio" days ago from a tiny remark in a "Minutes of Technical Board Meetings" email, and even then it took enumerating "dpdk-next-windows" branches to find the source. The matter is, as a New Year's holiday project of mine I implemented Windows support from scratch to the point it runs in QEMU with virtio-pci [0]. It is not of production quality, cuts some corners and lacks major features (see bottom). My primary goal was fun^W making it work. Comparing it to "windpdk-v18.08" branch of "dpdk-next-windows", I can see that 1) our implementations take rather different approaches in some cases, and 2) both have severe issues and would benefit from amalgamation. I'd like to contribute to Windows support with this code, but to do so, coordination is required, because changes are significant. Primary topics to discuss: 1. Memory management (@Anatoly) 1.1. MM changed radically since v18.08 and dpdk-next-windows does not implement it properly anyway, it allocates segment lists in a PCI bus driver. My implementation closely follows the Linux one using VirtualAlloc2() with XXX_PLACEHOLDER flags to reserve and commit memory, but does not map hugepages to files. Is there a consensus on MM approach in Windows? Anyway, I think EAL private MM API would have to be changed, because memory reservation, allocation, and mapping are completely different operations. Hiding this with an mmap() shim doesn't look right, because mmap()'s behavior differs even among Unix platforms. 1.2. In Windows, there is no /dev/mem to implement rte_virt2iova(), so a simple kernel driver is required for mapping. Moreover, Windows kernel abstracts IOMMU, so those physical addresses may be unsuitable for DMA at all (see below). 2. Kernel drivers (@Harini, @Stephen) 2.1. The most serious issue is that Windows formally prohibits using arbitrary physical addresses with DMA in favor of allocating special buffers (presumably because IOMMU may be engaged, and there is no way to check). We can either live with it (technically, everything works with PA mode), or we could revive DMA allocation API from ethdev to ask the driver for a proper DMA buffer. 2.2. Neither netuio, nor my driver (userpci) support interrupts. I see not inherent difficulty here, but interface should be designed carefully. 2.3. Windows allows mapping I/O ports into user-space, but there is no API to change IOPL, which makes mapping useless and requires a syscall for every I/O port access. This demolishes virtio-legacy performance. Perhaps Microsoft could give some advice here. OTOH, PIO is all legacy, so might be much effort is not justified. 2.4. I believe GUIDs approach for identifying compatible devices should be strictly preferred, and not DosDevices symlinks. Think of Mellanox OFED on Linux, which uses a different driver, but could provide a compatible interface. Another reason is that a single driver can implement multiple kernel interfaces with appropriate GUIDs. 2.5. DPDK Windows driver guidelines, driver review, and certification. The quality of both netuio and userpci is below standards now (e. g. netuio does not mind its context when mapping memory, and userpci lacks synchronization), code style is a mix of Windows and DPDK, logging may be insufficient. 3. POSIX shim vs EAL wrappers (@Thomas, @Pallavi, @Ranjit) What is the policy: to implement a POSIX shim in EAL (as the latest patches from Pallavi Kadam do), or to add dependencies (as [1] suggests)? IMO creating a shim is wrong. First, some POSIX concepts do not easily map to Windows, like poll() interface and I/O model in general. Second, there are numerous getopt, pthread, etc. implementations for Windows, no point wasting resources and repeat them, adding bugs. I can think of two exceptions: * , which is header-only. * Berkeley sockets. Adding to public headers creates more trouble that its worth: definitions for a few structures and constants. May be there should be some to abstract platform differences. Some highlights on my implementation: * Major features NOT supported: * multi-process (due to limited time) * interrupts (limited time + explained above) * eventdev (requires access to physical memory) * hot-plug (due to limited time and Windows knowledge) * bbdev (see comments in config/common_windows) * FreeBSD (trivial, I just don't use it) * DPDK is built using MinGW-w64 with GNUmake or Meson. Drivers are built using DDK (msbuild or Visual Studio). Actually, I cross-compile DPDK and build drivers natively. * Only tested on Windows 10 in QEMU with virtio-legacy. * No docs, but there's nothing unusual for those familiar with Windows. Bind virt2phys driver to Root\virt2phys, bind userpci driver to device(s). * Commit history is squashed, because it was a mess from experiments. There also may be some leftover changes, but those commits are not proper patches anyway. References: [0]: https://github.com/PlushBeaver/dpdk/commits/windows [1]: http://mails.dpdk.org/archives/dev/2015-February/014245.html -- Dmitry Kozlyuk