From patchwork Thu Oct 4 20:24:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10626641 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 BE2E315E2 for ; Thu, 4 Oct 2018 20:25:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B2455296FC for ; Thu, 4 Oct 2018 20:25:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A52CA29703; Thu, 4 Oct 2018 20:25:57 +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,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 3D802296FC for ; Thu, 4 Oct 2018 20:25:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3E6566E67E; Thu, 4 Oct 2018 20:25:20 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ed1-x542.google.com (mail-ed1-x542.google.com [IPv6:2a00:1450:4864:20::542]) by gabe.freedesktop.org (Postfix) with ESMTPS id BA5846E67D for ; Thu, 4 Oct 2018 20:25:17 +0000 (UTC) Received: by mail-ed1-x542.google.com with SMTP id z21-v6so5315766edb.11 for ; Thu, 04 Oct 2018 13:25:17 -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:mime-version:content-transfer-encoding; bh=BZy1JP540jIovlvKOYhTZfD7VLBjXKUCX4hNQoYnjoY=; b=ILcTRyklqMC8KrppbEuT6OI1tLw2Fa6haKWPKKZUF+Ry4C4FZYjQQUAr4TaQFdFaqH yjyoOpo8wshwv1kUiqRnZu1bozL5HmUZZo8esHWZaNuZDmOfX5/6mqpOTYCPSVOI5+we thoSiBSiUm9GG3MJpTnry0ikBlYOh9lseeqLTkXj8Mc3e8d4vVSe4dVZWlURb0iqSh4L yOKyWhiwC50kwhVh7sO+ed59692KCYWgWsX+8yfSVGaq6mEXlbR2g4QLed4yF0JS/lq1 IgyYUza7THuutOoGTu4Dgb4NBfCCD3d2mjJh79N15zx/++h6FF+0dj87TZSWU6p+/W/S 2Wew== X-Gm-Message-State: ABuFfog5ym/Os/t+qxxTap6We1c2BFCfFXlnZWtzqYm98q8PSUCm4xRs djESEoghr/AhFghz12rbJFKDvhQ/cng= X-Google-Smtp-Source: ACcGV62HK1M741A5y/MhqOUgr2ok2wGEmhWydmQr91zav7zjlsoFeU4ki4iJqRtehon/8a8qBYhjbQ== X-Received: by 2002:aa7:da1a:: with SMTP id r26-v6mr10663674eds.54.1538684716022; Thu, 04 Oct 2018 13:25:16 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id y8-v6sm2040002edd.43.2018.10.04.13.25.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Oct 2018 13:25:15 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 12/21] drm/sti: Use drm_atomic_helper_shutdown Date: Thu, 4 Oct 2018 22:24:37 +0200 Message-Id: <20181004202446.22905-13-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.19.0.rc2 In-Reply-To: <20181004202446.22905-1-daniel.vetter@ffwll.ch> References: <20181004202446.22905-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 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: Daniel Vetter , Vincent Abriou Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP drm_plane_helper_disable is a non-atomic drivers only function, and will blow up (since no one passes the locking context it needs). Atomic drivers which want to quiescent their hw on unload should use drm_atomic_helper_shutdown() instead. The sti cleanup code seems supremely confused: - In the load error path it calls drm_mode_config_cleanup before it stops various kms services like poll worker or fbdev emulation. That's going to oops. - The actual unload code doesn't even bother with the cleanup and just leaks. Try to fix this while at it. Reviewed-by: Ville Syrjälä Signed-off-by: Daniel Vetter Cc: Benjamin Gaignard Cc: Vincent Abriou --- drivers/gpu/drm/sti/sti_cursor.c | 1 - drivers/gpu/drm/sti/sti_drv.c | 6 +++--- drivers/gpu/drm/sti/sti_gdp.c | 1 - drivers/gpu/drm/sti/sti_hqvdp.c | 1 - 4 files changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/sti/sti_cursor.c b/drivers/gpu/drm/sti/sti_cursor.c index 57b870e1e696..bc908453ffb3 100644 --- a/drivers/gpu/drm/sti/sti_cursor.c +++ b/drivers/gpu/drm/sti/sti_cursor.c @@ -332,7 +332,6 @@ static void sti_cursor_destroy(struct drm_plane *drm_plane) { DRM_DEBUG_DRIVER("\n"); - drm_plane_helper_disable(drm_plane, NULL); drm_plane_cleanup(drm_plane); } diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c index 6dced8abcf16..ac54e0f9caea 100644 --- a/drivers/gpu/drm/sti/sti_drv.c +++ b/drivers/gpu/drm/sti/sti_drv.c @@ -206,6 +206,8 @@ static void sti_cleanup(struct drm_device *ddev) struct sti_private *private = ddev->dev_private; drm_kms_helper_poll_fini(ddev); + drm_atomic_helper_shutdown(ddev); + drm_mode_config_cleanup(ddev); component_unbind_all(ddev->dev, ddev); kfree(private); ddev->dev_private = NULL; @@ -230,7 +232,7 @@ static int sti_bind(struct device *dev) ret = drm_dev_register(ddev, 0); if (ret) - goto err_register; + goto err_cleanup; drm_mode_config_reset(ddev); @@ -238,8 +240,6 @@ static int sti_bind(struct device *dev) return 0; -err_register: - drm_mode_config_cleanup(ddev); err_cleanup: sti_cleanup(ddev); err_drm_dev_put: diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c index c32de6cbf061..3c19614d3f75 100644 --- a/drivers/gpu/drm/sti/sti_gdp.c +++ b/drivers/gpu/drm/sti/sti_gdp.c @@ -883,7 +883,6 @@ static void sti_gdp_destroy(struct drm_plane *drm_plane) { DRM_DEBUG_DRIVER("\n"); - drm_plane_helper_disable(drm_plane, NULL); drm_plane_cleanup(drm_plane); } diff --git a/drivers/gpu/drm/sti/sti_hqvdp.c b/drivers/gpu/drm/sti/sti_hqvdp.c index 03ac3b4a4469..23565f52dd71 100644 --- a/drivers/gpu/drm/sti/sti_hqvdp.c +++ b/drivers/gpu/drm/sti/sti_hqvdp.c @@ -1260,7 +1260,6 @@ static void sti_hqvdp_destroy(struct drm_plane *drm_plane) { DRM_DEBUG_DRIVER("\n"); - drm_plane_helper_disable(drm_plane, NULL); drm_plane_cleanup(drm_plane); }