diff mbox series

[RFC,v2,32/32] x86/fred: disable FRED by default in its early stage

Message ID 20230106085617.17248-33-xin3.li@intel.com (mailing list archive)
State New, archived
Headers show
Series x86: enable FRED for x86-64 | expand

Commit Message

Li, Xin3 Jan. 6, 2023, 8:56 a.m. UTC
Disable FRED by default in its early stage.

To enable FRED, a new kernel command line option "fred" needs to be added.

Signed-off-by: Xin Li <xin3.li@intel.com>
---
 Documentation/admin-guide/kernel-parameters.txt | 4 ++++
 arch/x86/kernel/cpu/common.c                    | 3 +++
 2 files changed, 7 insertions(+)

Comments

H. Peter Anvin Jan. 6, 2023, 9:25 p.m. UTC | #1
On January 6, 2023 12:56:17 AM PST, Xin Li <xin3.li@intel.com> wrote:
>Disable FRED by default in its early stage.
>
>To enable FRED, a new kernel command line option "fred" needs to be added.
>
>Signed-off-by: Xin Li <xin3.li@intel.com>
>---
> Documentation/admin-guide/kernel-parameters.txt | 4 ++++
> arch/x86/kernel/cpu/common.c                    | 3 +++
> 2 files changed, 7 insertions(+)
>
>diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
>index 42af9ca0127e..0bc76d926dd4 100644
>--- a/Documentation/admin-guide/kernel-parameters.txt
>+++ b/Documentation/admin-guide/kernel-parameters.txt
>@@ -1506,6 +1506,10 @@
> 			Warning: use of this parameter will taint the kernel
> 			and may cause unknown problems.
> 
>+	fred
>+			Forcefully enable flexible return and event delivery,
>+			which is otherwise disabled by default.
>+
> 	ftrace=[tracer]
> 			[FTRACE] will set and start the specified tracer
> 			as early as possible in order to facilitate early
>diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
>index 5de68356fe62..1a160337ad41 100644
>--- a/arch/x86/kernel/cpu/common.c
>+++ b/arch/x86/kernel/cpu/common.c
>@@ -1434,6 +1434,9 @@ static void __init cpu_parse_early_param(void)
> 	char *argptr = arg, *opt;
> 	int arglen, taint = 0;
> 
>+	if (!cmdline_find_option_bool(boot_command_line, "fred"))
>+		setup_clear_cpu_cap(X86_FEATURE_FRED);
>+
> #ifdef CONFIG_X86_32
> 	if (cmdline_find_option_bool(boot_command_line, "no387"))
> #ifdef CONFIG_MATH_EMULATION

Specifically, the intent is to enable it by default once hardware is widely available. This allows e.g. distros to compile in the support for opt-in field testing before throwing the switch.

The motivation for this comes from the SMAP experience where the code was functional and correct when merged, but a change elsewhere in the kernel code base broke it during the intervening period.
Li, Xin3 Jan. 6, 2023, 11 p.m. UTC | #2
> >Disable FRED by default in its early stage.
> >
> >To enable FRED, a new kernel command line option "fred" needs to be added.
> >
> >Signed-off-by: Xin Li <xin3.li@intel.com>
> >---
> > Documentation/admin-guide/kernel-parameters.txt | 4 ++++
> > arch/x86/kernel/cpu/common.c                    | 3 +++
> > 2 files changed, 7 insertions(+)
> >
> >diff --git a/Documentation/admin-guide/kernel-parameters.txt
> >b/Documentation/admin-guide/kernel-parameters.txt
> >index 42af9ca0127e..0bc76d926dd4 100644
> >--- a/Documentation/admin-guide/kernel-parameters.txt
> >+++ b/Documentation/admin-guide/kernel-parameters.txt
> >@@ -1506,6 +1506,10 @@
> > 			Warning: use of this parameter will taint the kernel
> > 			and may cause unknown problems.
> >
> >+	fred
> >+			Forcefully enable flexible return and event delivery,
> >+			which is otherwise disabled by default.
> >+
> > 	ftrace=[tracer]
> > 			[FTRACE] will set and start the specified tracer
> > 			as early as possible in order to facilitate early diff --git
> >a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index
> >5de68356fe62..1a160337ad41 100644
> >--- a/arch/x86/kernel/cpu/common.c
> >+++ b/arch/x86/kernel/cpu/common.c
> >@@ -1434,6 +1434,9 @@ static void __init cpu_parse_early_param(void)
> > 	char *argptr = arg, *opt;
> > 	int arglen, taint = 0;
> >
> >+	if (!cmdline_find_option_bool(boot_command_line, "fred"))
> >+		setup_clear_cpu_cap(X86_FEATURE_FRED);
> >+
> > #ifdef CONFIG_X86_32
> > 	if (cmdline_find_option_bool(boot_command_line, "no387")) #ifdef
> > CONFIG_MATH_EMULATION
> 
> Specifically, the intent is to enable it by default once hardware is widely available.
> This allows e.g. distros to compile in the support for opt-in field testing before
> throwing the switch.
> 
> The motivation for this comes from the SMAP experience where the code was
> functional and correct when merged, but a change elsewhere in the kernel code
> base broke it during the intervening period.

Thanks for the clarification.
diff mbox series

Patch

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 42af9ca0127e..0bc76d926dd4 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -1506,6 +1506,10 @@ 
 			Warning: use of this parameter will taint the kernel
 			and may cause unknown problems.
 
+	fred
+			Forcefully enable flexible return and event delivery,
+			which is otherwise disabled by default.
+
 	ftrace=[tracer]
 			[FTRACE] will set and start the specified tracer
 			as early as possible in order to facilitate early
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 5de68356fe62..1a160337ad41 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -1434,6 +1434,9 @@  static void __init cpu_parse_early_param(void)
 	char *argptr = arg, *opt;
 	int arglen, taint = 0;
 
+	if (!cmdline_find_option_bool(boot_command_line, "fred"))
+		setup_clear_cpu_cap(X86_FEATURE_FRED);
+
 #ifdef CONFIG_X86_32
 	if (cmdline_find_option_bool(boot_command_line, "no387"))
 #ifdef CONFIG_MATH_EMULATION