Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Apr 2014 16:10:15 +0200
From:      =?ISO-8859-1?Q?Roger_Pau_Monn=E9?= <roger.pau@citrix.com>
To:        "seanrees@gmail.com" <seanrees@gmail.com>, <freebsd-xen@freebsd.org>
Subject:   Re: VM in Xen 4.1; poor packet forwarding performance on xn0
Message-ID:  <53567847.10203@citrix.com>
In-Reply-To: <CAJGy1F0%2BG1zq9hVbifTM2Vq6HHEmCM9hnFvQ=4t-4d5x=npaCA@mail.gmail.com>
References:  <CAJGy1F0%2BG1zq9hVbifTM2Vq6HHEmCM9hnFvQ=4t-4d5x=npaCA@mail.gmail.com>

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

On 18/04/14 16:57, seanrees@gmail.com wrote:
> Hi there freebsd-xen,
> 
> I tried first on freebsd-questions@ without success, so I thought to retry
> here.
> 
> I run OpenVPN on a FreeBSD 10.0-Rp1 VM in Xen 4.1 (HVM). I am experiencing
> slow network performance on xn0 that seems to have developed after I
> upgraded to FreeBSD 10 (no other changes). I can only achieve about 0.5mbps
> through this interface when forwarding packets; packets in a single
> direction are fine (e.g; downloading to the VPS or pushing from the VPS)
> and clock in at many (>10 usually) mbps.
> 
> Interestingly, my identical VM (configuration managed centrally) running on
> Xen 3.4 (HVM) does *not* have this issue.

Hello,

The difference between Xen 3.4 and Xen 4.1 is that FreeBSD will make use
of the vector callback, the PV timer and PV IPIs when running on Xen >
4.0 (which should provide better performance). I'm attaching a patch
that will make FreeBSD behave the same way when running on either Xen
3.4 or Xen 4.1 (by disabling all this new additions), could you please
give it a try?

> 
> I did a little debugging and here's what I've noticed:
>    - Not related to OpenVPN, repro'd using ssh -d.
>    - Slow VM has a very low rate of context switches (~250) while
> forwarding, fast VM has a lot more (~2000) sampled over 5 seconds using
> systat -v.
>   - I can't repro a context switch limit (tried a limited fork() bomb).
>   - Tried with *and* without LRO and TSO on xn0 (and all combinations of
> LRO and TSO on/off)

I've got the feeling that the issue you are seeing is not related to the
Xen version itself, but the Linux Dom0 kernel version (which I suppose
is different in the Xen 3.4 and Xen 4.1 hosts). Could you ask your
provider which Linux Dom0 kernel are they using on the different hosts?

Roger.

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

>From a866add6f87d726ae2c6ab5837d1b6eefb721be8 Mon Sep 17 00:00:00 2001
From: Roger Pau Monne <roger.pau@citrix.com>
Date: Tue, 22 Apr 2014 09:50:09 +0200
Subject: [PATCH]

---
 sys/x86/xen/hvm.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/sys/x86/xen/hvm.c b/sys/x86/xen/hvm.c
index 72811dc..8ad0f2d 100644
--- a/sys/x86/xen/hvm.c
+++ b/sys/x86/xen/hvm.c
@@ -626,6 +626,7 @@ xen_hvm_set_callback(device_t dev)
 
 	xhp.domid = DOMID_SELF;
 	xhp.index = HVM_PARAM_CALLBACK_IRQ;
+#if 0
 	if (xen_feature(XENFEAT_hvm_callback_vector) != 0) {
 		int error;
 
@@ -638,6 +639,7 @@ xen_hvm_set_callback(device_t dev)
 		printf("Xen HVM callback vector registration failed (%d). "
 		    "Falling back to emulated device interrupt\n", error);
 	}
+#endif
 	xen_vector_callback_enabled = 0;
 	if (dev == NULL) {
 		/*
@@ -783,7 +785,7 @@ xen_hvm_cpu_init(void)
 	info.mfn = vtophys(vcpu_info) >> PAGE_SHIFT;
 	info.offset = vtophys(vcpu_info) - trunc_page(vtophys(vcpu_info));
 
-	rc = HYPERVISOR_vcpu_op(VCPUOP_register_vcpu_info, cpu, &info);
+	rc = 1;
 	if (rc != 0)
 		DPCPU_SET(vcpu_info, &HYPERVISOR_shared_info->vcpu_info[cpu]);
 	else
-- 
1.7.7.5 (Apple Git-26)


--------------030009050109050005060006--



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