From patchwork Thu Sep 8 12:00:22 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 1129612 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p88D1Xii029571 for ; Thu, 8 Sep 2011 13:01:53 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0E999A199B for ; Thu, 8 Sep 2011 06:01:33 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-ww0-f43.google.com (mail-ww0-f43.google.com [74.125.82.43]) by gabe.freedesktop.org (Postfix) with ESMTP id 9ACEDA197B for ; Thu, 8 Sep 2011 06:00:17 -0700 (PDT) Received: by mail-ww0-f43.google.com with SMTP id 32so679251wwe.12 for ; Thu, 08 Sep 2011 06:00:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=6sgQvFhPDvGBrSN15bXr3ktW8d7OGqBXo45KnZDwAXo=; b=UHh3y3d1sa/VtHV7pcgLlpzHipoGcNQHYZ6vtXn5vgvNISKk0J3IQtbOAvdF6PQtYA rGEjX58VgCXo4eR0QTE4M9LWYEe5eqyoKiguZfT49AUIeLdWBElDTLJDM1/9AAzE0vqc xz0eeE6cUrQCZW0ek2El9MHaFGqT2LR11SrlM= Received: by 10.227.199.16 with SMTP id eq16mr724609wbb.48.1315486817294; Thu, 08 Sep 2011 06:00:17 -0700 (PDT) Received: from localhost.localdomain (178-83-130-250.dynamic.hispeed.ch [178.83.130.250]) by mx.google.com with ESMTPS id ev5sm4161718wbb.11.2011.09.08.06.00.16 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 08 Sep 2011 06:00:16 -0700 (PDT) From: Daniel Vetter To: intel-gfx@lists.freedesktop.org Date: Thu, 8 Sep 2011 14:00:22 +0200 Message-Id: <1315483222-2195-3-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 1.7.6 In-Reply-To: <1315483222-2195-1-git-send-email-daniel.vetter@ffwll.ch> References: <1315483222-2195-1-git-send-email-daniel.vetter@ffwll.ch> Cc: Daniel Vetter , Ben Widawsky Subject: [Intel-gfx] [PATCH 3/3] drm/i915: properly cancel rps_work on module unload v2 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 08 Sep 2011 13:02:18 +0000 (UTC) The rps disabling code wasn't properly cancelling outstanding work items. Also add a comment that explains why we're not racing with the work item that could unmask interrupts - that piece of code confused me quite a bit. v2: Ben Widawsky pointed out that the first patch would deadlock (and a few lesser problems). All corrected. Signed-off-by: Daniel Vetter Reviewed-by: Ben Widawsky --- drivers/gpu/drm/i915/intel_display.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 56a8554..2e425be 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -7484,6 +7484,10 @@ void gen6_disable_rps(struct drm_device *dev) I915_WRITE(GEN6_RPNSWREQ, 1 << 31); I915_WRITE(GEN6_PMINTRMSK, 0xffffffff); I915_WRITE(GEN6_PMIER, 0); + /* Complete PM interrupt masking here doesn't race with the rps work + * item again unmasking PM interrupts because that is using a different + * register (PMIMR) to mask PM interrupts. The only risk is in leaving + * stale bits in PMIIR and PMIMR which gen6_enable_rps will clean up. */ spin_lock_irq(&dev_priv->rps_lock); dev_priv->pm_iir = 0; @@ -8478,6 +8482,7 @@ void intel_modeset_cleanup(struct drm_device *dev) * enqueue unpin/hotplug work. */ drm_irq_uninstall(dev); cancel_work_sync(&dev_priv->hotplug_work); + cancel_work_sync(&dev_priv->rps_work); /* flush any delayed tasks or pending work */ flush_scheduled_work();