Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp4255589ybf; Wed, 4 Mar 2020 00:03:23 -0800 (PST) X-Google-Smtp-Source: ADFU+vusjZ3i27juunUDrnl8LB4GFC9M5IgA+EhbwC90YGwmx/PWVfMMmh+H2oY/ZFGOJV0ojLpp X-Received: by 2002:a05:6830:12d1:: with SMTP id a17mr1428559otq.39.1583309003364; Wed, 04 Mar 2020 00:03:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583309003; cv=none; d=google.com; s=arc-20160816; b=DbolliHJRSVsh/tFndmsmFBKT0J3vuAIrOdMnWP9ZUHlRSP0DHpqq/yTtLnjGdy/7g H31oNrHpBhlTozfTRFjrYG+E0H3K3nkETwvC40qf0m8Fay9br8mv9BZ1cCDJTUM4uhcf N4POma6EeT18M5U0qaEqkHa4xGmdlgbBPrTq4Pxj7DFQmn1ZTCoJARYs2yngKuK8ZBJa Bx8Y/O+t1Ifr6XMZi29csP1fvXYB/uavyEtn7mIDWekBZk/dsOvMqYnX2/pAhgXnCuyK EO0rQgSFbhfBt76ebPtt5tR8QH2BqAyxFlpXkIDwU9A+vqd8Kmij38JJJPVA6bPjgoMQ 8Ihg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=zRcprHlNKHf2Y4uTuJshwgaM2L8IjHdUUjSNLW2L6Ws=; b=vpe0K1Vm+142x4a8kF5qcDXJ8cLM9W6jmgAWICXlBL5FXiLXMpZw+XRxeYVemBFUPr u27rUVVo05bgC+yx2PLxp4wWJz0wFe7gMmSQ++ce4ZJckdX1KOJJMxa4kymiRtRn8mfK ZPuTP59wwb8U2yfaXhEeDJyYwq3P6b4SIgcY4YZHpLkxUnZ1Qnm4uxdgS/++WuuYMmuW C17OBlXVRwapwlNCH98AiEMQtnugD3YvXnldwTW9ZDX+N4nF2bDNMkeZSpcBQB709jw8 c0/8Yn2JbIqXDiKE+bPVLsU8K4HYjLnc0a22Auszxw8HaRoMwTZlOFeAsBwtMGgqV7Tn vSJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bPwA8DVq; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b26si645486otf.96.2020.03.04.00.03.10; Wed, 04 Mar 2020 00:03:23 -0800 (PST) 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=@redhat.com header.s=mimecast20190719 header.b=bPwA8DVq; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727176AbgCDIBb (ORCPT + 99 others); Wed, 4 Mar 2020 03:01:31 -0500 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:41550 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725271AbgCDIBb (ORCPT ); Wed, 4 Mar 2020 03:01:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583308890; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=zRcprHlNKHf2Y4uTuJshwgaM2L8IjHdUUjSNLW2L6Ws=; b=bPwA8DVqIel19xIFS+Lv+tYYa3kWiC8Wg2rvyRBuIAevGcB24yAEQvFpIawPMFgIiCxccu BBqYLyxBz3HrNIkqegElhvCZBIJWsso/oxCfMeiaAwYG3ckzaoJfZstUXCjGNSqxvIJGGT ofIhqOAxfQyHVSkDefKbIaZh1H/OA7w= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-76-7VMskJu9NeKxqy4Gs6rfng-1; Wed, 04 Mar 2020 03:01:26 -0500 X-MC-Unique: 7VMskJu9NeKxqy4Gs6rfng-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C8551801E5C; Wed, 4 Mar 2020 08:01:23 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-150.ams2.redhat.com [10.36.116.150]) by smtp.corp.redhat.com (Postfix) with ESMTP id B825D1BC6D; Wed, 4 Mar 2020 08:01:20 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 0266617506; Wed, 4 Mar 2020 09:01:20 +0100 (CET) Date: Wed, 4 Mar 2020 09:01:19 +0100 From: Gerd Hoffmann To: David Stevens Cc: David Airlie , Daniel Vetter , "Michael S . Tsirkin" , Jason Wang , Sumit Semwal , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, virtualization@lists.linux-foundation.org, linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org, virtio-dev@lists.oasis-open.org Subject: Re: [PATCH v2 4/4] drm/virtio: Support virtgpu exported resources Message-ID: <20200304080119.i55opxkhk4kdt4hp@sirius.home.kraxel.org> References: <20200302121524.7543-1-stevensd@chromium.org> <20200302121524.7543-5-stevensd@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200302121524.7543-5-stevensd@chromium.org> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, > + if (vgdev->has_resource_assign_uuid) { > + spin_lock(&vgdev->resource_export_lock); > + if (bo->uuid_state == UUID_NOT_INITIALIZED) { > + bo->uuid_state = UUID_INITIALIZING; > + needs_init = true; > + } > + spin_unlock(&vgdev->resource_export_lock); > + > + if (needs_init) { > + ret = virtio_gpu_cmd_resource_assign_uuid(vgdev, bo); You can submit a fenced command, then wait on the fence here. Removes the need for UUID_INITIALIZING. Also note that this function will be called only once, on the first export. When exporting the same object again drm will simply reuse the existing dmabuf. You can drop UUID_NOT_INITIALIZED and needs_init. So you are left with only two uuid_state states. You could turn uuid into a pointer, so it gets only allocated when needed. Also uuid == NULL can be used for "uuid not available" then. cheers, Gerd