bhyve guest dies on building java/openjdk6

Neel Natu neelnatu at gmail.com
Tue Jun 25 00:11:18 UTC 2013


Hi Aryeh,

On Mon, Jun 24, 2013 at 4:25 PM, Aryeh Friedman
<aryeh.friedman at gmail.com> wrote:
>
> As soon as java/openjdk6 starts its build process (fdesc and procfs
> both are present as per pkg-message) bhyve dies with:
>
> vm exit[0]
>                 reason          VMX
>                                         rip             0x00000008032322ac
>
>         inst_length     2
>
>                                 error           0
>
>                                                         exit_reason     10


Thanks for reporting this. The exit reason indicates bhyve is not
happy with the cpuid leaf that the guest is querying.

Tycho Nightingale has a patch to the cpuid emulation that should fix
the issue you are seeing.

Could you give it a spin?

Index: x86.c
===================================================================
--- x86.c	(revision 251672)
+++ x86.c	(working copy)
@@ -45,7 +45,7 @@

 #define	CPUID_VM_HIGH		0x40000000

-static const char bhyve_id[12] = "BHyVE BHyVE ";
+static const char bhyve_id[12] = "bhyve bhyve ";

 int
 x86_emulate_cpuid(struct vm *vm, int vcpu_id,
@@ -80,12 +80,10 @@
 		case CPUID_0000_0000:
 		case CPUID_0000_0002:
 		case CPUID_0000_0003:
-		case CPUID_0000_000A:
 			cpuid_count(*eax, *ecx, regs);
 			break;

 		case CPUID_8000_0000:
-		case CPUID_8000_0001:
 		case CPUID_8000_0002:
 		case CPUID_8000_0003:
 		case CPUID_8000_0004:
@@ -94,6 +92,15 @@
 			cpuid_count(*eax, *ecx, regs);
 			break;

+		case CPUID_8000_0001:
+                       /*
+                        * Hide rdtscp/ia32_tsc_aux until we know how
+                        * to deal with them.
+                        */
+			cpuid_count(*eax, *ecx, regs);
+			regs[3] &= ~AMDID_RDTSCP;
+			break;
+
 		case CPUID_8000_0007:
 			cpuid_count(*eax, *ecx, regs);
 			/*
@@ -151,6 +158,11 @@
 			regs[2] &= ~CPUID2_MON;

 			/*
+			 * Hide the performance and debug features.
+			 */
+			regs[2] &= ~CPUID2_PDCM;
+
+			/*
 			 * Hide thermal monitoring
 			 */
 			regs[3] &= ~(CPUID_ACPI | CPUID_TM);
@@ -161,6 +173,11 @@
 			 */
 			regs[3] &= ~(CPUID_MCA | CPUID_MCE | CPUID_MTRR);

+                        /*
+			 * Hide the debug store capability.
+			 */
+			regs[3] &= ~CPUID_DS;
+
 			/*
 			 * Disable multi-core.
 			 */
@@ -180,6 +197,7 @@

 		case CPUID_0000_0006:
 		case CPUID_0000_0007:
+		case CPUID_0000_000A:
 			/*
 			 * Handle the access, but report 0 for
 			 * all options
@@ -203,12 +221,17 @@
 		case 0x40000000:
 			regs[0] = CPUID_VM_HIGH;
 			bcopy(bhyve_id, &regs[1], 4);
-			bcopy(bhyve_id, &regs[2], 4);
-			bcopy(bhyve_id, &regs[3], 4);
+			bcopy(bhyve_id + 4, &regs[2], 4);
+			bcopy(bhyve_id + 8, &regs[3], 4);
 			break;
+
 		default:
-			/* XXX: Leaf 5? */
-			return (0);
+			/*
+			 * The leaf value has already been clamped, so
+			 * simply pass this through
+			 */
+			cpuid_count(*eax, *ecx, regs);
+			break;
 	}

 	*eax = regs[0];

best
Neel

>                 qualification   0x0000000000000000
> _______________________________________________
> freebsd-virtualization at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
> To unsubscribe, send any mail to "freebsd-virtualization-unsubscribe at freebsd.org"


More information about the freebsd-virtualization mailing list