From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konrad Rzeszutek Wilk Subject: Re: [PATCH 3/3] KVM: VMX: Allow I/O port 0x80 bypass when userspace prefer Date: Fri, 11 May 2018 11:44:58 -0400 Message-ID: <20180511154458.GI27459@char.us.oracle.com> References: <1523943962-25415-1-git-send-email-wanpengli@tencent.com> <1523943962-25415-4-git-send-email-wanpengli@tencent.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Paolo Bonzini , Radim =?utf-8?B?S3LEjW3DocWZ?= , Tim Shearer , Liran Alon To: Wanpeng Li Return-path: Content-Disposition: inline In-Reply-To: <1523943962-25415-4-git-send-email-wanpengli@tencent.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On Mon, Apr 16, 2018 at 10:46:02PM -0700, Wanpeng Li wrote: > From: Wanpeng Li >=20 > Tim Shearer reported that "There is a guest which is running a packet=20 > forwarding app based on the DPDK (dpdk.org). The packet receive routine= =20 > writes to 0xc070 using glibc's "outw_p" function which does an addition= al=20 > write to I/O port 80. It does this write for every packet that's receiv= ed,=20 > causing a flood of KVM userspace context switches". He uses mpstat to=20 > observe a CPU performing L2 packet forwarding on a pinned guest vCPU,=20 > the guest time is 95 percent when allowing I/O port 0x80 bypass, howeve= r,=20 > it is 65.78 percent when I/O port 0x80 bypss is disabled. =20 >=20 > This patch allows I/O port 0x80 bypass when userspace prefer. s/prefer/requests it/ >=20 Perhaps: Reported-by: Tim Shearer as well? > Cc: Paolo Bonzini > Cc: Radim Kr=C4=8Dm=C3=A1=C5=99 > Cc: Tim Shearer > Cc: Liran Alon > Signed-off-by: Wanpeng Li > --- > arch/x86/kvm/vmx.c | 7 +++++++ > 1 file changed, 7 insertions(+) >=20 > diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c > index ebf1140..d3e5fef 100644 > --- a/arch/x86/kvm/vmx.c > +++ b/arch/x86/kvm/vmx.c > @@ -10118,6 +10118,13 @@ static int vmx_vm_init(struct kvm *kvm) > goto out; > memset(kvm_vmx->vmx_io_bitmap[i], 0xff, PAGE_SIZE); > } > + if (kvm->arch.ioport_disable_intercept) { > + /* > + * Allow direct access to the PC debug port (it is often used for I/= O > + * delays, but the vmexits simply slow things down). > + */ > + clear_bit(0x80, kvm_vmx->vmx_io_bitmap[VMX_IO_BITMAP_A]); > + } > return 0; > =20 > out: > --=20 > 2.7.4 >=20