From patchwork Thu Nov 9 18:33:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Gupta X-Patchwork-Id: 16427 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b129:0:b0:403:3b70:6f57 with SMTP id q9csp628557vqs; Thu, 9 Nov 2023 10:34:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IGzCBrJ+t/y2lgIaab2Fis8B5NpTxcLF73je0ZIRpkGD2ZtQZw3dOHmAWGQYRKrbPXselB1 X-Received: by 2002:a17:90b:4a44:b0:280:c98f:2092 with SMTP id lb4-20020a17090b4a4400b00280c98f2092mr2629316pjb.33.1699554886114; Thu, 09 Nov 2023 10:34:46 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1699554886; cv=pass; d=google.com; s=arc-20160816; b=nD0mDDEk91Xn1qUPiEq143J2W6vrqi6dAqS/7LLp5PqCRhZJw+P+VuXmSBI84iTEYX TZjl9dvmzIELP+fPQxvykVCx08LhsfbdKBd4Tu+8hQJE1aEhfyCB2Hran1z3CdS4Y3Ci tpZrhP12e+Pc8IWYngLHjh6lCvHRU3MZvNGlC+2q9qU2z4upUFgvOQpyNqGOKqu7Bx9j s3fxF1K4GgjJRVD5UdWw5p+WKsuhoVfZpg1pQOfGQ0FI0fJeb5VvOQP4Lo4LtLnQEcPU 4IEFzgMoMW0vK2ORldT+4JsdySLTONz2pZtwFlkhCAnSm0krBQlUXTKeoxEZp0uccb5z M+LA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=hfM3WHIeXjz7sqMCuSqwWTeXBai8vexZaC7tZqa16aU=; fh=5xkTn4l+UZwltdULW6+G/qLp/OlHSZqeS466txMuUug=; b=Ay9eN3OhnvmoybQcFRjinWtbUL4OmX+I6eurfZ6cEzqyZRZPtF1nFRR51JlqJxctGf CW63hIB+eaxv5XeebNi98lOi9LtvO7fN8/AH1MNAjFWHqHFTZHlpLdjvTdaXL5n3zWNZ YaPxi4EAvvMXECPU8MpTMyofqTvPOccoGsqnlLsEtOlpic8tXbfRs32IizEAe+xKDtBd i7yQhtJ3NirDetJAM7y1zjeKO1+oqKObu6rtVQjHUEDQaAQm4ZoqbcBaVy3KSIdrvlr1 i9r/inLFAqKp5hfqv+2rv/scAzSAh9GJMAyS0ytu1Qpf/fVvtIblHvjewUvR7AI971dK eThg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=Msw3YelK; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id dw13-20020a17090b094d00b002802950ea02si2193164pjb.170.2023.11.09.10.34.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 10:34:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=Msw3YelK; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 0420F824788B; Thu, 9 Nov 2023 10:34:41 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344997AbjKISeJ (ORCPT + 30 others); Thu, 9 Nov 2023 13:34:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344938AbjKISeB (ORCPT ); Thu, 9 Nov 2023 13:34:01 -0500 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2082.outbound.protection.outlook.com [40.107.243.82]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 686FA2D44; Thu, 9 Nov 2023 10:33:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JzmEaxJd2Zxo31UHC2+13YtRIPbmZtR+QaTzsEnhC0SeGQhhnG62Fm5Zz6sqa4hi47+3leHSnDURyaf2fup1sDOcGsornjzlz40iEgcK9DrRGJACUsKfQhfzK558J5Dc8vuVgycRZS60uSAXlsYKEtOnLidA/88et1rqdwfgIQikJAsaiNlAvC0aWhOvR65pGD8liXc9fX6Brblyu5HsENcJN0/anMZ3SkTf9KrnovSfQl5nKLRAUvf0ACcVAPUWj/LmfrqZ+vBrgYrzr53YWpCrK1gXCa14WeOwtW7IjBbaIXI6lIJbKOAWJ5mspajwMUV/EtixM2PRnDhiqvU3Bg== 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=hfM3WHIeXjz7sqMCuSqwWTeXBai8vexZaC7tZqa16aU=; b=QtGN8rwdDZl3M8cEdhjPwXYovxTj2QPjaO0JTLXPilPKUcXHpyxWlxmwQwzlWwhkUEmvkmc55qcO657w95XeO/kFZjOUR5/59iZxn4cMf5dEwnFmQs1OYSxmrrzPyvFogkJKHoxysut+b39+utnG1+nAeCnrEUHX2FpCfPQWOE9K3WBqSdzkD/cNpplF6nNl+pQB7nVZL9uU7R9J4qZtUC1EaCcpQZ/xVolP6+84zCheK+G0ox8uCk8CPo9dibcv5O5QJjhlzXOsb9Y2nSEMzinNaDWvpiXWshl1MfpmRwhf6Ehgy09b2FgFMA1Go2Fx38zDKJ7lY9PkQkHDd8pQrw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=kernel.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hfM3WHIeXjz7sqMCuSqwWTeXBai8vexZaC7tZqa16aU=; b=Msw3YelKvT8ADT7n+L0a1cInvjUZ2jksOcVianrVQ9RCaW2sGYxr6bR6cv3l3c2ryAs4Nfd62UdOzNTUG9iz9qDKkoxzqfl9ya7xmUzkvLjNCxYnpI1oq92dc4s+HVTu9G0qndkc1upR5Qd1OhD3QCJIm+X3xKjNqsXP5Wc9vNYx/ukgHcivUJUd3ta4bONXHO0Nnns8MaHfQ4XclA0zITgG3NRNcc4CYY28dW4qZG8yb2e2xnu+etPblCPgiwRDCa8q1euPBMzTR1YXy/NcckwkkCjJXRsViJu2IHebdtgzaIkrvwEWvzPPA9Yledws7BTMsLii12ZCNEK5P0cAXA== Received: from MW4PR04CA0300.namprd04.prod.outlook.com (2603:10b6:303:89::35) by MN2PR12MB4272.namprd12.prod.outlook.com (2603:10b6:208:1de::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.29; Thu, 9 Nov 2023 18:33:51 +0000 Received: from CO1PEPF000044F0.namprd05.prod.outlook.com (2603:10b6:303:89:cafe::f4) by MW4PR04CA0300.outlook.office365.com (2603:10b6:303:89::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6977.19 via Frontend Transport; Thu, 9 Nov 2023 18:33:50 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by CO1PEPF000044F0.mail.protection.outlook.com (10.167.241.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6977.16 via Frontend Transport; Thu, 9 Nov 2023 18:33:50 +0000 Received: from rnnvmail202.nvidia.com (10.129.68.7) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Thu, 9 Nov 2023 10:33:31 -0800 Received: from rnnvmail205.nvidia.com (10.129.68.10) by rnnvmail202.nvidia.com (10.129.68.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Thu, 9 Nov 2023 10:33:31 -0800 Received: from sumitg-l4t.nvidia.com (10.127.8.10) by mail.nvidia.com (10.129.68.10) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Thu, 9 Nov 2023 10:33:26 -0800 From: Sumit Gupta To: , , , , , , , , , CC: , , , , , , , Subject: [Patch v6 0/2] Add support for _TFP and change throttle pctg Date: Fri, 10 Nov 2023 00:03:20 +0530 Message-ID: <20231109183322.28039-1-sumitg@nvidia.com> X-Mailer: git-send-email 2.17.1 X-NVConfidentiality: public MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044F0:EE_|MN2PR12MB4272:EE_ X-MS-Office365-Filtering-Correlation-Id: 7026923c-5ea4-4e51-89a9-08dbe1526b5f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7utotz0STRWiBXaS+5A8WtC1XQtfFqXbGtlsEAm9q80tRe4cvk8BWzTsNl0q6ubklzv/Q1WyuRHAXXsAxtTzlPu5/6ZpN0wRN7nN1SigEA1R1l8dzU3Uf0hKWSgdSQeabIMNmMjwEw+4LvolBIyWSQEfFJL7XsdZpoiAYqv29M1Hs443ynlQiTczjxgnt7Pe+QFciMQyAd0omB+4C0zGichGZR3D+YjxpAiBPzFWW1cK2IDATm7A7C8HmiW0zOrQ0hE4rXB9cX9CFVPwSjgiYJzi2aVLf0789h/YXoB+dQI2iWB95o1heI3/rilRXx2lKZr0Aec4AWLl2qRqGiEvFMgBQg2jEApoy80i4P39J/9gjLbR7SBAjJU9+c2XqkEclVCoMya1/Id4qfLWohMANXKVDQVFwgXeo2cktX91x+2sD6xBqIsmNSkzSfZQzkzEcs8kgq5BkHMLXFjYcqBaI179HgO8Zxy4ODjshsVfu73oF+A9ANVqoZKab3Z1uO1KjXI0tC1k3yIanMX6txev1Si5sysC76osS9riVsKf2fOD6QvrjojUhqVx60Ke8xh8rl9ZSen294u/oSxzx670YKxZPFGdQOsEmI8f8a7g3lnBv1GQvRGhwRr6O+UBP5f82XlvwN0q65ZxuTwBKtwReVM585wPgg0rBCZ5D+x6qaHJQ+lNB2oxxhkEF9dMyIGh3N+pUpwgzvEAhQSrU+TotE/hycqYPShRit0qShYaaU0AoOG6ix+WPssnZbT1f7HoBNqA4qnWvCNlLKz/5qAilFbs9st96GAsPKVuUTTi+NIEgjgLTcK04ujqwbIMqsL5ihV3t4C6y46X2EE22STZMhLdCCiQFtVuqZPdbU+eAVl1D/gLMlwCOscmt/ozgNUZQXqpozseWVbSaNNL5s5NxzY9dVOOsAXyO6ua9fqtUwk= X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230031)(4636009)(39860400002)(376002)(136003)(346002)(396003)(230173577357003)(230922051799003)(230273577357003)(1800799009)(82310400011)(64100799003)(186009)(451199024)(36840700001)(46966006)(40470700004)(2616005)(6666004)(921008)(478600001)(966005)(110136005)(7416002)(70206006)(336012)(426003)(54906003)(41300700001)(1076003)(2906002)(316002)(8936002)(5660300002)(8676002)(7696005)(4326008)(26005)(70586007)(107886003)(36756003)(82740400003)(86362001)(36860700001)(47076005)(83380400001)(356005)(7636003)(40480700001)(40460700003)(2101003)(83996005);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Nov 2023 18:33:50.6485 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7026923c-5ea4-4e51-89a9-08dbe1526b5f X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1PEPF000044F0.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4272 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Thu, 09 Nov 2023 10:34:41 -0800 (PST) X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782112463824735875 X-GMAIL-MSGID: 1782112463824735875 This patch set adds two improvements to get a finer control over the impact of thermal throttling on performance. Requesting to merge the patches if no further changes needed. 1) Patch 1: Adds support to read "Thermal fast Sampling Period (_TFP)" ACPI object and use it over "Thermal Sampling Period (_TSP)" for Passive cooling if both are present. 2) Patch 2: Adds support to reduce the CPUFREQ reduction percentage and not always cause throttling in steps of "20%" for Tegra241 SoC. Both patches can be applied independently. --- v5[5] -> 6: - Patch 1: rename passive_delay variable to delay [Rafael] : re-structured the if check when reading _TFP [Rafael] - Patch 2: compile thermal_cpufreq.c by default [Sudeep] : rename arch hook to acpi_arch_thermal_cpufreq_pctg() [Sudeep] : move null functions from acpi.h to internal.h [Rafael] : rename existing reduction_pctg to reduction_step : rename cpufreq_thermal_pctg to cpufreq_thermal_reduction_pctg : update formula to get same num of max steps as old with 20% v4[4] -> 5: - Patch 2: fix kernel robot warning for acpi_thermal_cpufreq_pctg(). v3[3] -> 4: - Patch 2: move ARM code from generic to new file 'thermal_cpufreq.c'. : get 'cpufreq_thermal_pctg' value for Tegra241 from new file. : move dummy/null function to 'acpi.h'. v2[2] -> v3: - Patch1: rebased on top of linux-next. - Patch2: use __read_mostly for the cpufreq_thermal_* variables. : add static to new function acpi_thermal_cpufreq_config_nvidia. : add null function if CONFIG_HAVE_ARM_SMCCC_DISCOVERY undefined : removed redundant parenthesis. v1[1] -> v2: - Patch1: add ACPI spec section info in commit description and rebased. - Patch2: add info about hardware in the commit description. : switched CPUFREQ THERMAL tuning macros to static variables. : update the tunings for Tegra241 SoC only using soc_id check. Jeff Brasen (1): ACPI: thermal: Add Thermal fast Sampling Period (_TFP) support Srikar Srimath Tirumala (1): ACPI: processor: reduce CPUFREQ thermal reduction pctg for Tegra241 drivers/acpi/arm64/Makefile | 1 + drivers/acpi/arm64/thermal_cpufreq.c | 22 +++++++++++++ drivers/acpi/internal.h | 9 +++++ drivers/acpi/processor_thermal.c | 49 +++++++++++++++++++++++----- drivers/acpi/thermal.c | 12 +++++-- 5 files changed, 81 insertions(+), 12 deletions(-) create mode 100644 drivers/acpi/arm64/thermal_cpufreq.c [5] https://lore.kernel.org/all/20231014105426.26389-1-sumitg@nvidia.com/ [4] https://lore.kernel.org/lkml/20231009171839.12267-1-sumitg@nvidia.com/ [3] https://lore.kernel.org/linux-acpi/20231006153612.5851-1-sumitg@nvidia.com/ [2] https://lore.kernel.org/lkml/20230913164659.9345-1-sumitg@nvidia.com/ [1] https://lore.kernel.org/lkml/20230817093011.1378-1-sumitg@nvidia.com/