Message ID | 20230412194917.7164-5-mario.limonciello@amd.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp571688vqo; Wed, 12 Apr 2023 13:02:05 -0700 (PDT) X-Google-Smtp-Source: AKy350bk2c7wHTCLdjPmW813ArdHEnN2kpP9AJuHBTMz46n8axv0j5beT31xuSSGjZffukB7ttAV X-Received: by 2002:a05:6a00:14cc:b0:627:ea2c:ad9c with SMTP id w12-20020a056a0014cc00b00627ea2cad9cmr172723pfu.9.1681329725658; Wed, 12 Apr 2023 13:02:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1681329725; cv=pass; d=google.com; s=arc-20160816; b=OpVfbXsItS1UF1OhsVPLrOwKCgRPoxCSLrnSvGfFXH0/9ROzjmWaUuTow97Bn7V9eC LCUgUt1/g0g3qTM1LciuXOIKUMpN3/NZU6/HX4+ehbpc2hPQlzseGJ5KDSdjLQtxeBzp uFqKbwNuaPQtp7f1OaC3WcynZbONq3YJHjirw+EF3iqL8Uvw/WnyJURisDgrXiHd2q+Y DllmUky/AuNiNil+20hrOge0mIcm2rLI6K6bkFzfUjdLGeAe0bNdQEr3/nYvGI7syImw Ogiw25JWiNad41DZpoa1DyHZR1th7v5PPFBUygTfYQhkxcY86ESdqveBG/o7K2c2Dp+l 3hdA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=fCQus717f+zD9JKyXeRkEq1zVYd+Ada2Q2y6ruMT/bM=; b=gyEDnrtueQS8+MjMS5a46KgP4MZ20PZU99j651zoffctTYfbAfdV4yGaVZFnH6HIxM m7LJ+OTNqf+grSUpz01sUupGp0vwTVwAZi0xu5GNEHyJdhu7e5qh9D7Qa2tyGfC2et/S Wbbx5Vr/1gs3pcCbUT67yDzGWhgHMG3cXo+fjtFpXVHxdRGbTCgByNQLm/tev07pwIzN KRVixULDei8T2u/aB9+PqC1c1ExKxVToHU3UQKMd6elbGi8LUzEz2K5zJyrUPDX8zcdR C76TuJeEaFl1ewoVs7e0mZAzDfvU9DbxM3TBW8/oRbTIEfkrtqK+qesQrAv9pK3XJ+ol yLNA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="frrmy33/"; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w79-20020a627b52000000b0063517dd1b47si11364991pfc.128.2023.04.12.13.01.52; Wed, 12 Apr 2023 13:02:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="frrmy33/"; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230215AbjDLTuS (ORCPT <rfc822;peter110.wang@gmail.com> + 99 others); Wed, 12 Apr 2023 15:50:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230176AbjDLTtr (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 12 Apr 2023 15:49:47 -0400 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2047.outbound.protection.outlook.com [40.107.212.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 079F17A80; Wed, 12 Apr 2023 12:49:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M4oLoyt2UJuFINE6kDcpyJTpWDJy0rwhIx1JRZunDerfSoYKk/l80JVMMj6aVW/bx+i9goX2BjpnjN15Ya1DdwuGWfuRG/pVEfGI5HqXAbHkdObeIvYXJb/Ez/qnXpKcZpLeepeW30fpNeoqRbh7AMCMWs/QXgZorLVEfTg61+KvQO+A3hq5KqrKR204N7752LICrAAUS1LZK1LmaNfjdRDpEQmtSip33QBTjAdFxKy89Sv/diJYPDS8pI4MkiFqJODcw6NKsqk/9R/ZjBTp8F50re6OelD2HzYKW0smxA7Hx6iXdqQri6e/3O+2SXd+7SOe4bqTjBi42UIsI0Snlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=fCQus717f+zD9JKyXeRkEq1zVYd+Ada2Q2y6ruMT/bM=; b=PL6lgA/epwI+F+Bpr/JRRsgeaOoBAu6YeVuFfVK5d3QQjr0Dt2BKhExOCuSOVab2PSqDRWQ9O2FfRutda3pIc8Tj/6xY92GXfe0g9BAmeS2aOkbQw2D/I+9GGIO+2q2Ye2zIU1pRdoSXBjFemqYM9dfBczwxYNY6/CZ72H2jLS9Z5yn+3seu2VOlmOo7Ri/BX5i9I59NHJiuL1e6D3pVMpuJRjAxy+hzRtLCCsGH9VZMWHBsAi/zt5yHRd2ZA6YZWPpDmysAVPXQ6U10+dOpxmSYzmwv6zRwzLyjWHsN6LfvsaMbpzdiAlDwAKEiigRyGlLfGnkFuulJavJek4RbLA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fCQus717f+zD9JKyXeRkEq1zVYd+Ada2Q2y6ruMT/bM=; b=frrmy33/ySyssOSk7hUZkk7Ge3eHXY6Bg1VuGVBIu9coc1nx7A0viGl368CBvsI5HP27i3UeZcJuS705Hh/a+2CgwUTrqXmLvOolUqBSav2yiYY2EBv7vJsF6Ga6BUrjdxdEKM4HxFwZW451c1wSlE1pTw1pOYIcgt9TR9Y5zoQ= Received: from DM6PR06CA0064.namprd06.prod.outlook.com (2603:10b6:5:54::41) by SA1PR12MB6728.namprd12.prod.outlook.com (2603:10b6:806:257::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.37; Wed, 12 Apr 2023 19:49:39 +0000 Received: from DM6NAM11FT070.eop-nam11.prod.protection.outlook.com (2603:10b6:5:54:cafe::fe) by DM6PR06CA0064.outlook.office365.com (2603:10b6:5:54::41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.30 via Frontend Transport; Wed, 12 Apr 2023 19:49:39 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT070.mail.protection.outlook.com (10.13.173.51) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6298.31 via Frontend Transport; Wed, 12 Apr 2023 19:49:39 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 12 Apr 2023 14:49:37 -0500 From: Mario Limonciello <mario.limonciello@amd.com> To: Box David E <david.e.box@intel.com>, <jstultz@google.com>, <pavel@ucw.cz>, <svenva@chromium.org>, Rajneesh Bhardwaj <irenic.rajneesh@gmail.com> CC: <Shyam-sundar.S-k@amd.com>, <rrangel@chromium.org>, Jain Rajat <rajatja@google.com>, <hdegoede@redhat.com>, Mario Limonciello <mario.limonciello@amd.com>, Mark Gross <markgross@kernel.org>, <platform-driver-x86@vger.kernel.org>, <linux-kernel@vger.kernel.org> Subject: [PATCH v8 4/4] platform/x86/intel/pmc: core: Report duration of time in HW sleep state Date: Wed, 12 Apr 2023 14:49:16 -0500 Message-ID: <20230412194917.7164-5-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230412194917.7164-1-mario.limonciello@amd.com> References: <20230412194917.7164-1-mario.limonciello@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT070:EE_|SA1PR12MB6728:EE_ X-MS-Office365-Filtering-Correlation-Id: fdaa4028-c203-4f7f-3513-08db3b8f0d61 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: A6e6vmHmhVjIOtQWlj2HwOOzIe+7faWuATD+cK30c2digTrLKROlstuX3SNxX/2CY+6iR7IhMSzF7VZSBqgzW00Pac6ckzBayGy8WSytFyAg1fU0kb6ck1XwSUKH4j2Im6BU+Lx79SLsFn/fhPHx+JrXZV09cTHpoiEXcHqepXHwKTLbdIWNwXlzHgSdbL3Buhq2imHzfObFBoGZPZxuZclgU5rI4vR2XJD1+3K7Jq6VoLBgJ/oN09aKLTvaJDDiFIMCwogUg+DZ9idlByTrq4tuE2P79EF7rTvXytenrXY+IA6ohAWds4DS6jtirpqe87D+e0tqGgx8gxudNeBXUxi4Fh7xbgiDNwEauYSB9YPenJV+NRhQ/BYA7li49Aei+zdZjIFlbGFYNX4Auo8gsJORBJe/0c5PVNJFF97Y+hkYjMaTmiOD3UnQhwhK2F9jEOB56qEZhtnyWqtpH2nNmX+qy0SjayA6j4UMKBhd8qXswK1ziqZ+YH4t+OTzz4AdPnUOVABEyGW9cprM4NWYFNhIlaLfYLpLwIl0XKITr1U8WX/D5LXQZBTQEUtjIXLRufr7AzzHFpFLfpS8DnEphCB8F+kYzL1XSeZ5BEeyoqTKooOPoKE8r+mdUWcGycsSR5j9rzS37eYZT517kpjdksnxjJRUZDUhIc/gEi7s9zrSZYIXiiVJVuACkwWi5tazKWR2rFbMmPM95Gm5jiqYJWYWMZElEeUonPSM90gVpS0= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(136003)(39860400002)(396003)(376002)(346002)(451199021)(46966006)(36840700001)(40470700004)(40460700003)(8676002)(70206006)(41300700001)(54906003)(70586007)(7696005)(478600001)(4326008)(110136005)(316002)(36756003)(86362001)(83380400001)(426003)(47076005)(336012)(1076003)(26005)(6666004)(2616005)(5660300002)(2906002)(8936002)(44832011)(7416002)(82310400005)(40480700001)(356005)(82740400003)(81166007)(16526019)(186003)(36860700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Apr 2023 19:49:39.3112 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fdaa4028-c203-4f7f-3513-08db3b8f0d61 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT070.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB6728 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763001998522853830?= X-GMAIL-MSGID: =?utf-8?q?1763001998522853830?= |
Series |
Add vendor agnostic mechanism to report hardware sleep
|
|
Commit Message
Mario Limonciello
April 12, 2023, 7:49 p.m. UTC
intel_pmc_core displays a warning when the module parameter
`warn_on_s0ix_failures` is set and a suspend didn't get to a HW sleep
state.
Report this to the standard kernel reporting infrastructure so that
userspace software can query after the suspend cycle is done.
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
v7->v8:
* Report max sleep as well
---
drivers/platform/x86/intel/pmc/core.c | 3 +++
1 file changed, 3 insertions(+)
Comments
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 config: i386-randconfig-a004-20230410 (https://download.01.org/0day-ci/archive/20230413/202304130908.LOiMWRYR-lkp@intel.com/config) compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # 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 COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 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/oe-kbuild-all/202304130908.LOiMWRYR-lkp@intel.com/ All warnings (new ones prefixed by >>): >> drivers/platform/x86/intel/pmc/core.c:1156:31: warning: shift count >= width of type [-Wshift-count-overflow] pm_report_max_hw_sleep(((1UL << 32) - 1) * pmc_core_adjust_slp_s0_step(pmcdev, 1)); ^ ~~ 1 warning generated. vim +1156 drivers/platform/x86/intel/pmc/core.c 1097 1098 static int pmc_core_probe(struct platform_device *pdev) 1099 { 1100 static bool device_initialized; 1101 struct pmc_dev *pmcdev; 1102 const struct x86_cpu_id *cpu_id; 1103 void (*core_init)(struct pmc_dev *pmcdev); 1104 u64 slp_s0_addr; 1105 1106 if (device_initialized) 1107 return -ENODEV; 1108 1109 pmcdev = devm_kzalloc(&pdev->dev, sizeof(*pmcdev), GFP_KERNEL); 1110 if (!pmcdev) 1111 return -ENOMEM; 1112 1113 platform_set_drvdata(pdev, pmcdev); 1114 pmcdev->pdev = pdev; 1115 1116 cpu_id = x86_match_cpu(intel_pmc_core_ids); 1117 if (!cpu_id) 1118 return -ENODEV; 1119 1120 core_init = (void (*)(struct pmc_dev *))cpu_id->driver_data; 1121 1122 /* 1123 * Coffee Lake has CPU ID of Kaby Lake and Cannon Lake PCH. So here 1124 * Sunrisepoint PCH regmap can't be used. Use Cannon Lake PCH regmap 1125 * in this case. 1126 */ 1127 if (core_init == spt_core_init && !pci_dev_present(pmc_pci_ids)) 1128 core_init = cnp_core_init; 1129 1130 mutex_init(&pmcdev->lock); 1131 core_init(pmcdev); 1132 1133 1134 if (lpit_read_residency_count_address(&slp_s0_addr)) { 1135 pmcdev->base_addr = PMC_BASE_ADDR_DEFAULT; 1136 1137 if (page_is_ram(PHYS_PFN(pmcdev->base_addr))) 1138 return -ENODEV; 1139 } else { 1140 pmcdev->base_addr = slp_s0_addr - pmcdev->map->slp_s0_offset; 1141 } 1142 1143 pmcdev->regbase = ioremap(pmcdev->base_addr, 1144 pmcdev->map->regmap_length); 1145 if (!pmcdev->regbase) 1146 return -ENOMEM; 1147 1148 if (pmcdev->core_configure) 1149 pmcdev->core_configure(pmcdev); 1150 1151 pmcdev->pmc_xram_read_bit = pmc_core_check_read_lock_bit(pmcdev); 1152 pmc_core_get_low_power_modes(pdev); 1153 pmc_core_do_dmi_quirks(pmcdev); 1154 1155 pmc_core_dbgfs_register(pmcdev); > 1156 pm_report_max_hw_sleep(((1UL << 32) - 1) * pmc_core_adjust_slp_s0_step(pmcdev, 1)); 1157 1158 device_initialized = true; 1159 dev_info(&pdev->dev, " initialized\n"); 1160 1161 return 0; 1162 } 1163
On Wed, 12 Apr 2023, Mario Limonciello wrote: > intel_pmc_core displays a warning when the module parameter > `warn_on_s0ix_failures` is set and a suspend didn't get to a HW sleep > state. > > Report this to the standard kernel reporting infrastructure so that > userspace software can query after the suspend cycle is done. > > Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> > --- > v7->v8: > * Report max sleep as well > --- > drivers/platform/x86/intel/pmc/core.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/platform/x86/intel/pmc/core.c b/drivers/platform/x86/intel/pmc/core.c > index 925c5d676a43..f9677104353d 100644 > --- a/drivers/platform/x86/intel/pmc/core.c > +++ b/drivers/platform/x86/intel/pmc/core.c > @@ -1153,6 +1153,7 @@ static int pmc_core_probe(struct platform_device *pdev) > pmc_core_do_dmi_quirks(pmcdev); > > pmc_core_dbgfs_register(pmcdev); > + pm_report_max_hw_sleep(((1UL << 32) - 1) * pmc_core_adjust_slp_s0_step(pmcdev, 1)); Technically this is FIELD_MAX(SLP_S0_RES_COUNTER_MASK) * pmc_core_adjust...? Where the define is: #define SLP_S0_RES_COUNTER_MASK GENMASK(31, 0) > > device_initialized = true; > dev_info(&pdev->dev, " initialized\n"); > @@ -1214,6 +1215,8 @@ static inline bool pmc_core_is_s0ix_failed(struct pmc_dev *pmcdev) > if (pmc_core_dev_state_get(pmcdev, &s0ix_counter)) > return false; > > + pm_report_hw_sleep_time((u32)(s0ix_counter - pmcdev->s0ix_counter)); > + > if (s0ix_counter == pmcdev->s0ix_counter) > return true; > >
[Public] > -----Original Message----- > From: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> > Sent: Thursday, April 13, 2023 04:24 > To: Limonciello, Mario <Mario.Limonciello@amd.com> > Cc: Box David E <david.e.box@intel.com>; jstultz@google.com; > pavel@ucw.cz; svenva@chromium.org; Rajneesh Bhardwaj > <irenic.rajneesh@gmail.com>; S-k, Shyam-sundar <Shyam-sundar.S- > k@amd.com>; rrangel@chromium.org; Jain Rajat <rajatja@google.com>; > hdegoede@redhat.com; Mark Gross <markgross@kernel.org>; platform- > driver-x86@vger.kernel.org; LKML <linux-kernel@vger.kernel.org> > Subject: Re: [PATCH v8 4/4] platform/x86/intel/pmc: core: Report duration of > time in HW sleep state > > On Wed, 12 Apr 2023, Mario Limonciello wrote: > > > intel_pmc_core displays a warning when the module parameter > > `warn_on_s0ix_failures` is set and a suspend didn't get to a HW sleep > > state. > > > > Report this to the standard kernel reporting infrastructure so that > > userspace software can query after the suspend cycle is done. > > > > Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> > > --- > > v7->v8: > > * Report max sleep as well > > --- > > drivers/platform/x86/intel/pmc/core.c | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/drivers/platform/x86/intel/pmc/core.c > b/drivers/platform/x86/intel/pmc/core.c > > index 925c5d676a43..f9677104353d 100644 > > --- a/drivers/platform/x86/intel/pmc/core.c > > +++ b/drivers/platform/x86/intel/pmc/core.c > > @@ -1153,6 +1153,7 @@ static int pmc_core_probe(struct platform_device > *pdev) > > pmc_core_do_dmi_quirks(pmcdev); > > > > pmc_core_dbgfs_register(pmcdev); > > + pm_report_max_hw_sleep(((1UL << 32) - 1) * > pmc_core_adjust_slp_s0_step(pmcdev, 1)); > > Technically this is FIELD_MAX(SLP_S0_RES_COUNTER_MASK) * > pmc_core_adjust...? > Where the define is: > #define SLP_S0_RES_COUNTER_MASK GENMASK(31, 0) That's fine by me to switch it over, it certainly makes it a lot more readable. I took the value from @Box David E to use suggested in v7, so what are your thoughts? The current version has an overflow error reported by the robot for i386, so it definitely needs some sort of change. > > > > > device_initialized = true; > > dev_info(&pdev->dev, " initialized\n"); > > @@ -1214,6 +1215,8 @@ static inline bool pmc_core_is_s0ix_failed(struct > pmc_dev *pmcdev) > > if (pmc_core_dev_state_get(pmcdev, &s0ix_counter)) > > return false; > > > > + pm_report_hw_sleep_time((u32)(s0ix_counter - pmcdev- > >s0ix_counter)); > > + > > if (s0ix_counter == pmcdev->s0ix_counter) > > return true; > > > > > > -- > i.
On Thu, 2023-04-13 at 22:40 +0000, Limonciello, Mario wrote: > [Public] > > > > > -----Original Message----- > > From: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> > > Sent: Thursday, April 13, 2023 04:24 > > To: Limonciello, Mario <Mario.Limonciello@amd.com> > > Cc: Box David E <david.e.box@intel.com>; jstultz@google.com; > > pavel@ucw.cz; svenva@chromium.org; Rajneesh Bhardwaj > > <irenic.rajneesh@gmail.com>; S-k, Shyam-sundar <Shyam-sundar.S- > > k@amd.com>; rrangel@chromium.org; Jain Rajat <rajatja@google.com>; > > hdegoede@redhat.com; Mark Gross <markgross@kernel.org>; platform- > > driver-x86@vger.kernel.org; LKML <linux-kernel@vger.kernel.org> > > Subject: Re: [PATCH v8 4/4] platform/x86/intel/pmc: core: Report duration of > > time in HW sleep state > > > > On Wed, 12 Apr 2023, Mario Limonciello wrote: > > > > > intel_pmc_core displays a warning when the module parameter > > > `warn_on_s0ix_failures` is set and a suspend didn't get to a HW sleep > > > state. > > > > > > Report this to the standard kernel reporting infrastructure so that > > > userspace software can query after the suspend cycle is done. > > > > > > Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> > > > --- > > > v7->v8: > > > * Report max sleep as well > > > --- > > > drivers/platform/x86/intel/pmc/core.c | 3 +++ > > > 1 file changed, 3 insertions(+) > > > > > > diff --git a/drivers/platform/x86/intel/pmc/core.c > > b/drivers/platform/x86/intel/pmc/core.c > > > index 925c5d676a43..f9677104353d 100644 > > > --- a/drivers/platform/x86/intel/pmc/core.c > > > +++ b/drivers/platform/x86/intel/pmc/core.c > > > @@ -1153,6 +1153,7 @@ static int pmc_core_probe(struct platform_device > > *pdev) > > > pmc_core_do_dmi_quirks(pmcdev); > > > > > > pmc_core_dbgfs_register(pmcdev); > > > + pm_report_max_hw_sleep(((1UL << 32) - 1) * > > pmc_core_adjust_slp_s0_step(pmcdev, 1)); > > > > Technically this is FIELD_MAX(SLP_S0_RES_COUNTER_MASK) * > > pmc_core_adjust...? > > Where the define is: > > #define SLP_S0_RES_COUNTER_MASK GENMASK(31, 0) > > That's fine by me to switch it over, it certainly makes it a lot more > readable. > I took the value from @Box David E to use suggested in v7, so what are your > thoughts? Ilpo's suggestion is preferable. The warning comes from using 1UL, long being 4 bytes on i386. > > The current version has an overflow error reported by the robot for i386, so > it > definitely needs some sort of change. Resolved by using the macro. With Ilpo's suggestion you can add my reviewed by. Thanks. David > > > > > > > > > device_initialized = true; > > > dev_info(&pdev->dev, " initialized\n"); > > > @@ -1214,6 +1215,8 @@ static inline bool pmc_core_is_s0ix_failed(struct > > pmc_dev *pmcdev) > > > if (pmc_core_dev_state_get(pmcdev, &s0ix_counter)) > > > return false; > > > > > > + pm_report_hw_sleep_time((u32)(s0ix_counter - pmcdev- > > > s0ix_counter)); > > > + > > > if (s0ix_counter == pmcdev->s0ix_counter) > > > return true; > > > > > > > > > > -- > > i.
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 config: i386-randconfig-a001 (https://download.01.org/0day-ci/archive/20230414/202304140957.hkvWzLzM-lkp@intel.com/config) compiler: gcc-11 (Debian 11.3.0-8) 11.3.0 reproduce (this is a W=1 build): # 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 O=build_dir ARCH=i386 olddefconfig make W=1 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/oe-kbuild-all/202304140957.hkvWzLzM-lkp@intel.com/ All warnings (new ones prefixed by >>): drivers/platform/x86/intel/pmc/core.c: In function 'pmc_core_probe': >> drivers/platform/x86/intel/pmc/core.c:1156:38: warning: left shift count >= width of type [-Wshift-count-overflow] 1156 | pm_report_max_hw_sleep(((1UL << 32) - 1) * pmc_core_adjust_slp_s0_step(pmcdev, 1)); | ^~ vim +1156 drivers/platform/x86/intel/pmc/core.c 1097 1098 static int pmc_core_probe(struct platform_device *pdev) 1099 { 1100 static bool device_initialized; 1101 struct pmc_dev *pmcdev; 1102 const struct x86_cpu_id *cpu_id; 1103 void (*core_init)(struct pmc_dev *pmcdev); 1104 u64 slp_s0_addr; 1105 1106 if (device_initialized) 1107 return -ENODEV; 1108 1109 pmcdev = devm_kzalloc(&pdev->dev, sizeof(*pmcdev), GFP_KERNEL); 1110 if (!pmcdev) 1111 return -ENOMEM; 1112 1113 platform_set_drvdata(pdev, pmcdev); 1114 pmcdev->pdev = pdev; 1115 1116 cpu_id = x86_match_cpu(intel_pmc_core_ids); 1117 if (!cpu_id) 1118 return -ENODEV; 1119 1120 core_init = (void (*)(struct pmc_dev *))cpu_id->driver_data; 1121 1122 /* 1123 * Coffee Lake has CPU ID of Kaby Lake and Cannon Lake PCH. So here 1124 * Sunrisepoint PCH regmap can't be used. Use Cannon Lake PCH regmap 1125 * in this case. 1126 */ 1127 if (core_init == spt_core_init && !pci_dev_present(pmc_pci_ids)) 1128 core_init = cnp_core_init; 1129 1130 mutex_init(&pmcdev->lock); 1131 core_init(pmcdev); 1132 1133 1134 if (lpit_read_residency_count_address(&slp_s0_addr)) { 1135 pmcdev->base_addr = PMC_BASE_ADDR_DEFAULT; 1136 1137 if (page_is_ram(PHYS_PFN(pmcdev->base_addr))) 1138 return -ENODEV; 1139 } else { 1140 pmcdev->base_addr = slp_s0_addr - pmcdev->map->slp_s0_offset; 1141 } 1142 1143 pmcdev->regbase = ioremap(pmcdev->base_addr, 1144 pmcdev->map->regmap_length); 1145 if (!pmcdev->regbase) 1146 return -ENOMEM; 1147 1148 if (pmcdev->core_configure) 1149 pmcdev->core_configure(pmcdev); 1150 1151 pmcdev->pmc_xram_read_bit = pmc_core_check_read_lock_bit(pmcdev); 1152 pmc_core_get_low_power_modes(pdev); 1153 pmc_core_do_dmi_quirks(pmcdev); 1154 1155 pmc_core_dbgfs_register(pmcdev); > 1156 pm_report_max_hw_sleep(((1UL << 32) - 1) * pmc_core_adjust_slp_s0_step(pmcdev, 1)); 1157 1158 device_initialized = true; 1159 dev_info(&pdev->dev, " initialized\n"); 1160 1161 return 0; 1162 } 1163
diff --git a/drivers/platform/x86/intel/pmc/core.c b/drivers/platform/x86/intel/pmc/core.c index 925c5d676a43..f9677104353d 100644 --- a/drivers/platform/x86/intel/pmc/core.c +++ b/drivers/platform/x86/intel/pmc/core.c @@ -1153,6 +1153,7 @@ static int pmc_core_probe(struct platform_device *pdev) pmc_core_do_dmi_quirks(pmcdev); pmc_core_dbgfs_register(pmcdev); + pm_report_max_hw_sleep(((1UL << 32) - 1) * pmc_core_adjust_slp_s0_step(pmcdev, 1)); device_initialized = true; dev_info(&pdev->dev, " initialized\n"); @@ -1214,6 +1215,8 @@ static inline bool pmc_core_is_s0ix_failed(struct pmc_dev *pmcdev) if (pmc_core_dev_state_get(pmcdev, &s0ix_counter)) return false; + pm_report_hw_sleep_time((u32)(s0ix_counter - pmcdev->s0ix_counter)); + if (s0ix_counter == pmcdev->s0ix_counter) return true;