Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp1340092imm; Thu, 5 Jul 2018 21:02:01 -0700 (PDT) X-Google-Smtp-Source: AAOMgpds2/1kiAEk4NaL+wTsUJn74S01lHG18B13Q43j4T51AL1f+DlLdjGTCzEfLn7oIMUfSidk X-Received: by 2002:a63:5fc1:: with SMTP id t184-v6mr7673915pgb.183.1530849721467; Thu, 05 Jul 2018 21:02:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530849721; cv=none; d=google.com; s=arc-20160816; b=eLEiBB+V/c56sYdZZK32j+Pjw4l4fvO22fJKwJvCNFzrH/nZ4UAYBJhpAc62DK9b5n jH41KyFpu4Ft31u5Rc26R8UOt+MB31gK0fTczb4nnzfTr1x+/oxd4ipy3BVz4hjhdGR6 G017sRDZKr8Z/GosWj1bnoXgZXV3gRKu5XeUNlpDPqRBBDIy7GjqwZcIwrMPKf436hQE J2s95N1+Ea+RdhluUjYIQU5PLc4LtSWG3OsjGyNT9/fI9wVUJnlGvClTc4L/1qsdvigW DIMK/zoz/wjPv+MLdOdvp5+RmRusSLw2OUImpXuw7+xDzEV54zh9O7i8PVfUyUMiwo+u nKrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=Ug85XCSBHqlXAm2gwMboy1aVaUcB35k42N7CpvogDsA=; b=r/HsV5tUyf+F9jQnw2eggIpWuAKZPoZtx3W0mE0RYl1sg2VT+mwgbMPyQN8KsSauhM UfzbX9pB3Ao2/xpOx3hnzdFF5jJqVYuikVGH1HGkeP0WzVprmBfAU8RHPVCs0J0fqc40 Eze7dwxbkB2fU+f1DmJnbtnuSgTBuffe56Ss/WtYJfXgHeDAPs8wGecXLeEdfK1HoEVy YwNwd4/d42MNy/NcMfwCePLSt6V5qo3LBMl4I/bAkFugzyn+s/98tn0cBR/Zh9f6/zdb u97QIVfdaoKEKW/DTdHUTjgQdbhg3auPuLfvcBYJu7bPG9k7XNAPx+2fxwOliW89U8MQ 3wzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=U5rRXiAX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c8-v6si7470905pfc.136.2018.07.05.21.01.46; Thu, 05 Jul 2018 21:02:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=U5rRXiAX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752849AbeGFEBA (ORCPT + 99 others); Fri, 6 Jul 2018 00:01:00 -0400 Received: from mail-qk0-f195.google.com ([209.85.220.195]:43043 "EHLO mail-qk0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750711AbeGFEA5 (ORCPT ); Fri, 6 Jul 2018 00:00:57 -0400 Received: by mail-qk0-f195.google.com with SMTP id z74-v6so5655590qkb.10; Thu, 05 Jul 2018 21:00:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Ug85XCSBHqlXAm2gwMboy1aVaUcB35k42N7CpvogDsA=; b=U5rRXiAXODpauiR4fzP09lI3sWGlXHryEEY73G/axAtXQ4hYvbsBbC0zwbd5zQnNAv uK/qbYPLvLtg3JRuU171n/vxSg2KdDKoQ+7O4kALzypF8qmF557bpK/I/rL3KEy6v4Rq U/dzd9JATBtiuQLjTQYSP1ilnWluv1Jh3dr2MkRrxRhUnD7csjk5ZzOe4uslF0XPbjJh lxQZ4o/SeMBkEeK92IyZDowDW/5m/B+rw1CM40/KQOl5XOrQlnPyQ6ltOIAij4qzD/53 vbajKbg55oD4MsIiVZxtGPDUmEIqV6ZIORr6R7TeuLrbh5LibMiETMhDvAARACN/soiI oA4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=Ug85XCSBHqlXAm2gwMboy1aVaUcB35k42N7CpvogDsA=; b=cf+2KuVGfi/FI4YuZ1yeq4drlQK3Ry+fmoln4fkXNS3FjR65cHeyuS9PIz+V9+3DZV twXEsjOAT/ypMPSjb5R8UK/iIe/YvkRC/N5243i8iz8GfpNSZbClTIT7FEIcrgM9IGhL 32XOWMt7Hr1PTCC0p3qRpjEO6Wu1ROg+jqbnXkN4xgmykC156jrtbQrDhXAfv76KBDu8 7bjCGteJmpMfPU3dbApRH8BRa4Fbdrmki+093TW8W0vY7j/GIZZr7NlZNBwc4tpHz++a BbNgNPrqyUcK9NVZ6oI7M/ifJhL8JTlJyUeOJhR6bFNKNcxaYyCrRtPF+8v3oiQVVzKZ S99w== X-Gm-Message-State: APt69E0TcGsk1/ltDaULvwKczNOgCTT506P0ry9mZFY0Ah+ADZ2xcqgc 1Pcs7PP3TLwYlhMOSQnEXQWDiF4b9uGYidE+dVo= X-Received: by 2002:a37:56c7:: with SMTP id k190-v6mr7065484qkb.29.1530849656161; Thu, 05 Jul 2018 21:00:56 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ac8:1e87:0:0:0:0:0 with HTTP; Thu, 5 Jul 2018 21:00:55 -0700 (PDT) In-Reply-To: <20180704080005.juutrwri4kxm7yim@sirius.home.kraxel.org> References: <20180703075359.30349-1-kraxel@redhat.com> <20180703083757.GG7880@phenom.ffwll.local> <20180704055338.n3b7oexltaejqmcd@sirius.home.kraxel.org> <9818b301-9c9d-c703-d4fe-7c2d4d43ed66@collabora.com> <20180704080005.juutrwri4kxm7yim@sirius.home.kraxel.org> From: Dave Airlie Date: Fri, 6 Jul 2018 14:00:55 +1000 Message-ID: Subject: Re: [PATCH v6] Add udmabuf misc device To: Gerd Hoffmann Cc: Tomeu Vizoso , Daniel Stone , Jonathan Corbet , David Airlie , "open list:DOCUMENTATION" , open list , dri-devel , "moderated list:DMA BUFFER SHARING FRAMEWORK" , Laurent Pinchart , "open list:KERNEL SELFTEST FRAMEWORK" , Shuah Khan , "open list:DMA BUFFER SHARING FRAMEWORK" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4 July 2018 at 18:00, Gerd Hoffmann wrote: > On Wed, Jul 04, 2018 at 09:26:39AM +0200, Tomeu Vizoso wrote: >> On 07/04/2018 07:53 AM, Gerd Hoffmann wrote: >> > On Tue, Jul 03, 2018 at 10:37:57AM +0200, Daniel Vetter wrote: >> > > On Tue, Jul 03, 2018 at 09:53:58AM +0200, Gerd Hoffmann wrote: >> > > > A driver to let userspace turn memfd regions into dma-bufs. >> > > > >> > > > Use case: Allows qemu create dmabufs for the vga framebuffer or >> > > > virtio-gpu ressources. Then they can be passed around to display >> > > > those guest things on the host. To spice client for classic full >> > > > framebuffer display, and hopefully some day to wayland server for >> > > > seamless guest window display. >> > > > >> > > > qemu test branch: >> > > > https://git.kraxel.org/cgit/qemu/log/?h=sirius/udmabuf >> > > > >> > > > Cc: David Airlie >> > > > Cc: Tomeu Vizoso >> > > > Cc: Laurent Pinchart >> > > > Cc: Daniel Vetter >> > > > Signed-off-by: Gerd Hoffmann >> > > >> > > I think some ack for a 2nd use-case, like virtio-wl or whatever would be >> > > really cool. To give us some assurance that this is generically useful. >> > >> > Tomeu? Laurent? >> >> Sorry, but I think I will need some help to understand how this could help >> in the virtio-wl case [adding Zach Reizner to CC]. >> >> Any graphics buffers that are allocated with memfd will be shared with the >> compositor via wl_shm, without need for dmabufs. > > Within one machine, yes. Once virtualization is added to the mix things > become more complicated ... > > When using virtio-gpu the guest will allocate graphics buffers from > normal (guest) ram, then register these buffers (which are allowed to be > scattered) with the host as resource. > > qemu can use memfd to allocate guest ram. Now, with the help of > udmabuf, qemu can create a *host* dma-buf for the *guest* graphics > buffer. > > That dma-buf can be used by qemu internally (mmap it to get a linear > mapping of the resource, to avoid copying). It can be passed on to > spice-client, to display the guest framebuffer. > > And I think it could also be quite useful to pass guest wayland windows > to the host compositor, without mapping host-allocated buffers into the > guest, so we don't have do deal with the "find some address space for > the mapping" issue in the first place. There are more things needed to > complete this of course, but it's a building block ... There is a use case where I think we have to deal with the "find some address space" problem. For GL4.4 ARB_buffer_storage and Vulkan memory mangement there is the concept of coherent buffers between GPU and CPU. From the virgl point of view, we'd create a host buffer in GL, and then create a mapping from it on the host that we'd need to present in the guest userspace as a linear buffer. Just in case we think this can solve all our problems :-) Dave.