Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3826605ybv; Mon, 10 Feb 2020 07:07:31 -0800 (PST) X-Google-Smtp-Source: APXvYqya3tp7HIeGMFHZx5AWHu7TGkOpzvq997Kgc+Fnn3kcZeiYrjsr34Cvy10bYMIvtiTzoOhJ X-Received: by 2002:aca:48d0:: with SMTP id v199mr1078256oia.10.1581347251374; Mon, 10 Feb 2020 07:07:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581347251; cv=none; d=google.com; s=arc-20160816; b=hxbLRLPUdTPQsPYVlP25uuDrhWJKSZKayqHyYwcQ9AEzjAUhwDn40BqYTZHt5aT1xj BXzSke9EOV6gHa93TGAffGvQt5e05thpeTPDy9j/LKpdz+dpbz+SorSMznUaiWTygkMp UvMNc3r9zCbiJLVmjMPNyXGMjud81cOkAhs3pY1nZTnZVbGImHWWQJdV4hjXFuS8PVo+ 8hTdDQ2cavOw4UgrfaC4VtnAY7LjZLYskH/ApcWneOI4dhPVG6g1kBWeEWJ+UY/tatFH elqp5MY2LBxN4LKyK6C4BfpmOiFSc+dQQZq4LFOp6ntcJK97DpjLJnFa1idoIGatVD4O zGkA== 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:mail-followup-to:message-id:subject:cc:to :from:date:dkim-signature; bh=SZWw5BNnqsxO+B1PSnFYos2X0WTIUEc5MmcB9KkYh80=; b=N5U4cH6HBq4f0GzYujSWAsC7ucpk1gQPhtVGbNBLDzx387X8KDVht1kTujZ8oNwVf9 qtxDvew6dzo9gSBaOTMDzPBlieY9beqElu8tqWDdBtGhXf2yZLnfDkRfgq+85MSR9aUu 6yt5tfLFC0DnVLrnK7/rvZWb4y8L5rtKsCJ7rhmtVikH1DVrLRbPSye4nY904tVGmAEL QUF5Fivg0QtS63SRALMs+nMTQnIHqRR1CW+r5GKvLhN+wAJ7dfmWwqCM4/lT3WuWGAJL /nPzZPdd5cs4MQkGNPYxxxJZqIuWRsFFLC1ZXnTzRWXJFO8cvmA1v1R/m30qhKr/KMJH vfRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=W0V0l0jr; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b6si276203oie.181.2020.02.10.07.07.19; Mon, 10 Feb 2020 07:07:31 -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=@ffwll.ch header.s=google header.b=W0V0l0jr; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729406AbgBJPGj (ORCPT + 99 others); Mon, 10 Feb 2020 10:06:39 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:37765 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728815AbgBJPGi (ORCPT ); Mon, 10 Feb 2020 10:06:38 -0500 Received: by mail-wm1-f66.google.com with SMTP id a6so740344wme.2 for ; Mon, 10 Feb 2020 07:06:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=SZWw5BNnqsxO+B1PSnFYos2X0WTIUEc5MmcB9KkYh80=; b=W0V0l0jrXQHgBSOItUTUJwRpOtkv/Q/smtmpPUJS47OOLZBD9qbyJ8CY7KClmjxKxE OFc5xuUJTNI4H//VPHEy4UoWZp7QD8sRKpumXKABiIZpcpZIkyHN4QhqxByZ2lH+sKZu XV3LNb2Q4Jr9z+7WNawVmGuKpSgkkjfr0VcRE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=SZWw5BNnqsxO+B1PSnFYos2X0WTIUEc5MmcB9KkYh80=; b=sus6dr4menGuCnMJUJA2Iv/dRT4a+AeL5AxtDcsfM70NDjosPmRknFiTAlp2W/fZZU okr7XFF/aCPYuqJsxjyddpckLpCvxIZWlXsOztCjhhQdzhu+MGm0i13CP6BaIel/dT2t r5YXbFEHDo4U1CRg3JbFYaRVNHygD3B+bOF5USh6TLLS0jc/d90Peds8caMVmtb/OweF ftReNjfksN1qqEI7roMpeq/2KuGWvwnXRcDcxI064dTP8T/7B/HRUkbs3NAKG+ukDHqp CiLtl2Ycw/nQiNbpDVLDdXPo4w1tns0U8iet8xCvet7HkCk4WYAPcQkPwILcEobcsB3/ eVmw== X-Gm-Message-State: APjAAAWvrCypJrEnU7lQhaCffRPEu1DcLSnKCIw8/LKzCSYw4lyvSqjs dsaUMvIwCztEJa7YySu0er0+Ag== X-Received: by 2002:a1c:44d:: with SMTP id 74mr16475365wme.53.1581347195749; Mon, 10 Feb 2020 07:06:35 -0800 (PST) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id t13sm935403wrw.19.2020.02.10.07.06.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Feb 2020 07:06:35 -0800 (PST) Date: Mon, 10 Feb 2020 16:06:33 +0100 From: Daniel Vetter To: Gerd Hoffmann Cc: dri-devel@lists.freedesktop.org, Dave Airlie , David Airlie , Daniel Vetter , "open list:DRM DRIVER FOR QXL VIRTUAL GPU" , "open list:DRM DRIVER FOR QXL VIRTUAL GPU" , open list Subject: Re: [PATCH v2 2/2] drm/qxl: add drm_driver.release callback. Message-ID: <20200210150633.GS43062@phenom.ffwll.local> Mail-Followup-To: Gerd Hoffmann , dri-devel@lists.freedesktop.org, Dave Airlie , David Airlie , "open list:DRM DRIVER FOR QXL VIRTUAL GPU" , "open list:DRM DRIVER FOR QXL VIRTUAL GPU" , open list References: <20200210113753.5614-1-kraxel@redhat.com> <20200210113753.5614-3-kraxel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200210113753.5614-3-kraxel@redhat.com> X-Operating-System: Linux phenom 5.3.0-3-amd64 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 10, 2020 at 12:37:52PM +0100, Gerd Hoffmann wrote: > Move final cleanups to qxl_drm_release() callback. > Add drm_atomic_helper_shutdown() call to qxl_pci_remove(). > > Signed-off-by: Gerd Hoffmann > --- > drivers/gpu/drm/qxl/qxl_drv.c | 26 +++++++++++++++++++------- > 1 file changed, 19 insertions(+), 7 deletions(-) > > diff --git a/drivers/gpu/drm/qxl/qxl_drv.c b/drivers/gpu/drm/qxl/qxl_drv.c > index 1d601f57a6ba..4fda3f9b29f4 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,30 @@ 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; > + > + /* > + * TODO: qxl_device_fini() call should be in qxl_pci_remove(), > + * reodering qxl_modeset_fini() + qxl_device_fini() calls is > + * non-trivial though. > + */ > + qxl_modeset_fini(qdev); So the drm_mode_config_cleanup call in here belongs in ->release, but the qxl_destroy_monitors_object feels like should be perfectly fine in the remove hook. You might need to sprinkle a few drm_dev_enter/exit around to protect code paths thought. Aside from this lgtm, for the series Acked-by: Daniel Vetter And up to you whether you want to fix this or not really. Btw for testing all these patches that add a ->release hook I think it'd be good if the drm core checks that drm_device->dev is set to NULL, and that we do this in the remove hook. Since that's guaranteed to be gone at that point, so anything in ->release that still needs the device is broken. Ofc maybe do that check only for drivers which have a ->release hook, and we might need a few fixups. Cheers, Daniel > + 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 +289,8 @@ static struct drm_driver qxl_driver = { > .major = 0, > .minor = 1, > .patchlevel = 0, > + > + .release = qxl_drm_release, > }; > > static int __init qxl_init(void) > -- > 2.18.1 > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch