From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on atuin.qyliss.net X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.6 Received: from atuin.qyliss.net (localhost [IPv6:::1]) by atuin.qyliss.net (Postfix) with ESMTP id A1D0D90339; Mon, 10 Oct 2022 23:32:41 +0000 (UTC) Received: by atuin.qyliss.net (Postfix, from userid 496) id 17DEA90199; Mon, 10 Oct 2022 23:32:26 +0000 (UTC) Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by atuin.qyliss.net (Postfix) with ESMTPS id 360B0900CC for ; Mon, 10 Oct 2022 23:32:13 +0000 (UTC) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 206045C01AC for ; Mon, 10 Oct 2022 19:32:09 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Mon, 10 Oct 2022 19:32:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alyssa.is; h=cc :content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm2; t=1665444729; x=1665531129; bh=A/ Axjn9toecZ48C6Gi4oiXxw50tHed+rhxLsGZjaX3M=; b=d+pJO8itSv9yRrJgJL h0uBTjkLTxsZF14gAJLL72uUr6T5TGMfVc4eZDJCr0LtbOFCj0UOkE0foteWHgk1 2YIYUb70Y+8Fda48e5B7cdGh2KRVSVn2qThP7QuNd4a3Eo4BGp9JcEYiXQic4VG2 JBB/c7Btqegb0lWYquZookWMPblYGRqkrazJBncuYi9ZoftQc8m0IuwuE9tHWjn5 TOzLqjJ25/eU8xkm5r7NJW1+asFmChYpO+k0Fgh1gm5uj+4mWx8IUFE8LUEh09zM 00pHZpyRCfsxjCfDZZVhaAVZJ81YurQYpKo5FvynLOGgKrJUb4Fieh3k9Tnet0N1 okOQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; t=1665444729; x=1665531129; bh=A/Axjn9toecZ4 8C6Gi4oiXxw50tHed+rhxLsGZjaX3M=; b=gatLGwQUr4kCCmTcI3hPuLwS4RGCM CpRfd87znKbJnK+1d82jUYseDYmSi0yS0p/Xc2bIGnHVsAYnSdQNmN8Y8NCq+ufJ 3G0QZ5tav7U2pNQNDFn37ThD+ekOqeVvSNGscYjo+Jdtyf7BNrKjKJquSuQUtksw F8gAga5AZO1SAwX2MoBBG0CZgmFSvQGX4T8S0cQP3OcdpiughXnnFRgPA8Xgo73u okG0arjxCPAMQOA7Hqs7mDXz1DNQ2iiBdsd3bBXu4rDheDz4JTLPLoQXquWpJC/Z aGkonomjGUnQB1UuGRwAuZKOuKUABX+gNGlkO5MqCYuQjrGMZGRaGP4BA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfeejhedgvddvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomheptehlhihsshgrucftohhsshcuoehhihesrghlhihsshgrrdhi sheqnecuggftrfgrthhtvghrnhepteelieefgfejvddvfeektdfgfefgffeftdetuddtvd elfeevgeevueevhfduueeinecuffhomhgrihhnpehkvghrnhgvlhdruggvvhenucevlhhu shhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehqhihlihhsshesgi dvvddtrdhqhihlihhsshdrnhgvth X-ME-Proxy: Feedback-ID: i12284293:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Mon, 10 Oct 2022 19:32:08 -0400 (EDT) Received: by x220.qyliss.net (Postfix, from userid 1000) id 35D12BB6; Mon, 10 Oct 2022 23:32:06 +0000 (UTC) From: Alyssa Ross To: devel@spectrum-os.org Subject: [PATCH 06/22] img/app: add support for testing virtiofs Date: Mon, 10 Oct 2022 23:28:46 +0000 Message-Id: <20221010232909.1953738-7-hi@alyssa.is> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20221010232909.1953738-1-hi@alyssa.is> References: <20221010232909.1953738-1-hi@alyssa.is> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: KIYKGAAJBZ3K5WSMEEDJET6DPH2WKQSI X-Message-ID-Hash: KIYKGAAJBZ3K5WSMEEDJET6DPH2WKQSI X-MailFrom: qyliss@x220.qyliss.net X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-devel.spectrum-os.org-0; header-match-devel.spectrum-os.org-1; header-match-devel.spectrum-os.org-2; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.5 Precedence: list List-Id: Patches and low-level development discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Signed-off-by: Alyssa Ross --- .gitignore | 5 ++++- img/app/Makefile | 19 ++++++++++++++++--- img/app/shell.nix | 6 +++++- 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index a97f309..802df73 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,10 @@ # SPDX-License-Identifier: CC0-1.0 -# SPDX-FileCopyrightText: 2021 Alyssa Ross +# SPDX-FileCopyrightText: 2021-2022 Alyssa Ross /config.nix build/ result result-* + +# s6-ipcserver-socketbinder creates lockfiles for sockets. +*.sock.lock diff --git a/img/app/Makefile b/img/app/Makefile index c5a4684..7d8e1c1 100644 --- a/img/app/Makefile +++ b/img/app/Makefile @@ -5,7 +5,10 @@ # Nixpkgs. If you don't have qemu-kvm, you'll need to set e.g. # QEMU_KVM = qemu-system-x86_64 -enable-kvm. QEMU_KVM = qemu-kvm +BACKGROUND = background CLOUD_HYPERVISOR = cloud-hypervisor +S6_IPCSERVER_SOCKETBINDER = s6-ipcserver-socketbinder +VIRTIOFSD = virtiofsd prefix = /usr/local imgdir = $(prefix)/img @@ -94,25 +97,35 @@ build/etc/s6-rc: $(VM_S6_RC_FILES) s6-rc-compile $@ $$dir; \ exit=$$?; rm -r $$dir; exit $$exit -run-qemu: build/host/appvm/blk/root.img +start-virtiofsd: + $(S6_IPCSERVER_SOCKETBINDER) -B virtiofsd.sock \ + $(BACKGROUND) $(VIRTIOFSD) --fd 0 --shared-dir . "" +.PHONY: start-virtiofsd + +run-qemu: build/host/appvm/blk/root.img start-virtiofsd $(QEMU_KVM) -m 128 -cpu host -machine q35,kernel=$(KERNEL) -vga none \ -drive file=build/host/appvm/blk/root.img,if=virtio,format=raw,readonly=on \ -drive file=$(RUN_IMG),if=virtio,format=raw,readonly=on \ -append "console=ttyS0 root=PARTLABEL=root" \ -netdev user,id=net0 \ -device virtio-net,netdev=net0,mac=0A:B3:EC:00:00:00 \ + -chardev socket,id=virtiofsd,path=virtiofsd.sock \ + -device vhost-user-fs-pci,chardev=virtiofsd,tag=virtiofs0 \ + -object memory-backend-memfd,id=mem,size=128M,share=on \ + -numa node,memdev=mem \ -chardev vc,id=virtiocon0 \ -device virtio-serial-pci \ -device virtconsole,chardev=virtiocon0 .PHONY: run-qemu -run-cloud-hypervisor: build/host/appvm/blk/root.img +run-cloud-hypervisor: build/host/appvm/blk/root.img start-virtiofsd $(CLOUD_HYPERVISOR) \ --api-socket path=vmm.sock \ - --memory size=128M \ + --memory size=128M,shared=on \ --disk path=build/host/appvm/blk/root.img,readonly=on \ path=$(RUN_IMG),readonly=on \ --net tap=tap0,mac=0A:B3:EC:00:00:00 \ + --fs tag=virtiofs0,socket=virtiofsd.sock \ --kernel $(KERNEL) \ --cmdline "console=ttyS0 root=PARTLABEL=root" \ --console tty \ diff --git a/img/app/shell.nix b/img/app/shell.nix index 83dcd76..60ca465 100644 --- a/img/app/shell.nix +++ b/img/app/shell.nix @@ -12,7 +12,11 @@ with config.pkgs; { nativeBuildInputs = nativeBuildInputs ++ [ - cloud-hypervisor jq qemu_kvm reuse + # Both QEMU and virtiofsd come with a virtiofsd executable, + # so we have to list virtiofsd first. + virtiofsd + + cloud-hypervisor execline jq qemu_kvm reuse s6 ]; KERNEL = "${passthru.kernel.dev}/vmlinux"; -- 2.37.1