From patchwork Thu Dec 20 14:16:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 154337 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp6238501ljp; Thu, 20 Dec 2018 06:17:05 -0800 (PST) X-Google-Smtp-Source: AFSGD/W3itDcKezs6yCx8+jKW5CsK+aNUgiQQjTDGbVg9oFqUAgu+sZYCjG8XI2e5pQptT/Y1V+S X-Received: by 2002:a63:9712:: with SMTP id n18mr6693022pge.295.1545315425584; Thu, 20 Dec 2018 06:17:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545315425; cv=none; d=google.com; s=arc-20160816; b=MkwCwoNOr6WAS+enObcfEieFS1g4IKVyTJrAL/Sr3k8gXUA1BoJ7SJAQGuTJoylP8h 5ldm7afHUy8A5Merx0z+Na1BE1oMXMZhC094Y+dDVdVkAl1W4mEsFosdEGrq+HovqNh+ iS8BYiiOSWSLmMuN7E6rWW1z4eD02bPRIY0sB+WYn1B2lkCpepNSWlfuUgltlH+hVRkT PvknR8BoI8fDc+8UWv+YGe+aU/pXBJ7qOcL2oO+vTG6+jRhpYscoQ6QAp5roArScy7Jk K6XXiYofg3xoFQRoh66wT34ul1FYzJYnoFf3psOs/pGgDMH4wIJRFboF5OM/RcgwaYQn pA5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:message-id:date:subject:to:from:delivered-to; bh=ncOdOW+mAjvCcdOVe0mODFnmyK2pHzHh37OOOKZ32Mw=; b=WgaBw6M1HkvFmtxzwv3WYB7ksz1mBE2B5s6fIYSiNRgI7nNWt/QrUb/lomzqyYFIkT OfdEcqfmvTO+zKj8RV5dSLHeqDGktkg0CjjmEiYub0PRESRCWkOoNOQRCMNTxD8yYLCS HkJSW7G1fqC8Q+EAfSBMewiWvrzJXexaEqsWIoKq6OHd4l4RYpGQ5dmU41pyAJE1fdDS 4pfpBsVq8IxQxhI4rWXq6Tm0H4Tmdchn9rBvwN/oQJw/yUEA72hShE6p94W4UUTezbPP TR/8SpGBFR9FAB+F+4KOahF+jsMC/Cne44+/mEsPOsGGKAXeJSUkBYFxQo5Q19DQtnY5 agog== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id n28si19585962pfb.88.2018.12.20.06.17.05 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Dec 2018 06:17:05 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5D19A6F3C7; Thu, 20 Dec 2018 14:17:04 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1DAE96F3C8 for ; Thu, 20 Dec 2018 14:17:03 +0000 (UTC) Received: by mail-wm1-x341.google.com with SMTP id m1so2221184wml.2 for ; Thu, 20 Dec 2018 06:17:03 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=dl0vWZ2OmuLRkr6rXUIz7t6LbyxfogMj8WkEhaEhsA0=; b=DltAS1mCzqBlOinWZcLmffRslEG+f0d7mu/8Ei35nRmEUBqbBVzsYe0zX9E8Ds5+VG HqcYrgK6gYSLyftLWbVDu+Zr+EjKv0chHR7uqtiCU/6XVsvJI50xwOHoqPvomhzNedHw 4RVHGXk+/WGrRhBT+REH1nCg5YJXlPELytrnBaRc6shrRsGMBWz9Sflq3k6Hyr5Vsvoo axOeVAl8cdZIbRp9ARTQm4UY+UqxlFiyDLalsIFnfmNDfV0GsRdkA1eKwcOHAcHwBX1A CIctsOrwpA7n8StDbTWK4PQ3FvKKsvDnmSMxYHFGVoRABtay2frSd/kwVqxl3S3mvs0u UYYQ== X-Gm-Message-State: AA+aEWbYDetpL4TAJiINJLJQKlRtdVhg3ednqHRilCqJGojaTN/JPUsf fIX/QPfhnCw3SbzryA8MKk5GFQ== X-Received: by 2002:a1c:128b:: with SMTP id 133mr12239546wms.22.1545315421678; Thu, 20 Dec 2018 06:17:01 -0800 (PST) Received: from localhost.localdomain ([2a01:e0a:f:6020:f9b3:37c1:b11a:64ce]) by smtp.gmail.com with ESMTPSA id v132sm7855024wme.20.2018.12.20.06.17.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 20 Dec 2018 06:17:00 -0800 (PST) From: Vincent Guittot To: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, rjw@rjwysocki.net, thara.gopinath@linaro.org, jani.nikula@linux.intel.com, joonas.lahtinen@linux.intel.com, rodrigo.vivi@intel.com, airlied@linux.ie, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [PATCH v4 2/3] drm/i915: Move on the new pm runtime interface Date: Thu, 20 Dec 2018 15:16:57 +0100 Message-Id: <1545315417-14483-1-git-send-email-vincent.guittot@linaro.org> X-Mailer: git-send-email 2.7.4 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ulf.hansson@linaro.org, Vincent Guittot MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Use the new pm runtime interface to get the accounted suspended time: pm_runtime_accounted_time_get() Signed-off-by: Vincent Guittot --- drivers/gpu/drm/i915/i915_pmu.c | 16 ++++++---------- drivers/gpu/drm/i915/i915_pmu.h | 4 ++-- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c index d6c8f8f..3f76f60 100644 --- a/drivers/gpu/drm/i915/i915_pmu.c +++ b/drivers/gpu/drm/i915/i915_pmu.c @@ -5,6 +5,7 @@ */ #include +#include #include "i915_pmu.h" #include "intel_ringbuffer.h" #include "i915_drv.h" @@ -478,7 +479,6 @@ static u64 get_rc6(struct drm_i915_private *i915) * counter value. */ spin_lock_irqsave(&i915->pmu.lock, flags); - spin_lock(&kdev->power.lock); /* * After the above branch intel_runtime_pm_get_if_in_use failed @@ -491,16 +491,13 @@ static u64 get_rc6(struct drm_i915_private *i915) * suspended and if not we cannot do better than report the last * known RC6 value. */ - if (kdev->power.runtime_status == RPM_SUSPENDED) { - if (!i915->pmu.sample[__I915_SAMPLE_RC6_ESTIMATED].cur) - i915->pmu.suspended_jiffies_last = - kdev->power.suspended_jiffies; + if (pm_runtime_status_suspended(kdev)) { + val = pm_runtime_suspended_time(kdev); - val = kdev->power.suspended_jiffies - - i915->pmu.suspended_jiffies_last; - val += jiffies - kdev->power.accounting_timestamp; + if (!i915->pmu.sample[__I915_SAMPLE_RC6_ESTIMATED].cur) + i915->pmu.suspended_time_last = val; - val = jiffies_to_nsecs(val); + val -= i915->pmu.suspended_time_last; val += i915->pmu.sample[__I915_SAMPLE_RC6].cur; i915->pmu.sample[__I915_SAMPLE_RC6_ESTIMATED].cur = val; @@ -510,7 +507,6 @@ static u64 get_rc6(struct drm_i915_private *i915) val = i915->pmu.sample[__I915_SAMPLE_RC6].cur; } - spin_unlock(&kdev->power.lock); spin_unlock_irqrestore(&i915->pmu.lock, flags); } diff --git a/drivers/gpu/drm/i915/i915_pmu.h b/drivers/gpu/drm/i915/i915_pmu.h index 7f164ca..3dc2a30 100644 --- a/drivers/gpu/drm/i915/i915_pmu.h +++ b/drivers/gpu/drm/i915/i915_pmu.h @@ -95,9 +95,9 @@ struct i915_pmu { */ struct i915_pmu_sample sample[__I915_NUM_PMU_SAMPLERS]; /** - * @suspended_jiffies_last: Cached suspend time from PM core. + * @suspended_time_last: Cached suspend time from PM core. */ - unsigned long suspended_jiffies_last; + u64 suspended_time_last; /** * @i915_attr: Memory block holding device attributes. */