Skip to contentSkip to conversation

x86/cpuid: Fix booting on AMD Phenom 6-core platform

PATCH In review Andrew Cooper 3 participants 6 messages Mar 2, 2017 – Mar 3, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/cpuid: Fix booting on AMD Phenom 6-core platform

c/s 5cecf60f4 "x86/cpuid: Handle leaf 0x1 in guest_cpuid()" causes Linux 4.10 to crash during boot.

It turns out to be because of the reported apic_id, which was altered to be more consistent across guests. Revert back to the previous behaviour, by limiting the apic_id adjustment to HVM guests only. Whomever gets to fixes topology representation is going to have a lot of fun with non-power-of-2 AMD boxes.

---
CC: Jan Beulich <[email protected]>

---
 xen/arch/x86/cpuid.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
xen/arch/x86/cpuid.c +2 -1
index 0dd35dc..d6f6b88 100644
@@ -749,7 +749,8 @@ void guest_cpuid(const struct vcpu *v, uint32_t leaf,
     case 0x1:
         /* TODO: Rework topology logic. */
         res->b &= 0x00ffffffu;
-        res->b |= (v->vcpu_id * 2) << 24;
+        if ( has_hvm_container_domain(d) )
+            res->b |= (v->vcpu_id * 2) << 24;
 
         /* TODO: Rework vPMU control in terms of toolstack choices. */
         if ( vpmu_available(v) &&
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 02.03.17 at 21:02, <[email protected]> wrote:

c/s 5cecf60f4 "x86/cpuid: Handle leaf 0x1 in guest_cpuid()" causes Linux 4.10 to crash during boot.

Quoted 8 lines

It turns out to be because of the reported apic_id, which was altered to be more consistent across guests. Revert back to the previous behaviour, by limiting the apic_id adjustment to HVM guests only. Whomever gets to fixes topology representation is going to have a lot of fun with non-power-of-2 AMD boxes.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#2 lore raw
In reply to Andrew Cooper
Quoted 11 lines · Andrew Cooper

c/s 5cecf60f4 "x86/cpuid: Handle leaf 0x1 in guest_cpuid()" causes Linux 4.10 to crash during boot.

It turns out to be because of the reported apic_id, which was altered to be more consistent across guests. Revert back to the previous behaviour, by limiting the apic_id adjustment to HVM guests only. Whomever gets to fixes topology representation is going to have a lot of fun with non-power-of-2 AMD boxes.

Sorry I forgot to CC you this. (I keep forgetting that git doesn't understand Reported-by when collecting its CC list.)

Would you mind double checking this patch please?

~Andrew

Quoted 11 lines

---
CC: Jan Beulich <[email protected]>

---
 xen/arch/x86/cpuid.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
xen/arch/x86/cpuid.c +0 -0
index 0dd35dc..d6f6b88 100644

xen/arch/x86/cpuid.c void guest_cpuid(const struct vcpu *v, uint32_t leaf, · line 756

Quoted 9 lines
xen/arch/x86/cpuid.c +2 -1
@@ -749,7 +749,8 @@ void guest_cpuid(const struct vcpu *v, uint32_t leaf,
     case 0x1:
         /* TODO: Rework topology logic. */
         res->b &= 0x00ffffffu;
-        res->b |= (v->vcpu_id * 2) << 24;
+        if ( has_hvm_container_domain(d) )
+            res->b |= (v->vcpu_id * 2) << 24;
 
         /* TODO: Rework vPMU control in terms of toolstack choices. */
         if ( vpmu_available(v) &&

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#3 lore raw
Quoted 10 lines · Andrew Cooper
Quoted 9 lines · Andrew Cooper

c/s 5cecf60f4 "x86/cpuid: Handle leaf 0x1 in guest_cpuid()" causes Linux 4.10 to crash during boot.

It turns out to be because of the reported apic_id, which was altered to be more consistent across guests. Revert back to the previous behaviour, by limiting the apic_id adjustment to HVM guests only. Whomever gets to fixes topology representation is going to have a lot of fun with non-power-of-2 AMD boxes.

Quoted 7 lines
Quoted 2 lines

Sorry I forgot to CC you this. (I keep forgetting that git doesn't understand Reported-by when collecting its CC list.)

Would you mind double checking this patch please?

Sure (but it will take till somewhere this evening CET though).

--
Sander

Quoted 20 lines

~Andrew

Quoted 18 lines

---
CC: Jan Beulich <[email protected]>

---
 xen/arch/x86/cpuid.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
xen/arch/x86/cpuid.c +2 -1
index 0dd35dc..d6f6b88 100644
@@ -749,7 +749,8 @@ void guest_cpuid(const struct vcpu *v, uint32_t leaf,
     case 0x1:
         /* TODO: Rework topology logic. */
         res->b &= 0x00ffffffu;
-        res->b |= (v->vcpu_id * 2) << 24;
+        if ( has_hvm_container_domain(d) )
+            res->b |= (v->vcpu_id * 2) << 24;
 
Quoted 3 lines

xen/arch/x86/cpuid.c void guest_cpuid(const struct vcpu *v, uint32_t leaf, · line 756

Quoted 2 lines
xen/arch/x86/cpuid.c +0 -0
         /* TODO: Rework vPMU control in terms of toolstack choices. */
         if ( vpmu_available(v) &&

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#4 lore raw
Quoted 11 lines · Sander Eikelenboom
Quoted 10 lines · Andrew Cooper
Quoted 9 lines · Andrew Cooper

c/s 5cecf60f4 "x86/cpuid: Handle leaf 0x1 in guest_cpuid()" causes Linux 4.10 to crash during boot.

It turns out to be because of the reported apic_id, which was altered to be more consistent across guests. Revert back to the previous behaviour, by limiting the apic_id adjustment to HVM guests only. Whomever gets to fixes topology representation is going to have a lot of fun with non-power-of-2 AMD boxes.

Quoted 7 lines
Quoted 6 lines
Quoted 2 lines

Sorry I forgot to CC you this. (I keep forgetting that git doesn't understand Reported-by when collecting its CC list.)

Would you mind double checking this patch please?

Sure (but it will take till somewhere this evening CET though).

No problem. Thanks.

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#5 lore raw
Quoted 17 lines · Andrew Cooper
Quoted 16 lines · Sander Eikelenboom
Quoted 15 lines · Andrew Cooper
Quoted 11 lines · Andrew Cooper

c/s 5cecf60f4 "x86/cpuid: Handle leaf 0x1 in guest_cpuid()" causes Linux 4.10 to crash during boot.

It turns out to be because of the reported apic_id, which was altered to be more consistent across guests. Revert back to the previous behaviour, by limiting the apic_id adjustment to HVM guests only. Whomever gets to fixes topology representation is going to have a lot of fun with non-power-of-2 AMD boxes.

Sorry I forgot to CC you this. (I keep forgetting that git doesn't understand Reported-by when collecting its CC list.)

Quoted 7 lines
Quoted 2 lines
Quoted 1 line

Would you mind double checking this patch please?

Sure (but it will take till somewhere this evening CET though).

No problem. Thanks.

~Andrew

Hi Andrew,

Just tested and it works fine.
Thanks again !

--
Sander

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel