Received: by 10.192.165.156 with SMTP id m28csp716716imm; Mon, 16 Apr 2018 07:37:23 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+6crNpatqyENDucJgBfzA4bxyglSMKFGp3HZAKVJDEO9JQRjXkncNnH/oFk+fExI2eqyvq X-Received: by 2002:a17:902:5992:: with SMTP id p18-v6mr16027172pli.49.1523889443544; Mon, 16 Apr 2018 07:37:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523889443; cv=none; d=google.com; s=arc-20160816; b=l901gXf6CuSGZnEm2Saw6s534+6ncuU5l8U1bDMklnpSfrc/nMBOsrPuQIFwRymQAI IQCxgL7A2rOhxVRjsoLO9tabOqDzADgvOyKuqH8QUT7XENlMVamQNS3W+0xP+qOJgnsc uq3K8BoiR1F/FtS7pRjaNVOHGpsvxmF8OPZBvQnlmZhe+ymC8B/Kzs/HNnbVWI7xwThE Xex7J/1L2E+pE93n3aYG8aAZU2Go6YSysEXff+0KJ29PVJYOZ5P56wbKNxsQ+siH8TCG mEThjhTaoKqlOg6zROWnWFQkdE5kCLoXyz9r3Z8Ag76+E62tVoZr+TAn25z6kWgV5OVH 1Txw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=GSAljZce/71lgVsNDJgpmNj/IGCsDVN4+XxsM425+AA=; b=M2ZN4DOdYXj+1WaFAT9PJf5vVeVdEhS8BROEmzGUOhA3tH/xdRLek6BGiBsb+Cdm37 aVhKOH+FFA56xRIgTrpSt+9JJS3zybJNa80lN4wtU6DG7b2EyJX1MIZhiKnsayK8rxZS nRDCCeOMnvDKbJFUZudFtpwuHj5xtr/WICNBJ8sprZwlQT+vM3Z6EvUxa45dMyRwwNEk 1MHKWZPCEaO95Ajw3eSH7lSQEzBaOpP41E4SFgRzzhad7QJ3sHAQl5jxJbElfbNij47H SNM+to5PAvWQ+d9iBb8KBiC43Gi3MdxQ9iYmPMTk34gjPnQ1N0u90hl6w5krdBzvYfc1 YXzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=bDqkMrvC; 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 g66si9589803pgc.624.2018.04.16.07.37.09; Mon, 16 Apr 2018 07:37:23 -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=bDqkMrvC; 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 S1752774AbeDPOdx (ORCPT + 99 others); Mon, 16 Apr 2018 10:33:53 -0400 Received: from mail-lf0-f67.google.com ([209.85.215.67]:36568 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751205AbeDPOdu (ORCPT ); Mon, 16 Apr 2018 10:33:50 -0400 Received: by mail-lf0-f67.google.com with SMTP id d20-v6so22424554lfe.3 for ; Mon, 16 Apr 2018 07:33:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=GSAljZce/71lgVsNDJgpmNj/IGCsDVN4+XxsM425+AA=; b=bDqkMrvCqo3QSfNk8diGyk8fbhuB5TtHb57RCj8BT+dKdusqMIuYGCYbrhZoIF0OLK +ZEJt5Ihq5Ro10bbscoHmF4J7eJKOaNKVmxePKJu5C/6SvRFF9R0FZZj2yuzzTSTFRD7 utDEvHvRr4VmZef8C083Hw8jJ1CSFBPYlPnnzDOzHXLvd5IaIsPNvyQuHobPUMEi1ETh R9IMmeyeuD3XuRh1lhtf0eBuXlRWGx5TbTgsXK8rC4hXspiIX3jXwmVmXFLyv66cSsPn 9GgbTGBEwEYAeuepg+ffx+5JYPterKK1NLfifAlwVV37yz2UAsFRBLappQQ0hWbDpa7u vlvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=GSAljZce/71lgVsNDJgpmNj/IGCsDVN4+XxsM425+AA=; b=IiZyR3SEfX2OuE0PlnJwj1TfeM93tFhiuJPNWRBMrfEpDxfjWiTnu31LKqqh1GylUQ g6lGP/4ENqZQPE2rtodmBPFidPgWtMwYJByx4GkGpPl5XjM42VUNaVXjAMYdKNITmA1O 612UR6iP+1ZIRqG95LNqKAoN0ceELstPNcgs+ZWakgG1+nNN1uF+A38+/1c47IGV77Bl lBnKzokpIX5lkwc4WSW9CZBdcBwn/aa6IBbF1BB5tRGN+FGKRZGRNlLa4gs3V/+Yqhl1 5HM2s32Fj4nPMhbFx9BinM89YVgqeXUP1EJScJQZy68APR0UyIraMqW7+CqO/lkVYjJM hfCw== X-Gm-Message-State: ALQs6tBDK4XNUUeXPuYeO3bNu51D7Gvnypzgc8KJHtmAphoozle/iOf+ 8eSvpT8NKRC3MAppTCX0evQ= X-Received: by 2002:a19:4f0a:: with SMTP id d10-v6mr15430668lfb.134.1523889228453; Mon, 16 Apr 2018 07:33:48 -0700 (PDT) Received: from [10.17.182.9] (ll-74.141.223.85.sovam.net.ua. [85.223.141.74]) by smtp.gmail.com with ESMTPSA id q83-v6sm2853559lfg.46.2018.04.16.07.33.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Apr 2018 07:33:47 -0700 (PDT) Subject: Re: [PATCH 0/1] drm/xen-zcopy: Add Xen zero-copy helper DRM driver To: xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, airlied@linux.ie, daniel.vetter@intel.com, seanpaul@chromium.org, gustavo@padovan.org, jgross@suse.com, boris.ostrovsky@oracle.com, konrad.wilk@oracle.com Cc: Oleksandr Andrushchenko , Dongwon Kim , "Potrola, MateuszX" , Matt Roper , Artem Mygaiev References: <20180329131931.29957-1-andr2000@gmail.com> From: Oleksandr Andrushchenko Message-ID: <5d8fec7f-956c-378f-be90-f45029385740@gmail.com> Date: Mon, 16 Apr 2018 17:33:46 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180329131931.29957-1-andr2000@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, all! After discussing xen-zcopy and hyper-dmabuf [1] approaches it seems that xen-zcopy can be made not depend on DRM core any more and be dma-buf centric (which it in fact is). The DRM code was mostly there for dma-buf's FD import/export with DRM PRIME UAPI and with DRM use-cases in mind, but it comes out that if the proposed 2 IOCTLs (DRM_XEN_ZCOPY_DUMB_FROM_REFS and DRM_XEN_ZCOPY_DUMB_TO_REFS) are extended to also provide a file descriptor of the corresponding dma-buf, then PRIME stuff in the driver is not needed anymore. That being said, xen-zcopy can safely be detached from DRM and moved from drivers/gpu/drm/xen into drivers/xen/dma-buf-backend(?). This driver then becomes a universal way to turn any shared buffer between Dom0/DomD and DomU(s) into a dma-buf, e.g. one can create a dma-buf from any grant references or represent a dma-buf as grant-references for export. This way the driver can be used not only for DRM use-cases, but also for other use-cases which may require zero copying between domains. For example, the use-cases we are about to work in the nearest future will use V4L, e.g. we plan to support cameras, codecs etc. and all these will benefit from zero copying much. Potentially, even block/net devices may benefit, but this needs some evaluation. I would love to hear comments for authors of the hyper-dmabuf and Xen community, as well as DRI-Devel and other interested parties. Thank you, Oleksandr On 03/29/2018 04:19 PM, Oleksandr Andrushchenko wrote: > From: Oleksandr Andrushchenko > > Hello! > > When using Xen PV DRM frontend driver then on backend side one will need > to do copying of display buffers' contents (filled by the > frontend's user-space) into buffers allocated at the backend side. > Taking into account the size of display buffers and frames per seconds > it may result in unneeded huge data bus occupation and performance loss. > > This helper driver allows implementing zero-copying use-cases > when using Xen para-virtualized frontend display driver by > implementing a DRM/KMS helper driver running on backend's side. > It utilizes PRIME buffers API to share frontend's buffers with > physical device drivers on backend's side: > > - a dumb buffer created on backend's side can be shared > with the Xen PV frontend driver, so it directly writes > into backend's domain memory (into the buffer exported from > DRM/KMS driver of a physical display device) > - a dumb buffer allocated by the frontend can be imported > into physical device DRM/KMS driver, thus allowing to > achieve no copying as well > > For that reason number of IOCTLs are introduced: > - DRM_XEN_ZCOPY_DUMB_FROM_REFS > This will create a DRM dumb buffer from grant references provided > by the frontend > - DRM_XEN_ZCOPY_DUMB_TO_REFS > This will grant references to a dumb/display buffer's memory provided > by the backend > - DRM_XEN_ZCOPY_DUMB_WAIT_FREE > This will block until the dumb buffer with the wait handle provided > be freed > > With this helper driver I was able to drop CPU usage from 17% to 3% > on Renesas R-Car M3 board. > > This was tested with Renesas' Wayland-KMS and backend running as DRM master. > > Thank you, > Oleksandr > > Oleksandr Andrushchenko (1): > drm/xen-zcopy: Add Xen zero-copy helper DRM driver > > Documentation/gpu/drivers.rst | 1 + > Documentation/gpu/xen-zcopy.rst | 32 + > drivers/gpu/drm/xen/Kconfig | 25 + > drivers/gpu/drm/xen/Makefile | 5 + > drivers/gpu/drm/xen/xen_drm_zcopy.c | 880 ++++++++++++++++++++++++++++ > drivers/gpu/drm/xen/xen_drm_zcopy_balloon.c | 154 +++++ > drivers/gpu/drm/xen/xen_drm_zcopy_balloon.h | 38 ++ > include/uapi/drm/xen_zcopy_drm.h | 129 ++++ > 8 files changed, 1264 insertions(+) > create mode 100644 Documentation/gpu/xen-zcopy.rst > create mode 100644 drivers/gpu/drm/xen/xen_drm_zcopy.c > create mode 100644 drivers/gpu/drm/xen/xen_drm_zcopy_balloon.c > create mode 100644 drivers/gpu/drm/xen/xen_drm_zcopy_balloon.h > create mode 100644 include/uapi/drm/xen_zcopy_drm.h > [1] https://lists.xenproject.org/archives/html/xen-devel/2018-02/msg01202.html