From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tomeu Vizoso Subject: Re: passing FDs across domains Date: Tue, 14 Nov 2017 09:08:54 +0100 Message-ID: References: <2d73a3e1-af70-83a1-0e84-98b5932ea20c@collabora.com> <20171114080257.p7fcafmfva64aeua@sirius.home.kraxel.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, Stefan Hajnoczi , Zach Reizner , Helen Mae Koike Fornazier To: Gerd Hoffmann Return-path: Received: from bhuna.collabora.co.uk ([46.235.227.227]:40906 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751391AbdKNII7 (ORCPT ); Tue, 14 Nov 2017 03:08:59 -0500 In-Reply-To: <20171114080257.p7fcafmfva64aeua@sirius.home.kraxel.org> Content-Language: en-US Sender: kvm-owner@vger.kernel.org List-ID: On 11/14/2017 09:02 AM, Gerd Hoffmann wrote: > On Mon, Nov 13, 2017 at 03:18:46PM +0100, Tomeu Vizoso wrote: >> Hi, >> >> I'm looking at what would be the best way for Wayland clients running in a >> VM to communicate with a Wayland compositor in the host. >> >> The base Wayland protocol is fairly self-contained, with little or no >> references to objects outside the client and the server, so it lends itself >> very well to virtualization. >> >> But there's a problem when passing references to pixel buffers around with >> FD passing, as SCM_RIGHTS isn't currently implemented in AF_VSOCK. >> >> The Wayland project is willing to consider adding AF_VSOCK support to the >> libwayland libraries alongside existing support for AF_UNIX, both on client >> and server. >> >> Any opinions on whether adding SCM_RIGHTS support to AF_VSOCK is a good >> idea? > > Not going to work. A file handle is a reference to a kernel object > which can be pretty much anything (file, socket, timer, memory, ...) and > you can't pass that across machine borders. It's not working for > AF_INET for the same reason. The idea was to only allow passing FDs that point that objects that can be shared across domains. So shared memory buffers in this case. >> Or other options for letting processes in the host to access shmem >> buffers allocated within the guest? >> >> Regarding the mechanics of mapping guest buffers in the host, I was hoping >> the approach described below would work: >> >> http://www.fp7-save.eu/papers/SCALCOM2016.pdf > > Doesn't look that useful to me on a quick glance. > > Lets step back and look at the problem you are trying to solve. > > It seems you want guest wayland applications appear seamless on the host > wayland server, correct? Correct. > How does the wayland rendering workflow look like? As far I know the > wayland protocol doesn't include any rendering. Rendering happens > client side, into some buffer (one per window), which is then passed to > the server for display compositing. Correct? So you basically want > pass that buffer from guest to host? Correct. > What kind of shared memory is used by wayland? > sysv shm? gbm buffers / dmabufs? Typically, shared memory for CPU-rendered content, and dmabufs for GPU-rendered content. Thanks, Tomeu