From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.3 (2019-12-06) on atuin X-Spam-Level: X-Spam-Status: No, score=-1.5 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS autolearn=ham autolearn_force=no version=3.4.3 Received: from [127.0.1.1] (localhost [IPv6:::1]) by atuin.qyliss.net (Postfix) with ESMTP id 623102979; Sun, 19 Apr 2020 22:25:49 +0000 (UTC) Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by atuin.qyliss.net (Postfix) with ESMTPS id BAB69296B; Sun, 19 Apr 2020 22:25:42 +0000 (UTC) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id CD1255C00A4; Sun, 19 Apr 2020 18:25:40 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Sun, 19 Apr 2020 18:25:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alyssa.is; h= from:to:subject:date:message-id:mime-version:content-type; s= fm2; bh=7Wb+sPSM+o2Euh0XOleKMhAviGnLLrdwyfEcq/coafA=; b=aBDK4XZ+ GOAXrxh+n9ijQnRwgZIgN7C8N26mwGAWyOtSpqHewHoDRlPD8PGgYrhk1jC+DkGm YIFcdp43jHilvmv3LSVMDrYnjfg6LCgxHUk447QEIm+rM+4xILrnPi8xsU6B4FWO aya8oKT80csdyF3eZcUJFqoURTEEZWAwaKFeUGXqYb/w/IuPVpc3138d+7ktDhhy ciIlxCfGbVEuVw0iDDMcVXt8JGqOA/M/jZQTmhYgeSL4WzcefZL5vvNFnCs5PBTP kbdpDAAhqyco/M776nZS8WgILpaKUHBjr5RjC2UvUcllJtYUvVXWHRO2eu9wn2GQ /Sn1N3smnE7cSg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:message-id :mime-version:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; bh=7Wb+sPSM+o2Euh0XOleKMhAviGnLL rdwyfEcq/coafA=; b=YobKrZtuFvOyHI5XZWjplIOjpXrEkEGvl03Txd78pKM+B 9ADPF4rnS3IW1GIV588910OfVyzwq5d8WC8TjqzCpk9RvflvGjX6UPG/7zgpW+nZ 812n2tHyFhkT869sXmSgOFBpZ0N/2sccXMZNk2eNgnZC2zzquacmBOhVhdUEgLif KdktpYeQjP1+xulwWiA+zRs5P320S0HpfegSRpc8gEy/heeHxNG6NuXMr8b+7CEc TVhWrq6AfNzFQNf3ws3zZbgT3/EHR4EjrkZP4WGHTjDaOseoOFDYZoA/afrNob+3 6ZnLfSzSzAQxW2zylYri7aHsVgjou0sDhCdQoLtYw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrgedvgddtlecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkfggtgesghdtreertddttd enucfhrhhomheptehlhihsshgrucftohhsshcuoehhihesrghlhihsshgrrdhisheqnecu ffhomhgrihhnpehsphgvtghtrhhumhdqohhsrdhorhhgpdhgihhthhhusgdrtghomhdpkh gvrhhnvghlrdhorhhgnecukfhppeekgedrudekgedrvddvhedrudeknecuvehluhhsthgv rhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhephhhisegrlhihshhsrgdrih hs X-ME-Proxy: Received: from x220.qyliss.net (p54b8e112.dip0.t-ipconnect.de [84.184.225.18]) by mail.messagingengine.com (Postfix) with ESMTPA id 37F263280064; Sun, 19 Apr 2020 18:25:40 -0400 (EDT) Received: by x220.qyliss.net (Postfix, from userid 1000) id 2A208436; Sun, 19 Apr 2020 22:25:38 +0000 (UTC) From: Alyssa Ross To: devel@spectrum-os.org, discuss@spectrum-os.org Subject: This Week in Spectrum Date: Sun, 19 Apr 2020 22:25:22 +0000 Message-ID: <874ktf15bh.fsf@alyssa.is> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Message-ID-Hash: ET3QIKDRDB2HQJVPSIBMQS5VNJVBVSZJ X-Message-ID-Hash: ET3QIKDRDB2HQJVPSIBMQS5VNJVBVSZJ X-MailFrom: hi@alyssa.is X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.3.0 Precedence: list List-Id: General high-level discussion about Spectrum Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Wow, a week isn't very long at all. But still, there's definitely enough to write about, even if I spent most of the week just reading mailing list threads. More on that in a bit. Spectrum Live + nixpkgs =2D---------------------- I did another stream. This time, we looked at updating the Chromium OS packages in Spectrum. The script I used to update them had broken -- it was stuck on an old version, so first we had to fix the script, and then fix the package builds. A lot of the Chromium OS packages aren't actually necessary at the moment, but I made them a while ago when it looked like they would be. I couldn't get one particular such package, libchrome, to build any more at all after spending quite a few hours on it, so I ended up just dropping it, along with libbrillo, which depended on it. Some other package updates had some complexity, but we managed to work through them all on the stream. This stream was much more focused on what I was working on than the last one. The last one was more about people asking general questions and me answering them and demonstrating things. This time I stayed on the package updates for the whole stream. I figure people asked all their questions last time. But there were lots of questions about specific issues in the package updates, etc. It was nice to know that I had explained things sufficiently well that people could follow along with what I was doing. Viewer numbers were up too, which was nice. We were on 15 for most of the stream. The packaging work I mostly did on the stream, and then finished up afterwards is here: https://spectrum-os.org/git/nixpkgs/log/?h=3D2bd191e91f097ff2146099fae8b7c8= bd90817808 And a couple of small upstream Nixpkgs PRs: https://github.com/NixOS/nixpkgs/pull/85549 https://github.com/NixOS/nixpkgs/pull/85551 crosvm still needs to be updated in upstream Nixpkgs. If you want to help out, this might be a good thing to pick up! You'd need to copy the update.py change I made in Spectrum's Nixpkgs to the crosvm update.py in upstream Nixpkgs, and then copy the changes in Spectrum nixpkgs' crosvm to upstream Nixpkgs's crosvm. If not, I'll probably get to it in a few days. crosvm =2D----- Last week, I said that we might me able to use Virtio Wayland as a transport for crosvm device <-> crosvm communication across a VM boundary, but that I'd just had the idea and I might decide it couldn't work. Having researched it extensively this week, reading over the code for the virtio_wl kernel driver with puck and consuming a huge number of messages on assorted kernel-adjacent mailing lists, I think we can make it work, and it's our best path forward, but I'm still not sure how exactly. The main problem is that Virtio Wayland can only send shared memory from host to guest, not the other way around. So when a Wayland compositor in a guest hands the Wayland crosvm device, it's not going to be able to pass it over the VM boundary to the crosvm instance running a Wayland client. Sharing a guest memory buffer with the host, or another guest, turns out not to be a solved problem in general. As an example, here is a very long mailing list thread about how a generic way to do this could work, from November/December, which reached no firm conclusions: https://lore.kernel.org/linux-media/20191105105456.7xbhtistnbp272lj@sirius.= home.kraxel.org/t/#u I expect that for most devices, e.g. the network driver, this won't be a problem. But we're definitely going to need this for Wayland. One option would be to modify a Wayland compositor to make it ask the host for some shared memory, rather than allocating its own shared memory buffer. That would work, but it's the last resort, because it would have to be a modification made to any Wayland compositor we might want to use. At a high level, what we want to do is have a crosvm device running inside a device VM tell crosvm that a certain address in guest memory is some shared memory, and have it handle that as it would shared memory it had allocated itself. crosvm does support sending dmabufs from guest to host, because of virtio-gpu. There's a relatively new kernel API called udmabuf that converts a memfd into a dmabuf, which sounds like it should solve exactly this problem. It has no documentation in the kernel, but I did manage to find a small amount of documentation in a patch that was for some reason never applied[1]. I then managed to write a small test program that at least called all the ioctls properly and ended up with a dmabuf. Actually testing this any further will involve a VM, and testing this sort of thing in a VM at the moment is a real pain, and I want to make a small tooling improvement around that before I proceed any further with testing udmabuf. There are also good reasons to suspect that the udmabuf idea won't work anyway. puck thinks that the only dmabufs Virtio Wayland will be able to transfer are those allocated by virtio-gpu. So, not dmabufs that we just made out of a memfd given to us by a Wayland compositor. If udmabuf ends up not working, I'll want to see whether we can use virtio-gpu to allocate dmabufs. The problem with this is that I don't know how we'll bridge compositor shared memory to virtio-gpu dmabufs. It'll presumably involve writing kernel code, which I've been pleased to avoid so far. I can at least probably use the udmabuf implementation as a starting point. The third least bad option would be to modify the virtio_wl kernel driver so it supports shared memory originating from the guest. This would be very nice to use from userspace, but I just don't think there's any way I'll be able to write the required kernel code. And the fourth least bad option (the worst one) would be to modify the compositor as mentioned above. spectrum-vm =2D---------- The current way of running a Spectrum test VM is to build and run a file called start-vm.nix that lives in the root of a non-default branch of Spectrum's nixpkgs called crosvm-demo. Any time you want to try a custom kernel, rootfs, or crosvm, you need to modify this file. This is extremely annoying. Also, as time goes on, start-vm.nix is getting longer and longer, and more and more difficult to understand. So I think it's finally time to do something better. The something better is that we introduce derivations for a Spectrum rootfs, guest kernel, and crosvm, and then provide a program, spectrum-vm, that by default runs a VM with those three components. It would also have options for overriding those components, so if you built a custom kernel you could just drop that one in instead of the default one, for example. And finally, it would allow changing the flags passed to crosvm. I started working on this this morning, and I'm quite excited about it. It's not going to take very long at all to do, but it's going to be such a big improvement. It will also mean I no longer have a separate crosvm-demo branch, to merge Spectrum nixpkgs master into every time I update it. So I'm going to spend the next couple of days on this, and then get back into investigating udmabuf with a nice new tool. So, that's what happened this week. I feel like I just spent most of the week reading mailing lists and not making much progress, but I've managed to write quite a lot (again) so I suppose I've accomplished something! Now, I've been extremely immersed in this stuff all week, and I suspect that some of this update, especially the crosvm stuff, will not be clear to somebody who has not been similarly immersed. And, it's getting dangerously close to midnight UTC, my self-imposed This Week in Spectrum deadline. So I'm going to send this as is, even though it's probably confusing. But! I do want you to understand what's going on. So please feel free to reply and point out anything I didn't explain very well and ask me for a better explanation. Just be prepared for me not to know the answer, since I'm still trying to figure out a lot of this stuff! As a nice side effect, maybe we'll get a mailing list discussion going. :) [1]: https://lore.kernel.org/lkml/20180911134216.9760-14-kraxel@redhat.com/ --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEH9wgcxqlHM/ARR3h+dvtSFmyccAFAl6cz9IACgkQ+dvtSFmy ccAVuA//WfqqcDZU5cTXT5yzb2wtb+Lj5+oCnFqVN+lXg/n3BqkPl+J3ZuBUQZZf UPPwbtVmYKf5oMA1C+jMtwArLLVmYoDxLYNdfNb1+aAfKBvGFJBDGXFcwSMz0Ht4 z3ZoXjCB9XQoPy2V1Z8B0msK7L7gVFw8iC6uziF64HhvP7sAyhlU+7+5bMmRSM6B NZL1LmqqZu0OSUcl+BD/Ed1sAEhursbBmYBkWp8crgHb/paVtgBKDGVTRgDaICyf 54MCxK/xjZSuh9jacFWRR7SPWfXVLQxZWbSSC8SeC6dxBinsxc7KSHE2mHrH0F6v 4o7243tO4O7ps/9qZIirj7YIpSjRU0BLF6YT/5nBAJzcSy25YwNDTIhW7+3veqGa oCxyYZ0EF7RqnJ7Co8Oj3u2shi5oHLp6TOCsmvcJ94gYyr3DiCfaXpJYN/zejlXy QlAg/800PBzztLOz4lYDliI7pfMPH5L7Yaqfj8xZIk7JByNCzSqVoe/s7/N/eCiy cZalXS8pZvXVI2/oR7Xgh00rK2RsrQyqmtI/VcF4VlmZtFWO30Y3L3ofC1AU4tdE PgzZdsU2bluJO5w3ONGEIBKEC7NdxuGnA89Cgl1fqOJrs4txKUZtBNoOi3E05rNy +VKPnlR98SV1BD3Sns8jOahc5dCFgLbTgmJAel1a0lWt/ToU3zs= =mvpo -----END PGP SIGNATURE----- --=-=-=--