Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Sep 2013 16:50:47 +0200
From:      =?ISO-8859-1?Q?Roger_Pau_Monn=E9?= <roger.pau@citrix.com>
To:        Shanker Balan <mail@shankerbalan.net>
Cc:        "freebsd-xen@freebsd.org" <freebsd-xen@freebsd.org>, abgupta@microsoft.com, grehan@FreeBSD.org, "freebsd-virtualization@freebsd.org" <freebsd-virtualization@freebsd.org>
Subject:   Re: Latest current -CURRENT (rev 255904) panics with "device hyperv" on XenServer 6.2
Message-ID:  <52459B47.8030101@citrix.com>
In-Reply-To: <7943FB36-C6F4-4529-A805-2C467192231F@shankerbalan.net>
References:  <7943FB36-C6F4-4529-A805-2C467192231F@shankerbalan.net>

next in thread | previous in thread | raw e-mail | index | archive | help
--------------020200080305020009060200
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 7bit

On 27/09/13 08:16, Shanker Balan wrote:
> Helo,
> 
> Now that XENHVM has been merged into the GENERIC kernel, I recompiled todays -CURRENT (rev 255904)
> and hit the following panic. It seeems to be HyperV related.
> 
> GENERIC without "device hyperv" works properly. The hypervisor is XenServer 6.2.
> 
> # HyperV drivers
> device          hyperv          # HyperV drivers 
> 
> Panic screenshots with backtrace at http://imgur.com/cZsDsKE&VCkh4VS

Hello,

This is because XenServer enables viridian by default when running HVM
guests. That makes Xen also announce itself as HyperV for compatibility
reasons, as a workaround you can try to disable viridian support (not
sure if this is possible on XenServer).

I'm attaching a patch that should solve the problem, Ccing the virt
mailing list and the persons that I think are involved in the HyperV
support for FreeBSD.

Roger.


--------------020200080305020009060200
Content-Type: text/plain; charset="UTF-8"; x-mac-type=0; x-mac-creator=0;
	name="xen_hyperv.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="xen_hyperv.patch"

diff --git a/sys/dev/hyperv/vmbus/hv_hv.c b/sys/dev/hyperv/vmbus/hv_hv.c
index e3f3ae0..64b10fb 100644
--- a/sys/dev/hyperv/vmbus/hv_hv.c
+++ b/sys/dev/hyperv/vmbus/hv_hv.c
@@ -88,6 +88,16 @@ hv_vmbus_query_hypervisor_presence(void)
 {
 	u_int regs[4];
 	int hyper_v_detected = 0;
+
+	/*
+	 * The Xen Hypervisor also announces itself as HyperV when
+	 * viridian support is enabled, but we should only use Xen
+	 * in this case, so check for Xen first and disable HyperV
+	 * support if Xen is found.
+	 */
+	if (vm_guest == VM_GUEST_XEN)
+		return 0;
+
 	do_cpuid(1, regs);
 	if (regs[2] & 0x80000000) { /* if(a hypervisor is detected) */
 		/* make sure this really is Hyper-V */
diff --git a/sys/x86/xen/hvm.c b/sys/x86/xen/hvm.c
index 2286cf0..9539dd1 100644
--- a/sys/x86/xen/hvm.c
+++ b/sys/x86/xen/hvm.c
@@ -699,6 +699,7 @@ xen_hvm_init(enum xen_hvm_init_type init_type)
 			return;
 
 		setup_xen_features();
+		vm_guest = VM_GUEST_XEN;
 		break;
 	case XEN_HVM_INIT_RESUME:
 		if (error != 0)

--------------020200080305020009060200--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?52459B47.8030101>