Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp352229rdb; Tue, 5 Dec 2023 07:14:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IENSUdnCUCFkN73RrDmyJWlBkBDsSbqMI2j0Gt8sKmKOtJU0CzutvSzSA6CcRKjfM+k9e/T X-Received: by 2002:a17:902:8bca:b0:1ce:6669:3260 with SMTP id r10-20020a1709028bca00b001ce66693260mr5762210plo.67.1701789284954; Tue, 05 Dec 2023 07:14:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701789284; cv=none; d=google.com; s=arc-20160816; b=Tfy8JfXd1J5QVcQ2RcBiBiLNnM8/dywIjq/c9QwF0+5+i1et1lspsm1gMeYm/0F2ps MY7R33O4NRFPBNVmwAFwE6Pp/CysS8qqMJQG5wa2xp9U20lIdPvS2m1HKJ8cY3gtXHgM a9WUahIYVq3uXSzPyV7d1Io/Brp/lNhYknUFrdYEAKbEaI3yrpWBmfWZL0wxR1sAEMUt //vSURl2mHbMA9EN9AuVrT4EPpMSrJTUiFKzsf2yW/PzgPX2r0yUp8Pn0en9Awle0IFv xVVyCqZaWWFqWqzJ5fxH/tiXVsnyitBYxyYtUdbi2adSOcfYk2Nj+OIQsIih8BI49KOI RuLg== 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=aA527ZbGG+qdghRfvAISgVaPT3L9rhCKjqZ+UJ1RvlM=; fh=vh6cZEAx5+dclC9sqMJjsTJXRBzpmmBgNel4lbC4l6A=; b=ZyDN82Ao3cSCjInn9PrIgUhSWWa1sdz2oJ73vVDc+bkJERzfXfNwycf7WK8Ry2GgCP kADY0mavkp9Xw8ZqcqaCOfPbBMoF8ooXUf01+6Or2B2mDCrNC12IyJoIyKi06F4RXFMT NNz6MrLyYIwwr4n319ZA8TAPn3BU1JxcGuKjnmPwE5dWIGsyZfMcZkxERuUTIEG8wjVz pu+27NvL92M8tLeiUKgYJBGukteHQamI/x7pLzKlxtu4t77qBBTJkFULXZ8BrwbVKjQc J2KebfW6fIAmHllkAcFj8kSINZ1ULaLw7fOJeQS82OPbJI2PsQ94uPnPZQwJCIUEyWw7 ap0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=bWB+R4UR; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id i4-20020a170902c94400b001cfb52101e3si2265186pla.413.2023.12.05.07.14.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Dec 2023 07:14:44 -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=@amazon.com header.s=amazon201209 header.b=bWB+R4UR; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 1C4F58045C74; Tue, 5 Dec 2023 07:14:42 -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 S1346032AbjLEPOT (ORCPT + 99 others); Tue, 5 Dec 2023 10:14:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346031AbjLEPOQ (ORCPT ); Tue, 5 Dec 2023 10:14:16 -0500 Received: from smtp-fw-9106.amazon.com (smtp-fw-9106.amazon.com [207.171.188.206]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C50881BD for ; Tue, 5 Dec 2023 07:14:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1701789263; x=1733325263; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=aA527ZbGG+qdghRfvAISgVaPT3L9rhCKjqZ+UJ1RvlM=; b=bWB+R4URSNlvHjqPqDYN9HQnObQV9QibUhnGAQQ54KyM+Zvw4lOHrUOG NeULO/KJvLG8L4K2PGRnYHsILLo7l3dfW4c3k55wIFHeFODZDOeY3rffo hdba1Yev+/H1OXd7q0MKSyjQ54sz8lr9qa8+Zlb6/uVYnm6/AJo2P9Mbt c=; X-IronPort-AV: E=Sophos;i="6.04,252,1695686400"; d="scan'208";a="688422232" Received: from pdx4-co-svc-p1-lb2-vlan2.amazon.com (HELO email-inbound-relay-iad-1d-m6i4x-25ac6bd5.us-east-1.amazon.com) ([10.25.36.210]) by smtp-border-fw-9106.sea19.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Dec 2023 15:14:16 +0000 Received: from smtpout.prod.us-west-2.prod.farcaster.email.amazon.dev (iad7-ws-svc-p70-lb3-vlan2.iad.amazon.com [10.32.235.34]) by email-inbound-relay-iad-1d-m6i4x-25ac6bd5.us-east-1.amazon.com (Postfix) with ESMTPS id D8A5B48B2A; Tue, 5 Dec 2023 15:14:12 +0000 (UTC) Received: from EX19MTAEUB001.ant.amazon.com [10.0.43.254:35674] by smtpin.naws.eu-west-1.prod.farcaster.email.amazon.dev [10.0.2.196:2525] with esmtp (Farcaster) id fbf23383-9723-40f1-b63a-a4abaefb30c5; Tue, 5 Dec 2023 15:14:11 +0000 (UTC) X-Farcaster-Flow-ID: fbf23383-9723-40f1-b63a-a4abaefb30c5 Received: from EX19D033EUB003.ant.amazon.com (10.252.61.76) by EX19MTAEUB001.ant.amazon.com (10.252.51.26) 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 15:14:11 +0000 Received: from EX19MTAUEC001.ant.amazon.com (10.252.135.222) by EX19D033EUB003.ant.amazon.com (10.252.61.76) 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 15:14:10 +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.40 via Frontend Transport; Tue, 5 Dec 2023 15:14:09 +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 , Subject: [PATCH v4] x86: intel_epb: Add earlyparam option to keep bias at performance Date: Tue, 5 Dec 2023 15:14:02 +0000 Message-ID: <20231205151403.76015-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 agentk.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 (agentk.vger.email [0.0.0.0]); Tue, 05 Dec 2023 07:14:42 -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_no_override" which will leave the EPB at performance if during the restoration code path it is detected as such. Signed-off-by: Jack Allister Acked-by: Rafael J. Wysocki 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..4a3523225572 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'). However, if it is desirable to retain the + * original initial EPB value, intel_epb_no_override can be set to enforce it. */ 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