From: Souvik Kumar Chakravarty <souvik.k.chakravarty@intel.com>
To: platform-driver-x86@vger.kernel.org
Cc: dvhart@infradead.org, andy@infradead.org,
linux-kernel@vger.kernel.org, rajneesh.bhardwaj@intel.com,
Souvik Kumar Chakravarty <souvik.k.chakravarty@intel.com>
Subject: [PATCH v3 2/4] platform/x86: intel_telemetry: Fix suspend stats
Date: Fri, 24 Nov 2017 19:04:42 +0530 [thread overview]
Message-ID: <1511530484-29845-3-git-send-email-souvik.k.chakravarty@intel.com> (raw)
In-Reply-To: <1511530484-29845-1-git-send-email-souvik.k.chakravarty@intel.com>
Suspend stats are not reported consistently due to a limitation in the PMC
firmware. This limitation causes a delay in updating the s0ix counters and
residencies in the telemetry log upon s0ix exit. As a consequence, reading
these counters from the suspend-exit notifier may result in zero read.
This patch fixes this issue by cross-verifying the s0ix residencies from
the GCR TELEM registers in case the counters are not incremented in the
telemetry log after suspend.
This fixes https://bugzilla.kernel.org/show_bug.cgi?id=197833
Reported-and-tested-by: Rajneesh Bhardwaj <rajneesh.bhardwaj@intel.com>
Signed-off-by: Souvik Kumar Chakravarty <souvik.k.chakravarty@intel.com>
---
drivers/platform/x86/intel_telemetry_debugfs.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
Changes since v2:
* Use pmc_ipc_gcr_read64() API to read 64-bits at a time
* Re-introduce the static qualifier to handle the case where the telemetry
suspend/resume log does not contain the s0ix residencies. In that case,
we would like to retain the values from the previous/initial cycle.
Changes since v1:
* Use pmc_ipc_gcr_readq API to read 64-bits at a time
diff --git a/drivers/platform/x86/intel_telemetry_debugfs.c b/drivers/platform/x86/intel_telemetry_debugfs.c
index 4249e826..5bc4f20 100644
--- a/drivers/platform/x86/intel_telemetry_debugfs.c
+++ b/drivers/platform/x86/intel_telemetry_debugfs.c
@@ -890,6 +890,31 @@ static int pm_suspend_exit_cb(void)
goto out;
}
+ /*
+ * Due to some design limitations in the firmware, sometimes the
+ * counters do not get updated by the time we reach here. As a
+ * workaround, we try to see if this was a genuine case of sleep
+ * failure or not by cross-checking from PMC GCR registers directly.
+ */
+ if (suspend_shlw_ctr_exit == suspend_shlw_ctr_temp &&
+ suspend_deep_ctr_exit == suspend_deep_ctr_temp) {
+ ret = intel_pmc_gcr_read64(PMC_GCR_TELEM_SHLW_S0IX_REG,
+ &suspend_shlw_res_exit);
+ if (ret < 0)
+ goto out;
+
+ ret = intel_pmc_gcr_read64(PMC_GCR_TELEM_DEEP_S0IX_REG,
+ &suspend_deep_res_exit);
+ if (ret < 0)
+ goto out;
+
+ if (suspend_shlw_res_exit > suspend_shlw_res_temp)
+ suspend_shlw_ctr_exit++;
+
+ if (suspend_deep_res_exit > suspend_deep_res_temp)
+ suspend_deep_ctr_exit++;
+ }
+
suspend_shlw_ctr_exit -= suspend_shlw_ctr_temp;
suspend_deep_ctr_exit -= suspend_deep_ctr_temp;
suspend_shlw_res_exit -= suspend_shlw_res_temp;
--
2.7.4
next prev parent reply other threads:[~2017-11-24 5:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-24 13:34 [PATCH v3 0/4] platform/x86: intel_telemetry: Fix logs and formatting Souvik Kumar Chakravarty
2017-11-24 13:34 ` [PATCH v1 1/4] platform/x86: intel_pmc_ipc: Add read64 API Souvik Kumar Chakravarty
2017-11-24 13:34 ` Souvik Kumar Chakravarty [this message]
2017-11-24 13:34 ` [PATCH v2 3/4] platform/x86: intel_telemetry: Improve S0ix logs Souvik Kumar Chakravarty
2017-11-24 13:34 ` [PATCH v2 4/4] platform/x86: intel_telemetry: Remove redundancies Souvik Kumar Chakravarty
2017-11-24 20:55 ` [PATCH v3 0/4] platform/x86: intel_telemetry: Fix logs and formatting Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1511530484-29845-3-git-send-email-souvik.k.chakravarty@intel.com \
--to=souvik.k.chakravarty@intel.com \
--cc=andy@infradead.org \
--cc=dvhart@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
--cc=rajneesh.bhardwaj@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).