From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751767AbdESIEy convert rfc822-to-8bit (ORCPT ); Fri, 19 May 2017 04:04:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37678 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750734AbdESIEx (ORCPT ); Fri, 19 May 2017 04:04:53 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 7FE9319D4CF Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=kraxel@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 7FE9319D4CF Message-ID: <1495181089.627.33.camel@redhat.com> Subject: Re: [RFC PATCH 6/6] drm/i915/gvt: support QEMU getting the dmabuf From: Gerd Hoffmann To: Alex Williamson Cc: "Chen, Xiaoguang" , "Tian, Kevin" , "linux-kernel@vger.kernel.org" , "zhenyuw@linux.intel.com" , "Lv, Zhiyuan" , "intel-gvt-dev@lists.freedesktop.org" , "Wang, Zhi A" Date: Fri, 19 May 2017 10:04:49 +0200 In-Reply-To: <20170518085601.51e3296a@w520.home> References: <1493372130-27727-1-git-send-email-xiaoguang.chen@intel.com> <20170504100833.199bc8ba@t450s.home> <1493967331.371.53.camel@redhat.com> <20170505091115.7a680636@t450s.home> <1494509273.17970.12.camel@redhat.com> <20170511094526.164985ee@w520.home> <20170511205829.672854c3@t450s.home> <1494580325.14352.57.camel@redhat.com> <20170512103828.4a1378a1@t450s.home> <20170515114409.414d1fdb@w520.home> <20170517154331.1b465f69@w520.home> <20170518085601.51e3296a@w520.home> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT Mime-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 19 May 2017 08:04:52 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, > > User space need to check whether there's a dmabuf for the plane(user space usually cached two or three dmabuf to handle double buffer or triple buffer situation) only there's no dmabuf for the plane we will create a dmabuf for it(another ioctl). > > If our ioctls are "Query current plane" and "Give me a dmabuf for > current plane", isn't that racey? The current plane could have changed > between those two calls so the user doesn't absolutely know which plane > the dmabuf retrieved is for. The "Give me a dmabuf" therefore needs to > take some sort of plane index so the user can request a specific > plane. The "give me a dmabuf" ioctl returns the plane description too, so userspace can at least figure it did hit the race window. We could also do it the other way around: Instead of having the kernel returning the plane description userspace could pass it in, and the kernel throws -EINVAL in case it doesn't match due to things having changed meanwhile. cheers, Gerd