Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp271835rdb; Tue, 5 Dec 2023 05:14:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IGh8uWe+tSf3MiUlCQH0kTpCXW/XiQ+gYzhZ55ynBLj3/DNqaG0lgHISP52nstUnRCJxuAr X-Received: by 2002:a17:902:ab95:b0:1d0:60c6:1db8 with SMTP id f21-20020a170902ab9500b001d060c61db8mr2160713plr.32.1701782069759; Tue, 05 Dec 2023 05:14:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701782069; cv=none; d=google.com; s=arc-20160816; b=aVJbTDf+f81oclvfnGC2TMDjPoKtLxh8hsPHHp8Tv1FgqOkU/ejv8Jf3l55g9Q9vVv 1b9QVYg9AOtyMNg36WuntVNukNdt7TxB3mTan3fGmSGSeRBZS5WJ1wlVg48C+V8smMRh V9bXpvKXsk5ID1VtIF2HNYaQCd5gaEdyxQ50MzK78iUJ0IksYtgHhU4WpRu4BWiUhdFv jSMWWee744O1CfJDu6oSZi8uLUfGJRICuGKSpqPa/tSaWjB9vYQFHq5qFii8Z6aOfBW1 4nCN/5rumEQnlNRFBCPmZlgJnwAlaUYHBIyB3GyD5o2TIHsHGw4SEa1+hdcFz9sFkRMF RLlg== ARC-Message-Signature: i=1; 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=pSJlca4xBejtCeIUqyK0VgdZ900slw7mcW1vqgZbHNw=; fh=TLt0+tN9WPWuo3GUgUJpzuB6JoUS99EjFiSANGgagHA=; b=xzxqgP5SQscAeHdtKnL35embTv7jOnaM+3WeEcARR6P4xGqBBsn0m/zUtlMP0mD3HP Y/sR0sdgJGKXLLxXpHslPMJOYBX/k0B1qZLUVDTywLMA63wqK2a8YEQrytJuiM8WMfEP QuMds0mt0OVDe3UKSgEhUYMNmqwMH4rQGQqMXsMk3yEcFJ4nvOhiItzTu9HYmhX1XHLK 9xNEb5OKY5Bbek2optbot2ZO36T/Dbx5MeiK8IFDRYAP/OP3vXl2ijS331kPnZg6KfCV OMWMsof1XeX5qcBbJavbUOqOySZNsKBztx/OKVWS1dsJvtgrrWg26f3V7ETTJoo3iegt kaWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=s8mjyu65; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id jk5-20020a170903330500b001d0748f1dffsi5385819plb.162.2023.12.05.05.14.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Dec 2023 05:14:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=s8mjyu65; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 49596822C61E; Tue, 5 Dec 2023 05:14:26 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235163AbjLENOG (ORCPT + 99 others); Tue, 5 Dec 2023 08:14:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232060AbjLENOG (ORCPT ); Tue, 5 Dec 2023 08:14:06 -0500 Received: from smtp-fw-52003.amazon.com (smtp-fw-52003.amazon.com [52.119.213.152]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 071ED120 for ; Tue, 5 Dec 2023 05:14:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1701782052; x=1733318052; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=pSJlca4xBejtCeIUqyK0VgdZ900slw7mcW1vqgZbHNw=; b=s8mjyu65S2U1fhMw4R5qQwN9TwaWRw5FV2zk6QYqqNGtSdHFQtb2lWDu wXMHPVtH4CWjemRFiduZaHCsbh8vaeYYO7hIwbpIitxwkBnmN2V7DMAxV YWRr20g3AFvbMIdwi7sUOhtewPNUy3YOdapGEaR27dT2LvN3kdgsEP7ZM M=; X-IronPort-AV: E=Sophos;i="6.04,252,1695686400"; d="scan'208";a="623364236" Received: from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-iad-1d-m6i4x-e651a362.us-east-1.amazon.com) ([10.43.8.6]) by smtp-border-fw-52003.iad7.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Dec 2023 13:14:11 +0000 Received: from smtpout.prod.us-west-2.prod.farcaster.email.amazon.dev (iad7-ws-svc-p70-lb3-vlan3.iad.amazon.com [10.32.235.38]) by email-inbound-relay-iad-1d-m6i4x-e651a362.us-east-1.amazon.com (Postfix) with ESMTPS id 0F9E4812FF; Tue, 5 Dec 2023 13:14:06 +0000 (UTC) Received: from EX19MTAEUC001.ant.amazon.com [10.0.43.254:14418] by smtpin.naws.eu-west-1.prod.farcaster.email.amazon.dev [10.0.40.84:2525] with esmtp (Farcaster) id 7fe427f2-f048-42ad-b344-5ae159f3585f; Tue, 5 Dec 2023 13:14:05 +0000 (UTC) X-Farcaster-Flow-ID: 7fe427f2-f048-42ad-b344-5ae159f3585f Received: from EX19D032EUB002.ant.amazon.com (10.252.61.47) by EX19MTAEUC001.ant.amazon.com (10.252.51.193) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Tue, 5 Dec 2023 13:14:05 +0000 Received: from EX19MTAUEC001.ant.amazon.com (10.252.135.222) by EX19D032EUB002.ant.amazon.com (10.252.61.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Tue, 5 Dec 2023 13:14:05 +0000 Received: from dev-dsk-jalliste-1c-e3349c3e.eu-west-1.amazon.com (10.13.244.142) by mail-relay.amazon.com (10.252.135.200) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.39 via Frontend Transport; Tue, 5 Dec 2023 13:14:03 +0000 From: Jack Allister To: CC: Jack Allister , Paul Durrant , Jue Wang , Usama Arif , "Thomas Gleixner" , Ingo Molnar , "Borislav Petkov" , Dave Hansen , , "H. Peter Anvin" , Hans de Goede , Peter Zijlstra , "Rafael J. Wysocki" , Subject: [PATCH] x86: intel_epb: Add earlyparam option to keep bias at performance Date: Tue, 5 Dec 2023 13:13:57 +0000 Message-ID: <20231205131359.66338-1-jalliste@amazon.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain 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, UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email 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 (howler.vger.email [0.0.0.0]); Tue, 05 Dec 2023 05:14:26 -0800 (PST) There are certain scenarios where it may be intentional that the EPB was set at to 0/ENERGY_PERF_BIAS_PERFORMANCE on kernel boot. For example, in data centers a kexec/live-update of the kernel may be performed regularly. Usually this live-update is time critical and defaulting of the bias back to ENERGY_PERF_BIAS_NORMAL may actually be detrimental to the overall update time if processors' time to ramp up/boost are affected. This patch introduces a kernel command line "intel_epb_keep_performance" which will leave the EPB at performance if during the restoration code path it is detected as such. Signed-off-by: Jack Allister Cc: Paul Durrant Cc: Jue Wang Cc: Usama Arif --- arch/x86/kernel/cpu/intel_epb.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/cpu/intel_epb.c b/arch/x86/kernel/cpu/intel_epb.c index e4c3ba91321c..cbe0e224b8d9 100644 --- a/arch/x86/kernel/cpu/intel_epb.c +++ b/arch/x86/kernel/cpu/intel_epb.c @@ -50,7 +50,8 @@ * the OS will do that anyway. That sometimes is problematic, as it may cause * the system battery to drain too fast, for example, so it is better to adjust * it on CPU bring-up and if the initial EPB value for a given CPU is 0, the - * kernel changes it to 6 ('normal'). + * kernel changes it to 6 ('normal'). This however is overridable via + * intel_epb_no_override if required. */ static DEFINE_PER_CPU(u8, saved_epb); @@ -75,6 +76,8 @@ static u8 energ_perf_values[] = { [EPB_INDEX_POWERSAVE] = ENERGY_PERF_BIAS_POWERSAVE, }; +static bool intel_epb_no_override __read_mostly; + static int intel_epb_save(void) { u64 epb; @@ -106,7 +109,7 @@ static void intel_epb_restore(void) * ('normal'). */ val = epb & EPB_MASK; - if (val == ENERGY_PERF_BIAS_PERFORMANCE) { + if (!intel_epb_no_override && val == ENERGY_PERF_BIAS_PERFORMANCE) { val = energ_perf_values[EPB_INDEX_NORMAL]; pr_warn_once("ENERGY_PERF_BIAS: Set to 'normal', was 'performance'\n"); } @@ -213,6 +216,12 @@ static const struct x86_cpu_id intel_epb_normal[] = { {} }; +static __init int intel_epb_no_override_setup(char *str) +{ + return kstrtobool(str, &intel_epb_no_override); +} +early_param("intel_epb_no_override", intel_epb_no_override_setup); + static __init int intel_epb_init(void) { const struct x86_cpu_id *id = x86_match_cpu(intel_epb_normal); -- 2.40.1