From patchwork Tue Apr 1 22:39:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Zanoni X-Patchwork-Id: 3925911 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 2181C9F2F7 for ; Tue, 1 Apr 2014 22:40:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5B38D20240 for ; Tue, 1 Apr 2014 22:40:09 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 2F706202B4 for ; Tue, 1 Apr 2014 22:40:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C77476E880; Tue, 1 Apr 2014 15:40:07 -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 BBC1A6E890 for ; Tue, 1 Apr 2014 15:40:06 -0700 (PDT) Received: by mail-yk0-f169.google.com with SMTP id 142so8197067ykq.28 for ; Tue, 01 Apr 2014 15:40:06 -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:in-reply-to:references; bh=U7Nngz8kIYm6Rt2XNJGw+v8fP0uDhwxkEsoQ9m3ydgc=; b=QCCNG2XvCyKwObSJUSFPMd3gzErRx3okJkKgdeinLTcZqNUXifIa/Z27KwvAZPXsW5 xFmLwSksZJTyyP58ATLxaO5SheIK202L1NHlWYvZl9C6CYaOQ7rio7j22RNbMTPEIDuD 3Kip5/KiZeBG+/iNzHiN1lLz5pTNFE5NhEM0DA6aqnPcNZ1oYcGj8eSijaqCbJtP/idi WEMv/wbWc5Xc63gIuuZSay5wsZMxtsSlessnVJ3m2IctN/Z75JE52msvqTy3/6CYnYma 8Vj2EGyHB2ijL6flpdR8Bumaq35vhwcEGywqNFOu6ZdtNeLI/yj8cTyB4q3xQgJX8peP PErg== X-Received: by 10.236.147.10 with SMTP id s10mr17424031yhj.88.1396392006380; Tue, 01 Apr 2014 15:40:06 -0700 (PDT) Received: from localhost.localdomain ([177.42.99.148]) by mx.google.com with ESMTPSA id r46sm46418yhd.29.2014.04.01.15.40.05 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Apr 2014 15:40:05 -0700 (PDT) From: Paulo Zanoni To: intel-gfx@lists.freedesktop.org Date: Tue, 1 Apr 2014 19:39:49 -0300 Message-Id: <1396391989-2244-4-git-send-email-przanoni@gmail.com> X-Mailer: git-send-email 1.8.5.3 In-Reply-To: <1396391989-2244-1-git-send-email-przanoni@gmail.com> References: <1396391989-2244-1-git-send-email-przanoni@gmail.com> Cc: Paulo Zanoni Subject: [Intel-gfx] [PATCH 3/3] drm/i915: fix infinite loop at gen6_update_ring_freq 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.7 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 If I boot my Broadwell machine to X on a system with Mesa Gallium llvmpipe instead of i965, then kill X and try to run pm_pc8.c, when we disable PC8 and call gen6_update_ring_freq(), we will get stuck on an infinite loop because the frequencies are zero and the variables are unsigned. This happens because we never ran any batch, so we did not enable RC6, so the variables are zero. If I run gem_exec_nop before running pm_pc8, everything works as expected because gem_exec_nop makes RC6 be enabled. This commit should prevent the infinite loop, which IMHO is already a good reason to be merged, but it is not the proper fix to the "RC6 is not being enabled" problem. Signed-off-by: Paulo Zanoni --- drivers/gpu/drm/i915/intel_pm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index cebe0d4..0a0685b 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c @@ -3487,7 +3487,8 @@ void gen6_update_ring_freq(struct drm_device *dev) * to use for memory access. We do this by specifying the IA frequency * the PCU should use as a reference to determine the ring frequency. */ - for (gpu_freq = dev_priv->rps.max_freq_softlimit; gpu_freq >= dev_priv->rps.min_freq_softlimit; + for (gpu_freq = dev_priv->rps.max_freq_softlimit; + gpu_freq >= dev_priv->rps.min_freq_softlimit && gpu_freq != 0; gpu_freq--) { int diff = dev_priv->rps.max_freq_softlimit - gpu_freq; unsigned int ia_freq = 0, ring_freq = 0;