Skip to contentSkip to conversation

x86/intel: Fix always false range check in x86_vfm model matching

PATCH In review Suchit Karunakaran 4 participants 10 messages Jul 29, 2025 – Jul 30, 2025 1 message not in the archive x86

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 x86/intel: Fix always false range check in x86_vfm model matching

Fix a logic bug in early_init_intel() where a conditional range check:
(c->x86_vfm >= INTEL_P4_PRESCOTT && c->x86_vfm <= INTEL_P4_WILLAMETTE) was always false due to (PRESCOTT) being numerically greater than the upper bound (WILLAMETTE). This triggers:-Werror=logical-op:
logical ‘and’ of mutually exclusive tests is always false The fix corrects the constant ordering to ensure the range is valid:
(c->x86_vfm >= INTEL_P4_PRESCOTT && c->x86_vfm <= INTEL_P4_CEDARMILL)

Fixes fadb6f569b10 ("x86/cpu/intel: Limit the non-architectural

constant_tsc model checks")

Changes since v1:
- Fix incorrect logic

---
 arch/x86/kernel/cpu/intel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/intel.c +1 -1
index 076eaa41b8c8..6f5bd5dbc249 100644
@@ -262,7 +262,7 @@ static void early_init_intel(struct cpuinfo_x86 *c)
 	if (c->x86_power & (1 << 8)) {
 		set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
 		set_cpu_cap(c, X86_FEATURE_NONSTOP_TSC);
-	} else if ((c->x86_vfm >= INTEL_P4_PRESCOTT && c->x86_vfm <= INTEL_P4_WILLAMETTE) ||
+	} else if ((c->x86_vfm >=  INTEL_P4_PRESCOTT && c->x86_vfm <= INTEL_P4_CEDARMILL) ||
 		   (c->x86_vfm >= INTEL_CORE_YONAH  && c->x86_vfm <= INTEL_IVYBRIDGE)) {
 		set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
 	}
Signature · 1 line
2.50.1
#1 lore raw
Quoted 36 lines · Suchit Karunakaran

Fix a logic bug in early_init_intel() where a conditional range check:
(c->x86_vfm >= INTEL_P4_PRESCOTT && c->x86_vfm <= INTEL_P4_WILLAMETTE) was always false due to (PRESCOTT) being numerically greater than the upper bound (WILLAMETTE). This triggers:-Werror=logical-op:
logical ‘and’ of mutually exclusive tests is always false The fix corrects the constant ordering to ensure the range is valid:
(c->x86_vfm >= INTEL_P4_PRESCOTT && c->x86_vfm <= INTEL_P4_CEDARMILL)

Fixes fadb6f569b10 ("x86/cpu/intel: Limit the non-architectural

constant_tsc model checks")

Changes since v1:
- Fix incorrect logic

---
 arch/x86/kernel/cpu/intel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/intel.c +1 -1
index 076eaa41b8c8..6f5bd5dbc249 100644
@@ -262,7 +262,7 @@ static void early_init_intel(struct cpuinfo_x86 *c)
 	if (c->x86_power & (1 << 8)) {
 		set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
 		set_cpu_cap(c, X86_FEATURE_NONSTOP_TSC);
-	} else if ((c->x86_vfm >= INTEL_P4_PRESCOTT && c->x86_vfm <= INTEL_P4_WILLAMETTE) ||
+	} else if ((c->x86_vfm >=  INTEL_P4_PRESCOTT && c->x86_vfm <= INTEL_P4_CEDARMILL) ||
 		   (c->x86_vfm >= INTEL_CORE_YONAH  && c->x86_vfm <= INTEL_IVYBRIDGE)) {
 		set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
 	}
Signature · 1 line
2.50.1

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him a patch that has triggered this response. He used to manually respond to these common problems, but in order to save his sanity (he kept writing the same thing over and over, yet to different people), I was created. Hopefully you will not take offence and will fix the problem in your patch and resubmit it so that it can be accepted into the Linux kernel tree.

You are receiving this message because of the following common error(s) as indicated below:

- You have marked a patch with a "Fixes:" tag for a commit that is in an older released kernel, yet you do not have a cc: stable line in the signed-off-by area at all, which means that the patch will not be applied to any older kernel releases. To properly fix this, please follow the documented rules in the Documentation/process/stable-kernel-rules.rst file for how to resolve this.

If you wish to discuss this problem further, or you have questions about how to resolve this issue, please feel free to respond to this email and Greg will reply once he has dug out from the pending patches received from other developers.

thanks,

greg k-h's patch email bot

#2 lore raw
Quoted 60 lines · Greg KH
Quoted 33 lines · Suchit Karunakaran

Fix a logic bug in early_init_intel() where a conditional range check:
(c->x86_vfm >= INTEL_P4_PRESCOTT && c->x86_vfm <= INTEL_P4_WILLAMETTE) was always false due to (PRESCOTT) being numerically greater than the upper bound (WILLAMETTE). This triggers:-Werror=logical-op:
logical ‘and’ of mutually exclusive tests is always false The fix corrects the constant ordering to ensure the range is valid:
(c->x86_vfm >= INTEL_P4_PRESCOTT && c->x86_vfm <= INTEL_P4_CEDARMILL)

Fixes fadb6f569b10 ("x86/cpu/intel: Limit the non-architectural

constant_tsc model checks")

Changes since v1:
- Fix incorrect logic

---
 arch/x86/kernel/cpu/intel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/intel.c +1 -2
index 076eaa41b8c8..6f5bd5dbc249 100644
@@ -262,7 +262,7 @@ static void early_init_intel(struct cpuinfo_x86 *c)
      if (c->x86_power & (1 << 8)) {
              set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
              set_cpu_cap(c, X86_FEATURE_NONSTOP_TSC);
-     } else if ((c->x86_vfm >= INTEL_P4_PRESCOTT && c->x86_vfm <= INTEL_P4_WILLAMETTE) ||
+     } else if ((c->x86_vfm >=  INTEL_P4_PRESCOTT && c->x86_vfm <= INTEL_P4_CEDARMILL) ||
                 (c->x86_vfm >= INTEL_CORE_YONAH  && c->x86_vfm <= INTEL_IVYBRIDGE)) {
              set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
      }
--
Quoted 3 lines

2.50.1

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him a patch that has triggered this response. He used to manually respond to these common problems, but in order to save his sanity (he kept writing the same thing over and over, yet to different people), I was created. Hopefully you will not take offence and will fix the problem in your patch and resubmit it so that it can be accepted into the Linux kernel tree.

You are receiving this message because of the following common error(s) as indicated below:

- You have marked a patch with a "Fixes:" tag for a commit that is in an older released kernel, yet you do not have a cc: stable line in the signed-off-by area at all, which means that the patch will not be applied to any older kernel releases. To properly fix this, please follow the documented rules in the Documentation/process/stable-kernel-rules.rst file for how to resolve this.

Quoted 8 lines

If you wish to discuss this problem further, or you have questions about how to resolve this issue, please feel free to respond to this email and Greg will reply once he has dug out from the pending patches received from other developers.

thanks,

greg k-h's patch email bot

Hi Greg,
I've a question regarding backporting this fix. Can this fix be backported to stable kernel version 6.15.8? Also, should I send the backport patch only after the initial patch has been merged in mainline or linux-next?

#3 lore raw
Quoted 68 lines · Suchit Karunakaran
Quoted 67 lines · Greg KH
Quoted 33 lines · Suchit Karunakaran

Fix a logic bug in early_init_intel() where a conditional range check:
(c->x86_vfm >= INTEL_P4_PRESCOTT && c->x86_vfm <= INTEL_P4_WILLAMETTE) was always false due to (PRESCOTT) being numerically greater than the upper bound (WILLAMETTE). This triggers:-Werror=logical-op:
logical ‘and’ of mutually exclusive tests is always false The fix corrects the constant ordering to ensure the range is valid:
(c->x86_vfm >= INTEL_P4_PRESCOTT && c->x86_vfm <= INTEL_P4_CEDARMILL)

Fixes fadb6f569b10 ("x86/cpu/intel: Limit the non-architectural

constant_tsc model checks")

Changes since v1:
- Fix incorrect logic

---
 arch/x86/kernel/cpu/intel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/intel.c +1 -2
index 076eaa41b8c8..6f5bd5dbc249 100644
@@ -262,7 +262,7 @@ static void early_init_intel(struct cpuinfo_x86 *c)
      if (c->x86_power & (1 << 8)) {
              set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
              set_cpu_cap(c, X86_FEATURE_NONSTOP_TSC);
-     } else if ((c->x86_vfm >= INTEL_P4_PRESCOTT && c->x86_vfm <= INTEL_P4_WILLAMETTE) ||
+     } else if ((c->x86_vfm >=  INTEL_P4_PRESCOTT && c->x86_vfm <= INTEL_P4_CEDARMILL) ||
                 (c->x86_vfm >= INTEL_CORE_YONAH  && c->x86_vfm <= INTEL_IVYBRIDGE)) {
              set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
      }
--
Quoted 3 lines

2.50.1

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him a patch that has triggered this response. He used to manually respond to these common problems, but in order to save his sanity (he kept writing the same thing over and over, yet to different people), I was created. Hopefully you will not take offence and will fix the problem in your patch and resubmit it so that it can be accepted into the Linux kernel tree.

You are receiving this message because of the following common error(s) as indicated below:

- You have marked a patch with a "Fixes:" tag for a commit that is in an older released kernel, yet you do not have a cc: stable line in the signed-off-by area at all, which means that the patch will not be applied to any older kernel releases. To properly fix this, please follow the documented rules in the Documentation/process/stable-kernel-rules.rst file for how to resolve this.

If you wish to discuss this problem further, or you have questions about how to resolve this issue, please feel free to respond to this email and Greg will reply once he has dug out from the pending patches received from other developers.

thanks,

Quoted 7 lines
Quoted 1 line

greg k-h's patch email bot

Hi Greg,
I've a question regarding backporting this fix. Can this fix be backported to stable kernel version 6.15.8? Also, should I send the backport patch only after the initial patch has been merged in mainline or linux-next?

Did you read the document that my bot linked to above? It should answer those questions :)

thanks,

greg k-h

#4 lore raw
Quoted 78 lines · Greg KH
Quoted 68 lines · Suchit Karunakaran
Quoted 67 lines · Greg KH
Quoted 33 lines · Suchit Karunakaran

Fix a logic bug in early_init_intel() where a conditional range check:
(c->x86_vfm >= INTEL_P4_PRESCOTT && c->x86_vfm <= INTEL_P4_WILLAMETTE) was always false due to (PRESCOTT) being numerically greater than the upper bound (WILLAMETTE). This triggers:-Werror=logical-op:
logical ‘and’ of mutually exclusive tests is always false The fix corrects the constant ordering to ensure the range is valid:
(c->x86_vfm >= INTEL_P4_PRESCOTT && c->x86_vfm <= INTEL_P4_CEDARMILL)

Fixes fadb6f569b10 ("x86/cpu/intel: Limit the non-architectural

constant_tsc model checks")

Changes since v1:
- Fix incorrect logic

---
 arch/x86/kernel/cpu/intel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/intel.c +1 -2
index 076eaa41b8c8..6f5bd5dbc249 100644
@@ -262,7 +262,7 @@ static void early_init_intel(struct cpuinfo_x86 *c)
      if (c->x86_power & (1 << 8)) {
              set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
              set_cpu_cap(c, X86_FEATURE_NONSTOP_TSC);
-     } else if ((c->x86_vfm >= INTEL_P4_PRESCOTT && c->x86_vfm <= INTEL_P4_WILLAMETTE) ||
+     } else if ((c->x86_vfm >=  INTEL_P4_PRESCOTT && c->x86_vfm <= INTEL_P4_CEDARMILL) ||
                 (c->x86_vfm >= INTEL_CORE_YONAH  && c->x86_vfm <= INTEL_IVYBRIDGE)) {
              set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
      }
--
Quoted 3 lines

2.50.1

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him a patch that has triggered this response. He used to manually respond to these common problems, but in order to save his sanity (he kept writing the same thing over and over, yet to different people), I was created. Hopefully you will not take offence and will fix the problem in your patch and resubmit it so that it can be accepted into the Linux kernel tree.

You are receiving this message because of the following common error(s) as indicated below:

- You have marked a patch with a "Fixes:" tag for a commit that is in an older released kernel, yet you do not have a cc: stable line in the signed-off-by area at all, which means that the patch will not be applied to any older kernel releases. To properly fix this, please follow the documented rules in the Documentation/process/stable-kernel-rules.rst file for how to resolve this.

If you wish to discuss this problem further, or you have questions about how to resolve this issue, please feel free to respond to this email and Greg will reply once he has dug out from the pending patches received from other developers.

thanks,

Quoted 7 lines
Quoted 1 line

greg k-h's patch email bot

Hi Greg,
I've a question regarding backporting this fix. Can this fix be backported to stable kernel version 6.15.8? Also, should I send the backport patch only after the initial patch has been merged in mainline or linux-next?

Quoted 6 lines

Did you read the document that my bot linked to above? It should answer those questions :)

thanks,

greg k-h

Hi Greg,
I did go through the document you linked. I just wanted to clarify about the backporting process, especially since the merge window has already started and it might take some time for this to be merged into mainline. Regardless, I'll send the backport patch after the initial one has been merged.
Thanks again, and I apologize for any inconvenience.

#5 lore raw
Quoted 84 lines · Suchit Karunakaran
Quoted 83 lines · Greg KH
Quoted 68 lines · Suchit Karunakaran
Quoted 67 lines · Greg KH
Quoted 33 lines · Suchit Karunakaran

Fix a logic bug in early_init_intel() where a conditional range check:
(c->x86_vfm >= INTEL_P4_PRESCOTT && c->x86_vfm <= INTEL_P4_WILLAMETTE) was always false due to (PRESCOTT) being numerically greater than the upper bound (WILLAMETTE). This triggers:-Werror=logical-op:
logical ‘and’ of mutually exclusive tests is always false The fix corrects the constant ordering to ensure the range is valid:
(c->x86_vfm >= INTEL_P4_PRESCOTT && c->x86_vfm <= INTEL_P4_CEDARMILL)

Fixes fadb6f569b10 ("x86/cpu/intel: Limit the non-architectural

constant_tsc model checks")

Changes since v1:
- Fix incorrect logic

---
 arch/x86/kernel/cpu/intel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/intel.c +1 -2
index 076eaa41b8c8..6f5bd5dbc249 100644
@@ -262,7 +262,7 @@ static void early_init_intel(struct cpuinfo_x86 *c)
      if (c->x86_power & (1 << 8)) {
              set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
              set_cpu_cap(c, X86_FEATURE_NONSTOP_TSC);
-     } else if ((c->x86_vfm >= INTEL_P4_PRESCOTT && c->x86_vfm <= INTEL_P4_WILLAMETTE) ||
+     } else if ((c->x86_vfm >=  INTEL_P4_PRESCOTT && c->x86_vfm <= INTEL_P4_CEDARMILL) ||
                 (c->x86_vfm >= INTEL_CORE_YONAH  && c->x86_vfm <= INTEL_IVYBRIDGE)) {
              set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
      }
--
Quoted 3 lines

2.50.1

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him a patch that has triggered this response. He used to manually respond to these common problems, but in order to save his sanity (he kept writing the same thing over and over, yet to different people), I was created. Hopefully you will not take offence and will fix the problem in your patch and resubmit it so that it can be accepted into the Linux kernel tree.

You are receiving this message because of the following common error(s) as indicated below:

- You have marked a patch with a "Fixes:" tag for a commit that is in an older released kernel, yet you do not have a cc: stable line in the signed-off-by area at all, which means that the patch will not be applied to any older kernel releases. To properly fix this, please follow the documented rules in the Documentation/process/stable-kernel-rules.rst file for how to resolve this.

If you wish to discuss this problem further, or you have questions about how to resolve this issue, please feel free to respond to this email and Greg will reply once he has dug out from the pending patches received from other developers.

thanks,

Quoted 7 lines
Quoted 1 line

greg k-h's patch email bot

Hi Greg,
I've a question regarding backporting this fix. Can this fix be backported to stable kernel version 6.15.8? Also, should I send the backport patch only after the initial patch has been merged in mainline or linux-next?

Did you read the document that my bot linked to above? It should answer those questions :)

thanks,

Quoted 8 lines
Quoted 1 line

greg k-h

Hi Greg,
I did go through the document you linked. I just wanted to clarify about the backporting process, especially since the merge window has already started and it might take some time for this to be merged into mainline. Regardless, I'll send the backport patch after the initial one has been merged.

As the document states, a commit must be in Linus's tree first, before we can consider it for any stable release.

thanks,

greg k-h

#6 lore raw
Quoted 95 lines · Greg KH
Quoted 84 lines · Suchit Karunakaran
Quoted 83 lines · Greg KH
Quoted 68 lines · Suchit Karunakaran
Quoted 67 lines · Greg KH
Quoted 33 lines · Suchit Karunakaran

Fix a logic bug in early_init_intel() where a conditional range check:
(c->x86_vfm >= INTEL_P4_PRESCOTT && c->x86_vfm <= INTEL_P4_WILLAMETTE) was always false due to (PRESCOTT) being numerically greater than the upper bound (WILLAMETTE). This triggers:-Werror=logical-op:
logical ‘and’ of mutually exclusive tests is always false The fix corrects the constant ordering to ensure the range is valid:
(c->x86_vfm >= INTEL_P4_PRESCOTT && c->x86_vfm <= INTEL_P4_CEDARMILL)

Fixes fadb6f569b10 ("x86/cpu/intel: Limit the non-architectural

constant_tsc model checks")

Changes since v1:
- Fix incorrect logic

---
 arch/x86/kernel/cpu/intel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/intel.c +1 -2
index 076eaa41b8c8..6f5bd5dbc249 100644
@@ -262,7 +262,7 @@ static void early_init_intel(struct cpuinfo_x86 *c)
      if (c->x86_power & (1 << 8)) {
              set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
              set_cpu_cap(c, X86_FEATURE_NONSTOP_TSC);
-     } else if ((c->x86_vfm >= INTEL_P4_PRESCOTT && c->x86_vfm <= INTEL_P4_WILLAMETTE) ||
+     } else if ((c->x86_vfm >=  INTEL_P4_PRESCOTT && c->x86_vfm <= INTEL_P4_CEDARMILL) ||
                 (c->x86_vfm >= INTEL_CORE_YONAH  && c->x86_vfm <= INTEL_IVYBRIDGE)) {
              set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
      }
--
Quoted 3 lines

2.50.1

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him a patch that has triggered this response. He used to manually respond to these common problems, but in order to save his sanity (he kept writing the same thing over and over, yet to different people), I was created. Hopefully you will not take offence and will fix the problem in your patch and resubmit it so that it can be accepted into the Linux kernel tree.

You are receiving this message because of the following common error(s) as indicated below:

- You have marked a patch with a "Fixes:" tag for a commit that is in an older released kernel, yet you do not have a cc: stable line in the signed-off-by area at all, which means that the patch will not be applied to any older kernel releases. To properly fix this, please follow the documented rules in the Documentation/process/stable-kernel-rules.rst file for how to resolve this.

If you wish to discuss this problem further, or you have questions about how to resolve this issue, please feel free to respond to this email and Greg will reply once he has dug out from the pending patches received from other developers.

thanks,

Quoted 7 lines
Quoted 1 line

greg k-h's patch email bot

Hi Greg,
I've a question regarding backporting this fix. Can this fix be backported to stable kernel version 6.15.8? Also, should I send the backport patch only after the initial patch has been merged in mainline or linux-next?

Did you read the document that my bot linked to above? It should answer those questions :)

thanks,

Quoted 8 lines
Quoted 1 line

greg k-h

Hi Greg,
I did go through the document you linked. I just wanted to clarify about the backporting process, especially since the merge window has already started and it might take some time for this to be merged into mainline. Regardless, I'll send the backport patch after the initial one has been merged.

Quoted 6 lines

As the document states, a commit must be in Linus's tree first, before we can consider it for any stable release.

thanks,

greg k-h

Hi Greg,
Thank you for the clarification. I now understand that a commit must be in Linus's tree before it can be considered for any stable release. I apologize for the repeated questions and any inconvenience.

Thanks,
Suchit

A message that is not in the archive (sent off-list or not yet received): CAO9wTFjkBz=NbHeAdOaJ8jFpgOmO=pM5O+Q43hTT8qqvvXTSog@mail.gmail.com

#8 lore raw
Quoted 128 lines · Suchit Karunakaran
Quoted 3 lines · Greg KH
Quoted 1 line · Suchit Karunakaran

On Tue, 29 Jul 2025 at 13:26, Greg KH <[email protected]>

Quoted 3 lines · wrote:
Quoted 3 lines
Quoted 3 lines · Suchit Karunakaran
Quoted 1 line

On Tue, 29 Jul 2025 at 10:58, Greg KH <[email protected]>

Quoted 2 lines · wrote:
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

On Tue, Jul 29, 2025 at 09:56:21AM +0530, Suchit Karunakaran

Quoted 1 line · wrote:
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

Fix a logic bug in early_init_intel() where a conditional range

check:

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

(c->x86_vfm >= INTEL_P4_PRESCOTT && c->x86_vfm <=

INTEL_P4_WILLAMETTE)

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

was always false due to (PRESCOTT) being numerically greater

than the

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

upper bound (WILLAMETTE). This triggers:-Werror=logical-op:
logical ‘and’ of mutually exclusive tests is always false The fix corrects the constant ordering to ensure the range is

valid:

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

(c->x86_vfm >= INTEL_P4_PRESCOTT && c->x86_vfm <=

INTEL_P4_CEDARMILL)

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Fixes fadb6f569b10 ("x86/cpu/intel: Limit the non-architectural

constant_tsc model checks")

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Review

Quoted 7 lines

Changes since v1:
- Fix incorrect logic

---
 arch/x86/kernel/cpu/intel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/arch/x86/kernel/cpu/intel.c

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

arch/x86/kernel/cpu/intel.c static void early_init_intel(struct

Quoted 4 lines

index 076eaa41b8c8..6f5bd5dbc249 100644

arch/x86/kernel/cpu/intel.c +0 -0
@@ -262,7 +262,7 @@ static void early_init_intel(struct

cpuinfo_x86 *c)

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

arch/x86/kernel/cpu/intel.c static void early_init_intel(struct · line 265

Quoted 4 lines
arch/x86/kernel/cpu/intel.c +0 -1
      if (c->x86_power & (1 << 8)) {
              set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
              set_cpu_cap(c, X86_FEATURE_NONSTOP_TSC);
-     } else if ((c->x86_vfm >= INTEL_P4_PRESCOTT && c->x86_vfm

<= INTEL_P4_WILLAMETTE) ||

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

arch/x86/kernel/cpu/intel.c static void early_init_intel(struct · line 265

Quoted 1 line
arch/x86/kernel/cpu/intel.c +1 -0
+     } else if ((c->x86_vfm >=  INTEL_P4_PRESCOTT &&

c->x86_vfm <= INTEL_P4_CEDARMILL) ||

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

arch/x86/kernel/cpu/intel.c static void early_init_intel(struct · line 266

Quoted 1 line
arch/x86/kernel/cpu/intel.c +0 -0
                 (c->x86_vfm >= INTEL_CORE_YONAH  && c->x86_vfm

<= INTEL_IVYBRIDGE)) {

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 6 lines
arch/x86/kernel/cpu/intel.c +0 -1
              set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
      }
--

2.50.1

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman. You have

sent him

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

a patch that has triggered this response. He used to manually

respond

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

to these common problems, but in order to save his sanity (he kept writing the same thing over and over, yet to different people), I

was

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

created. Hopefully you will not take offence and will fix the

problem

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

in your patch and resubmit it so that it can be accepted into the

Linux

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

kernel tree.

You are receiving this message because of the following common

error(s)

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

as indicated below:

- You have marked a patch with a "Fixes:" tag for a commit that

is in an

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

older released kernel, yet you do not have a cc: stable line in

the

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

signed-off-by area at all, which means that the patch will not

be

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

applied to any older kernel releases. To properly fix this,

please

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

follow the documented rules in the Documentation/process/stable-kernel-rules.rst file for how to

resolve

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

this.

If you wish to discuss this problem further, or you have

questions about

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

how to resolve this issue, please feel free to respond to this

email and

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

Greg will reply once he has dug out from the pending patches

received

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

from other developers.

thanks,

greg k-h's patch email bot

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines

Hi Greg,
I've a question regarding backporting this fix. Can this fix be backported to stable kernel version 6.15.8? Also, should I send the backport patch only after the initial patch has been merged in mainline or linux-next?

Did you read the document that my bot linked to above? It should

answer

Quoted 13 lines
Quoted 4 lines
Quoted 4 lines

those questions :)

thanks,

Quoted 8 lines
Quoted 1 line

greg k-h

Hi Greg,
I did go through the document you linked. I just wanted to clarify about the backporting process, especially since the merge window has already started and it might take some time for this to be merged into mainline. Regardless, I'll send the backport patch after the initial one has been merged.

Quoted 3 lines

As the document states, a commit must be in Linus's tree first, before we can consider it for any stable release.

Quoted 7 lines

Hi Greg,
Thanks for clarifying. I understand now that a commit must be in Linus's tree before it can be considered for any stable release.
I apologize for the repeated questions and any inconvenience.

Thanks,
Suchit

It does, *unless* there is a detailed explanation why it is not applicable to mainline (for example, "the code in mainline was completely rewritten and does not have the bug because...")

#9 lore raw
In reply to Suchit Karunakaran

Though the title is correct, it is better to make it more precise. Something like:

x86/cpu/intel: Fix the constant_tsc model check for Pentium 4s

Quoted 5 lines · Suchit Karunakaran

Fix a logic bug in early_init_intel() where a conditional range check:
(c->x86_vfm >= INTEL_P4_PRESCOTT && c->x86_vfm <= INTEL_P4_WILLAMETTE) was always false due to (PRESCOTT) being numerically greater than the upper bound (WILLAMETTE). This triggers:-Werror=logical-op:
logical ‘and’ of mutually exclusive tests is always false

We can focus on the why instead of how this error was found. How about wording it as below?

The logic to synthesize constant_tsc for Pentium 4s (Family 15) is wrong. Since INTEL_P4_PRESCOTT is numerically greater than INTEL_P4_WILLAMETTE, the logic always results in false and never sets X86_FEATURE_CONSTANT_TSC for any Pentium 4 model.

The error was introduced while replacing the x86_model check with a VFM one. The original check was as follows:

	if ((c->x86 == 0xf && c->x86_model >= 0x03) ||
		(c->x86 == 0x6 && c->x86_model >= 0x0e))
		set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);

Fix the logic to cover all Pentium 4 models from Prescott (model 3) to Cedarmill (model 6) which is the last model released in Family 15.

Quoted 3 lines

The fix corrects the constant ordering to ensure the range is valid:
(c->x86_vfm >= INTEL_P4_PRESCOTT && c->x86_vfm <= INTEL_P4_CEDARMILL)

This line is unnecessary. Changes that are easily observable in the diff below don't need to be described in the commit message.

Quoted 3 lines
Fixes fadb6f569b10 ("x86/cpu/intel: Limit the non-architectural

constant_tsc model checks")

The "Fixes:" line doesn't need to be broken down into multiple lines. All of it can be on the same line.

For patches being reviewed for upstream, adding a stable Cc (Option 1 in the stable documentation) is the easiest and preferred way to automatically trigger submissions for stable.

In this case, include the below Cc: line after the Fixes: line.

Cc <[email protected]> # v6.15
Quoted 4 lines

Changes since v1:
- Fix incorrect logic

Patch-to-patch changes should be below the --- line. That way they will get ignored when the patch is applied to the maintainer's tree.

Quoted 17 lines
---
 arch/x86/kernel/cpu/intel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/intel.c +1 -1
index 076eaa41b8c8..6f5bd5dbc249 100644
@@ -262,7 +262,7 @@ static void early_init_intel(struct cpuinfo_x86 *c)
 	if (c->x86_power & (1 << 8)) {
 		set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
 		set_cpu_cap(c, X86_FEATURE_NONSTOP_TSC);
-	} else if ((c->x86_vfm >= INTEL_P4_PRESCOTT && c->x86_vfm <= INTEL_P4_WILLAMETTE) ||
+	} else if ((c->x86_vfm >=  INTEL_P4_PRESCOTT && c->x86_vfm <= INTEL_P4_CEDARMILL) ||
 		   (c->x86_vfm >= INTEL_CORE_YONAH  && c->x86_vfm <= INTEL_IVYBRIDGE)) {
 		set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
 	}
#10 lore raw
Quoted 65 lines · Sohil Mehta

Though the title is correct, it is better to make it more precise. Something like:

x86/cpu/intel: Fix the constant_tsc model check for Pentium 4s

Quoted 5 lines · Suchit Karunakaran

Fix a logic bug in early_init_intel() where a conditional range check:
(c->x86_vfm >= INTEL_P4_PRESCOTT && c->x86_vfm <= INTEL_P4_WILLAMETTE) was always false due to (PRESCOTT) being numerically greater than the upper bound (WILLAMETTE). This triggers:-Werror=logical-op:
logical ‘and’ of mutually exclusive tests is always false

We can focus on the why instead of how this error was found. How about wording it as below?

The logic to synthesize constant_tsc for Pentium 4s (Family 15) is wrong. Since INTEL_P4_PRESCOTT is numerically greater than INTEL_P4_WILLAMETTE, the logic always results in false and never sets X86_FEATURE_CONSTANT_TSC for any Pentium 4 model.

The error was introduced while replacing the x86_model check with a VFM one. The original check was as follows:

        if ((c->x86 == 0xf && c->x86_model >= 0x03) ||
                (c->x86 == 0x6 && c->x86_model >= 0x0e))
                set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);

Fix the logic to cover all Pentium 4 models from Prescott (model 3) to Cedarmill (model 6) which is the last model released in Family 15.

Quoted 3 lines

The fix corrects the constant ordering to ensure the range is valid:
(c->x86_vfm >= INTEL_P4_PRESCOTT && c->x86_vfm <= INTEL_P4_CEDARMILL)

This line is unnecessary. Changes that are easily observable in the diff below don't need to be described in the commit message.

Quoted 3 lines
Fixes fadb6f569b10 ("x86/cpu/intel: Limit the non-architectural

constant_tsc model checks")

The "Fixes:" line doesn't need to be broken down into multiple lines. All of it can be on the same line.

For patches being reviewed for upstream, adding a stable Cc (Option 1 in the stable documentation) is the easiest and preferred way to automatically trigger submissions for stable.

In this case, include the below Cc: line after the Fixes: line.

Cc <[email protected]> # v6.15
Quoted 4 lines

Changes since v1:
- Fix incorrect logic

Patch-to-patch changes should be below the --- line. That way they will get ignored when the patch is applied to the maintainer's tree.

Quoted 4 lines
---
 arch/x86/kernel/cpu/intel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 14 lines

arch/x86/kernel/cpu/intel.c static void early_init_intel(struct cpuinfo_x86 *c) · line 268

Quoted 13 lines
arch/x86/kernel/cpu/intel.c +1 -1
index 076eaa41b8c8..6f5bd5dbc249 100644
@@ -262,7 +262,7 @@ static void early_init_intel(struct cpuinfo_x86 *c)
      if (c->x86_power & (1 << 8)) {
              set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
              set_cpu_cap(c, X86_FEATURE_NONSTOP_TSC);
-     } else if ((c->x86_vfm >= INTEL_P4_PRESCOTT && c->x86_vfm <= INTEL_P4_WILLAMETTE) ||
+     } else if ((c->x86_vfm >=  INTEL_P4_PRESCOTT && c->x86_vfm <= INTEL_P4_CEDARMILL) ||
                 (c->x86_vfm >= INTEL_CORE_YONAH  && c->x86_vfm <= INTEL_IVYBRIDGE)) {
              set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
      }

Hi Sohil,
Thank you very much for your valuable feedback. I have incorporated all the suggested changes and sent out the v3 patch. Could you please review it?

Thanks,
Suchit