Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4422731yba; Wed, 17 Apr 2019 11:08:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqwU1kptTc+SjzJ0ae//lSc5wjGzV61KCxf72cK0naxhc1w/zptxAyv0DMrE6MjmYh0+zGKN X-Received: by 2002:a17:902:9a4a:: with SMTP id x10mr91433938plv.113.1555524519172; Wed, 17 Apr 2019 11:08:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555524519; cv=none; d=google.com; s=arc-20160816; b=Yu4D4YZKKXq4DBqsUnmOwEVJWn77xFwtwKtu5YKFEet+gcSPh95XsEQcgnWBY54l3Q OHj5gr3BjZSnj8qHunSLAj25CX9huovMFr/cPoqRCwcLeCRd87ff40bIiZDbThBBTdbr DM2ly0N1e6lh9x6bpG3Rpwj1olCbGwgCEceSxoWiFNiFz5x6SPHYKG/rTugVAJ70PCi7 39gxh1IkeSUIVI0twjrFCkp9UN6a3q0cf15HPaY6X1E9XmvQsGmLaHZJhTx/oyHIeEl6 Ef5zQvrF7ewS+w1s59d0IhUUk/Q8ISmiK9OqzaikVjYn4I2TVWBh5A8egJ8R0pt/cgev JNdw== 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 :in-reply-to:references:mime-version:dkim-signature; bh=ivMa+ybPpD2KsvvjrcpbeauKLe55Ky4VkAKG13FO8Io=; b=wNjyux6rgEO5t3J7gBqUWOPGWTHM6WfzngMc7KmS0/YEBRi/xGYWvuIeesd5bGK38S ufwB6DGrqNnPUwTZAH84dVfYMECxZEfYEIUJjb/nOK3pf5MIbuM18MrssmC/JhixmJaF xLkWo7rrVq9VLgpQa7hh8WmnXCclGzdPBtUbq8SVzJWee8FkEvmmMXSaSIumw+5DUG7e l1TFVsP5WYkF2GadaA3ZAiezucEJZPvWLNJ9O23n0UmTncfMgUZY0TFJ3vywP8ECn4N6 b9VFsFEueuriBEuDJ9i3GTGg5CN+r0wRMvNOSDQVksZ1oT4Pln39cYZ3YmzSnynFVMaK a2yA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=rVrx2hyR; 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 13si33121156pgz.9.2019.04.17.11.08.23; Wed, 17 Apr 2019 11:08:39 -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=rVrx2hyR; 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 S1731249AbfDQSGa (ORCPT + 99 others); Wed, 17 Apr 2019 14:06:30 -0400 Received: from mail-it1-f194.google.com ([209.85.166.194]:37016 "EHLO mail-it1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726751AbfDQSG3 (ORCPT ); Wed, 17 Apr 2019 14:06:29 -0400 Received: by mail-it1-f194.google.com with SMTP id u65so5897266itc.2 for ; Wed, 17 Apr 2019 11:06:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ivMa+ybPpD2KsvvjrcpbeauKLe55Ky4VkAKG13FO8Io=; b=rVrx2hyRcLVlGagFejkXXE3y+RztYrKGMLAByTjxCSikwhVXq9a0BBHmwcO0WN2BeY aZ1Rcd5Nsa/Qn/U9QkWwo9enrFrvaZQ0Ur9zSgWH3yfDOPnpMUe7sYNKptpUz0KDNDXP NsBbI/9ZX3u5987dQFFGtjjotzePBRqKyhG1q7Ra3z7lBjZ3XV22UUyQ2U7tkpm/QeIX 4ApuNSAPf2oAFUlhhSbit65dMlDP96CsoDYfGMN7xiMlQEmjEaECbsEh/dESgousgC30 jXGYiNplkr/kwMJW8WPpwv1Db096EFiDaKcln+MWBpzsf6W4v9/Q0G5hjC466f5tAOev Updg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ivMa+ybPpD2KsvvjrcpbeauKLe55Ky4VkAKG13FO8Io=; b=oDgabe5+X0fGQAxgIkuiqR0aHOGA+l5KEN9bIRHPXIMBsNWZ+aMNUglSz792cV5oWY AxZep9hTq4JBYh4v2Qa/BP7hIjV26okgxiIt9cOGribQz68aM5PHcW72nMFcNoy9hMV6 XLQUCyz2RD8sWdJjShtUrUdvjVWE0+vMx5V9aKDg4jhNNlOE5iFvlzwcz5p4lOzt0dKZ e6J7XJfrdJftpKUPjF7Ou7nbxmA5lMzpPFuXFrZV3d1zdPr8vppgjMGYNDKAGeuJwWwV pqetOlaXV59SL0zD7cE8gLxcxMqj086Idsh3XF6eyVv2oZvMHg42PG2JFZrhD8s1ySaD XlJQ== X-Gm-Message-State: APjAAAWHa2JAcTD4WeKwAZkOyIPA9Xu3HiHb2U9vB7LLVON7syL7vbEh Vq7iU/O/+lwzgq58YOWalQvi8x9imQC4/g7KmHo= X-Received: by 2002:a24:43cf:: with SMTP id s198mr832232itb.113.1555524388551; Wed, 17 Apr 2019 11:06:28 -0700 (PDT) MIME-Version: 1.0 References: <20190410114227.25846-1-kraxel@redhat.com> <20190410114227.25846-4-kraxel@redhat.com> <20190411050322.mfxo5mrwwzajlz3h@sirius.home.kraxel.org> <20190412054924.dvh6bfxfrbgvezxr@sirius.home.kraxel.org> <20190417095750.lre3xrg4dlgskfjg@sirius.home.kraxel.org> In-Reply-To: <20190417095750.lre3xrg4dlgskfjg@sirius.home.kraxel.org> From: Chia-I Wu Date: Wed, 17 Apr 2019 11:06:17 -0700 Message-ID: Subject: Re: [PATCH 3/3] virtio-gpu api: VIRTIO_GPU_F_RESSOURCE_V2 To: Gerd Hoffmann Cc: Gurchetan Singh , Tomeu Vizoso , "Michael S. Tsirkin" , David Airlie , Jason Wang , open list , ML dri-devel , "open list:VIRTIO CORE, NET AND BLOCK DRIVERS" , David Airlie , virtio@lists.oasis-open.org 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 Wed, Apr 17, 2019 at 2:57 AM Gerd Hoffmann wrote: > > On Fri, Apr 12, 2019 at 04:34:20PM -0700, Chia-I Wu wrote: > > Hi, > > > > I am still new to virgl, and missed the last round of discussion about > > resource_create_v2. > > > > From the discussion below, semantically resource_create_v2 creates a host > > resource object _without_ any storage; memory_create creates a host memory > > object which provides the storage. Is that correct? > > Right now all resource_create_* variants create a resource object with > host storage. memory_create creates guest storage, and > resource_attach_memory binds things together. Then you have to transfer > the data. In Gurchetan's Vulkan example, the host storage allocation happens in (some variant of) memory_create, not in resource_create_v2. Maybe that's what got me confused. > > Hmm, maybe we need a flag indicating that host storage is not needed, > for resources where we want establish some kind of shared mapping later > on. This makes sense, to support both Vulkan and non-Vulkan models. This differs from this patch, but I think a full-fledged resource should logically have three components - a RESOURCE component that has not storage - a MEMORY component that provides the storage - a BACKING component that is for transfers resource_attach_backing sets the BACKING component. BACKING always uses guest pages and supports only transfers into or out of MEMORY. resource_attach_memory sets the MEMORY component. MEMORY can use host or guest pages, and must always support GPU operations. When a MEMORY is mappable in the guest, we can skip BACKING and achieve zero-copy. resource_create_* can then get a flag to indicate whether only RESOURCE is created or RESOURCE+MEMORY is created. > > > Do we expect these new commands to be supported by OpenGL, which does not > > separate resources and memories? > > Well, for opengl you need a 1:1 relationship between memory region and > resource. > > > > Yes, even though it is not clear yet how we are going to handle > > > host-allocated buffers in the vhost-user case ... > > > > This might be another dumb question, but is this only an issue for > > vhost-user(-gpu) case? What mechanisms are used to map host dma-buf into > > the guest address space? > > qemu can change the address space, that includes mmap()ing stuff there. > An external vhost-user process can't do this, it can only read the > address space layout, and read/write from/to guest memory. I thought vhost-user process can work with the host-allocated dmabuf directly. That is, qemu: injects dmabuf pages into guest address space vhost-user: work with the dmabuf guest: can read/write those pages > > > But one needs to create the resource first to know which memory types can > > be attached to it. I think the metadata needs to be returned with > > resource_create_v2. > > There is a resource_info reply for that. > > > That should be good enough. But by returning alignments, we can minimize > > the gaps when attaching multiple resources, especially when the resources > > are only used by GPU. > > We can add alignments to the resource_info reply. > > cheers, > Gerd >