Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3114207ybl; Fri, 20 Dec 2019 04:11:41 -0800 (PST) X-Google-Smtp-Source: APXvYqwQ1yjGGfnwgorzVC7Gp9uKEnXo+PksKvtd3nB/KFp2TFKeaXIM9EWdaGjjQAwq6b58ou6z X-Received: by 2002:a05:6830:c2:: with SMTP id x2mr1678198oto.8.1576843901095; Fri, 20 Dec 2019 04:11:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576843901; cv=none; d=google.com; s=arc-20160816; b=Vfeo26S8nAjV/xWyxmSMfpC75DDnkgio6B+aj4oTSuVrT2CpOkdHjqfmUPNyr34EIy 6Jw5U3a98BkbtPA7j3/RnccXF15qCpQS22GeTXNHssVBD88SlyLCgoeLBJJ2a4UAEPmq 0wQACsxLvcnEfsZ0JVGY8BzZqdvunDmQzZnmWhkR2Wher8tISsXLaRW70KwDnLmVce2Z S1AGwjFE8zIdmJYu7biPO90PaLiYbbPWW0+1/Hjaf7+nIzo09HqfEyQwi0Gnm/Vi5c+Y /LzBYkJOHstuFginL9Vk4N8vASU6nzpw0i8egVeaeO9NnlurooOTXJFaqwpOFFFAQzd4 Y22g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:thread-index:thread-topic :content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date:dkim-signature; bh=ggNgN4kZ9i+MoUaiQjXmngHKUSv2F7J0XkcDe5Qaau8=; b=dNKBXwQFoorqhjS4xn5GjPhaiFNd/dmn+LB35sX/V7yX8pKusoOS6vOkqb1uPlvwaF IZyjJG5fajCL3btA2dSgds3ygoDnrQhsLJietxmhJPh5qp6t6hvO6/CcipjSURHg87Mb PUV2/y66WFB1qI4o0BpwMGsfZP+Cf8KtFECM8THnzhahIOnJSL3kbVjGRSJuL1S2xFeg mhIFTvYZvlzNZ8C0KX0ys0dyFpU+ZyxzMj82dBib/Sqfe0sz3r8FoztamYy81aKQeJNx FmZB6rEBKGLmVfqrBIS9ZVLYiDBKvMis2C5MF5omkFyM1WlEQ5g3tvXaa7h3JeJNdqnA BoYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=APQoEjWO; 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 x16si5051013otp.184.2019.12.20.04.11.29; Fri, 20 Dec 2019 04:11:41 -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=APQoEjWO; 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 S1727276AbfLTMJ2 (ORCPT + 99 others); Fri, 20 Dec 2019 07:09:28 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:60329 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727177AbfLTMJ1 (ORCPT ); Fri, 20 Dec 2019 07:09:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576843766; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ggNgN4kZ9i+MoUaiQjXmngHKUSv2F7J0XkcDe5Qaau8=; b=APQoEjWO7QehZ1pL/A1G6DmU0fO24guEwtbC7tYnnXjFOYQNocb4vIkQyhDxj6NWM3CxgW dsFE7x8FINNGYi96hvmB6XtHI0dGTrgAv+Q09RHSMndlDskUaaepShTxM3IBSddiQjkyHe FTl8Q9eVFG7kt+yW+weWBb+f2igW1kw= 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-192-zoztgdUnNKGDy1rqZuF0bA-1; Fri, 20 Dec 2019 07:09:23 -0500 X-MC-Unique: zoztgdUnNKGDy1rqZuF0bA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 70EB1800D4E; Fri, 20 Dec 2019 12:09:22 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 57AC260BEC; Fri, 20 Dec 2019 12:09:22 +0000 (UTC) Received: from zmail25.collab.prod.int.phx2.redhat.com (zmail25.collab.prod.int.phx2.redhat.com [10.5.83.31]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 3072B18089C8; Fri, 20 Dec 2019 12:09:22 +0000 (UTC) Date: Fri, 20 Dec 2019 07:09:20 -0500 (EST) From: Frediano Ziglio To: Gerd Hoffmann Cc: dri-devel@lists.freedesktop.org, David Airlie , open list , "open list:DRM DRIVER FOR QXL VIRTUAL GPU" , Daniel Vetter , "open list:DRM DRIVER FOR QXL VIRTUAL GPU" , Dave Airlie Message-ID: <57755373.16738363.1576843760950.JavaMail.zimbra@redhat.com> In-Reply-To: <20191220115935.15152-5-kraxel@redhat.com> References: <20191220115935.15152-1-kraxel@redhat.com> <20191220115935.15152-5-kraxel@redhat.com> Subject: Re: [Spice-devel] [PATCH 4/4] drm/qxl: add drm_driver.release callback. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [10.33.32.30, 10.4.195.8] Thread-Topic: drm/qxl: add drm_driver.release callback. Thread-Index: qFYuv/xSK8+PQDglvsHlqfFXX34xLQ== X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > Move final cleanups to qxl_drm_release() callback. Can you explain in the commit why this is better or preferable? > Add drm_atomic_helper_shutdown() call to qxl_pci_remove(). I suppose this is to replace the former manual cleanup calls, which were moved to qxl_drm_release, I think this could be added in the commit message ("why"), I don't see much value in describing "how" this was done. > > Reorder calls in qxl_device_fini(). Cleaning up gem & ttm > might trigger qxl commands, so we should do that before > releaseing command rings. Typo: releaseing -> releasing Why not putting this in a separate commit? Was this behaviour changed? It does not seem so to me. > > Signed-off-by: Gerd Hoffmann > --- > drivers/gpu/drm/qxl/qxl_drv.c | 21 ++++++++++++++------- > drivers/gpu/drm/qxl/qxl_kms.c | 8 ++++---- > 2 files changed, 18 insertions(+), 11 deletions(-) > > diff --git a/drivers/gpu/drm/qxl/qxl_drv.c b/drivers/gpu/drm/qxl/qxl_drv.c > index 1d601f57a6ba..8044363ba0f2 100644 > --- a/drivers/gpu/drm/qxl/qxl_drv.c > +++ b/drivers/gpu/drm/qxl/qxl_drv.c > @@ -34,6 +34,7 @@ > #include > > #include > +#include > #include > #include > #include > @@ -132,21 +133,25 @@ qxl_pci_probe(struct pci_dev *pdev, const struct > pci_device_id *ent) > return ret; > } > > +static void qxl_drm_release(struct drm_device *dev) > +{ > + struct qxl_device *qdev = dev->dev_private; > + > + qxl_modeset_fini(qdev); > + qxl_device_fini(qdev); > + dev->dev_private = NULL; > + kfree(qdev); > +} > + > static void > qxl_pci_remove(struct pci_dev *pdev) > { > struct drm_device *dev = pci_get_drvdata(pdev); > - struct qxl_device *qdev = dev->dev_private; > > drm_dev_unregister(dev); > - > - qxl_modeset_fini(qdev); > - qxl_device_fini(qdev); > + drm_atomic_helper_shutdown(dev); > if (is_vga(pdev)) > vga_put(pdev, VGA_RSRC_LEGACY_IO); > - > - dev->dev_private = NULL; > - kfree(qdev); > drm_dev_put(dev); > } > > @@ -279,6 +284,8 @@ static struct drm_driver qxl_driver = { > .major = 0, > .minor = 1, > .patchlevel = 0, > + > + .release = qxl_drm_release, > }; > > static int __init qxl_init(void) > diff --git a/drivers/gpu/drm/qxl/qxl_kms.c b/drivers/gpu/drm/qxl/qxl_kms.c > index bfc1631093e9..70b20ee4741a 100644 > --- a/drivers/gpu/drm/qxl/qxl_kms.c > +++ b/drivers/gpu/drm/qxl/qxl_kms.c > @@ -299,12 +299,12 @@ void qxl_device_fini(struct qxl_device *qdev) > { > qxl_bo_unref(&qdev->current_release_bo[0]); > qxl_bo_unref(&qdev->current_release_bo[1]); > - flush_work(&qdev->gc_work); > - qxl_ring_free(qdev->command_ring); > - qxl_ring_free(qdev->cursor_ring); > - qxl_ring_free(qdev->release_ring); > qxl_gem_fini(qdev); > qxl_bo_fini(qdev); > + flush_work(&qdev->gc_work); > + qxl_ring_free(qdev->command_ring); > + qxl_ring_free(qdev->cursor_ring); > + qxl_ring_free(qdev->release_ring); > io_mapping_free(qdev->surface_mapping); > io_mapping_free(qdev->vram_mapping); > iounmap(qdev->ram_header); Frediano