From patchwork Fri Jun 27 21:51:51 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Zanoni X-Patchwork-Id: 4437911 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 84F3FBEEAA for ; Fri, 27 Jun 2014 21:52:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AF9DC2026D for ; Fri, 27 Jun 2014 21:52:16 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id B7FA520176 for ; Fri, 27 Jun 2014 21:52:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3CD5E6E7EE; Fri, 27 Jun 2014 14:52:15 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-yk0-f169.google.com (mail-yk0-f169.google.com [209.85.160.169]) by gabe.freedesktop.org (Postfix) with ESMTP id 254B76E7EE for ; Fri, 27 Jun 2014 14:52:14 -0700 (PDT) Received: by mail-yk0-f169.google.com with SMTP id 79so3288677ykr.0 for ; Fri, 27 Jun 2014 14:52:13 -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=xbifiwI7b6nctl0FDTVerNPH6NT7AjU4Bzu9u0t8HrA=; b=xKVpNKn3Y0HKWFF9NatX2oyARvEPPcKsi5qM1fuXZZJNT61kymjFbDjHe8dXYjcS9G P6dLBbe16p7nBhCfYcEW+EerKpWHrCaxsxvVtBqUP6J2HzVx5XtQsiJI2eacEi7O+Hyd 49mVqh7I6KqZOnHbBd8xDZZaPWut0sII1oj9aOpqWI0GOUBnTaGaZHgUGvpxktbWsxO6 sN27LsqyqpFCGDnJdds/H8cWV03d/a/72MKn8GZYJryeNBXKrj4RZDPdaiiD4R+5+6Mo AFppyVcobFNFh35vxWHvqzptZooevGXpX4nJTfU0yY5nPipCJmzjnqQme7ThvneMoYQ2 qAIg== X-Received: by 10.236.101.198 with SMTP id b46mr35531294yhg.68.1403905933346; Fri, 27 Jun 2014 14:52:13 -0700 (PDT) Received: from localhost.localdomain ([177.156.215.8]) by mx.google.com with ESMTPSA id d46sm5883948yha.10.2014.06.27.14.52.11 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 27 Jun 2014 14:52:12 -0700 (PDT) From: Paulo Zanoni To: intel-gfx@lists.freedesktop.org Date: Fri, 27 Jun 2014 18:51:51 -0300 Message-Id: <1403905911-3859-1-git-send-email-przanoni@gmail.com> X-Mailer: git-send-email 2.0.0 Cc: Paulo Zanoni Subject: [Intel-gfx] [PATCH] drm/i915: flush delayed_resume_work when suspending 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 It is possible that, by the time we run i915_drm_freeze(), delayed_resume_work was already queued but did not run yet. If it still didn't run after intel_runtime_pm_disable_interrupts(), by the time it runs it will try to change the interrupt registers with the interrupts already disabled, which will trigger a WARN. We can reliably reproduce this with the pm_rpm system-suspend test case. In order to avoid the problem, we have to flush the work before disabling the interrupts. We could also cancel the work instead of flushing it, but that would require us to put a runtime PM reference - and any other resource we may need in the future - in case the work was already queued, so I believe flushing the work is more future-proof, although less efficient. But I can also change this part if someone requests. Another thing I tried was to move the intel_suspend_gt_powersave() call to before intel_runtime_pm_disable_interrupts(), but since that function needs to be called after the interrupts are already disabled, due to dev_priv->rps.work, this strategy didn't work. Testcase: igt/pm_rpm/system-suspend Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=80517 Signed-off-by: Paulo Zanoni Reviewed-by: Rodrigo Vivi Reviewed-by: Rodrigo Vivi --- drivers/gpu/drm/i915/i915_drv.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index e64547e..672694b 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -524,6 +524,8 @@ static int i915_drm_freeze(struct drm_device *dev) return error; } + flush_delayed_work(&dev_priv->rps.delayed_resume_work); + intel_runtime_pm_disable_interrupts(dev); dev_priv->enable_hotplug_processing = false;