From patchwork Sat Feb 18 11:27:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 9581047 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2082C600F6 for ; Sat, 18 Feb 2017 11:27:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0A25A27F9A for ; Sat, 18 Feb 2017 11:27:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F30E72811E; Sat, 18 Feb 2017 11:27:16 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID 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 82D4327F9A for ; Sat, 18 Feb 2017 11:27:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3F4896E001; Sat, 18 Feb 2017 11:27:15 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm0-x241.google.com (mail-wm0-x241.google.com [IPv6:2a00:1450:400c:c09::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id B8E2B6E001 for ; Sat, 18 Feb 2017 11:27:13 +0000 (UTC) Received: by mail-wm0-x241.google.com with SMTP id r18so6514354wmd.3 for ; Sat, 18 Feb 2017 03:27:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id; bh=U8C7PIig/ACWYPLCL7Nx6CcR64o9op7jzBleNaeB+aA=; b=rITzuZZh8Kq45FW0jZiedj9iUWPYDQLgJrK0ASLRatCtqI7YmxhCPcUyVGMrlegVXw U8xYDG+MfmWMBl7uV5Btwo4k3k9ogqnGrTwfTONvvcZ+o9m6dl5SlfrnUzHEnlO/9Le3 6+6Dpn44qtEMtewF2fCwDKEoUxlug2ygf4nK92QXT/AGLZYcPdxpfXLFXpyyAqVYDS6k Fq5vNQozP3PoaeKBoZX3mxEf0nWtAV6jWNCcgE9H4dYks8jZSj8Y0L2y0zzRSjhdM90B 05UWDQISqlR7D4K6mXduEtXpbxdnIi92/drB07OCOptIakuI5RWUfUP7wnWXj/hZ0s1f 1xrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=U8C7PIig/ACWYPLCL7Nx6CcR64o9op7jzBleNaeB+aA=; b=L06gNIEr6Zb5ngtWlSew7zXZced+GXrygVFcvTKYpm2ea0tI4o4qljeCZ2O8OSBJEm mMW5NzMCFJKxjV6sNLm+wi9U2PRNstfNeT0VETE2shhs9usxQuoht7XuRYk4bHIVS8/5 aCZIcBI6KkFuKtSmb0Fa101jixshgyPA/5t0DJVAqjy++RMNWF4eIOn2tWSnyasor/GI ATU7QVGx9gPMcwJk1My+kEdLsO1fq/y/X2G/0Hv8YfNerC/21xTPT51JiP9PXfCslOUW GWszbPfoiZ43hcCk0EofttUhHsRz3WKW5yacip7Z0woLTM1Aa/GWsAAFMfmWNqtSlvxK f9fw== X-Gm-Message-State: AMke39nu10V8gpYcUCbUAfCDLBDcQkqfNIQSNJ67/LKSAvowGis3TNGmdjrR1VFiqV7ihQ== X-Received: by 10.28.157.70 with SMTP id g67mr8451387wme.111.1487417232132; Sat, 18 Feb 2017 03:27:12 -0800 (PST) Received: from haswell.alporthouse.com ([78.156.65.138]) by smtp.gmail.com with ESMTPSA id c57sm9640315wra.47.2017.02.18.03.27.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 18 Feb 2017 03:27:11 -0800 (PST) From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Sat, 18 Feb 2017 11:27:08 +0000 Message-Id: <20170218112708.24504-1-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.11.0 Subject: [Intel-gfx] [PATCH] drm/i915: Prevent divide-by-zero in debugfs/i915_rps_boost_info X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 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-Virus-Scanned: ClamAV using ClamSMTP Either by chance, or by misread, the current evaluation interval may be zero. If that is the case, don't divide by it! Signed-off-by: Chris Wilson Reviewed-by: Radoslaw Szwichtenberg --- drivers/gpu/drm/i915/i915_debugfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 124213a36b4f..c0bc922fe497 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c @@ -2367,10 +2367,10 @@ static int i915_rps_boost_info(struct seq_file *m, void *data) seq_printf(m, "\nRPS Autotuning (current \"%s\" window):\n", rps_power_to_str(dev_priv->rps.power)); seq_printf(m, " Avg. up: %d%% [above threshold? %d%%]\n", - 100 * rpup / rpupei, + rpup && rpupei ? 100 * rpup / rpupei : 0, dev_priv->rps.up_threshold); seq_printf(m, " Avg. down: %d%% [below threshold? %d%%]\n", - 100 * rpdown / rpdownei, + rpdown && rpdownei ? 100 * rpdown / rpdownei : 0, dev_priv->rps.down_threshold); } else { seq_puts(m, "\nRPS Autotuning inactive\n");