From patchwork Wed Oct 15 17:15:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paulo Zanoni X-Patchwork-Id: 5086321 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 45641C11AC for ; Wed, 15 Oct 2014 17:15:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3D29920127 for ; Wed, 15 Oct 2014 17:15:25 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id CF68D20122 for ; Wed, 15 Oct 2014 17:15:23 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F19816E1A3; Wed, 15 Oct 2014 10:15:22 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-qc0-f180.google.com (mail-qc0-f180.google.com [209.85.216.180]) by gabe.freedesktop.org (Postfix) with ESMTP id A498B6E1A3 for ; Wed, 15 Oct 2014 10:15:21 -0700 (PDT) Received: by mail-qc0-f180.google.com with SMTP id x3so1308420qcv.39 for ; Wed, 15 Oct 2014 10:15:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=Ipiv6EOSMfC34v7ko0cvVxMUG48XmymGf5ggzBkKM6s=; b=sxQchlseDrcBJc5zDcuBtLn43NwxS4o3p8C4M3zPcxzmCn0TiJLnZT5JqQrTPUSVkc 2tTxxzG8MMAdnv5eBx8ZNJi+lmGtl+WjYl/ngr92z7VjDrHLvwkjIHB4/eoOHLsktpP8 cwd9QKUyZ/9cTv++vna8fKDkg71nIIdc4d37oJL8ykGewgtB/VdHT6jB0FvKvBDmBsXh 2kFzrcly+rt2IPqE+GRTEERb0wOryfm2MqZknnyWbYCM9MHGTLJtJF/G1Wl76xfN+zC0 nPOA+re+318ErewasczdBoFj5zPJlycjf8w5aYvCrpMy+WLFvKzR4SsTfXl5k5qAfsUH izPQ== X-Received: by 10.229.239.74 with SMTP id kv10mr22839137qcb.27.1413393320032; Wed, 15 Oct 2014 10:15:20 -0700 (PDT) Received: from localhost.localdomain (177.204.135.17.dynamic.adsl.gvt.net.br. [177.204.135.17]) by mx.google.com with ESMTPSA id 11sm18660853qgp.2.2014.10.15.10.15.18 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 15 Oct 2014 10:15:19 -0700 (PDT) From: Paulo Zanoni To: intel-gfx@lists.freedesktop.org Date: Wed, 15 Oct 2014 14:15:04 -0300 Message-Id: <1413393304-3224-1-git-send-email-przanoni@gmail.com> X-Mailer: git-send-email 1.9.1 Cc: Paulo Zanoni Subject: [Intel-gfx] [PATCH] drm/i915: call drm_vblank_cleanup() earlier at unload X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Paulo Zanoni In its current place, it just segfaults while trying to access the CRTC structures: [ 9132.421681] Call Trace: [ 9132.421707] [] i915_get_crtc_scanoutpos+0x1e8/0x220 [i915] [ 9132.421727] [] drm_calc_vbltimestamp_from_scanoutpos+0x94/0x330 [drm] [ 9132.421744] [] ?vblank_disable_and_save+0x40/0x1e0 [drm] [ 9132.421769] [] i915_get_vblank_timestamp+0x68/0xb0 [i915] [ 9132.421786] [] drm_get_last_vbltimestamp+0x44/0x80 [drm] [ 9132.421801] [] vblank_disable_and_save+0x1a6/0x1e0 [drm] [ 9132.421817] [] drm_vblank_cleanup+0x61/0xa0 [drm] [ 9132.421849] [] i915_driver_unload+0xde/0x290 [i915] [ 9132.421867] [] drm_dev_unregister+0x24/0xb0 [drm] [ 9132.421884] [] drm_put_dev+0x1e/0x70 [drm] [ 9132.421901] [] i915_pci_remove+0x10/0x20 [i915] [ 9132.421910] [] pci_device_remove+0x36/0xb0 [ 9132.421920] [] __device_release_driver+0x7a/0xf0 [ 9132.421928] [] driver_detach+0xb8/0xc0 [ 9132.421936] [] bus_remove_driver+0x4a/0xb0 [ 9132.421944] [] driver_unregister+0x27/0x50 [ 9132.421953] [] pci_unregister_driver+0x25/0x70 [ 9132.421971] [] drm_pci_exit+0x78/0xa0 [drm] [ 9132.422000] [] i915_exit+0x20/0x94e [i915] [ 9132.422009] [] SyS_delete_module+0x13c/0x1f0 [ 9132.422019] [] ? trace_hardirqs_on_thunk+0x3a/0x3f [ 9132.422028] [] system_call_fastpath+0x16/0x1b This means it has to be before intel_modeset_cleanup, which cleans the CRTC structures. But if we move it to before intel_fbdev_fini(), we get WARNs because intel_fbdev_fini() still tries to use the vblanks, so the only acceptable point for drm_vblank_cleanup() seems to be this place. Related commit: commit cbb47d179fb345c579cd8cd884693903fceed26a Author: Chris Wilson Date: Mon Sep 23 17:33:20 2013 -0300 drm/i915: Add some missing steps to i915_driver_load error path Testsuite: igt/drv_module_reload Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77511 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=83484 Signed-off-by: Paulo Zanoni Reviewed-by: Ville Syrjälä --- drivers/gpu/drm/i915/i915_dma.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index 85d14e1..1b39807 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c @@ -1853,8 +1853,12 @@ int i915_driver_unload(struct drm_device *dev) acpi_video_unregister(); - if (drm_core_check_feature(dev, DRIVER_MODESET)) { + if (drm_core_check_feature(dev, DRIVER_MODESET)) intel_fbdev_fini(dev); + + drm_vblank_cleanup(dev); + + if (drm_core_check_feature(dev, DRIVER_MODESET)) { intel_modeset_cleanup(dev); /* @@ -1895,8 +1899,6 @@ int i915_driver_unload(struct drm_device *dev) i915_free_hws(dev); } - drm_vblank_cleanup(dev); - intel_teardown_gmbus(dev); intel_teardown_mchbar(dev);