Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp414824ybe; Wed, 4 Sep 2019 23:11:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqyqxhZvxCamJnOMO+XJBx+w14ok7APhj/kcg8S2kJcyo2XJVqK6x/rok2uDCGAARGGzADIk X-Received: by 2002:a63:6901:: with SMTP id e1mr1595868pgc.390.1567663881707; Wed, 04 Sep 2019 23:11:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567663881; cv=none; d=google.com; s=arc-20160816; b=mtp0oBwhZR7c+yuopQxzOgFsJYwYW4LUQFSogEh/datVURLXjgzXAf4gjdLfOaj1Po m/9rANopn9iMq3m+wvL+Dicueo2GfbxG/7lMvaRTbqYw5mlRw5HCarOxBHdPYrlhKWws 1TbsnHxTtSn8EPWUWEZRxs1jh1bgmhUJ0w3xbPQehXrqTE5la0VWQr+ir3SFQP8RiDWj ieXjPmxHNOs6W+yJDcbN1hU4RX41wthbjiec5fJJAOgzfvdVQ31lW45qYj8Y5DFLSCWp u4Y4jZbRfK1NTLVyodHe+sAYrrhLjOASOIXCfqCaURPtcT9F+VEsKBHlNpObTNipNLnz a55A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=/J25yNrkd4GnCzFX6uqW9/DAuM+8yQYgZHXB7Dl/vTQ=; b=Gz5XwXDDLkOj7xY8XRDLkUL+60N/lxtOzt51W3OPXKyTOqrLkeIqeODdXaLH8kbdVi tSXPcSsjqaFSJ1oR8E0zjKOcygoK962CsnoU0RGZ+82d0Wuuh67zE2Tb/jbxFUpOZ0b+ pReBRS3ElfNpZbhB//YJFM1NYxTNqJ8rH8rgtblFwS1D1TqPCzl7gM6p+T4n1mEjUuvl tHvj25eBH7xa0DK49LtbZMwm3hwmlN2SmTfs84xB6npbNzxgh8Bx2ks4m57v/gss3tZ1 Ai6+vk8vhykkfsM8JC4eMVaOxz8cZQV7zTSQRo2XP3xUet4AkyBlGg3e5xbLMC0gCvdj tQgQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (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 h9si1074240pls.354.2019.09.04.23.11.05; Wed, 04 Sep 2019 23:11:21 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730767AbfIEFXn (ORCPT + 99 others); Thu, 5 Sep 2019 01:23:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:28749 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726047AbfIEFXn (ORCPT ); Thu, 5 Sep 2019 01:23:43 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 343963090FD1; Thu, 5 Sep 2019 05:23:43 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-117-72.ams2.redhat.com [10.36.117.72]) by smtp.corp.redhat.com (Postfix) with ESMTP id AE9AF60606; Thu, 5 Sep 2019 05:23:41 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 84C01784F; Thu, 5 Sep 2019 07:23:40 +0200 (CEST) Date: Thu, 5 Sep 2019 07:23:40 +0200 From: Gerd Hoffmann To: Chia-I Wu Cc: ML dri-devel , David Airlie , Daniel Vetter , "open list:VIRTIO GPU DRIVER" , open list Subject: Re: [PATCH] drm/virtio: fix command submission with objects but without fence. Message-ID: <20190905052340.gfwmzkqwcpxtvzvu@sirius.home.kraxel.org> References: <20190904074828.32502-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Thu, 05 Sep 2019 05:23:43 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 04, 2019 at 04:10:30PM -0700, Chia-I Wu wrote: > On Wed, Sep 4, 2019 at 12:48 AM Gerd Hoffmann wrote: > > > > Only call virtio_gpu_array_add_fence if we actually have a fence. > > > > Fixes: da758d51968a ("drm/virtio: rework virtio_gpu_execbuffer_ioctl fencing") > > Signed-off-by: Gerd Hoffmann > > --- > > drivers/gpu/drm/virtio/virtgpu_vq.c | 9 +++++---- > > 1 file changed, 5 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/gpu/drm/virtio/virtgpu_vq.c b/drivers/gpu/drm/virtio/virtgpu_vq.c > > index 595fa6ec2d58..7fd2851f7b97 100644 > > --- a/drivers/gpu/drm/virtio/virtgpu_vq.c > > +++ b/drivers/gpu/drm/virtio/virtgpu_vq.c > > @@ -339,11 +339,12 @@ static void virtio_gpu_queue_fenced_ctrl_buffer(struct virtio_gpu_device *vgdev, > > goto again; > > } > > > > - if (fence) > > + if (fence) { > > virtio_gpu_fence_emit(vgdev, hdr, fence); > > - if (vbuf->objs) { > > - virtio_gpu_array_add_fence(vbuf->objs, &fence->f); > > - virtio_gpu_array_unlock_resv(vbuf->objs); > > + if (vbuf->objs) { > > + virtio_gpu_array_add_fence(vbuf->objs, &fence->f); > > + virtio_gpu_array_unlock_resv(vbuf->objs); > > + } > This leaks when fence == NULL and vbuf->objs != NULL (which can really > happen IIRC... not at my desk to check). Yes, it can happen, for example when flushing dumb buffers. But I don't think we leak in this case. The code paths which don't need a fence also do not call virtio_gpu_array_lock_resv(), so things are balanced. The actual release of the objs happens in virtio_gpu_dequeue_ctrl_func() via virtio_gpu_array_put_free_delayed(). cheers, Gerd