Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp388534ybc; Tue, 12 Nov 2019 03:06:46 -0800 (PST) X-Google-Smtp-Source: APXvYqzWk5+ahP+83CSku7HYGG5AwAJs2uyuv62yCspqg40QufA+7q6COwyGea65876jF82B7sQn X-Received: by 2002:a05:6402:488:: with SMTP id k8mr31852596edv.293.1573556806273; Tue, 12 Nov 2019 03:06:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573556806; cv=none; d=google.com; s=arc-20160816; b=ks8zyBc4f0nuNAdeKt0OpEwkRci409/G2xOoJ4BO4NN29+3Yx8MP6RkJGSSLsk0dK5 aN+xxoxqSFMxPYqBwO04Yy1vV4AgdEHnDFo+/7ygAeoAcVd3InaSH+uBEDsMPdpR7qoz ziUzYn0AHIB+VRXs6clAdhJ8TagVUtDbVdiqj1pRj65LyyqWvySR2PkqNp28p+sKVoOC Ph50dEIMcvuJJc59J4eUGQoDcntaIz9UlX42PXkaWIvg87G1qWkQ2x+A/drHGSAIe+n0 uSnZkGo1JerySue8rh1V38YOozFq/Rm79PVC8gVxdrmWG34Mi/j5cNxLapL5wshzQZcA DNYw== 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=7v/v4nr+zqzk2y/jAd0gNZ9DfjLyLFd4Z21yLnvf0Dw=; b=nQ2EUBAzuNyta1DVtVjR1cPSuK9ocsYLnkLBi8YEIno9MF8X2G+07mBwShfdnZ5hPD HUgwbmHEg9BzmGsUnqBz3etYRo2d/QRjnxiBq6bMF6O0Qv2L8vck4TYf3gK68h/X5heQ bXW4xEAPbDU3fJJF5j2gYtMWEiVKQJbU2Cp406ffqsx+gZsh0DwDzZyQmc/O5fjwy61y GwhKvGq4u8QeWkvur5VXGti2aWyhkXHLLcgrh79E/0QsW/xKp82zFTEZk4z/waXe7/pK ivYlsYsj1gAPy+CsWxiGKTZt207l/pU3+kscetSSuxS3mDipUq12l1Xq5DivWoZUnBvH iBEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=WGcrxOsc; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j3si13342550edh.14.2019.11.12.03.06.21; Tue, 12 Nov 2019 03:06:46 -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=@gmail.com header.s=20161025 header.b=WGcrxOsc; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726008AbfKLLDS (ORCPT + 99 others); Tue, 12 Nov 2019 06:03:18 -0500 Received: from mail-ed1-f66.google.com ([209.85.208.66]:41623 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725881AbfKLLDS (ORCPT ); Tue, 12 Nov 2019 06:03:18 -0500 Received: by mail-ed1-f66.google.com with SMTP id a21so14558651edj.8 for ; Tue, 12 Nov 2019 03:03:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=7v/v4nr+zqzk2y/jAd0gNZ9DfjLyLFd4Z21yLnvf0Dw=; b=WGcrxOsczq3GVLUIOlQBv9NqR40pTHNB89f52HlTcJP/airVxcI1SbQma3s/xI/y9b 3FzS+nvwEDIrjUz2i2JkCwft5P+/PNYXiNcxG6SeQicGHSv4apY9rtF/iOfeKgKERvGi 49Mh+wxoUpPZaJmxb9Nw6btNQVViXnOh65IYkoGrkBwPGsVMEnTa7lGIUtfNvTF+Gn3V Qe6PMS86mVL8zxP5qiu8kymKk6Zx8AH19LR1tOXygo4H+xoYMcZsRW7KYCViZ0cRc+oW /MXLGW+zWRzqppdLzFyZg5PVEzdYx8ePWwKKIta0fJ9bjReuWFvvR2ms3JaP8Joey/fo 0Rkg== 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=7v/v4nr+zqzk2y/jAd0gNZ9DfjLyLFd4Z21yLnvf0Dw=; b=ct8idkxTLsYi5rZ+y+oB5rg3OeVH11+o2+gDe7pDTVtxKSZKAdbGJEjLnP6LG0sT8l 8xopb8KL5sOjtr0chmEOWCiBVzEXrHg+Psk11lG7zGvYGcMQMo8u4kPuZdRapfzzj+22 +dh8m0ilfSgQrgtmafQMEAvsN+A0JwaL4etN8uHEyLFCmFKLUxPxaIyQRi8fbqTfHWWN +ZjJs5jykXEr9IUKuJ+jKbnugyw8H2rFeXsFBS4fCo7NH4syTkgafydBZEnghoVJgT1C N/nw8NeybJ6HSs6qeExhb7h+8y6YUOnd09TR4ZhpgWdocpSsWauRdREDlIxq37FofUvD F60g== X-Gm-Message-State: APjAAAVVTxyQ2MFEdMiG1votf+flMVo6TILRYRd7rj39X4j17bcdve14 OqVLOffmb7N5G6iYIt1Cmy888PrRJCh7bAfyMgM= X-Received: by 2002:a17:906:f109:: with SMTP id gv9mr28018882ejb.196.1573556596349; Tue, 12 Nov 2019 03:03:16 -0800 (PST) MIME-Version: 1.0 References: <20191109075417.29808-1-hslester96@gmail.com> <20191112094031.GF23790@phenom.ffwll.local> In-Reply-To: <20191112094031.GF23790@phenom.ffwll.local> From: Chuhong Yuan Date: Tue, 12 Nov 2019 19:03:05 +0800 Message-ID: Subject: Re: [PATCH] drm/virtgpu: fix double unregistration To: Chuhong Yuan , David Airlie , Gerd Hoffmann , dri-devel@lists.freedesktop.org, virtualization@lists.linux-foundation.org, LKML 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 Tue, Nov 12, 2019 at 5:40 PM Daniel Vetter wrote: > > On Sat, Nov 09, 2019 at 03:54:17PM +0800, Chuhong Yuan wrote: > > drm_put_dev also calls drm_dev_unregister, so dev will be unregistered > > twice. > > Replace it with drm_dev_put to fix it. > > > > Signed-off-by: Chuhong Yuan > > Nice catch, I'll apply. > > Since this is so confusing, we actually have a todo to remove drm_put_dev > completely from the codebase (and open-code it with explicit > unregister+put). Want to do that little patch series to update the > remaining few drivers and then remove drm_put_dev from core code? > > Thanks, Daniel > I am sorry that I have to focus on my current project in recent days. But since this is a problem, I have written a Coccinelle script just now to find drm_put_dev and open-code it. I hope this helps. The script is: virtual patch @ drm_put_dev depends on patch exists @ expression dev; @@ - drm_put_dev(dev); + drm_dev_unregister(dev); + drm_dev_put(dev); Regards, Chuhong > > --- > > drivers/gpu/drm/virtio/virtgpu_drv.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.c b/drivers/gpu/drm/virtio/virtgpu_drv.c > > index 0fc32fa0b3c0..fccc24e21af8 100644 > > --- a/drivers/gpu/drm/virtio/virtgpu_drv.c > > +++ b/drivers/gpu/drm/virtio/virtgpu_drv.c > > @@ -138,7 +138,7 @@ static void virtio_gpu_remove(struct virtio_device *vdev) > > > > drm_dev_unregister(dev); > > virtio_gpu_deinit(dev); > > - drm_put_dev(dev); > > + drm_dev_put(dev); > > } > > > > static void virtio_gpu_config_changed(struct virtio_device *vdev) > > -- > > 2.23.0 > > > > -- > Daniel Vetter > Software Engineer, Intel Corporation > http://blog.ffwll.ch