LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Jim Mattson <jmattson@google.com>
To: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: "Wanpeng Li" <kernellwp@gmail.com>,
	LKML <linux-kernel@vger.kernel.org>,
	"kvm list" <kvm@vger.kernel.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Radim Krčmář" <rkrcmar@redhat.com>,
	"Tim Shearer" <tshearer@advaoptical.com>,
	"Liran Alon" <liran.alon@oracle.com>,
	"Andrew Honig" <ahonig@google.com>,
	"Lars Bull" <larsbull@google.com>
Subject: Re: [PATCH 3/3] KVM: VMX: Allow I/O port 0x80 bypass when userspace prefer
Date: Tue, 15 May 2018 14:57:52 -0700	[thread overview]
Message-ID: <CALMp9eSKd3naf7KrU97qgB4vNtpLotC+6+k+40E_S1oA122Yvg@mail.gmail.com> (raw)
In-Reply-To: <20180511154458.GI27459@char.us.oracle.com>

This does seem to allow a DoS from userspace if userspace prefers it.
That doesn't seem wise.

On Fri, May 11, 2018 at 8:44 AM, Konrad Rzeszutek Wilk
<konrad.wilk@oracle.com> wrote:
> On Mon, Apr 16, 2018 at 10:46:02PM -0700, Wanpeng Li wrote:
>> From: Wanpeng Li <wanpengli@tencent.com>
>>
>> Tim Shearer reported that "There is a guest which is running a packet
>> forwarding app based on the DPDK (dpdk.org). The packet receive routine
>> writes to 0xc070 using glibc's "outw_p" function which does an additional
>> write to I/O port 80. It does this write for every packet that's received,
>> causing a flood of KVM userspace context switches". He uses mpstat to
>> observe a CPU performing L2 packet forwarding on a pinned guest vCPU,
>> the guest time is 95 percent when allowing I/O port 0x80 bypass, however,
>> it is 65.78 percent when I/O port 0x80 bypss is disabled.
>>
>> This patch allows I/O port 0x80 bypass when userspace prefer.
>
> s/prefer/requests it/
>>
>
> Perhaps:
>
> Reported-by: Tim Shearer as well?
>
>> Cc: Paolo Bonzini <pbonzini@redhat.com>
>> Cc: Radim Krčmář <rkrcmar@redhat.com>
>> Cc: Tim Shearer <tshearer@advaoptical.com>
>> Cc: Liran Alon <liran.alon@oracle.com>
>> Signed-off-by: Wanpeng Li <wanpengli@tencent.com>
>> ---
>>  arch/x86/kvm/vmx.c | 7 +++++++
>>  1 file changed, 7 insertions(+)
>>
>> 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;
>>
>>  out:
>> --
>> 2.7.4
>>

  reply	other threads:[~2018-05-15 21:57 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-17  5:45 [PATCH 0/3] KVM: VMX: Allow to disable ioport intercept per-VM by userspace Wanpeng Li
2018-04-17  5:46 ` [PATCH 1/3] KVM: VMX: Introduce per-VM I/O permission bitmaps Wanpeng Li
2018-05-11 15:39   ` Konrad Rzeszutek Wilk
2018-05-15 21:55     ` Jim Mattson
2018-04-17  5:46 ` [PATCH 2/3] KVM: X86: Allow userspace to disable ioport intercept Wanpeng Li
2018-05-11 15:42   ` Konrad Rzeszutek Wilk
2018-05-11 15:43     ` Konrad Rzeszutek Wilk
2018-05-15 21:56       ` Jim Mattson
2018-05-16  1:13         ` Wanpeng Li
2018-04-17  5:46 ` [PATCH 3/3] KVM: VMX: Allow I/O port 0x80 bypass when userspace prefer Wanpeng Li
2018-05-11 15:44   ` Konrad Rzeszutek Wilk
2018-05-15 21:57     ` Jim Mattson [this message]
2018-05-08  7:55 ` [PATCH 0/3] KVM: VMX: Allow to disable ioport intercept per-VM by userspace Wanpeng Li
2018-05-08 16:14   ` Paolo Bonzini
2018-05-11 15:40 ` Konrad Rzeszutek Wilk
2018-05-12  1:03   ` Wanpeng Li
2018-05-14 13:48     ` Tim Shearer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CALMp9eSKd3naf7KrU97qgB4vNtpLotC+6+k+40E_S1oA122Yvg@mail.gmail.com \
    --to=jmattson@google.com \
    --cc=ahonig@google.com \
    --cc=kernellwp@gmail.com \
    --cc=konrad.wilk@oracle.com \
    --cc=kvm@vger.kernel.org \
    --cc=larsbull@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liran.alon@oracle.com \
    --cc=pbonzini@redhat.com \
    --cc=rkrcmar@redhat.com \
    --cc=tshearer@advaoptical.com \
    --subject='Re: [PATCH 3/3] KVM: VMX: Allow I/O port 0x80 bypass when userspace prefer' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).