Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp226733ybk; Thu, 14 May 2020 22:09:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxan4Qffr4QIc6e3OL8keFzqI10Vq+fdWtpdMndW3MfOTtD0VWzNX8GSpBeDUrK3wyi5hUE X-Received: by 2002:a05:6402:552:: with SMTP id i18mr1157052edx.378.1589519355525; Thu, 14 May 2020 22:09:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589519355; cv=none; d=google.com; s=arc-20160816; b=cFW9WC6p6EwizMwL3nSB6w+m+qrwmNpvcuOhGECD5grrie6k7RHPuGTS0WvL5Uf0p/ 79CbifD0hQGeeZWG1QWtEFZujzRpdT4C9rwWkW+MX4l45sw7rDVKniSsyup7YSfJE/jL 4ap02WUTwFZO4bv2YjP2j7XLofWssoQLNaWijy9omEvGZRJ1rz8hReV+pMk+a09aNdps BZXcA86qXbJi0y265Cn4nUuJvYHxrCWtMPMVpca48/5S4oRXam66tGkUsVU4l7v+OBCu xaPYrHorjyQQ6mTWddaX30LbQyv74/QiDX2cadiq5CtmL4luIbeUirF8V+fdiAVgQnJE RDJA== 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=NfF55UVZjZM13JJTcnu7JHGlCcIWGQ0KC6+T1Qa4Oq4=; b=TT5K+Act+OyD21GE3QOgdbR7O+Ove9cZV9m7VSoeiKA+hexHohcixOOUnL1rbP0BTt 7Bb7LoSL2NEA8zaoM5aJw0IKe9aDkSCykj6fbEnaZwnMD30NIbqsTZ85H73R4qM/IUUu pmB65s2j8ztOEguNOa5XCa0P9oFuvfNsZNRVvthkPdn/Oe6c9sBdiDeAsN93mmDUm3q1 otDloB+zmKDKhhAzdm51lXyjonQjaFAW37fgAwI/kZvPJvdAB07Za4ndPSG290DBMkEY ui8yScAMmw1hmbhxHR0C5WSWPIG6f9/4qTf1EWcrPfBcZj9LZhxxcOnfCuqnm112Lzmb meFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=AUvyL4Tr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id u9si546329edd.338.2020.05.14.22.08.49; Thu, 14 May 2020 22:09:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=AUvyL4Tr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1726163AbgEOFHW (ORCPT + 99 others); Fri, 15 May 2020 01:07:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726000AbgEOFHW (ORCPT ); Fri, 15 May 2020 01:07:22 -0400 Received: from mail-qk1-x741.google.com (mail-qk1-x741.google.com [IPv6:2607:f8b0:4864:20::741]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D791C061A0C for ; Thu, 14 May 2020 22:07:20 -0700 (PDT) Received: by mail-qk1-x741.google.com with SMTP id b6so1328926qkh.11 for ; Thu, 14 May 2020 22:07:20 -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=NfF55UVZjZM13JJTcnu7JHGlCcIWGQ0KC6+T1Qa4Oq4=; b=AUvyL4TrY/k0uZRpPONkWX0+DRa3JypYhUj9VUTVReBzRNCwB1qGlwB9+xMr/5qKUx 662uoI0vmPYDQnkLnnoPeZk/8z5J82Bqaw2vZ2igGOXzasFB4XeQNy5SnPAM3aL8d+dm HgPH9ubkVbJpPFnpDTFwU2IAAxWbjm6erdork= 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=NfF55UVZjZM13JJTcnu7JHGlCcIWGQ0KC6+T1Qa4Oq4=; b=NB8E0ztdFACjR+IfCTJvHqLpuvY5j3bxlAYkwpwwi6u8TtjfhmT+BpejtoEAYcayvp b6v0bMn+XhzzLUXDDCh/cJ+XvzyYa0CxZUl80Tdix1wYUdEfkREJINne3LSTK9O7a7U7 E4p38GmVzlf6n+IMDYFlldB+KFzNGCnZZrMmtQJ01JC7giJpeedg9LYqL3FxVkr+LxHf xA7NR2goZf76MtUvqTmQy72jTRFL1XA4JmkfWb8zL00SbebbrlKrkXUAGUUDQ2mNiUih csj7McjiG/2ACHTbABvaY07Xy1Byfz5pJuqt/noWwDldQniFJr6GsSZDqzu+WQIvrs06 l9qw== X-Gm-Message-State: AOAM530tOeASfBOti4W+htkd2/RV/4TQdwcWGk6LidVG7hr3DNx/QLuk 5HZj7HzTeQAstiSS21l9V8aYekWT+IaHBwruUDcTHg== X-Received: by 2002:a37:a3d6:: with SMTP id m205mr1607571qke.241.1589519239498; Thu, 14 May 2020 22:07:19 -0700 (PDT) MIME-Version: 1.0 References: <20200311112004.47138-1-stevensd@chromium.org> <20200311112004.47138-2-stevensd@chromium.org> <20200514123007.GP206103@phenom.ffwll.local> In-Reply-To: <20200514123007.GP206103@phenom.ffwll.local> From: David Stevens Date: Fri, 15 May 2020 14:07:06 +0900 Message-ID: Subject: Re: [PATCH v3 1/4] dma-buf: add support for virtio exported objects To: David Stevens , Tomasz Figa , Gerd Hoffmann , David Airlie , "Michael S . Tsirkin" , Jason Wang , Sumit Semwal , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Linux Kernel Mailing List , dri-devel , "open list:VIRTIO CORE, NET..." , "open list:DMA BUFFER SHARING FRAMEWORK" , "moderated list:DMA BUFFER SHARING FRAMEWORK" , virtio-dev@lists.oasis-open.org Cc: Daniel Vetter 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 Thu, May 14, 2020 at 9:30 PM Daniel Vetter wrote: > On Thu, May 14, 2020 at 05:19:40PM +0900, David Stevens wrote: > > Sorry for the duplicate reply, didn't notice this until now. > > > > > Just storing > > > the uuid should be doable (assuming this doesn't change during the > > > lifetime of the buffer), so no need for a callback. > > > > Directly storing the uuid doesn't work that well because of > > synchronization issues. The uuid needs to be shared between multiple > > virtio devices with independent command streams, so to prevent races > > between importing and exporting, the exporting driver can't share the > > uuid with other drivers until it knows that the device has finished > > registering the uuid. That requires a round trip to and then back from > > the device. Using a callback allows the latency from that round trip > > registration to be hidden. > > Uh, that means you actually do something and there's locking involved. > Makes stuff more complicated, invariant attributes are a lot easier > generally. Registering that uuid just always doesn't work, and blocking > when you're exporting? Registering the id at creation and blocking in gem export is feasible, but it doesn't work well for systems with a centralized buffer allocator that doesn't support batch allocations (e.g. gralloc). In such a system, the round trip latency would almost certainly be included in the buffer allocation time. At least on the system I'm working on, I suspect that would add 10s of milliseconds of startup latency to video pipelines (although I haven't benchmarked the difference). Doing the blocking as late as possible means most or all of the latency can be hidden behind other pipeline setup work. In terms of complexity, I think the synchronization would be basically the same in either approach, just in different locations. All it would do is alleviate the need for a callback to fetch the UUID. -David