All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86, amd: Re-enable CPU topology extensions in case BIOS has disabled it
@ 2012-04-11 15:26 Andreas Herrmann
  2012-04-16  6:52 ` Ingo Molnar
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Herrmann @ 2012-04-11 15:26 UTC (permalink / raw)
  To: Ingo Molnar, H. Peter Anvin, Thomas Gleixner; +Cc: linux-kernel


For detection of thread siblings we are relying on the topology
extension CPUID leafs. Thus we have to re-enable it in case BIOS tries
to hide the correpsonding CPUID feature flag.

Cc: stable@vger.kernel.org
Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com>
---
 arch/x86/kernel/cpu/amd.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index 0a44b90..56a694b 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -579,6 +579,24 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
 		}
 	}
 
+	/* re-enable TopologyExtensions if switched off by BIOS */
+	if ((c->x86 == 0x15) &&
+	    (c->x86_model >= 0x10) && (c->x86_model <= 0x1f) &&
+	    !cpu_has(c, X86_FEATURE_TOPOEXT)) {
+		u64 val;
+
+		if (!rdmsrl_amd_safe(0xc0011005, &val)) {
+			val |= 1ULL << 54;
+			wrmsrl_amd_safe(0xc0011005, val);
+			rdmsrl(0xc0011005, val);
+			if (val & (1ULL << 54)) {
+				set_cpu_cap(c, X86_FEATURE_TOPOEXT);
+				printk(KERN_INFO FW_INFO "CPU: Re-enabling "
+				  "disabled Topology Extensions Support\n");
+			}
+		}
+	}
+
 	cpu_detect_cache_sizes(c);
 
 	/* Multi core CPU? */
-- 
1.7.5.rc3




^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] x86, amd: Re-enable CPU topology extensions in case BIOS has disabled it
  2012-04-11 15:26 [PATCH] x86, amd: Re-enable CPU topology extensions in case BIOS has disabled it Andreas Herrmann
@ 2012-04-16  6:52 ` Ingo Molnar
  2012-04-16 13:40   ` [PATCH v2] " Andreas Herrmann
  0 siblings, 1 reply; 3+ messages in thread
From: Ingo Molnar @ 2012-04-16  6:52 UTC (permalink / raw)
  To: Andreas Herrmann; +Cc: H. Peter Anvin, Thomas Gleixner, linux-kernel


* Andreas Herrmann <andreas.herrmann3@amd.com> wrote:

> 
> For detection of thread siblings we are relying on the topology
> extension CPUID leafs. Thus we have to re-enable it in case BIOS tries
> to hide the correpsonding CPUID feature flag.
> 
> Cc: stable@vger.kernel.org
> Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com>

This changelog is missing some key information:

 - how did you find the bug - did you see some actual badness?

 - what practical effect (if any) did you see from this patch?

 - what practical effect (if any) do you expect others to see from this patch?

This kind of information helps us prioritize bugfixes and helps 
us determine whether a fix requires a -stable backport.

Thanks,

    Ingo

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2] x86, amd: Re-enable CPU topology extensions in case BIOS has disabled it
  2012-04-16  6:52 ` Ingo Molnar
@ 2012-04-16 13:40   ` Andreas Herrmann
  0 siblings, 0 replies; 3+ messages in thread
From: Andreas Herrmann @ 2012-04-16 13:40 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: H. Peter Anvin, Thomas Gleixner, linux-kernel

>From 2da973d9e096cea39a3bd397c1449a821b76d816 Mon Sep 17 00:00:00 2001
From: Andreas Herrmann <andreas.herrmann3@amd.com>
Date: Tue, 3 Apr 2012 12:13:07 +0200
Subject: [PATCH] x86, amd: Re-enable CPU topology extensions in case BIOS has
 disabled it

BIOS will switch off the corresponding feature flag on family 15h
models 10h-1fh non-desktop CPUs.

The topology extension CPUID leafs are required to detect which cores
belong to the same compute unit. (thread siblings mask is set
accordingly and also correct information about L1i and L2 cache
sharing depends on this).

W/o this patch we wouldn't see which cores belong to the same compute
unit and also cache sharing information for L1i and L2 would be
incorrect on such systems.

Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com>
---
 arch/x86/kernel/cpu/amd.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)


Hi Ingo,

Hope this new commit messages answers your questions.

Of course this patch is more a workaround for "suboptimal BIOS
settings" and thus not strictly stable material. (BTW, no there is no
way to change the BIOS setting here.) But as a whole bunch of systems
will be affected it might also be reasonable to add this patch to
stable Linux versions.


Regards,
Andreas

diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index 1248f9c..0ae388d 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -579,6 +579,24 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
 		}
 	}
 
+	/* re-enable TopologyExtensions if switched off by BIOS */
+	if ((c->x86 == 0x15) &&
+	    (c->x86_model >= 0x10) && (c->x86_model <= 0x1f) &&
+	    !cpu_has(c, X86_FEATURE_TOPOEXT)) {
+		u64 val;
+
+		if (!rdmsrl_amd_safe(0xc0011005, &val)) {
+			val |= 1ULL << 54;
+			wrmsrl_amd_safe(0xc0011005, val);
+			rdmsrl(0xc0011005, val);
+			if (val & (1ULL << 54)) {
+				set_cpu_cap(c, X86_FEATURE_TOPOEXT);
+				printk(KERN_INFO FW_INFO "CPU: Re-enabling "
+				  "disabled Topology Extensions Support\n");
+			}
+		}
+	}
+
 	cpu_detect_cache_sizes(c);
 
 	/* Multi core CPU? */
-- 
1.7.8.5



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-04-16 13:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-11 15:26 [PATCH] x86, amd: Re-enable CPU topology extensions in case BIOS has disabled it Andreas Herrmann
2012-04-16  6:52 ` Ingo Molnar
2012-04-16 13:40   ` [PATCH v2] " Andreas Herrmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.