From patchwork Fri Jul 20 14:11:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damir Shaikhutdinov X-Patchwork-Id: 10539693 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 880BB17FD for ; Mon, 23 Jul 2018 07:19:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6E2E02852A for ; Mon, 23 Jul 2018 07:19:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 613F82852E; Mon, 23 Jul 2018 07:19:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 207182852A for ; Mon, 23 Jul 2018 07:19:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9411C6E242; Mon, 23 Jul 2018 07:19:07 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ed1-x544.google.com (mail-ed1-x544.google.com [IPv6:2a00:1450:4864:20::544]) by gabe.freedesktop.org (Postfix) with ESMTPS id E07B26EFF7 for ; Fri, 20 Jul 2018 14:11:49 +0000 (UTC) Received: by mail-ed1-x544.google.com with SMTP id h1-v6so9897843eds.1 for ; Fri, 20 Jul 2018 07:11:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=dP8IKTT5aEoKppP9cV5vrfsa1v8tCWTeltnlcPIlXhU=; b=KRhRh3fMdg0htLpD0oU8zl3OdITnYJx5Uiwxnjx5iNyNvMD8hjsOAedMwkL4s+vImB ULq7KA6LSNl9OHKdMt+giDRmM8JnLypI2iKTEVqnmb0zvtlpMHGvrja3z+hW8C9TVRSR TyZetsqrAfJNR41B1imlYAwfYDu0hx7bLR2Sj11Ctj32fOy/l1JNvcvAcKV39uU28JOA UiUzCmHnqhyqYlvter/xkaXw/3bXxgnd+aDB62QU6K9Y1o4K1n0LZ4lRZmw38x42XwfW HDYqs+w50CQn6fWXWeRw9yc+5ZLcNTYLxPrhG1ivAsLE5xKKyqDTr507Wj7gCRsra2hy bJZw== X-Gm-Message-State: AOUpUlFUTu1+pcRriR7uCneTda+x+9N+MgiiOnx9UecTvujixbBbigQi RR0ZuOWQDV+xU8t/3L5O5Qs= X-Google-Smtp-Source: AAOMgpcq+crRBWIPGcoUnTWlyegfexvIpxflB3AC1CPH3Dt+cxB/Nu2xOJFABIDm77GNnrJBVOkCBQ== X-Received: by 2002:a50:aca3:: with SMTP id x32-v6mr2784260edc.41.1532095908569; Fri, 20 Jul 2018 07:11:48 -0700 (PDT) Received: from os-lin-dsh.open-synergy.com ([217.66.60.5]) by smtp.gmail.com with ESMTPSA id j16-v6sm3391749edj.71.2018.07.20.07.11.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Jul 2018 07:11:48 -0700 (PDT) From: Damir Shaikhutdinov X-Google-Original-From: Damir Shaikhutdinov To: aerlied@gmail.com Subject: [PATCH 1/4] drm/virtio: Fix memory leak during framebuffer destruction. Date: Fri, 20 Jul 2018 16:11:40 +0200 Message-Id: <20180720141143.15469-2-damir.shaikhutdinov@opensynergy.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180720141143.15469-1-damir.shaikhutdinov@opensynergy.com> References: <20180720141143.15469-1-damir.shaikhutdinov@opensynergy.com> X-Mailman-Approved-At: Mon, 23 Jul 2018 07:18:41 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Damir Shaikhutdinov , dri-devel@lists.freedesktop.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP In function virtio_gpufb_create, a virtio_gpu_object is allocated for framebuffer using virtio_gpu_alloc_object. In virtio_gpu_fbdev_destroy, instead of freeing the object, pointer to it is set to NULL. This leads to memory leak during framebuffer destruction, which is reported to kmesg with a message like this: Memory manager not clean during takedown. With DRM_DEBUG_MM enabled, following additional information is printed about the leak: node [00100000 + 000001d5]: inserted at save_stack.isra.9+0x67/0xc0 drm_mm_insert_node_in_range+0x325/0x4f0 drm_vma_offset_add+0x46/0x60 ttm_bo_init_reserved+0x2c9/0x400 ttm_bo_init+0x2a/0x80 virtio_gpu_object_create+0x139/0x180 virtio_gpu_alloc_object+0x2f/0x60 virtio_gpufb_create+0xac/0x2a0 Correctly freeing virtio_gpu_object during framebuffer destruction fixes the issue. Signed-off-by: Damir Shaikhutdinov Signed-off-by: Kiran Pawar --- drivers/gpu/drm/virtio/virtgpu_fb.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_fb.c b/drivers/gpu/drm/virtio/virtgpu_fb.c index 15d18fd0c64b..10a66a387bfb 100644 --- a/drivers/gpu/drm/virtio/virtgpu_fb.c +++ b/drivers/gpu/drm/virtio/virtgpu_fb.c @@ -301,11 +301,14 @@ static int virtio_gpu_fbdev_destroy(struct drm_device *dev, drm_fb_helper_unregister_fbi(&vgfbdev->helper); - if (vgfb->obj) - vgfb->obj = NULL; drm_fb_helper_fini(&vgfbdev->helper); drm_framebuffer_cleanup(&vgfb->base); + if (vgfb->obj) { + virtio_gpu_gem_free_object(vgfb->obj); + vgfb->obj = NULL; + } + return 0; } static const struct drm_fb_helper_funcs virtio_gpu_fb_helper_funcs = { From patchwork Fri Jul 20 14:11:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damir Shaikhutdinov X-Patchwork-Id: 10539701 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CD2BA157A for ; Mon, 23 Jul 2018 07:20:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B3EAC2855D for ; Mon, 23 Jul 2018 07:20:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B234528560; Mon, 23 Jul 2018 07:20:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 787EA2857D for ; Mon, 23 Jul 2018 07:20:37 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 28E256E1C9; Mon, 23 Jul 2018 07:19:43 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ed1-x543.google.com (mail-ed1-x543.google.com [IPv6:2a00:1450:4864:20::543]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0ED256EFF7 for ; Fri, 20 Jul 2018 14:11:51 +0000 (UTC) Received: by mail-ed1-x543.google.com with SMTP id t3-v6so9888431eds.3 for ; Fri, 20 Jul 2018 07:11:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ugXctxFCCDcwCpx8lN4nwzjkZieC2Ch8TgBJcxowsBo=; b=bRj4xOegbCaB3qmKfZega1ZW/k1RedOvltogWCqvYRXedOJiAN28M8J17Agkm/FlNA 3GG5HJkZbpRK+lV/4jWkqR7N1D6X4FAmHR5G7bZfONK5N6MjvJggQgIjB/Y7j2/SQSch MzEqi5ZCMwNgrwCohix2fWog2k2ouANF5RI2b1tbc62XJslDnlyoC469zcB1Zq/Zs0xS IhLKNleSUR3+ipWkxSzalPht67A3/Qs1lu9w84mi88KHcmI+M59g61QoJPRhjqhv0Ths T9idkHZpYmFkqAFpt6jbL6FPlbHZwPTCeQTvADWjNbNnGm8Lz2pnPd8eT0tEie8AeRr4 lDRQ== X-Gm-Message-State: AOUpUlGP7hEWytFztEfG+pcK36bwFaRwkZSeN72jnNBW9Ab0pN/Bm8Oc 10srgHUuM0bqzQpgeerrSwM= X-Google-Smtp-Source: AAOMgpekpYanARdcKx5VFyTZbVX/tYEsLQ3Z26s5pbdO22Ko6ILfVUTbtnNDTFG4BofqDLgbbvMFXg== X-Received: by 2002:a50:9493:: with SMTP id s19-v6mr2843338eda.285.1532095909735; Fri, 20 Jul 2018 07:11:49 -0700 (PDT) Received: from os-lin-dsh.open-synergy.com ([217.66.60.5]) by smtp.gmail.com with ESMTPSA id j16-v6sm3391749edj.71.2018.07.20.07.11.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Jul 2018 07:11:49 -0700 (PDT) From: Damir Shaikhutdinov X-Google-Original-From: Damir Shaikhutdinov To: aerlied@gmail.com Subject: [PATCH 2/4] drm/virtio: Remove incorrect kfree during connector destruction. Date: Fri, 20 Jul 2018 16:11:41 +0200 Message-Id: <20180720141143.15469-3-damir.shaikhutdinov@opensynergy.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180720141143.15469-1-damir.shaikhutdinov@opensynergy.com> References: <20180720141143.15469-1-damir.shaikhutdinov@opensynergy.com> X-Mailman-Approved-At: Mon, 23 Jul 2018 07:18:41 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Damir Shaikhutdinov , dri-devel@lists.freedesktop.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP In function virtio_gpu_conn_destroy a pointer to a containing structure virtio_gpu_output is received using drm_connector_to_virtio_gpu_output (container_of), and then it is passed to kfree function. But this pointer points to a member of array (vgdev->outputs + index) (see vgdev_output_init): struct virtio_gpu_output *output = vgdev->outputs + index; struct drm_connector *connector = &output->conn; ... drm_connector_init(dev, connector, &virtio_gpu_connector_funcs, DRM_MODE_CONNECTOR_VIRTUAL); Signed-off-by: Damir Shaikhutdinov --- drivers/gpu/drm/virtio/virtgpu_display.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm/virtio/virtgpu_display.c index b6d52055a11f..d211d4e98b46 100644 --- a/drivers/gpu/drm/virtio/virtgpu_display.c +++ b/drivers/gpu/drm/virtio/virtgpu_display.c @@ -243,12 +243,8 @@ static enum drm_connector_status virtio_gpu_conn_detect( static void virtio_gpu_conn_destroy(struct drm_connector *connector) { - struct virtio_gpu_output *virtio_gpu_output = - drm_connector_to_virtio_gpu_output(connector); - drm_connector_unregister(connector); drm_connector_cleanup(connector); - kfree(virtio_gpu_output); } static const struct drm_connector_funcs virtio_gpu_connector_funcs = { From patchwork Fri Jul 20 14:11:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damir Shaikhutdinov X-Patchwork-Id: 10539689 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 95E9517FD for ; Mon, 23 Jul 2018 07:18:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7D6082852A for ; Mon, 23 Jul 2018 07:18:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 71F0A2852E; Mon, 23 Jul 2018 07:18:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B86F62852A for ; Mon, 23 Jul 2018 07:18:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1F6756E1E9; Mon, 23 Jul 2018 07:18:43 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ed1-x543.google.com (mail-ed1-x543.google.com [IPv6:2a00:1450:4864:20::543]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1D0C36EFFA for ; Fri, 20 Jul 2018 14:11:52 +0000 (UTC) Received: by mail-ed1-x543.google.com with SMTP id w14-v6so9879139eds.6 for ; Fri, 20 Jul 2018 07:11:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=TuZCmAbgwylFXDrZGXaoBjE3CpeoU9azbVFepEdiM+M=; b=l5CRsVoeSKZrjeSQf4R3cPBev3v48XxOkDtMowO6NArjs/2ws4DpxgYlfuTQHXcfUs W08HGdvxssXA7enLmwwUA/GVrgpSu6+DuKt2V5/zlwqACWS44DhWcM0xVhAdNl0mxsqI Huusxuyjp2++dRsJ3w5LxtXYc/9n2Y17aqjyR6Efu3xQlYZlPK8vNShgYTvxT/fsWPWD SE5O33yJ1NSg7QQl/L29pEMjD601K8TNwdNUSwW/1bWAGGu5Xwz7E2SgPhwAOwuq/9pu LlKvgGsn3IqK0f4Ph6RumaseGt/dcr0M9I2b6J5LJm37Y+Ux2ugAneM2G48uonUd+xH6 kvuA== X-Gm-Message-State: AOUpUlFE7fDHIo3Ymc7ymTAsUsOj2HjCM94Td5YOZBMch0ooVbExDYKH a20XOKWBwC3pTZW8hpK2DVU= X-Google-Smtp-Source: AAOMgpd01k/eLVZauGWDWSzcQoIRinHV81q7lHhsGNCTSFqWhNGE7/ZUPSBDBtljtMb1aCW6pSQFTw== X-Received: by 2002:a50:940b:: with SMTP id p11-v6mr2800392eda.107.1532095910778; Fri, 20 Jul 2018 07:11:50 -0700 (PDT) Received: from os-lin-dsh.open-synergy.com ([217.66.60.5]) by smtp.gmail.com with ESMTPSA id j16-v6sm3391749edj.71.2018.07.20.07.11.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Jul 2018 07:11:50 -0700 (PDT) From: Damir Shaikhutdinov X-Google-Original-From: Damir Shaikhutdinov To: aerlied@gmail.com Subject: [PATCH 3/4] drm/virtio: Fix virtio gpu fbdev deinitialization. Date: Fri, 20 Jul 2018 16:11:42 +0200 Message-Id: <20180720141143.15469-4-damir.shaikhutdinov@opensynergy.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180720141143.15469-1-damir.shaikhutdinov@opensynergy.com> References: <20180720141143.15469-1-damir.shaikhutdinov@opensynergy.com> X-Mailman-Approved-At: Mon, 23 Jul 2018 07:18:41 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Damir Shaikhutdinov , dri-devel@lists.freedesktop.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Module parameter virtio_gpu_fbdev is used to enable or disable fbdev in virtio. It is checked during fbdev initialization, but is not checked during deinitialization. Moving fbdev destruction to virtgpu_kms.c instead of virtgpu_display.c places deinitialization to the same file as initialization, and allows checking for virtio_gpu_fbdev module parameter. Signed-off-by: Damir Shaikhutdinov --- drivers/gpu/drm/virtio/virtgpu_display.c | 1 - drivers/gpu/drm/virtio/virtgpu_kms.c | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm/virtio/virtgpu_display.c index d211d4e98b46..d314e3c672f2 100644 --- a/drivers/gpu/drm/virtio/virtgpu_display.c +++ b/drivers/gpu/drm/virtio/virtgpu_display.c @@ -377,6 +377,5 @@ int virtio_gpu_modeset_init(struct virtio_gpu_device *vgdev) void virtio_gpu_modeset_fini(struct virtio_gpu_device *vgdev) { - virtio_gpu_fbdev_fini(vgdev); drm_mode_config_cleanup(vgdev->ddev); } diff --git a/drivers/gpu/drm/virtio/virtgpu_kms.c b/drivers/gpu/drm/virtio/virtgpu_kms.c index 6400506a06b0..b994ecfdd378 100644 --- a/drivers/gpu/drm/virtio/virtgpu_kms.c +++ b/drivers/gpu/drm/virtio/virtgpu_kms.c @@ -259,6 +259,8 @@ void virtio_gpu_driver_unload(struct drm_device *dev) flush_work(&vgdev->config_changed_work); vgdev->vdev->config->del_vqs(vgdev->vdev); + if (virtio_gpu_fbdev) + virtio_gpu_fbdev_fini(vgdev); virtio_gpu_modeset_fini(vgdev); virtio_gpu_ttm_fini(vgdev); virtio_gpu_free_vbufs(vgdev); From patchwork Fri Jul 20 14:11:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damir Shaikhutdinov X-Patchwork-Id: 10539695 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BFCDA157A for ; Mon, 23 Jul 2018 07:19:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A509B2852C for ; Mon, 23 Jul 2018 07:19:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9958328531; Mon, 23 Jul 2018 07:19:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5D1D32852C for ; Mon, 23 Jul 2018 07:19:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 30E5C6E285; Mon, 23 Jul 2018 07:19:08 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ed1-x544.google.com (mail-ed1-x544.google.com [IPv6:2a00:1450:4864:20::544]) by gabe.freedesktop.org (Postfix) with ESMTPS id 383706EFFB for ; Fri, 20 Jul 2018 14:11:53 +0000 (UTC) Received: by mail-ed1-x544.google.com with SMTP id t3-v6so9888510eds.3 for ; Fri, 20 Jul 2018 07:11:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=O12Fzoq/pgPaiFplBQ7x2ouS+2tIn2EtYVjtixWKuKA=; b=b0eZcXesh2eoXUFE82fE6r9Cqv5uFal2guBcRabEuzvyA8MJbiIFMwFVleDFGyr7eJ QxzI2JsJXui0SLyPXB2YVSMOuwYhLzzWFf3v0xFVMA50nQIunuYmbNiBxd7Gcmv4ujSb Z2koIPnjQmhXlpnv9xUKMpBjUG6Bvryq0E+/7427xLqs+k7FhyAMM4rteBWAUhkhaEOc ZHoTWjGn3u/Z6swxpl0z3I7hsbgHALYsBJZ03k9Y3oVvPD6ID9btvZlXBdmmGBh4NDix xfaekJk4IX0qIT+hZ0R5lWvq3JETFuEQ6ENFI3vfqRXoz+EUZdG2kduV4kUzgP1QXt9a 7yKQ== X-Gm-Message-State: AOUpUlE5E8l6o6s/EwCwv7AYf6LuR9QZjybrMO1GUYXywhYRKiIQ9XFa 7yOTSLMR/ODXNvZcAUrlh1A= X-Google-Smtp-Source: AAOMgpcyX5Ucrqt8/nTpLZQe7KXRTWVk6MFEGiE2vW4VVAcSiBzXEf7xB3WsL5PrSNM40ne8z/sOYA== X-Received: by 2002:a50:afc4:: with SMTP id h62-v6mr2778806edd.251.1532095911898; Fri, 20 Jul 2018 07:11:51 -0700 (PDT) Received: from os-lin-dsh.open-synergy.com ([217.66.60.5]) by smtp.gmail.com with ESMTPSA id j16-v6sm3391749edj.71.2018.07.20.07.11.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Jul 2018 07:11:51 -0700 (PDT) From: Damir Shaikhutdinov X-Google-Original-From: Damir Shaikhutdinov To: aerlied@gmail.com Subject: [PATCH 4/4] drm/virtio: Fix connector leak during virtio-gpu deinitialization. Date: Fri, 20 Jul 2018 16:11:43 +0200 Message-Id: <20180720141143.15469-5-damir.shaikhutdinov@opensynergy.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180720141143.15469-1-damir.shaikhutdinov@opensynergy.com> References: <20180720141143.15469-1-damir.shaikhutdinov@opensynergy.com> X-Mailman-Approved-At: Mon, 23 Jul 2018 07:18:41 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Damir Shaikhutdinov , dri-devel@lists.freedesktop.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Attaching CRTC to a connector increases its reference count, preventing it from correct deinitialization. Following kernel log is printed when the leak is found: Console: switching to colour VGA+ 80x25 WARNING: at drivers/gpu/drm/drm_mode_config.c:431 ... Call Trace: drm_mode_config_cleanup virtio_gpu_modeset_fini virtio_gpu_driver_unload drm_dev_unregister drm_put_dev virtio_gpu_remove virtio_dev_remove device_release_driver_internal device_release_driver bus_remove_device device_del device_unregister unregister_virtio_device ... [drm:drm_mode_config_cleanup] ERROR connector Virtual-1 leaked! Calling drm_atomic_helper_shutdown disconnects CRTCs from connectors, allowing them to be freed during drm_mode_config_cleanup. Signed-off-by: Damir Shaikhutdinov Signed-off-by: Kiran Pawar --- drivers/gpu/drm/virtio/virtgpu_display.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm/virtio/virtgpu_display.c index d314e3c672f2..088a751a35e9 100644 --- a/drivers/gpu/drm/virtio/virtgpu_display.c +++ b/drivers/gpu/drm/virtio/virtgpu_display.c @@ -377,5 +377,6 @@ int virtio_gpu_modeset_init(struct virtio_gpu_device *vgdev) void virtio_gpu_modeset_fini(struct virtio_gpu_device *vgdev) { + drm_atomic_helper_shutdown(vgdev->ddev); drm_mode_config_cleanup(vgdev->ddev); }