From patchwork Tue Sep 29 10:53:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naveen Krishna Chatradhi X-Patchwork-Id: 11805595 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6B4D7618 for ; Tue, 29 Sep 2020 10:54:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3C87D207C4 for ; Tue, 29 Sep 2020 10:54:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=amdcloud.onmicrosoft.com header.i=@amdcloud.onmicrosoft.com header.b="XhQFuXQb" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728299AbgI2KyH (ORCPT ); Tue, 29 Sep 2020 06:54:07 -0400 Received: from mail-eopbgr750074.outbound.protection.outlook.com ([40.107.75.74]:8175 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725497AbgI2KyG (ORCPT ); Tue, 29 Sep 2020 06:54:06 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fevVtrLUe31dPhsa9X3fyW73Zso21oH8+APDFKdJ7IBiiC0wvui3YvaYIssQJWcO1Th55a+jVUZzUJ1fDwoY/de9qY+XX0bHoBhvyvMqW/p1/FE9jLZNeVgxI4AI7MB3gWHCTd3+cCtWk9mVUfJ5HysHWTSjVBPtCCNiiKZfjdUnHCfy9zueNFdDsAEEQeOtHIBoFvHraKy5dVBCXqPETCWVOwcYDExC9xm6UH+7eeskKS7ZpPE6VaqnVOalHhYdMi2sFr4BrUXnk6zRONpsJLie0fWw+vXrnfXjad1R15h1QSN1UdHx3yRr/pfhWQwmtgG+wmX7q01R5fMDEGHCbw== 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-SenderADCheck; bh=qwAZXgW0oEWc1Ln9uPlWKcgGEO5AKJBRAhaDRVVd6U0=; b=iJWrjoYeEd8k7el/otozbnf5BRzMZkotY1TuPDxyMlaI49dOz/2+nK3r0nS24jaX3PJjZCaQuCrjkXzwrelLh/U5X/i5jYpZ08hD8ZEYCs6dtZFGOFUk71wnHIXGgdAacAprDcBXuxg2seHogkndUWwXkOiN8FLYhbA7zfCLgcx8SXkwpNonihTK5bHzURmSxGtiB9uR86P7oZ+TFZpclK69/Oxn6wcMjlvQN4MW7EtquE7XgNbLDbEUxc0rBK0C/TvY6zpb6FLszFPeN81RZwl5K/aiY2VhvQq+ZwiUrW3hAF2Zi6rdLYSeFoCxufv54aK+UfdhHjhM8vMNK1zWXw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qwAZXgW0oEWc1Ln9uPlWKcgGEO5AKJBRAhaDRVVd6U0=; b=XhQFuXQboTWyiiwZ0NWPHkSmMgubvIy0/NYDmGszfI5MPTXprhibXlmBgbQ5BRvry1LrFhQ6isGgD5I6a6sWtC+9bTE4wSwECGeF81plk2KIPVdP7h4u6z03+dAfVWCIGeUjiIiX8MWU4G4xRFi4O/gUQYpTPGGjmmm5Qf5B/Qs= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=amd.com; Received: from DM6PR12MB4388.namprd12.prod.outlook.com (20.180.254.74) by DM5PR1201MB0105.namprd12.prod.outlook.com (10.174.106.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.20; Tue, 29 Sep 2020 10:54:04 +0000 Received: from DM6PR12MB4388.namprd12.prod.outlook.com ([fe80::31b8:2b7f:39bb:23af]) by DM6PR12MB4388.namprd12.prod.outlook.com ([fe80::31b8:2b7f:39bb:23af%6]) with mapi id 15.20.3433.032; Tue, 29 Sep 2020 10:54:04 +0000 From: Naveen Krishna Chatradhi To: linux-hwmon@vger.kernel.org Cc: naveenkrishna.ch@gmail.com, Akshay Gupta Subject: [PATCH v2 1/4] hwmon: amd_energy: Move label out of accumulation structure Date: Tue, 29 Sep 2020 16:23:19 +0530 Message-Id: <20200929105322.8919-2-nchatrad@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200929105322.8919-1-nchatrad@amd.com> References: <20200929105322.8919-1-nchatrad@amd.com> X-Originating-IP: [165.204.156.251] X-ClientProxiedBy: MA1PR0101CA0022.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:21::32) To DM6PR12MB4388.namprd12.prod.outlook.com (2603:10b6:5:2a9::10) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from milan-ETHANOL-X.amd.com (165.204.156.251) by MA1PR0101CA0022.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:21::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.20 via Frontend Transport; Tue, 29 Sep 2020 10:54:02 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 954462d1-98e5-4a04-082a-08d86465fb27 X-MS-TrafficTypeDiagnostic: DM5PR1201MB0105: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:276; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aszSxVa3KzH75scaye0qw7Wo6Ep4nXqqrO2YKklKQhAoYYhyXAI8OZ32nUdOUEIRKXcpHb8HZdolv6rWvscT70arfTboCDCUsO9cNuVpLtSIDHxywqgBaW//1oluHvLT1WX6K2KYpT4gRbe6FJnJK0Gu72OFdL7S+yysKczB9UDjGB1ruPQOXti/pqQeGFVjtZFB+Is5KnZMm7EWqAsgGsUq995RRRSNDaxv0MbfR9yP6SrQL5BNKkk0EB1UMyduOr0l2ZYUbJ0FVD33iu2SuxssF2odDI3ZnM0Nb++O6JySarBQ3Xr6JGg+1UbWoD344EIbowMeX6NX4q2ylvSQbTi4gPoAo/ImN5tlES89rzpIIKnjsSFA7JEpAmT6zvO1 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR12MB4388.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(376002)(346002)(366004)(136003)(396003)(39860400002)(478600001)(8676002)(1076003)(316002)(83380400001)(66476007)(66556008)(66946007)(7696005)(52116002)(6666004)(36756003)(4326008)(2616005)(6916009)(8936002)(5660300002)(2906002)(6486002)(956004)(26005)(16526019)(186003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: fqQGts2bE8//IWQzVEdr/OflJBWwXhGvxoy5Bi64fogbGi/On5tS/21fNxAeyNVAYPpa47IZp01PxL77CiqAASLPHQb6ILP3hierMTZuGWAksGup2PnRjKTb+ezHvanA78z75gnjnvdiwCIsBuY3aXTtIpKfKIQvA8M22zsQzwdSZfkJzqz/kdBZPiIlYstcDl82qWP0dfbtc0iwnGxXjww6vl8j++H62Js/e+ZawnDbrli8GXyrfbfX12Bg3MbZwRwvJ7KvA7IKDGSypXqtFDUA9L1ZZIoCgNRFJMUtOXUhzLpdaohWe4IxQxB0w6GNBbPzxIiWos5/fMcr8a3n3Y3e22DG5H3j0JtaBuI5aO2T83RD75VTh7gIy6NGxPNxOwNCVrLVHJ9/b5sxejK9Ps3uSh1o3VWB5fCjP5tDnS53uDMT5H1yCcOZrV/f8viFWzGYBzglV8bVIJzh1mIv1A+JySOHyrOnRvSCbRTdgtBNFFW6Ky7wG/krnheUq7uXp06iBQfAiFU95RBwHv/YIUnG9R3kt7T3jIaW+otkp5Pi9VcvERbCM76x6YQZEfHcfjcXuBqt25QbSzLXSejKKg9atRFQ3D57kPD59D4sYg5LpN9kY8cOXk/WDvyGWJk72OXOM6cu0LL0rOmBpvizcA== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 954462d1-98e5-4a04-082a-08d86465fb27 X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB4388.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Sep 2020 10:54:04.2442 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 3T0YQWRikohrx2hvldmT1V0Jwp2zS+Uwic2qsj402E196gagwVBHItYZjRIGSn+P/z8t8nVS6ZyV+06n7oKv+w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1201MB0105 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org From: Akshay Gupta At present, core & socket labels are defined in struct sensor_accumulator This patch moves it to the amd_energy_data structure, which will help in calling memset on struct sensor_accumulator to optimize the code. Signed-off-by: Akshay Gupta --- Changes since v1: None drivers/hwmon/amd_energy.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/hwmon/amd_energy.c b/drivers/hwmon/amd_energy.c index 29603742c858..9580a16185b8 100644 --- a/drivers/hwmon/amd_energy.c +++ b/drivers/hwmon/amd_energy.c @@ -35,7 +35,6 @@ struct sensor_accumulator { u64 energy_ctr; u64 prev_value; - char label[10]; }; struct amd_energy_data { @@ -52,6 +51,7 @@ struct amd_energy_data { int nr_cpus; int nr_socks; int core_id; + char (*label)[10]; }; static int amd_energy_read_labels(struct device *dev, @@ -61,7 +61,7 @@ static int amd_energy_read_labels(struct device *dev, { struct amd_energy_data *data = dev_get_drvdata(dev); - *str = data->accums[channel].label; + *str = data->label[channel]; return 0; } @@ -253,6 +253,7 @@ static int amd_create_sensor(struct device *dev, struct sensor_accumulator *accums; int i, num_siblings, cpus, sockets; u32 *s_config; + char (*label_l)[10]; /* Identify the number of siblings per core */ num_siblings = ((cpuid_ebx(0x8000001e) >> 8) & 0xff) + 1; @@ -276,21 +277,25 @@ static int amd_create_sensor(struct device *dev, if (!accums) return -ENOMEM; + label_l = devm_kcalloc(dev, cpus + sockets, + sizeof(*label_l), GFP_KERNEL); + if (!label_l) + return -ENOMEM; + info->type = type; info->config = s_config; data->nr_cpus = cpus; data->nr_socks = sockets; data->accums = accums; + data->label = label_l; for (i = 0; i < cpus + sockets; i++) { s_config[i] = config; if (i < cpus) - scnprintf(accums[i].label, 10, - "Ecore%03u", i); + scnprintf(label_l[i], 10, "Ecore%03u", i); else - scnprintf(accums[i].label, 10, - "Esocket%u", (i - cpus)); + scnprintf(label_l[i], 10, "Esocket%u", (i - cpus)); } return 0; From patchwork Tue Sep 29 10:53:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naveen Krishna Chatradhi X-Patchwork-Id: 11805597 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 399A313B2 for ; Tue, 29 Sep 2020 10:54:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 06238208FE for ; Tue, 29 Sep 2020 10:54:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=amdcloud.onmicrosoft.com header.i=@amdcloud.onmicrosoft.com header.b="IkfLbUNG" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728263AbgI2KyQ (ORCPT ); Tue, 29 Sep 2020 06:54:16 -0400 Received: from mail-eopbgr750044.outbound.protection.outlook.com ([40.107.75.44]:22599 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728256AbgI2KyQ (ORCPT ); Tue, 29 Sep 2020 06:54:16 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aZJVoSdnjx2BXhXInQFiCEBllRbhb5vRathS6J1GHUe3CjjiOBM8dKMGoGpXqdX1cyZuqq7TxbvfkSt5nWoDTw1Zztm3M4sAgRnvxIc6zLZZIK7cEK9UQng4E5NYuaXePldjimY3m10ofcFunXAwHsds3kSbYxiXhfOLX0Gpn8+1+zxcUjXSqaHc/qlnYTDolYJnVXjvC1Cm9qM7RU1nQG0SMKYXviSXKySYj3fVGcRunCuJ/NwS0Mqq90UMXubttyKUOUPxLTdw8eq2UVej09oOrXdJcpSCsvWvOF4Ai705rZgGDfabNGPbSwRQDLusDJaZqZdyPvb4dgu9CU/YdQ== 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-SenderADCheck; bh=Oa98pIiH/m09Id4Wd3AEJIfsVgLoEv4Up/2LTvyeyoc=; b=loBBmjaJUP9ChKmImcNatYwOhUjMns+d72avGQvs/5XM1qNFgNsKI16QcHzDaXLDtQHUMaY4vD1lwwJ/QK0GCwcKZIas1GVyIfbgRh2jh0aMXHPlzO1zEWA2l95AaMF589TKFLyBayoF126kM0Ep/WZbS6Etm/e6spHfK7gpQbxW3YiLuyVvaAmelsbgAufc0HEmmeVTEJWoDVMK2q8l5lsJC39Wpl3mCMG+Q1/k1rC6XrGzH+eduUpYS5RuKr9sJuo9sidcQLMBZw9laUFl/P1QffElIhpt77h6zgBy0U74yO5LWuauACisZzuXAoBm2vqH62k0oHU2hOXG8e9Kuw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Oa98pIiH/m09Id4Wd3AEJIfsVgLoEv4Up/2LTvyeyoc=; b=IkfLbUNGzLGX+A22lGQ/SzubBqxk0mNpC/Hc/b5i7ZlyfnSJL4biOrEVnuuAsphvwhCzxlmPs0AY/Malukfs4vkNLmiXMGZBXDRFCHN/auRJaQ/T91NFNDuogvfp2HXRZSr5nldZFAZfcS3pvXHW9SJ/iIjlDw35DiAPMMk48Ho= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=amd.com; Received: from DM6PR12MB4388.namprd12.prod.outlook.com (20.180.254.74) by DM5PR1201MB0105.namprd12.prod.outlook.com (10.174.106.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.20; Tue, 29 Sep 2020 10:54:14 +0000 Received: from DM6PR12MB4388.namprd12.prod.outlook.com ([fe80::31b8:2b7f:39bb:23af]) by DM6PR12MB4388.namprd12.prod.outlook.com ([fe80::31b8:2b7f:39bb:23af%6]) with mapi id 15.20.3433.032; Tue, 29 Sep 2020 10:54:14 +0000 From: Naveen Krishna Chatradhi To: linux-hwmon@vger.kernel.org Cc: naveenkrishna.ch@gmail.com, Naveen Krishna Chatradhi Subject: [PATCH v2 2/4] hwmon: amd_energy: optimize accumulation interval Date: Tue, 29 Sep 2020 16:23:20 +0530 Message-Id: <20200929105322.8919-3-nchatrad@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200929105322.8919-1-nchatrad@amd.com> References: <20200929105322.8919-1-nchatrad@amd.com> X-Originating-IP: [165.204.156.251] X-ClientProxiedBy: MA1PR0101CA0022.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:21::32) To DM6PR12MB4388.namprd12.prod.outlook.com (2603:10b6:5:2a9::10) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from milan-ETHANOL-X.amd.com (165.204.156.251) by MA1PR0101CA0022.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:21::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.20 via Frontend Transport; Tue, 29 Sep 2020 10:54:11 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: ed24dc8b-8ef8-43b2-4cbf-08d86466008a X-MS-TrafficTypeDiagnostic: DM5PR1201MB0105: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4714; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NxTRK8D/pcoP0ItyzTbnIRlOB5JfjIqJZSQsN+rowcUttM1/U6XsSYu7EHJ+Nhv/5io8lsOolDkV2IxNuq81b0yeL0TVSJbbaAnUCCZMvMjnJFsTufbsakfQrsZxQVeHhdnQo3TecEi72J8aXzVjXDJznKs+IT/XTzrKFXoTq8evaG/wbnmD5tmAph7eyKp3S2Bq/+PAV9dzPkfMDd45Ui1BmRsU3jr6CH5AtAhfGHYDlnxJ7sbMsedbdaLEYbAsxqEpr87B2EZpqQklJp1Plxvpc8IYrgDXEW045BlCueb7g8YqXyy/FPCMfMzNwY2DD2Uk8gkCcFo7jOUQhJhMRozXLykIMubIsblguxoHOP3GAa5NJIblDgE+GapFh3dl X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR12MB4388.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(376002)(346002)(366004)(136003)(396003)(39860400002)(478600001)(8676002)(1076003)(316002)(83380400001)(66476007)(66556008)(66946007)(7696005)(52116002)(6666004)(36756003)(4326008)(2616005)(6916009)(8936002)(5660300002)(2906002)(6486002)(956004)(26005)(16526019)(186003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: kwr2V3gDbnf7gkRCoPcaqozUs7XWF8QDYgMYZrc/ouR8O/nTs2/Hwmq17SX7Jh3mIYCvbsNbv5alSu1YCtlrNnOo1OYAX75GXilU0QcyVvoRNQOaLIAbW3pdku7CEJ0ZiRrPmQlx+GBQ2Z5mQOMUlh6q9WOiidRM3qclEGKySuuuMQt7QRxr5Rry2ogBvt9gRmW08P8B/1Onp4Q9k5nYbNCTlGhXRTlbp5VhjwcZkR/GiahJzec7gQ1IY532RoRljg4bbfptCjAFmQi61tR4nyCWT5qxYcz+EKQ7chASngofguYB/L8MS82RTircOuhiiuelC7TfDklZE5MLKoE2fRlnItE9ufd8gk2pp6pWhMHP3eNmE1kjRGVvj0UIPm+YValfWM9YTtAWxp4r+b6De079lQXrmbnKaSRw9nh8P4QQQgG9xjAQ8pe75e7NdcJMRqQZ1kQyxwx0jiHmLWW6KExKJBF6ItG8P3tQsQjqeHJNA4PDj+XKdXct7+rCLTiW1IWsrp9fWBlIf3WZxlCZikIrWTL67d261AEpfBQwtEJH8DXHFJdsjLjJAnAJavtTNLtDKYogTyOoFhA2WNaThl3Zb7P8u/tzHkxFDB9AuptJn/gZ2f94JHtOjdqV3SqpprxS8UOEx6Ch94YYjhmkQQ== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: ed24dc8b-8ef8-43b2-4cbf-08d86466008a X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB4388.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Sep 2020 10:54:13.6368 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 96ZUzhd36xrVEoZnb7IEexvipiNDXLiw3vnMpInDA1ppWvXsrK/RTsFCO2wNEF83+i5I0y68TAM8l6agPFPSaw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1201MB0105 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org On a system with course grain resolution of energy unit (milli J) the accumulation thread can be executed less frequently than on the system with fine grain resolution(micro J). This patch sets the accumulation thread interval to an optimum value calculated based on the (energy unit) resolution supported by the hardware (assuming a peak wattage of 240W). Signed-off-by: Naveen Krishna Chatradhi --- Changes since v1: 1. Generalized formula as suggested by Guenter. 2. Use milli seconds for interval drivers/hwmon/amd_energy.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/drivers/hwmon/amd_energy.c b/drivers/hwmon/amd_energy.c index 9580a16185b8..c413adfc6a73 100644 --- a/drivers/hwmon/amd_energy.c +++ b/drivers/hwmon/amd_energy.c @@ -46,8 +46,9 @@ struct amd_energy_data { struct mutex lock; /* An accumulator for each core and socket */ struct sensor_accumulator *accums; + unsigned int timeout_ms; /* Energy Status Units */ - u64 energy_units; + int energy_units; int nr_cpus; int nr_socks; int core_id; @@ -215,6 +216,7 @@ static umode_t amd_energy_is_visible(const void *_data, static int energy_accumulator(void *p) { struct amd_energy_data *data = (struct amd_energy_data *)p; + unsigned int timeout = data->timeout_ms; while (!kthread_should_stop()) { /* @@ -227,14 +229,7 @@ static int energy_accumulator(void *p) if (kthread_should_stop()) break; - /* - * On a 240W system, with default resolution the - * Socket Energy status register may wrap around in - * 2^32*15.3 e-6/240 = 273.8041 secs (~4.5 mins) - * - * let us accumulate for every 100secs - */ - schedule_timeout(msecs_to_jiffies(100000)); + schedule_timeout(msecs_to_jiffies(timeout)); } return 0; } @@ -331,6 +326,13 @@ static int amd_energy_probe(struct platform_device *pdev) if (IS_ERR(hwmon_dev)) return PTR_ERR(hwmon_dev); + /* + * On a system with peak wattage of 250W + * timeout = 2 ^ 32 / 2 ^ energy_units / 250 secs + */ + data->timeout_ms = 1000 * + BIT(min(28, 31 - data->energy_units)) / 250; + data->wrap_accumulate = kthread_run(energy_accumulator, data, "%s", dev_name(hwmon_dev)); if (IS_ERR(data->wrap_accumulate)) From patchwork Tue Sep 29 10:53:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Naveen Krishna Chatradhi X-Patchwork-Id: 11805599 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1C3B1618 for ; Tue, 29 Sep 2020 10:54:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EE87A208FE for ; Tue, 29 Sep 2020 10:54:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=amdcloud.onmicrosoft.com header.i=@amdcloud.onmicrosoft.com header.b="DTuroris" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727360AbgI2Ky1 (ORCPT ); Tue, 29 Sep 2020 06:54:27 -0400 Received: from mail-co1nam11on2053.outbound.protection.outlook.com ([40.107.220.53]:64809 "EHLO NAM11-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725535AbgI2Ky1 (ORCPT ); Tue, 29 Sep 2020 06:54:27 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=icMtvZQmkWT3z/7ixhfqnzktqiIP5cKMEMRjHvXgsCDfNco1A9Rx2oRomEOBdxssvVKrvKJ7ttxmVQcOZ0cc9tHJM0LRbnkgdN8cVbnPYJBCM1t+rRDLGgxr2eCy5hyZ+dfyT/UP1QQZmug4z3+HKJU1RGtuS/uMYGW7VkUg62mq/2omFNUyGlARIlOdIdep9ar468WRJoLo6tJqFcO+URN/MsQvV3hyUTi7GsShElmvxHfBZdL0zP1eJ+c3E2FncZuBu48wpBTHm4OAOWw0MGz00xeOnCslcIDRk5q5Hu8aGDXxS1dFeWJECMRtI/59U7TF7G1z5jkPAl1CvsJWpA== 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-SenderADCheck; bh=hPtP89LYKGNbdvqAA318yGKkj8+mK8BIQZHIA5sufN4=; b=E5CNBKyGXBFWkQ1gDj3BsOYfqik0LQywu5zh7zrdxJjtQkUCDNsIesf4R2vjgOFJjD3nk5fNuiLDvtRMl8m2w7Enz3HN7hfttV71Tg8/9uIexUhvMoQZgC2Ari20gNJxtTusFX4lFqdxDNicKbVhrGV5U7fhwMWRhvwdwuLrRjwOLxFt+W5PCxjmZ179qnk+y2uZi1Kk1kBcSQSwbt1aOtRzxjPXYWPJh34NUobZSJqVJgIotlSBZQoRS7lwsU/Upx29l79ciuJ2+plrJE5aAtblykUR0L8seJEwFhmQRqNah6Z3HUd5Fvyu4K2ltbKzLbSTfanT3KYySfMJVJoVWA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hPtP89LYKGNbdvqAA318yGKkj8+mK8BIQZHIA5sufN4=; b=DTurorisfVt7XjUwr/NtKITwCIDrvrF91TEq8BY4R20fGdarDrNhQb3qcL7I+wl8W4Y+b25hQpXRBgbu+WMtW2rbbkZId4bWs62DwzFMPnB4brYSDlGsd1bAAxdHDnokex1Zaf7Dt9yQmabperfIgPuaWA7SEdKuyVpHqnlEvWA= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=amd.com; Received: from DM6PR12MB4388.namprd12.prod.outlook.com (20.180.254.74) by DM5PR1201MB0105.namprd12.prod.outlook.com (10.174.106.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.20; Tue, 29 Sep 2020 10:54:24 +0000 Received: from DM6PR12MB4388.namprd12.prod.outlook.com ([fe80::31b8:2b7f:39bb:23af]) by DM6PR12MB4388.namprd12.prod.outlook.com ([fe80::31b8:2b7f:39bb:23af%6]) with mapi id 15.20.3433.032; Tue, 29 Sep 2020 10:54:24 +0000 From: Naveen Krishna Chatradhi To: linux-hwmon@vger.kernel.org Cc: naveenkrishna.ch@gmail.com, Naveen Krishna Chatradhi Subject: [PATCH v2 3/4] hwmon: amd_energy: Improve the accumulation logic Date: Tue, 29 Sep 2020 16:23:21 +0530 Message-Id: <20200929105322.8919-4-nchatrad@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200929105322.8919-1-nchatrad@amd.com> References: <20200929105322.8919-1-nchatrad@amd.com> X-Originating-IP: [165.204.156.251] X-ClientProxiedBy: MA1PR0101CA0022.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:21::32) To DM6PR12MB4388.namprd12.prod.outlook.com (2603:10b6:5:2a9::10) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from milan-ETHANOL-X.amd.com (165.204.156.251) by MA1PR0101CA0022.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:21::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.20 via Frontend Transport; Tue, 29 Sep 2020 10:54:23 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 7e59306e-ffac-4093-98b6-08d86466072c X-MS-TrafficTypeDiagnostic: DM5PR1201MB0105: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:245; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jzldHhMYaIUGWpc2Q9Ej8JN65szm/EsIhtpGIj1+Bx7xMf/MpJBaDP35Zc+6m3CwSey1UfHUykPKnu5k0aclAuVgfUo9UopLPm7PTVNn8O6yoWrsFW8yi6JpRVfbAD/Ui8/u0N65FiJjXldDBWubjy95FHsG/lE2at0WXudvEyCAVYeBwy/ci+kWs8jJLNE6QZTFxGxRLpmn3elwHabRlPsrear23SRqzJUT79WiLCw9TWDeV+ta+ufclTPGsFyaz6My+h+21pE1w3KdQJALMT79BZXzyBao5XM3qIrTdzNJ9HJ2nPfszvJa2QFC/q5E6VoDk3f5+wffT4nWdwrp6iY4hDBomalji/pBx6/4p4H/D0oleOSWW5NCnoCJsJhh X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR12MB4388.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(376002)(346002)(366004)(136003)(396003)(39860400002)(478600001)(8676002)(1076003)(316002)(83380400001)(66476007)(66556008)(66946007)(7696005)(52116002)(36756003)(4326008)(2616005)(6916009)(8936002)(5660300002)(2906002)(6486002)(956004)(26005)(16526019)(186003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: cOaGnEKgIoalOkBCniwosynb85mn4I/hiyH6BrRrBNj7RPPWGwmGiOdU7y9Hn7WuUp7vV0D8QpfZLDdD5TjttZdbQMIrov1mGDYsyxLGTSwarn7idDQHhBNHnK1TKo7F3joZWd0hfK4NfR9/Sa88Y/2ZNCkG7IY3dd68k7QgB34zd1VV9SxoOF+U83iFTcADb5ypeZJrMuLxcUaoGd8rne9LzyvXbQBhEzPa+69gOmE2d7bXCSWS658QL1WFTvzKrCDR7rgr7dEF+ZlStIMToznjm2J4MxOuNyQFgOhAuvEfimAmCA7DaonuCgmqo2BifrOA9Venx0f98YLQcz5g8VW1ejzlDngqwVbAQmb6GI7UUF0I2jetdiGv/d6rRC2RXJSns065b7Baq6DEFWQ6Y7TVtD5az+OT1umifwJgAsu+kuC0Oa6HiQmGMhGAR3uiBOf8+pJlsB92MNdWu4sFtekGzRbiKj+EQ13DocbKkVxqrEmdzh++hg6ys0qa0SKKdj2mP/1FgxfVPKhXFkb0zrn8fOWns4AqxVMl8lciCQ7++xN7WH3MnPeKeiBVIxinxYapKjjKMjeNMzYe2vogF4MLJvSD9JNpMXYjgCAxLnMSBz41c8liqHZNLpdQKoSEwi/LJRDC/M5epW9P1Lvsrg== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7e59306e-ffac-4093-98b6-08d86466072c X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB4388.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Sep 2020 10:54:24.4114 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: I4Zyh5hWCV5gnqocY59NUjYp+DpF2F9Tbh9l8pfVyIXVNsWtvZ58GQ7Tizo0i7OGnkCs0Aad8CQLRL/r8uhMXQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1201MB0105 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org Factor out the common code in the accumulation functions for core and socket accumulation. While at it, handle the return value of the amd_create_sensor() function. Signed-off-by: Naveen Krishna Chatradhi --- Changes since v1: 1. Return values are handled in the probe. drivers/hwmon/amd_energy.c | 126 +++++++++++++------------------------ 1 file changed, 45 insertions(+), 81 deletions(-) diff --git a/drivers/hwmon/amd_energy.c b/drivers/hwmon/amd_energy.c index c413adfc6a73..cbc6a6e466c5 100644 --- a/drivers/hwmon/amd_energy.c +++ b/drivers/hwmon/amd_energy.c @@ -74,108 +74,67 @@ static void get_energy_units(struct amd_energy_data *data) data->energy_units = (rapl_units & AMD_ENERGY_UNIT_MASK) >> 8; } -static void accumulate_socket_delta(struct amd_energy_data *data, - int sock, int cpu) +static void accumulate_delta(struct amd_energy_data *data, + int channel, int cpu, u32 reg) { - struct sensor_accumulator *s_accum; + struct sensor_accumulator *accum; u64 input; mutex_lock(&data->lock); - rdmsrl_safe_on_cpu(cpu, ENERGY_PKG_MSR, &input); + rdmsrl_safe_on_cpu(cpu, reg, &input); input &= AMD_ENERGY_MASK; - s_accum = &data->accums[data->nr_cpus + sock]; - if (input >= s_accum->prev_value) - s_accum->energy_ctr += - input - s_accum->prev_value; + accum = &data->accums[channel]; + if (input >= accum->prev_value) + accum->energy_ctr += + input - accum->prev_value; else - s_accum->energy_ctr += UINT_MAX - - s_accum->prev_value + input; + accum->energy_ctr += UINT_MAX - + accum->prev_value + input; - s_accum->prev_value = input; + accum->prev_value = input; mutex_unlock(&data->lock); } -static void accumulate_core_delta(struct amd_energy_data *data) +static void read_accumulate(struct amd_energy_data *data) { - struct sensor_accumulator *c_accum; - u64 input; - int cpu; + int sock, scpu, cpu; + + for (sock = 0; sock < data->nr_socks; sock++) { + scpu = cpumask_first_and(cpu_online_mask, + cpumask_of_node(sock)); + + accumulate_delta(data, data->nr_cpus + sock, + scpu, ENERGY_PKG_MSR); + } - mutex_lock(&data->lock); if (data->core_id >= data->nr_cpus) data->core_id = 0; cpu = data->core_id; + if (cpu_online(cpu)) + accumulate_delta(data, cpu, cpu, ENERGY_CORE_MSR); - if (!cpu_online(cpu)) - goto out; - - rdmsrl_safe_on_cpu(cpu, ENERGY_CORE_MSR, &input); - input &= AMD_ENERGY_MASK; - - c_accum = &data->accums[cpu]; - - if (input >= c_accum->prev_value) - c_accum->energy_ctr += - input - c_accum->prev_value; - else - c_accum->energy_ctr += UINT_MAX - - c_accum->prev_value + input; - - c_accum->prev_value = input; - -out: data->core_id++; - mutex_unlock(&data->lock); -} - -static void read_accumulate(struct amd_energy_data *data) -{ - int sock; - - for (sock = 0; sock < data->nr_socks; sock++) { - int cpu; - - cpu = cpumask_first_and(cpu_online_mask, - cpumask_of_node(sock)); - - accumulate_socket_delta(data, sock, cpu); - } - - accumulate_core_delta(data); } static void amd_add_delta(struct amd_energy_data *data, int ch, - int cpu, long *val, bool is_core) + int cpu, long *val, u32 reg) { - struct sensor_accumulator *s_accum, *c_accum; + struct sensor_accumulator *accum; u64 input; mutex_lock(&data->lock); - if (!is_core) { - rdmsrl_safe_on_cpu(cpu, ENERGY_PKG_MSR, &input); - input &= AMD_ENERGY_MASK; - - s_accum = &data->accums[ch]; - if (input >= s_accum->prev_value) - input += s_accum->energy_ctr - - s_accum->prev_value; - else - input += UINT_MAX - s_accum->prev_value + - s_accum->energy_ctr; - } else { - rdmsrl_safe_on_cpu(cpu, ENERGY_CORE_MSR, &input); - input &= AMD_ENERGY_MASK; + rdmsrl_safe_on_cpu(cpu, reg, &input); + input &= AMD_ENERGY_MASK; - c_accum = &data->accums[ch]; - if (input >= c_accum->prev_value) - input += c_accum->energy_ctr - - c_accum->prev_value; - else - input += UINT_MAX - c_accum->prev_value + - c_accum->energy_ctr; - } + accum = &data->accums[ch]; + if (input >= accum->prev_value) + input += accum->energy_ctr - + accum->prev_value; + else + input += UINT_MAX - accum->prev_value + + accum->energy_ctr; /* Energy consumed = (1/(2^ESU) * RAW * 1000000UL) μJoules */ *val = div64_ul(input * 1000000UL, BIT(data->energy_units)); @@ -188,20 +147,22 @@ static int amd_energy_read(struct device *dev, u32 attr, int channel, long *val) { struct amd_energy_data *data = dev_get_drvdata(dev); + u32 reg; int cpu; if (channel >= data->nr_cpus) { cpu = cpumask_first_and(cpu_online_mask, cpumask_of_node (channel - data->nr_cpus)); - amd_add_delta(data, channel, cpu, val, false); + reg = ENERGY_PKG_MSR; } else { cpu = channel; if (!cpu_online(cpu)) return -ENODEV; - amd_add_delta(data, channel, cpu, val, true); + reg = ENERGY_CORE_MSR; } + amd_add_delta(data, channel, cpu, val, reg); return 0; } @@ -242,7 +203,7 @@ static const struct hwmon_ops amd_energy_ops = { static int amd_create_sensor(struct device *dev, struct amd_energy_data *data, - u8 type, u32 config) + enum hwmon_sensor_types type, u32 config) { struct hwmon_channel_info *info = &data->energy_info; struct sensor_accumulator *accums; @@ -301,6 +262,7 @@ static int amd_energy_probe(struct platform_device *pdev) struct device *hwmon_dev; struct amd_energy_data *data; struct device *dev = &pdev->dev; + int ret; data = devm_kzalloc(dev, sizeof(struct amd_energy_data), GFP_KERNEL); @@ -313,8 +275,10 @@ static int amd_energy_probe(struct platform_device *pdev) dev_set_drvdata(dev, data); /* Populate per-core energy reporting */ data->info[0] = &data->energy_info; - amd_create_sensor(dev, data, hwmon_energy, - HWMON_E_INPUT | HWMON_E_LABEL); + ret = amd_create_sensor(dev, data, hwmon_energy, + HWMON_E_INPUT | HWMON_E_LABEL); + if (ret) + return ret; mutex_init(&data->lock); get_energy_units(data); @@ -338,7 +302,7 @@ static int amd_energy_probe(struct platform_device *pdev) if (IS_ERR(data->wrap_accumulate)) return PTR_ERR(data->wrap_accumulate); - return PTR_ERR_OR_ZERO(data->wrap_accumulate); + return 0; } static int amd_energy_remove(struct platform_device *pdev) From patchwork Tue Sep 29 10:53:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naveen Krishna Chatradhi X-Patchwork-Id: 11805601 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 77807618 for ; Tue, 29 Sep 2020 10:54:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5A453207C4 for ; Tue, 29 Sep 2020 10:54:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=amdcloud.onmicrosoft.com header.i=@amdcloud.onmicrosoft.com header.b="Qv+qvLSg" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725535AbgI2Kyk (ORCPT ); Tue, 29 Sep 2020 06:54:40 -0400 Received: from mail-eopbgr750057.outbound.protection.outlook.com ([40.107.75.57]:5952 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725306AbgI2Kyk (ORCPT ); Tue, 29 Sep 2020 06:54:40 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JMZGEuJi0dEryeUNFfkB/8X+6h1I+9g85R4iN4i+xobmB0yXMEaC5H3aRhFZwJ9xnDlispNUG3KWj3sme0919wmw9khOHlF0O0Ah2LPq56Pj+BW3o1nrHPpVThMmvEJrVHBvUNzUvJNsyaCAjI1Tns4VQ0N/pKmE0YQZvAS9u+Dcu4HesQVgtwM7cjxNmEMF4lBdBPKnXAwh5q/TJI3aNZ8y1NxmG8V6u1RNNA95JKuAQH4+QlPsIpBHgUhjIW14VA3Yjiri4WN2pbfNv9kExhNFKjK5Z9illnMMyS7aJHPDyQcIYjT3Q5yEFZbBppcCgbowfiKjVmVjp14YG/xPGA== 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-SenderADCheck; bh=P8EZl2TGw699PkKeXZLop2Uvcbu7VsD4pEC3bFXfa9s=; b=dy7fuEq7MwBRnHnTFh+aSIQF32ECYwjtCKsTQBKvXByAqxkkkEK29XwNV05QcjxE9zxtZlEL4QVdmOf485l6itDDEsGC/9vpLiRjeYZxCv33VAQ+nGX2hD1Ubd4yPQ9Bo1pdvdCAYsisG8AzYp/3BNSLHrSQmF5GNGNuq33VJncsgAdgRL2IgGcKT4imaDo0gdP8ArLETfMrhv6RMvghRf0bkppfZaM/I2/ec9i7zjqBVm2wzQgtmk6x4qd5cvh2344/69XT1P2SmfINTzV4Vy/r9z/m/BEyH4D2JPsSUETtKLEG70bOahmq6BlDMaOe0RZa0Mlfu9Csx/4UGPxJ0A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=P8EZl2TGw699PkKeXZLop2Uvcbu7VsD4pEC3bFXfa9s=; b=Qv+qvLSg/rV7r0NjzEEAy7JYrlPCcHm8AHnXkqRKOq9zrKADKSCIrzybzCNeBtxwjdk2MQ2rlwACX9zVSr5ir3u/tFnjDHI0g3JpbVOj+I1nFTYTOP+3csYryWob2Z6oIZqaMmaizopU9Wv+nfGT+mNjRjoGCMzMRQXOAOey910= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=amd.com; Received: from DM6PR12MB4388.namprd12.prod.outlook.com (20.180.254.74) by DM5PR1201MB0105.namprd12.prod.outlook.com (10.174.106.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.20; Tue, 29 Sep 2020 10:54:38 +0000 Received: from DM6PR12MB4388.namprd12.prod.outlook.com ([fe80::31b8:2b7f:39bb:23af]) by DM6PR12MB4388.namprd12.prod.outlook.com ([fe80::31b8:2b7f:39bb:23af%6]) with mapi id 15.20.3433.032; Tue, 29 Sep 2020 10:54:38 +0000 From: Naveen Krishna Chatradhi To: linux-hwmon@vger.kernel.org Cc: naveenkrishna.ch@gmail.com, Naveen Krishna Chatradhi Subject: [PATCH v2 4/4] hwmon: (amd_energy) Update driver documentation Date: Tue, 29 Sep 2020 16:23:22 +0530 Message-Id: <20200929105322.8919-5-nchatrad@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200929105322.8919-1-nchatrad@amd.com> References: <20200929105322.8919-1-nchatrad@amd.com> X-Originating-IP: [165.204.156.251] X-ClientProxiedBy: MA1PR0101CA0022.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:21::32) To DM6PR12MB4388.namprd12.prod.outlook.com (2603:10b6:5:2a9::10) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from milan-ETHANOL-X.amd.com (165.204.156.251) by MA1PR0101CA0022.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:21::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.20 via Frontend Transport; Tue, 29 Sep 2020 10:54:36 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 74709860-a0ca-44db-8a2e-08d864660efb X-MS-TrafficTypeDiagnostic: DM5PR1201MB0105: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2887; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: J4vMPAu2hMXql6cn/TAp7QFHJKlBYKJNkozqBoUQDKoY9/JzAvtBO8GL7T9R6LkddG6itVylE2NtSc1KqkU7zPMVrFKF0/uVyc2VBix0hJnlrJNfaB1HZwscpo3wieiwlhJplup+qQyDYHojSHxwvUlXXAMQ2dl4lKEd8Fe8nWt0xFnvHtKvmsHCk+AU6IGDioioo16exfg0jZl4ya06P2IRvWiIcC+FKFeI8HX9xOt9o1R7lYuSeodNFZwU7+VPxPZZAnOZOqkBg92mS9jVqgt2LGZL4JHNe+vJ0+WN9ln+p0HFRdwrTR967QLgruxCCS2H6aJppVr2aTLjvuRCi1kNHJFhcaNrTelJK+n9v4R08noy7ZBLT0UsgjbFGPCJ X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR12MB4388.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(376002)(346002)(366004)(136003)(396003)(39860400002)(478600001)(8676002)(1076003)(316002)(83380400001)(66476007)(66556008)(15650500001)(66946007)(7696005)(52116002)(6666004)(36756003)(4326008)(2616005)(6916009)(8936002)(5660300002)(2906002)(6486002)(956004)(26005)(16526019)(186003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: hnoDNgQ0ibK0jY/TXbUtIOvDsMeMJ4HbFX0qpxj+wiTg9EzbPLGTvVAHPGMIAB8+BDF336GI0MChOw9pUfd1hFyoVlLwXTWqWbY3l1pB+57uQ3hfC1dlu7CzazxO4fOkkBalOUA2kkDPouXnntgh3Z5HVfkqnwkeErwmW8faigXd/C96hO5HJCTj+OBpFm8rHmutJWptkysba9ioF/ATVjePOlH+Zur9LQDUYMG1YQNJyne+MZPMr34BeVYQahAH7J71r4m/gZweLv8DDk7nKSr7upbAJGezqlRyTf19exsoIEk2ENgkXLHTnw3UBvxIc0uiH7K8c+y2sjbShmUahn/N4tRHR2YTRBMRlLPsZYLhpBTRE1JLtfKzxLfqPiZ0B+HVKW6pkKwehQhdBJdCGMe+YWeNi85+DA9Xl67v4PqzQPbdC70kxrzpQ/zdmrJXw+L0W5TC8E8NQp1Dn5zwxKj+Uu0NzFfEqfwyViNF8buRmvBpKiLi8pHUF8Ry/Su71iYv3ciCc/A85Dar+ZhYJvpU9SLryIYdNLcLRCV+dPVWd5wJbILwxqzw3W7MXJbT2hGB50xbnAwIs27PlJLZIrzMO5iM3R1oPAc39MzBtdZsWroaUdbPIZzPAZ+J6D7gZ0EmboJJoiNX7P4eeypMTQ== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 74709860-a0ca-44db-8a2e-08d864660efb X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB4388.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Sep 2020 10:54:37.9427 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: TTr3BNHWBpLtSsAb1z91ww4Bhr3AVo7vgXXXuBtIQYXHDRzaHsZzh77lZCv3ee9Eskrj6DJiEBykXl0H03lFGA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1201MB0105 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org Update the documentation with the newly added features * Set the accumulation interval based on resolution Signed-off-by: Naveen Krishna Chatradhi --- Changes since v1: Dropped the accumulator status control and debugfs feature updates Documentation/hwmon/amd_energy.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Documentation/hwmon/amd_energy.rst b/Documentation/hwmon/amd_energy.rst index f8288edff664..86e4ebc5cbc2 100644 --- a/Documentation/hwmon/amd_energy.rst +++ b/Documentation/hwmon/amd_energy.rst @@ -84,6 +84,11 @@ per run to a respective 64-bit counter. The kernel thread starts running during probe, wakes up every 100secs and stops running when driver is removed. +Frequency of the accumulator thread is set during the probe +based on the chosen energy unit resolution. For example +A. fine grain (1.625 micro J) +B. course grain (0.125 milli J) + A socket and core energy read would return the current register value added to the respective energy accumulator.