Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754207AbdFWDMH convert rfc822-to-8bit (ORCPT ); Thu, 22 Jun 2017 23:12:07 -0400 Received: from mga04.intel.com ([192.55.52.120]:15914 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753925AbdFWDMF (ORCPT ); Thu, 22 Jun 2017 23:12:05 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.39,376,1493708400"; d="scan'208";a="117851438" From: "Chakravarty, Souvik K" To: "Bhardwaj, Rajneesh" , "platform-driver-x86@vger.kernel.org" CC: "dvhart@infradead.org" , "andy@infradead.org" , "linux-kernel@vger.kernel.org" , "Murthy, Shanth" Subject: RE: [PATCH] x86/intel_telemetry: Add debugfs entry for S0ix residency Thread-Topic: [PATCH] x86/intel_telemetry: Add debugfs entry for S0ix residency Thread-Index: AQHS611cJfV1UfM7OkywL5X5kN5TfaIxw4hg Date: Fri, 23 Jun 2017 03:12:00 +0000 Message-ID: <5F7315E704FA0841B5DFCE90329B2BB462E8C986@BGSMSX102.gar.corp.intel.com> References: <1498138918-30544-1-git-send-email-rajneesh.bhardwaj@intel.com> In-Reply-To: <1498138918-30544-1-git-send-email-rajneesh.bhardwaj@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 10.0.102.7 dlp-reaction: no-action x-originating-ip: [10.223.10.10] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2457 Lines: 76 Seems to be an useful data to provide. +1 from me. > -----Original Message----- > From: Bhardwaj, Rajneesh > Sent: Thursday, June 22, 2017 7:12 PM > To: platform-driver-x86@vger.kernel.org > Cc: dvhart@infradead.org; andy@infradead.org; linux- > kernel@vger.kernel.org; Murthy, Shanth ; > Chakravarty, Souvik K ; Bhardwaj, > Rajneesh > Subject: [PATCH] x86/intel_telemetry: Add debugfs entry for S0ix residency > > This adds a debugfs consumer for the exported kernel API > intel_pmc_read_s0ix_residency. This debugfs entry reads S0ix residency > directly from the PMC hardware counters. > > TEST: > - echo freeze > /sys/power/state > - Wake the system, read the S0ix residency i.e. > cat /sys/kernel/debug/telemetry/s0ix_residency_usec > > Signed-off-by: Shanth Murthy > Signed-off-by: Rajneesh Bhardwaj > --- > drivers/platform/x86/intel_telemetry_debugfs.c | 26 > ++++++++++++++++++++++++++ > 1 file changed, 26 insertions(+) > > diff --git a/drivers/platform/x86/intel_telemetry_debugfs.c > b/drivers/platform/x86/intel_telemetry_debugfs.c > index efc0140..2eacb16 100644 > --- a/drivers/platform/x86/intel_telemetry_debugfs.c > +++ b/drivers/platform/x86/intel_telemetry_debugfs.c > @@ -713,6 +713,24 @@ static int telem_soc_state_open(struct inode > *inode, struct file *file) > .release = single_release, > }; > > +static int telem_s0ix_res_get(void *data, u64 *val) { > + u64 s0ix_total_res = 0; > + int ret; > + > + ret = intel_pmc_s0ix_counter_read(&s0ix_total_res); > + if (ret) { > + pr_err("Failed to read S0ix residency"); > + return ret; > + } > + > + *val = s0ix_total_res; > + > + return 0; > +} > + > +DEFINE_DEBUGFS_ATTRIBUTE(telem_s0ix_fops, telem_s0ix_res_get, NULL, > +"%llu\n"); > + > static int telem_pss_trc_verb_show(struct seq_file *s, void *unused) { > u32 verbosity; > @@ -994,6 +1012,14 @@ static int __init telemetry_debugfs_init(void) > goto out; > } > > + f = debugfs_create_file("s0ix_residency_usec", S_IFREG | S_IRUGO, > + debugfs_conf->telemetry_dbg_dir, > + NULL, &telem_s0ix_fops); > + if (!f) { > + pr_err("s0ix_residency_us debugfs register failed\n"); > + goto out; > + } > + > f = debugfs_create_file("pss_trace_verbosity", S_IFREG | S_IRUGO, > debugfs_conf->telemetry_dbg_dir, NULL, > &telem_pss_trc_verb_ops); > -- > 1.9.1