Skip to contentSkip to conversation

x86/cpu changes for v3.9

GIT PULL New Ingo Molnar 6 participants 15 messages Feb 19, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Linus,

Please pull the latest x86-cpu-for-linus git tree from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-cpu-for-linus

HEAD: f0322bd341fd63261527bf84afd3272bcc2e8dd3 x86, AMD: Enable WC+ memory type on family 10 processors

The biggest change is the enabling of the WC+ memory type on family 10 processors. (This is a BIOS bug workaround in essence:
if the BIOS fails to do this then we fall back to uncacheable, degrading performance, for example for virtualized guests using nested pages.)

Thanks,

Ingo

------------------>
Boris Ostrovsky (2):
x86, AMD: Clean up init_amd()
x86, AMD: Enable WC+ memory type on family 10 processors

Chen Gang (1):
x86/process: Change %8s to %s for pr_warn() in release_thread()

Kees Cook (1):
x86/cpu/hotplug: Remove CONFIG_EXPERIMENTAL dependency

 arch/x86/Kconfig                      |  4 +--
 arch/x86/include/uapi/asm/msr-index.h |  1 +
 arch/x86/kernel/cpu/amd.c             | 50 ++++++++++++++++++++---------------
 arch/x86/kernel/process_64.c          |  2 +-
 4 files changed, 32 insertions(+), 25 deletions(-)
arch/x86/Kconfig +2 -2
index 79795af..2d62103 100644
@@ -1699,7 +1699,7 @@ config HOTPLUG_CPU
 config BOOTPARAM_HOTPLUG_CPU0
 	bool "Set default setting of cpu0_hotpluggable"
 	default n
-	depends on HOTPLUG_CPU && EXPERIMENTAL
+	depends on HOTPLUG_CPU
 	---help---
 	  Set whether default state of cpu0_hotpluggable is on or off.
 
@@ -1728,7 +1728,7 @@ config BOOTPARAM_HOTPLUG_CPU0
 config DEBUG_HOTPLUG_CPU0
 	def_bool n
 	prompt "Debug CPU0 hotplug"
-	depends on HOTPLUG_CPU && EXPERIMENTAL
+	depends on HOTPLUG_CPU
 	---help---
 	  Enabling this option offlines CPU0 (if CPU0 can be offlined) as
 	  soon as possible and boots up userspace with CPU0 offlined. User
arch/x86/include/uapi/asm/msr-index.h +1 -0
index 433a59f..158cde9 100644
@@ -173,6 +173,7 @@
 #define MSR_AMD64_OSVW_ID_LENGTH	0xc0010140
 #define MSR_AMD64_OSVW_STATUS		0xc0010141
 #define MSR_AMD64_DC_CFG		0xc0011022
+#define MSR_AMD64_BU_CFG2		0xc001102a
 #define MSR_AMD64_IBSFETCHCTL		0xc0011030
 #define MSR_AMD64_IBSFETCHLINAD		0xc0011031
 #define MSR_AMD64_IBSFETCHPHYSAD	0xc0011032
arch/x86/kernel/cpu/amd.c +28 -22

93 lines not on this page · raw message

