All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v8 0/4] Add vendor agnostic mechanism to report hardware sleep
@ 2023-04-12 19:49 Mario Limonciello
  2023-04-12 19:49 ` [PATCH v8 1/4] PM: Add sysfs files to represent time spent in hardware sleep state Mario Limonciello
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Mario Limonciello @ 2023-04-12 19:49 UTC (permalink / raw)
  To: Box David E, jstultz, pavel, svenva, platform-driver-x86,
	linux-pm
  Cc: Shyam-sundar.S-k, rrangel, Jain Rajat, hdegoede,
	Mario Limonciello, linux-kernel

An important part of validating that s0ix worked properly is to check how
much of a cycle was spent in a hardware sleep state.

The reporting of hardware sleep is a mix of kernel messages and sysfs
files that vary from vendor to vendor. Collecting this information
requires extra information on the kernel command line or fetching from
debugfs.

To make this information more readily accessible introduce a new file in
suspend_stats that drivers can report into during their resume routine.

Userspace can fetch this information and compare it against the duration
of the cycle to allow determining residency percentages and flagging
problems.

Mario Limonciello (4):
  PM: Add sysfs files to represent time spent in hardware sleep state
  platform/x86/amd: pmc: Report duration of time in hw sleep state
  platform/x86/intel/pmc: core: Always capture counters on suspend
  platform/x86/intel/pmc: core: Report duration of time in HW sleep
    state

 Documentation/ABI/testing/sysfs-power | 29 +++++++++++++
 drivers/platform/x86/amd/pmc.c        |  6 +--
 drivers/platform/x86/intel/pmc/core.c | 16 ++++----
 drivers/platform/x86/intel/pmc/core.h |  2 -
 include/linux/suspend.h               |  8 ++++
 kernel/power/main.c                   | 59 +++++++++++++++++++++------
 6 files changed, 95 insertions(+), 25 deletions(-)


base-commit: 09a9639e56c01c7a00d6c0ca63f4c7c41abe075d
-- 
2.34.1


^ permalink raw reply	[flat|nested] 11+ messages in thread
* Re: [PATCH v8 4/4] platform/x86/intel/pmc: core: Report duration of time in HW sleep state
@ 2023-04-13  1:20 kernel test robot
  0 siblings, 0 replies; 11+ messages in thread
From: kernel test robot @ 2023-04-13  1:20 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp

:::::: 
:::::: Manual check reason: "low confidence static check warning: drivers/platform/x86/intel/pmc/core.c:1156:41: sparse: sparse: shift too big (32) for type unsigned long"
:::::: 

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20230412194917.7164-5-mario.limonciello@amd.com>
References: <20230412194917.7164-5-mario.limonciello@amd.com>
TO: Mario Limonciello <mario.limonciello@amd.com>
TO: Box David E <david.e.box@intel.com>
TO: jstultz@google.com
TO: pavel@ucw.cz
TO: svenva@chromium.org
TO: Rajneesh Bhardwaj <irenic.rajneesh@gmail.com>
CC: Shyam-sundar.S-k@amd.com
CC: rrangel@chromium.org
CC: Jain Rajat <rajatja@google.com>
CC: hdegoede@redhat.com
CC: Mario Limonciello <mario.limonciello@amd.com>
CC: Mark Gross <markgross@kernel.org>
CC: platform-driver-x86@vger.kernel.org
CC: linux-kernel@vger.kernel.org

Hi Mario,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 09a9639e56c01c7a00d6c0ca63f4c7c41abe075d]

url:    https://github.com/intel-lab-lkp/linux/commits/Mario-Limonciello/PM-Add-sysfs-files-to-represent-time-spent-in-hardware-sleep-state/20230413-035220
base:   09a9639e56c01c7a00d6c0ca63f4c7c41abe075d
patch link:    https://lore.kernel.org/r/20230412194917.7164-5-mario.limonciello%40amd.com
patch subject: [PATCH v8 4/4] platform/x86/intel/pmc: core: Report duration of time in HW sleep state
:::::: branch date: 5 hours ago
:::::: commit date: 5 hours ago
config: i386-randconfig-s002 (https://download.01.org/0day-ci/archive/20230413/202304130930.YmSObKSJ-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.4-39-gce1a6720-dirty
        # https://github.com/intel-lab-lkp/linux/commit/315b1dd23cbedfd2848c8ac8ec1f77c3610b955e
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Mario-Limonciello/PM-Add-sysfs-files-to-represent-time-spent-in-hardware-sleep-state/20230413-035220
        git checkout 315b1dd23cbedfd2848c8ac8ec1f77c3610b955e
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=i386 olddefconfig
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=i386 SHELL=/bin/bash drivers/platform/x86/intel/pmc/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/r/202304130930.YmSObKSJ-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> drivers/platform/x86/intel/pmc/core.c:1156:41: sparse: sparse: shift too big (32) for type unsigned long

vim +1156 drivers/platform/x86/intel/pmc/core.c

c9f86d6ca6b5e2 drivers/platform/x86/intel_pmc_core.c David E. Box        2021-04-16  1097  
6c96a78c7b3201 drivers/platform/x86/intel_pmc_core.c Rajat Jain          2019-04-17  1098  static int pmc_core_probe(struct platform_device *pdev)
b740d2e9233cb3 drivers/platform/x86/intel_pmc_core.c Rajneesh Bhardwaj   2016-05-26  1099  {
6c96a78c7b3201 drivers/platform/x86/intel_pmc_core.c Rajat Jain          2019-04-17  1100  	static bool device_initialized;
7dc4dc563dd40c drivers/platform/x86/intel_pmc_core.c David E. Box        2021-04-16  1101  	struct pmc_dev *pmcdev;
b740d2e9233cb3 drivers/platform/x86/intel_pmc_core.c Rajneesh Bhardwaj   2016-05-26  1102  	const struct x86_cpu_id *cpu_id;
284c01b72ac9ca drivers/platform/x86/intel/pmc/core.c Gayatri Kammela     2022-11-14  1103  	void (*core_init)(struct pmc_dev *pmcdev);
745698c37c08f4 drivers/platform/x86/intel_pmc_core.c Srinivas Pandruvada 2018-02-02  1104  	u64 slp_s0_addr;
b740d2e9233cb3 drivers/platform/x86/intel_pmc_core.c Rajneesh Bhardwaj   2016-05-26  1105  
6c96a78c7b3201 drivers/platform/x86/intel_pmc_core.c Rajat Jain          2019-04-17  1106  	if (device_initialized)
6c96a78c7b3201 drivers/platform/x86/intel_pmc_core.c Rajat Jain          2019-04-17  1107  		return -ENODEV;
6c96a78c7b3201 drivers/platform/x86/intel_pmc_core.c Rajat Jain          2019-04-17  1108  
7dc4dc563dd40c drivers/platform/x86/intel_pmc_core.c David E. Box        2021-04-16  1109  	pmcdev = devm_kzalloc(&pdev->dev, sizeof(*pmcdev), GFP_KERNEL);
7dc4dc563dd40c drivers/platform/x86/intel_pmc_core.c David E. Box        2021-04-16  1110  	if (!pmcdev)
7dc4dc563dd40c drivers/platform/x86/intel_pmc_core.c David E. Box        2021-04-16  1111  		return -ENOMEM;
7dc4dc563dd40c drivers/platform/x86/intel_pmc_core.c David E. Box        2021-04-16  1112  
7dc4dc563dd40c drivers/platform/x86/intel_pmc_core.c David E. Box        2021-04-16  1113  	platform_set_drvdata(pdev, pmcdev);
284c01b72ac9ca drivers/platform/x86/intel/pmc/core.c Gayatri Kammela     2022-11-14  1114  	pmcdev->pdev = pdev;
7dc4dc563dd40c drivers/platform/x86/intel_pmc_core.c David E. Box        2021-04-16  1115  
b740d2e9233cb3 drivers/platform/x86/intel_pmc_core.c Rajneesh Bhardwaj   2016-05-26  1116  	cpu_id = x86_match_cpu(intel_pmc_core_ids);
21ae43570940f8 drivers/platform/x86/intel_pmc_core.c Srinivas Pandruvada 2018-01-19  1117  	if (!cpu_id)
21ae43570940f8 drivers/platform/x86/intel_pmc_core.c Srinivas Pandruvada 2018-01-19  1118  		return -ENODEV;
21ae43570940f8 drivers/platform/x86/intel_pmc_core.c Srinivas Pandruvada 2018-01-19  1119  
284c01b72ac9ca drivers/platform/x86/intel/pmc/core.c Gayatri Kammela     2022-11-14  1120  	core_init = (void  (*)(struct pmc_dev *))cpu_id->driver_data;
745698c37c08f4 drivers/platform/x86/intel_pmc_core.c Srinivas Pandruvada 2018-02-02  1121  
661405bd817b20 drivers/platform/x86/intel_pmc_core.c Rajneesh Bhardwaj   2018-02-02  1122  	/*
43e82d8aa92503 drivers/platform/x86/intel_pmc_core.c Gayatri Kammela     2019-11-18  1123  	 * Coffee Lake has CPU ID of Kaby Lake and Cannon Lake PCH. So here
43e82d8aa92503 drivers/platform/x86/intel_pmc_core.c Gayatri Kammela     2019-11-18  1124  	 * Sunrisepoint PCH regmap can't be used. Use Cannon Lake PCH regmap
661405bd817b20 drivers/platform/x86/intel_pmc_core.c Rajneesh Bhardwaj   2018-02-02  1125  	 * in this case.
661405bd817b20 drivers/platform/x86/intel_pmc_core.c Rajneesh Bhardwaj   2018-02-02  1126  	 */
284c01b72ac9ca drivers/platform/x86/intel/pmc/core.c Gayatri Kammela     2022-11-14  1127  	if (core_init == spt_core_init && !pci_dev_present(pmc_pci_ids))
284c01b72ac9ca drivers/platform/x86/intel/pmc/core.c Gayatri Kammela     2022-11-14  1128  		core_init = cnp_core_init;
284c01b72ac9ca drivers/platform/x86/intel/pmc/core.c Gayatri Kammela     2022-11-14  1129  
284c01b72ac9ca drivers/platform/x86/intel/pmc/core.c Gayatri Kammela     2022-11-14  1130  	mutex_init(&pmcdev->lock);
284c01b72ac9ca drivers/platform/x86/intel/pmc/core.c Gayatri Kammela     2022-11-14  1131  	core_init(pmcdev);
284c01b72ac9ca drivers/platform/x86/intel/pmc/core.c Gayatri Kammela     2022-11-14  1132  
661405bd817b20 drivers/platform/x86/intel_pmc_core.c Rajneesh Bhardwaj   2018-02-02  1133  
7d505758b1e556 drivers/platform/x86/intel_pmc_core.c M. Vefa Bicakci     2019-08-15  1134  	if (lpit_read_residency_count_address(&slp_s0_addr)) {
21ae43570940f8 drivers/platform/x86/intel_pmc_core.c Srinivas Pandruvada 2018-01-19  1135  		pmcdev->base_addr = PMC_BASE_ADDR_DEFAULT;
7d505758b1e556 drivers/platform/x86/intel_pmc_core.c M. Vefa Bicakci     2019-08-15  1136  
7d505758b1e556 drivers/platform/x86/intel_pmc_core.c M. Vefa Bicakci     2019-08-15  1137  		if (page_is_ram(PHYS_PFN(pmcdev->base_addr)))
7d505758b1e556 drivers/platform/x86/intel_pmc_core.c M. Vefa Bicakci     2019-08-15  1138  			return -ENODEV;
7d505758b1e556 drivers/platform/x86/intel_pmc_core.c M. Vefa Bicakci     2019-08-15  1139  	} else {
745698c37c08f4 drivers/platform/x86/intel_pmc_core.c Srinivas Pandruvada 2018-02-02  1140  		pmcdev->base_addr = slp_s0_addr - pmcdev->map->slp_s0_offset;
7d505758b1e556 drivers/platform/x86/intel_pmc_core.c M. Vefa Bicakci     2019-08-15  1141  	}
745698c37c08f4 drivers/platform/x86/intel_pmc_core.c Srinivas Pandruvada 2018-02-02  1142  
21ae43570940f8 drivers/platform/x86/intel_pmc_core.c Srinivas Pandruvada 2018-01-19  1143  	pmcdev->regbase = ioremap(pmcdev->base_addr,
21ae43570940f8 drivers/platform/x86/intel_pmc_core.c Srinivas Pandruvada 2018-01-19  1144  				  pmcdev->map->regmap_length);
21ae43570940f8 drivers/platform/x86/intel_pmc_core.c Srinivas Pandruvada 2018-01-19  1145  	if (!pmcdev->regbase)
b740d2e9233cb3 drivers/platform/x86/intel_pmc_core.c Rajneesh Bhardwaj   2016-05-26  1146  		return -ENOMEM;
b740d2e9233cb3 drivers/platform/x86/intel_pmc_core.c Rajneesh Bhardwaj   2016-05-26  1147  
284c01b72ac9ca drivers/platform/x86/intel/pmc/core.c Gayatri Kammela     2022-11-14  1148  	if (pmcdev->core_configure)
284c01b72ac9ca drivers/platform/x86/intel/pmc/core.c Gayatri Kammela     2022-11-14  1149  		pmcdev->core_configure(pmcdev);
428131364f0073 drivers/platform/x86/intel_pmc_core.c Gayatri Kammela     2021-04-16  1150  
7dc4dc563dd40c drivers/platform/x86/intel_pmc_core.c David E. Box        2021-04-16  1151  	pmcdev->pmc_xram_read_bit = pmc_core_check_read_lock_bit(pmcdev);
45b6f75eab6aab drivers/platform/x86/intel_pmc_core.c David E. Box        2021-08-13  1152  	pmc_core_get_low_power_modes(pdev);
c9f86d6ca6b5e2 drivers/platform/x86/intel_pmc_core.c David E. Box        2021-04-16  1153  	pmc_core_do_dmi_quirks(pmcdev);
173943b3dae570 drivers/platform/x86/intel_pmc_core.c Rajneesh Bhardwaj   2016-10-07  1154  
151675540a2f93 drivers/platform/x86/intel_pmc_core.c Greg Kroah-Hartman  2019-06-12  1155  	pmc_core_dbgfs_register(pmcdev);
315b1dd23cbedf drivers/platform/x86/intel/pmc/core.c Mario Limonciello   2023-04-12 @1156  	pm_report_max_hw_sleep(((1UL << 32) - 1) * pmc_core_adjust_slp_s0_step(pmcdev, 1));
b740d2e9233cb3 drivers/platform/x86/intel_pmc_core.c Rajneesh Bhardwaj   2016-05-26  1157  
6c96a78c7b3201 drivers/platform/x86/intel_pmc_core.c Rajat Jain          2019-04-17  1158  	device_initialized = true;
6c96a78c7b3201 drivers/platform/x86/intel_pmc_core.c Rajat Jain          2019-04-17  1159  	dev_info(&pdev->dev, " initialized\n");
6c96a78c7b3201 drivers/platform/x86/intel_pmc_core.c Rajat Jain          2019-04-17  1160  
b740d2e9233cb3 drivers/platform/x86/intel_pmc_core.c Rajneesh Bhardwaj   2016-05-26  1161  	return 0;
b740d2e9233cb3 drivers/platform/x86/intel_pmc_core.c Rajneesh Bhardwaj   2016-05-26  1162  }
b740d2e9233cb3 drivers/platform/x86/intel_pmc_core.c Rajneesh Bhardwaj   2016-05-26  1163  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-04-14  1:59 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-12 19:49 [PATCH v8 0/4] Add vendor agnostic mechanism to report hardware sleep Mario Limonciello
2023-04-12 19:49 ` [PATCH v8 1/4] PM: Add sysfs files to represent time spent in hardware sleep state Mario Limonciello
2023-04-12 19:49 ` [PATCH v8 2/4] platform/x86/amd: pmc: Report duration of time in hw " Mario Limonciello
2023-04-12 19:49 ` [PATCH v8 3/4] platform/x86/intel/pmc: core: Always capture counters on suspend Mario Limonciello
2023-04-12 19:49 ` [PATCH v8 4/4] platform/x86/intel/pmc: core: Report duration of time in HW sleep state Mario Limonciello
2023-04-13  1:50   ` kernel test robot
2023-04-13  9:23   ` Ilpo Järvinen
2023-04-13 22:40     ` Limonciello, Mario
2023-04-14  0:35       ` David E. Box
2023-04-14  1:58   ` kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2023-04-13  1:20 kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.