Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3122639yba; Mon, 22 Apr 2019 20:36:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqzs87j1df0bk6DKMcCQna7lwedjjBVjKI1i/h+fEkk5Zvspv3+Fk5EyCr++jnXf5GQ/s0YK X-Received: by 2002:a17:902:bb84:: with SMTP id m4mr23040749pls.302.1555990577745; Mon, 22 Apr 2019 20:36:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555990577; cv=none; d=google.com; s=arc-20160816; b=Eao6csbvmr4C6kFDutGHBgskfnalePS2YAV4e5BwGKs3vohCWgrfW2Lm+FFEb6y56L +pvUA3w8MpUlR9VtE6ToSlCUFLzK0LjporGG0JASd/R6ksOEt09zMMZWWUFp1RumK8Ka qnsLJf6QAqwsIOYu0LpnRcSOPUhtjaHLxmNzEg1Zy78vasOArwmRDInm8+U0AAmY1vpA +9O+BqifXr7uqcBNKgrV6hEo8JEcpdvUjtZm4yMvvKEEwNfs2dCuSCOLBB7QJnzti7RW rrR9aDjDKzxifCmAIPZReW8cN4WY9h1KHg2PAoEuW76Iva+BCxP2ZkEgSVznd6ndtydV FVyg== 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=UUmqCcfPZLaQU2X8LOPqoTWw6XtkN6uP70+krzqW0TE=; b=fmhbJtj+NH9n7m77/XSF9cTIQq1257s57Rc6RbbdGOIymZxaz1/4aBP8XSiZfyQy7t VepLyo/9gTUwuA3epCo1o2XNsfTO37NwaDUspSC27EhubkalkiGImGqmi0iNxMWS8uzm 4s3/AYxaHmGLfi/1Vxqtpmw10kbfk25Gymv6eUARFksqxpTxANEYGTz7mK79RBpxjqBb sx0+5quwxBaMKsTQiuIxkJtrd/efbe3GXETdQHc8MEvGF2b/ac87ayA6HhRTixBNUW7F eD9PO140vysSaPZdeAnWP2xqwioppxnh7d5yBqgp9ILbF0v0zDge23r0Y4o1+4hyLw42 OoJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=fwqHDo1W; 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=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 2si14073888plf.294.2019.04.22.20.36.02; Mon, 22 Apr 2019 20:36:17 -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=@chromium.org header.s=google header.b=fwqHDo1W; 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=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730880AbfDWAMo (ORCPT + 99 others); Mon, 22 Apr 2019 20:12:44 -0400 Received: from mail-lj1-f195.google.com ([209.85.208.195]:42818 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729479AbfDWAMn (ORCPT ); Mon, 22 Apr 2019 20:12:43 -0400 Received: by mail-lj1-f195.google.com with SMTP id x13so1433078ljd.9 for ; Mon, 22 Apr 2019 17:12:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=UUmqCcfPZLaQU2X8LOPqoTWw6XtkN6uP70+krzqW0TE=; b=fwqHDo1WqONM6UbJ6zB5Xc0dfmDyeRii2GPY+aFKz2Gh+XG9yq3SfFSrB84aNDSjuk lu/TE5uNc2QzRahhEgOr4TnvvdDYv4ZM/nPYBeyOB0DMllP3875/DGAOn4dSVryyBNmg V+Jbh445PrI0DDN7Vv0zfR0aRmInr4KgYfu+M= 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=UUmqCcfPZLaQU2X8LOPqoTWw6XtkN6uP70+krzqW0TE=; b=sv/mUtuAapHJMr+8S6zTQNX5kdXGluOdK4+ohS6w/TMJxJoVC59C6JFEFCtlTAe6zD 3T70MynA45cWl7baIFIDhz2RivjDz9TXxYXWeUQhQaAk7jv0IAVDr87HaZKgUBY0QHn0 oelKB1Bd4w2lKvctGUfbxdSdQVcij21Y2wO1JPtXx0EKWfK3dcLHsHaxIuqWST4ifhK5 bt5aRGdUZfWS1vYsjG13BSIJ5PWDgnXdRo2owoHYIPl6Wus3BrQhJ6oMdbXQhi/EqE6j TbcivgMIJj9nAqa+TjRMf7mg6F+6fJHjBDpeH4p+iY1+GD7ZTudlCzN6TnhiMJAWCtHu zUDQ== X-Gm-Message-State: APjAAAWVIUHJjYDxPlD7aB0dAjtq4BX/P7MJDIcQG21x8A9h/vaTnzRS Q5yq4GJZdfXZ5a/Y7XDuG0rfYwVL9q0= X-Received: by 2002:a2e:4a1a:: with SMTP id x26mr10511102lja.49.1555978360578; Mon, 22 Apr 2019 17:12:40 -0700 (PDT) Received: from mail-lj1-f181.google.com (mail-lj1-f181.google.com. [209.85.208.181]) by smtp.gmail.com with ESMTPSA id n4sm3282165lfe.15.2019.04.22.17.12.38 for (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Mon, 22 Apr 2019 17:12:39 -0700 (PDT) Received: by mail-lj1-f181.google.com with SMTP id f18so11771676lja.10 for ; Mon, 22 Apr 2019 17:12:38 -0700 (PDT) X-Received: by 2002:a2e:9811:: with SMTP id a17mr12157196ljj.96.1555978357844; Mon, 22 Apr 2019 17:12:37 -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: Gurchetan Singh Date: Mon, 22 Apr 2019 17:12:26 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 3/3] virtio-gpu api: VIRTIO_GPU_F_RESSOURCE_V2 To: Gerd Hoffmann Cc: Chia-I Wu , 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. > > 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. > > > 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. > > > 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. The memory type should probably be in resource_create_v2, not in the reply. The metadata will be different based on the memory heap it's allocated from. Also, not all heaps need to be exposed to the guest kernel. For example, device local memory in Vulkan could be un-mappable. In fact, for resources that are not host visible we might be better off sidestepping the kernel altogether and tracking allocation in guest userspace. Here is an example of memory types the guest kernel may be interested in (based on i965): Type 0 --> DEVICE_LOCAL_BIT | HOST_VISIBLE_BIT | HOST_COHERENT_BIT | HOST_CACHED_BIT | RENDERER_ALLOCATED (Vulkan) Type 1 --> HOST_VISIBLE_BIT | HOST_COHERENT_BIT | EXTERNAL_ALLOCATED (gbm write combine) Type 2 --> HOST_VISIBLE_BIT | HOST_COHERENT_BIT | GUEST_ALLOCATED (guest allocated memory, which I assume is also write combine) Type 3 --> HOST_VISIBLE_BIT | HOST_CACHED | EXTERNAL_ALLOCATED (gbm cached memory) > > > 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 >