arch/x86/kernel/process_64.c +1 -1
index 6e68a61..0f49677 100644
@@ -117,7 +117,7 @@ void release_thread(struct task_struct *dead_task)
 {
 	if (dead_task->mm) {
 		if (dead_task->mm->context.size) {
-			pr_warn("WARNING: dead process %8s still has LDT? <%p/%d>\n",
+			pr_warn("WARNING: dead process %s still has LDT? <%p/%d>\n",
 				dead_task->comm,
 				dead_task->mm->context.ldt,
 				dead_task->mm->context.size);
maintainer
#1 lore raw
Quoted 14 lines · Ingo Molnar

Linus,

Please pull the latest x86-cpu-for-linus git tree from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-cpu-for-linus

HEAD: f0322bd341fd63261527bf84afd3272bcc2e8dd3 x86, AMD: Enable WC+ memory type on family 10 processors

The biggest change is the enabling of the WC+ memory type on family 10 processors. (This is a BIOS bug workaround in essence:
if the BIOS fails to do this then we fall back to uncacheable, degrading performance, for example for virtualized guests using nested pages.)

Quoted 8 lines

Thanks,

Ingo

------------------>
Boris Ostrovsky (2):
x86, AMD: Clean up init_amd()
x86, AMD: Enable WC+ memory type on family 10 processors

Those kill a kvm guest with a #GP. Can we apply the fix for it too pls?

http://marc.info/?l=linux-kernel&m=136077007423065&w=2

Signature · 5 lines
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
#2 lore raw
Quoted 19 lines · Borislav Petkov
Quoted 18 lines · Ingo Molnar

Linus,

Please pull the latest x86-cpu-for-linus git tree from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-cpu-for-linus

HEAD: f0322bd341fd63261527bf84afd3272bcc2e8dd3 x86, AMD: Enable WC+ memory type on family 10 processors

The biggest change is the enabling of the WC+ memory type on family 10 processors. (This is a BIOS bug workaround in essence:
if the BIOS fails to do this then we fall back to uncacheable, degrading performance, for example for virtualized guests using nested pages.)

Thanks,

Ingo

Quoted 8 lines
Quoted 4 lines

------------------>
Boris Ostrovsky (2):
x86, AMD: Clean up init_amd()
x86, AMD: Enable WC+ memory type on family 10 processors

Those kill a kvm guest with a #GP. Can we apply the fix for it too pls?

http://marc.info/?l=linux-kernel&m=136077007423065&w=2

Linus, please skip this pull request, we'll sort it out.

Thanks,

Ingo

#3 lore raw
Quoted 7 lines · Ingo Molnar
Quoted 4 lines

Those kill a kvm guest with a #GP. Can we apply the fix for it too pls?

http://marc.info/?l=linux-kernel&m=136077007423065&w=2

Linus, please skip this pull request, we'll sort it out.

My fault... I was tracking the fix and lost track of the thread.

The problem is that the fix is necessary but not sufficient, as it introduces an undesirable host-guest dependency. In order to allow neerw guests to work on older hosts we also should use the {rd,wr}msr_safe() functions to manipulate this MSR, with a comment as to why.

Boris, could you prepare such a patch, please?

-hpa

Signature · 2 lines
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.
maintainer
#4 lore raw
Quoted 9 lines · H. Peter Anvin

My fault... I was tracking the fix and lost track of the thread.

The problem is that the fix is necessary but not sufficient, as it introduces an undesirable host-guest dependency. In order to allow neerw guests to work on older hosts we also should use the {rd,wr}msr_safe() functions to manipulate this MSR, with a comment as to why.

Boris, could you prepare such a patch, please?

I don't think Boris O. is at AMD anymore. Want me to add that to my fix for kvm or prep a separate patch?

Signature · 5 lines
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
#5 lore raw
Quoted 9 lines · Borislav Petkov
Quoted 8 lines · H. Peter Anvin

My fault... I was tracking the fix and lost track of the thread.

The problem is that the fix is necessary but not sufficient, as it introduces an undesirable host-guest dependency. In order to allow neerw guests to work on older hosts we also should use the {rd,wr}msr_safe() functions to manipulate this MSR, with a comment as to why.

Quoted 5 lines
Quoted 1 line

Boris, could you prepare such a patch, please?

I don't think Boris O. is at AMD anymore. Want me to add that to my fix for kvm or prep a separate patch?

Separate patch, please, and yes, I would greatly appreciate it.

-hpa

Signature · 2 lines
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.
#10 lore raw
In reply to Borislav Petkov
Quoted 9 lines · Borislav Petkov
Quoted 8 lines · H. Peter Anvin

My fault... I was tracking the fix and lost track of the thread.

The problem is that the fix is necessary but not sufficient, as it introduces an undesirable host-guest dependency. In order to allow neerw guests to work on older hosts we also should use the {rd,wr}msr_safe() functions to manipulate this MSR, with a comment as to why.

Quoted 4 lines
Quoted 1 line

Boris, could you prepare such a patch, please?

I don't think Boris O. is at AMD anymore. Want me to add that to my fix for kvm or prep a separate patch?

CC-ing Boris.

Quoted 13 lines
Signature · 11 lines
-- 
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
maintainer
#11 lore raw
Quoted 1 line · Konrad Rzeszutek Wilk

CC-ing Boris.

Ah, the string after the "@" and before the ".com" is different now :-)

Signature · 5 lines
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
#12 lore raw
In reply to Konrad Rzeszutek Wilk
Quoted 10 lines · Konrad Rzeszutek Wilk
Quoted 9 lines · Borislav Petkov
Quoted 8 lines · H. Peter Anvin

My fault... I was tracking the fix and lost track of the thread.

The problem is that the fix is necessary but not sufficient, as it introduces an undesirable host-guest dependency. In order to allow neerw guests to work on older hosts we also should use the {rd,wr}msr_safe() functions to manipulate this MSR, with a comment as to why.

Quoted 4 lines
Quoted 3 lines
Quoted 1 line

Boris, could you prepare such a patch, please?

I don't think Boris O. is at AMD anymore. Want me to add that to my fix for kvm or prep a separate patch?

CC-ing Boris.

BorisP's patch is what I should have done. Can you take it?

-boris

#13 lore raw
Quoted 11 lines · Boris Ostrovsky
Quoted 10 lines · Konrad Rzeszutek Wilk
Quoted 9 lines · Borislav Petkov
Quoted 8 lines · H. Peter Anvin

My fault... I was tracking the fix and lost track of the thread.

The problem is that the fix is necessary but not sufficient, as it introduces an undesirable host-guest dependency. In order to allow neerw guests to work on older hosts we also should use the {rd,wr}msr_safe() functions to manipulate this MSR, with a comment as to why.

Quoted 7 lines
Quoted 4 lines
Quoted 3 lines
Quoted 1 line

Boris, could you prepare such a patch, please?

I don't think Boris O. is at AMD anymore. Want me to add that to my fix for kvm or prep a separate patch?

CC-ing Boris.

BorisP's patch is what I should have done. Can you take it?

As I stated:

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

The problem is that the fix is necessary but not sufficient, as it introduces an undesirable host-guest dependency. In order to allow neerw guests to work on older hosts we also should use the {rd,wr}msr_safe() functions to manipulate this MSR, with a comment as to why.

-hpa

Signature · 2 lines
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.
#14 lore raw
Quoted 13 lines · H. Peter Anvin
Quoted 12 lines · Boris Ostrovsky
Quoted 11 lines · Konrad Rzeszutek Wilk
Quoted 10 lines · Borislav Petkov
Quoted 9 lines · H. Peter Anvin

My fault... I was tracking the fix and lost track of the thread.

The problem is that the fix is necessary but not sufficient, as it introduces an undesirable host-guest dependency. In order to allow neerw guests to work on older hosts we also should use the {rd,wr}msr_safe() functions to manipulate this MSR, with a comment as to why.

Boris, could you prepare such a patch, please?

Quoted 14 lines
Quoted 6 lines
Quoted 3 lines
Quoted 2 lines

I don't think Boris O. is at AMD anymore. Want me to add that to my fix for kvm or prep a separate patch?

CC-ing Boris.

BorisP's patch is what I should have done. Can you take it?

As I stated:

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

The problem is that the fix is necessary but not sufficient, as it introduces an undesirable host-guest dependency. In order to allow neerw guests to work on older hosts we also should use the {rd,wr}msr_safe() functions to manipulate this MSR, with a comment as to why.

Ah, sorry --- I missed that part.

-boris

maintainer
#6 lore raw

PATCH 1/2 x86, CPU, AMD: Fix WC+ workaround for older hosts

In reply to H. Peter Anvin

From: Borislav Petkov <[email protected]>

The WC+ workaround for F10h introduces a new MSR and kvm host #GPs on accesses to unknown MSRs if paravirt is not compiled in. Use the exception-handling MSR accessors so as not to break 3.8 and later guests booting on older hosts.

Remove a redundant family check while at it.

---
 arch/x86/kernel/cpu/amd.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
arch/x86/kernel/cpu/amd.c +7 -5
index 721ef3208eb5..163af4a91d09 100644
@@ -723,12 +723,14 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
 		 * performance degradation for certain nested-paging guests.
 		 * Prevent this conversion by clearing bit 24 in
 		 * MSR_AMD64_BU_CFG2.
+		 *
+		 * NOTE: we want to use the _safe accessors so as not to #GP kvm
+		 * guests on older kvm hosts.
 		 */
-		if (c->x86 == 0x10) {
-			rdmsrl(MSR_AMD64_BU_CFG2, value);
-			value &= ~(1ULL << 24);
-			wrmsrl(MSR_AMD64_BU_CFG2, value);
-		}
+
+		rdmsrl_safe(MSR_AMD64_BU_CFG2, &value);
+		value &= ~(1ULL << 24);
+		wrmsrl_safe(MSR_AMD64_BU_CFG2, value);
 	}
 
 	rdmsr_safe(MSR_AMD64_PATCH_LEVEL, &c->microcode, &dummy);
Signature · 1 line
1.8.1.3.535.ga923c31
maintainer
#7 lore raw

PATCH 2/2 x86, kvm: Add MSR_AMD64_BU_CFG2 to the list of ignored MSRs

From: Borislav Petkov <[email protected]>

The "x86, AMD: Enable WC+ memory type on family 10 processors" patch currently in -tip added a workaround for AMD F10h CPUs which #GPs my guest when booted in kvm. This is because it accesses MSR_AMD64_BU_CFG2 which is not currently ignored by kvm. Do that because this MSR is only baremetal-relevant anyway. While at it, move the ignored MSRs at the beginning of kvm_set_msr_common so that we exit then and there.

Cc Boris Ostrovsky <[email protected]>
Cc Andre Przywara <[email protected]>
Cc Marcelo Tosatti <[email protected]>
---
 arch/x86/kvm/x86.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
arch/x86/kvm/x86.c +9 -7
index c243b81e3c74..37040079cd6b 100644
@@ -1881,6 +1881,14 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
 	u64 data = msr_info->data;
 
 	switch (msr) {
+	case MSR_AMD64_NB_CFG:
+	case MSR_IA32_UCODE_REV:
+	case MSR_IA32_UCODE_WRITE:
+	case MSR_VM_HSAVE_PA:
+	case MSR_AMD64_PATCH_LOADER:
+	case MSR_AMD64_BU_CFG2:
+		break;
+
 	case MSR_EFER:
 		return set_efer(vcpu, data);
 	case MSR_K7_HWCR:
@@ -1900,8 +1908,6 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
 			return 1;
 		}
 		break;
-	case MSR_AMD64_NB_CFG:
-		break;
 	case MSR_IA32_DEBUGCTLMSR:
 		if (!data) {
 			/* We support the non-activated case already */
@@ -1914,11 +1920,6 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
 		vcpu_unimpl(vcpu, "%s: MSR_IA32_DEBUGCTLMSR 0x%llx, nop\n",
 			    __func__, data);
 		break;
-	case MSR_IA32_UCODE_REV:
-	case MSR_IA32_UCODE_WRITE:
-	case MSR_VM_HSAVE_PA:
-	case MSR_AMD64_PATCH_LOADER:
-		break;
 	case 0x200 ... 0x2ff:
 		return set_msr_mtrr(vcpu, msr, data);
 	case MSR_IA32_APICBASE:
@@ -2253,6 +2254,7 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata)
 	case MSR_K8_INT_PENDING_MSG:
 	case MSR_AMD64_NB_CFG:
 	case MSR_FAM10H_MMIO_CONF_BASE:
+	case MSR_AMD64_BU_CFG2:
 		data = 0;
 		break;
 	case MSR_P6_PERFCTR0:
Signature · 1 line
1.8.1.3.535.ga923c31
#9 lore raw

[tip:x86/cpu] x86, cpu, amd: Fix WC+ workaround for older virtual hosts

In reply to Borislav Petkov
x86, cpu, amd: Fix WC+ workaround for older virtual hosts
Commit-ID:  52d3d06e706bdde3d6c5c386deb065c3b4c51618
Gitweb:     http://git.kernel.org/tip/52d3d06e706bdde3d6c5c386deb065c3b4c51618
Author:     Borislav Petkov <[email protected]>
AuthorDate: Tue, 19 Feb 2013 19:33:12 +0100
Committer:  H. Peter Anvin <[email protected]>
CommitDate: Tue, 19 Feb 2013 10:44:00 -0800

x86, cpu, amd: Fix WC+ workaround for older virtual hosts

The WC+ workaround for F10h introduces a new MSR and kvm host #GPs on accesses to unknown MSRs if paravirt is not compiled in. Use the exception-handling MSR accessors so as not to break 3.8 and later guests booting on older hosts.

Remove a redundant family check while at it.

---
 arch/x86/kernel/cpu/amd.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
arch/x86/kernel/cpu/amd.c +7 -5
index 721ef32..163af4a 100644
@@ -723,12 +723,14 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
 		 * performance degradation for certain nested-paging guests.
 		 * Prevent this conversion by clearing bit 24 in
 		 * MSR_AMD64_BU_CFG2.
+		 *
+		 * NOTE: we want to use the _safe accessors so as not to #GP kvm
+		 * guests on older kvm hosts.
 		 */
-		if (c->x86 == 0x10) {
-			rdmsrl(MSR_AMD64_BU_CFG2, value);
-			value &= ~(1ULL << 24);
-			wrmsrl(MSR_AMD64_BU_CFG2, value);
-		}
+
+		rdmsrl_safe(MSR_AMD64_BU_CFG2, &value);
+		value &= ~(1ULL << 24);
+		wrmsrl_safe(MSR_AMD64_BU_CFG2, value);
 	}
 
 	rdmsr_safe(MSR_AMD64_PATCH_LEVEL, &c->microcode, &dummy);
#8 lore raw

[tip:x86/cpu] x86, kvm: Add MSR_AMD64_BU_CFG2 to the list of ignored MSRs

In reply to Borislav Petkov
x86, kvm: Add MSR_AMD64_BU_CFG2 to the list of ignored MSRs
Commit-ID:  2e32b7190641a184b8510d3e342400473ff1ab60
Gitweb:     http://git.kernel.org/tip/2e32b7190641a184b8510d3e342400473ff1ab60
Author:     Borislav Petkov <[email protected]>
AuthorDate: Tue, 19 Feb 2013 19:33:13 +0100
Committer:  H. Peter Anvin <[email protected]>
CommitDate: Tue, 19 Feb 2013 10:44:07 -0800

x86, kvm: Add MSR_AMD64_BU_CFG2 to the list of ignored MSRs

The "x86, AMD: Enable WC+ memory type on family 10 processors" patch currently in -tip added a workaround for AMD F10h CPUs which #GPs my guest when booted in kvm. This is because it accesses MSR_AMD64_BU_CFG2 which is not currently ignored by kvm. Do that because this MSR is only baremetal-relevant anyway. While at it, move the ignored MSRs at the beginning of kvm_set_msr_common so that we exit then and there.

---
 arch/x86/kvm/x86.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
arch/x86/kvm/x86.c +9 -7
index c243b81..3704007 100644
@@ -1881,6 +1881,14 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
 	u64 data = msr_info->data;
 
 	switch (msr) {
+	case MSR_AMD64_NB_CFG:
+	case MSR_IA32_UCODE_REV:
+	case MSR_IA32_UCODE_WRITE:
+	case MSR_VM_HSAVE_PA:
+	case MSR_AMD64_PATCH_LOADER:
+	case MSR_AMD64_BU_CFG2:
+		break;
+
 	case MSR_EFER:
 		return set_efer(vcpu, data);
 	case MSR_K7_HWCR:
@@ -1900,8 +1908,6 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
 			return 1;
 		}
 		break;
-	case MSR_AMD64_NB_CFG:
-		break;
 	case MSR_IA32_DEBUGCTLMSR:
 		if (!data) {
 			/* We support the non-activated case already */
@@ -1914,11 +1920,6 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
 		vcpu_unimpl(vcpu, "%s: MSR_IA32_DEBUGCTLMSR 0x%llx, nop\n",
 			    __func__, data);
 		break;
-	case MSR_IA32_UCODE_REV:
-	case MSR_IA32_UCODE_WRITE:
-	case MSR_VM_HSAVE_PA:
-	case MSR_AMD64_PATCH_LOADER:
-		break;
 	case 0x200 ... 0x2ff:
 		return set_msr_mtrr(vcpu, msr, data);
 	case MSR_IA32_APICBASE:
@@ -2253,6 +2254,7 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata)
 	case MSR_K8_INT_PENDING_MSG:
 	case MSR_AMD64_NB_CFG:
 	case MSR_FAM10H_MMIO_CONF_BASE:
+	case MSR_AMD64_BU_CFG2:
 		data = 0;
 		break;
 	case MSR_P6_PERFCTR0: