Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp281737rdb; Tue, 5 Dec 2023 05:30:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IFxon90cgxvHI82Myn5S9EL1QsHuI62/qgWOrB/PMY8HHO4Dn1ThgNs6hX/DFNdrZKTDGfW X-Received: by 2002:a05:6a20:3944:b0:18b:3168:d1a1 with SMTP id r4-20020a056a20394400b0018b3168d1a1mr4045079pzg.46.1701783037490; Tue, 05 Dec 2023 05:30:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701783037; cv=none; d=google.com; s=arc-20160816; b=Hr9GIVLHUJGZH0aldwQFGHrD3VYoypB+GbWpEmwMHZegw59vpvWxVeiEJ5HnPAPgk3 b2186UIGlkQHPg83c16NwNV5mUEGjC95Xa+q2aExRWItOOst/KkcFRWbPPWyrNH47My6 aaY3SDYU0LLgve7PbHw82PMAl9erUpwdcNk9pMj54VXOmhVvNW+b8ZPTCDxHMuCqj+ey f4XLTKV62ERLPOo73lzGAt8if40Z7VQ8nEBSju7beNfS8w1O4zM9MEtI2+nMK4ck1x0M iuV7mBEn3rnvX6YyOYGzFf7a4wW0IAP1ilPTTCC0GxVY3unpnvzMRoadhqW0VlFcKUf1 i1ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=xnefoVbxiogTME6kuI5hJNkHQf4uTRCqlOsgvSW7Q4g=; fh=sAjNamE+yPPfwqaOMqdwBfDkXBpdkE33FZ/NhVFCvrA=; b=W3jQanfDUKGwPr0Dcf5/UpqLvc+v7ywpQ0sGa2Dlb4eDLufSlPWAB/mKFXAPXVp+LM apL/JYdG9utlkaIeaU3ATAQLpuX7CtYRxPLM1dtpna9GI0vNUd8l1l5JFw6arhdLznt0 eCb0GpYfbzoBL3pUABqNgWLN/mBEB2brmHfuI/1a7iMWqfT6Rb9qKiu3YAz6K92mGv2W /pI61ZRJm0STD9hAA4CoL5vkDHCd9X9dnxg2ZSbzwvAs82iZeUZEHBi5KLEP9ERsKIO4 3T2cO5wXHkzKMzL++SeYCvPW39fUYOlPpJic7XMtiQcPKLu1YCCXO/7ET3elGHSa5Wnc ZE9w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id a12-20020a056a000c8c00b006ce060dba6esi7080411pfv.240.2023.12.05.05.30.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Dec 2023 05:30:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id BEF818099240; Tue, 5 Dec 2023 05:30:29 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345442AbjLENaM convert rfc822-to-8bit (ORCPT + 99 others); Tue, 5 Dec 2023 08:30:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345403AbjLENaK (ORCPT ); Tue, 5 Dec 2023 08:30:10 -0500 Received: from mail-oa1-f49.google.com (mail-oa1-f49.google.com [209.85.160.49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD6F3B9 for ; Tue, 5 Dec 2023 05:30:16 -0800 (PST) Received: by mail-oa1-f49.google.com with SMTP id 586e51a60fabf-1fb6cbacf9aso63968fac.0 for ; Tue, 05 Dec 2023 05:30:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701783016; x=1702387816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sQ46Zu5o/jlw4aoBQJBdzf1PrFCmVa4Ine74hNCNpr8=; b=hmbPYYoJJoyI/1uybUb1dlZ/Ea7ufx24LvSDsm1tV9yU5YvRHgSMhF/LUucgYeAUxU 861srUCWCUCcvmTdlEhOYRYcl5nk7AwqPC+e8g7uupXUD9pjIjbXEVWSNxCn6hi7UfH5 G4eZCg0tSE0m5k294QGQbKFAwvcCLX7gFtOW8wN4EkAF1FWuXZgRM44xSg+g9/EP+xQ0 4ciRmL/9Pukd4SByEqY9wp5qt3BhSAwLAnig7Fo4XLVOFyWJlA/anWHq3s8zimzjAWvH +s2LboXGd+MXDToqxB3R9WqflYhT86cKVq5dcvC2hpb1RUf0KmAusnMhpkFXT7yyiwi2 jNtA== X-Gm-Message-State: AOJu0YyWp3L0PM+Hmu55mn9EyRdW/pBTY+vDBqOJ9wRfNPUDl9vTtX5m Usv4ImoKVMczR5urEE/TJ0odRFSAv7AwzUX3q60= X-Received: by 2002:a05:6870:971f:b0:1fa:f195:e3b4 with SMTP id n31-20020a056870971f00b001faf195e3b4mr12903829oaq.2.1701783016043; Tue, 05 Dec 2023 05:30:16 -0800 (PST) MIME-Version: 1.0 References: <20231205131359.66338-1-jalliste@amazon.com> In-Reply-To: <20231205131359.66338-1-jalliste@amazon.com> From: "Rafael J. Wysocki" Date: Tue, 5 Dec 2023 14:30:04 +0100 Message-ID: Subject: Re: [PATCH] x86: intel_epb: Add earlyparam option to keep bias at performance To: Jack Allister Cc: rafael@kernel.org, Paul Durrant , Jue Wang , Usama Arif , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Hans de Goede , Peter Zijlstra , "Rafael J. Wysocki" , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.0 required=5.0 tests=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 morse.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 (morse.vger.email [0.0.0.0]); Tue, 05 Dec 2023 05:30:30 -0800 (PST) On Tue, Dec 5, 2023 at 2:14 PM Jack Allister wrote: > > 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. > */ In the comment above I would say "However, if it is desirable to retain the original initial EPB value, intel_epb_no_override can be set to enforce it." Otherwise Acked-by: Rafael J. Wysocki > > 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 >