Re: [RFC PATCH v2 0/7] x86/idle: add halt poll support

2017-09-14 Thread Quan Xu
On 2017/9/14 17:19, Wanpeng Li wrote: 2017-09-14 16:36 GMT+08:00 Quan Xu <quan@gmail.com>: on 2017/9/13 19:56, Yang Zhang wrote: On 2017/8/29 22:56, Michael S. Tsirkin wrote: On Tue, Aug 29, 2017 at 11:46:34AM +, Yang Zhang wrote: Some latency-intensive workload will see obv

Re: [RFC PATCH v2 3/7] sched/idle: Add poll before enter real idle path

2017-09-14 Thread Quan Xu
on 2017/9/1 13:57, Quan Xu wrote: on 2017/8/29 20:45, Peter Zijlstra wrote: On Tue, Aug 29, 2017 at 11:46:37AM +, Yang Zhang wrote: Add poll in do_idle. For UP VM, if there are running task, it will not goes into idle path, so we only enable poll in SMP VM. Signed-off-by: Yang Zhang

Re: [RFC PATCH v2 0/7] x86/idle: add halt poll support

2017-09-14 Thread Quan Xu
on 2017/9/13 19:56, Yang Zhang wrote: On 2017/8/29 22:56, Michael S. Tsirkin wrote: On Tue, Aug 29, 2017 at 11:46:34AM +, Yang Zhang wrote: Some latency-intensive workload will see obviously performance drop when running inside VM. But are we trading a lot of CPU for a bit of lower

Re: [RFC PATCH v2 3/7] sched/idle: Add poll before enter real idle path

2017-09-29 Thread Quan Xu
On 2017/9/1 14:49, Quan Xu wrote: on 2017/8/29 22:39, Borislav Petkov wrote: On Tue, Aug 29, 2017 at 11:46:37AM +, Yang Zhang wrote: Add poll in do_idle. For UP VM, if there are running task, it will not goes into idle path, so we only enable poll in SMP VM. Signed-off-by: Yang Zhang

Re: [RFC PATCH v2 7/7] sched/idle: update poll time when wakeup from idle

2017-09-29 Thread Quan Xu
ang...@gmail.com> Signed-off-by: Quan Xu <quan@gmail.com> Same broken SoB chain, and not a useful word on why you need to adjust this crap to begin with. What you want that poll duration to be related to is the cost of a VMEXIT/VMENTER cycle, not however long we happened to be idle. So no. Pet

Re: [RFC PATCH v2 3/7] sched/idle: Add poll before enter real idle path

2017-09-01 Thread Quan Xu
ed-off-by: Quan Xu <quan@gmail.com> Cc: Thomas Gleixner <t...@linutronix.de> Cc: Ingo Molnar <mi...@redhat.com> Cc: "H. Peter Anvin" <h...@zytor.com> Cc: x...@kernel.org Cc: Peter Zijlstra <pet...@infradead.org> Cc: Borislav Petkov <b...@alien8.de> Cc:

Re: [RFC PATCH v2 3/7] sched/idle: Add poll before enter real idle path

2017-08-31 Thread Quan Xu
ed-off-by: Quan Xu <quan@gmail.com> Broken SoB chain.   Peter,  I can't follow 'Broken SoB chain'.. could you more about it?   -Quan diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c index 6c23e30..b374744 100644 --- a/kernel/sched/idle.c +++ b/kernel/sched/idle.c @@ -74,6 +74

Re: [PATCH 1/2] x86,kvm: move qemu/guest FPU switching out to vcpu_run

2017-11-15 Thread Quan Xu
On 2017-11-15 22:43, Rik van Riel wrote: Can you explain why you believe that? for example, a vcpu thread is running in kvm mode under cretical condition to stop. QEMU send an IPI to cause a VM-exit to happen immediately, and this IPI doesn't make vcpu return to QEMU. IIUC this vcpu thread

Re: [PATCH RFC 0/7] kvm pvtimer

2017-12-14 Thread Quan Xu
On 2017/12/14 19:56, Paolo Bonzini wrote: On 13/12/2017 17:28, Konrad Rzeszutek Wilk wrote: 1) VM idle path and network req/resp services: Does this go away if you don't hit the idle path? Meaning if you loop without hitting HLT/MWAIT? I am assuming the issue you are facing is the latency -

Re: [PATCH] KVM: x86: ioapic: Clear IRR for rtc bit when rtc EOI gotten

2017-12-14 Thread Quan Xu
On 2017/12/14 21:15, Gonglei (Arei) wrote: -Original Message- From: Liran Alon [mailto:liran.a...@oracle.com] Sent: Thursday, December 14, 2017 9:02 PM To: Gonglei (Arei); pbonz...@redhat.com; rkrc...@redhat.com Cc: k...@vger.kernel.org; linux-kernel@vger.kernel.org; Huangweidong (C)

Re: [PATCH RFC 3/7] KVM: timer: synchronize tsc-deadline timestamp for guest

2017-12-13 Thread Quan Xu
On 2017/12/08 23:06, Konrad Rzeszutek Wilk wrote: On Fri, Dec 08, 2017 at 04:39:46PM +0800, Quan Xu wrote: From: Ben Luo <bn0...@gmail.com> In general, KVM guest programs tsc-deadline timestamp to MSR_IA32_TSC_DEADLINE MSR. This will cause a VM-exit, and then KVM handles this timer for

Re: [PATCH] KVM: x86: avoid unnecessary XSETBV on guest entry

2017-12-13 Thread Quan Xu
cpu->guest_xcr0_loaded = 1; } } Reviewed-by: Quan Xu <quan@gmail.com>

Re: [PATCH RFC 0/7] kvm pvtimer

2017-12-13 Thread Quan Xu
On 2017/12/14 00:28, Konrad Rzeszutek Wilk wrote: On Wed, Dec 13, 2017 at 11:25:13PM +0800, Quan Xu wrote: On Fri, Dec 8, 2017 at 11:10 PM, Konrad Rzeszutek Wilk < konrad.w...@oracle.com> wrote: On Fri, Dec 08, 2017 at 04:39:43PM +0800, Quan Xu wrote: From: Ben Luo <bn0...@

Re: [PATCH RFC v3 3/6] sched/idle: Add a generic poll before enter real idle path

2017-11-17 Thread Quan Xu
On 2017-11-16 17:53, Thomas Gleixner wrote: On Thu, 16 Nov 2017, Quan Xu wrote: On 2017-11-16 06:03, Thomas Gleixner wrote: --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c @@ -210,6 +210,13 @@ int cpuidle_enter_state(struct cpuidle_device *dev, struct cpuidle_driver *drv

Re: [PATCH RFC v3 3/6] sched/idle: Add a generic poll before enter real idle path

2017-11-17 Thread Quan Xu
On 2017-11-17 19:36, Thomas Gleixner wrote: On Fri, 17 Nov 2017, Quan Xu wrote: On 2017-11-16 17:53, Thomas Gleixner wrote: That's just plain wrong. We don't want to see any of this PARAVIRT crap in anything outside the architecture/hypervisor interfacing code which really needs

Re: [PATCH 1/2] x86,kvm: move qemu/guest FPU switching out to vcpu_run

2017-11-16 Thread Quan Xu
On 2017-11-16 18:21, Paolo Bonzini wrote: On 16/11/2017 06:06, Quan Xu wrote: when vcpu thread is scheduled out, the pkru value in current->thread.fpu.state may be the host pkru value, instead of guest pkru value (of course, this _assumes_ that the pkru is in current->thread.fpu.state a

Re: [PATCH 1/2] x86,kvm: move qemu/guest FPU switching out to vcpu_run

2017-11-16 Thread Quan Xu
On 2017-11-16 20:18, Paolo Bonzini wrote: On 16/11/2017 13:12, Quan Xu wrote: However it seems there is still some gap.. as Rik said, "at context switch time, the context switch code will save the guest FPU state to current->thread.fpu when the VCPU thread is scheduled out."

Re: [PATCH RFC v3 4/6] Documentation: Add three sysctls for smart idle poll

2017-11-13 Thread Quan Xu
On 2017/11/13 23:08, Ingo Molnar wrote: * Quan Xu <quan.x...@gmail.com> wrote: From: Quan Xu <quan@gmail.com> To reduce the cost of poll, we introduce three sysctl to control the poll time when running as a virtual machine with paravirt. Signed-off-by: Yang Zhang

Re: [PATCH RFC v3 1/6] x86/paravirt: Add pv_idle_ops to paravirt ops

2017-11-14 Thread Quan Xu
On 2017/11/14 15:12, Wanpeng Li wrote: 2017-11-14 15:02 GMT+08:00 Quan Xu <quan@gmail.com>: On 2017/11/13 18:53, Juergen Gross wrote: On 13/11/17 11:06, Quan Xu wrote: From: Quan Xu <quan@gmail.com> So far, pv_idle_ops.poll is the only ops for pv_idle. .poll is called

Re: [PATCH RFC v3 1/6] x86/paravirt: Add pv_idle_ops to paravirt ops

2017-11-13 Thread Quan Xu
On 2017/11/13 18:53, Juergen Gross wrote: On 13/11/17 11:06, Quan Xu wrote: From: Quan Xu <quan@gmail.com> So far, pv_idle_ops.poll is the only ops for pv_idle. .poll is called in idle path which will poll for a while before we enter the real idle state. In virtualization, idl

Re: [PATCH RFC v3 1/6] x86/paravirt: Add pv_idle_ops to paravirt ops

2017-11-14 Thread Quan Xu
On 2017/11/14 18:27, Juergen Gross wrote: On 14/11/17 10:38, Quan Xu wrote: On 2017/11/14 15:30, Juergen Gross wrote: On 14/11/17 08:02, Quan Xu wrote: On 2017/11/13 18:53, Juergen Gross wrote: On 13/11/17 11:06, Quan Xu wrote: From: Quan Xu <quan@gmail.com> So far, pv_idle_op

Re: [PATCH RFC v3 1/6] x86/paravirt: Add pv_idle_ops to paravirt ops

2017-11-14 Thread Quan Xu
On 2017/11/14 15:30, Juergen Gross wrote: On 14/11/17 08:02, Quan Xu wrote: On 2017/11/13 18:53, Juergen Gross wrote: On 13/11/17 11:06, Quan Xu wrote: From: Quan Xu <quan@gmail.com> So far, pv_idle_ops.poll is the only ops for pv_idle. .poll is called in idle path which wil

Re: [PATCH RFC v3 1/6] x86/paravirt: Add pv_idle_ops to paravirt ops

2017-11-14 Thread Quan Xu
On 2017/11/14 16:22, Wanpeng Li wrote: 2017-11-14 16:15 GMT+08:00 Quan Xu <quan@gmail.com>: On 2017/11/14 15:12, Wanpeng Li wrote: 2017-11-14 15:02 GMT+08:00 Quan Xu <quan@gmail.com>: On 2017/11/13 18:53, Juergen Gross wrote: On 13/11/17 11:06, Quan Xu wrote: From: Q

Re: [PATCH RFC v3 3/6] sched/idle: Add a generic poll before enter real idle path

2017-11-19 Thread Quan Xu
On 2017-11-16 17:45, Daniel Lezcano wrote: On 16/11/2017 10:12, Quan Xu wrote: On 2017-11-16 06:03, Thomas Gleixner wrote: On Wed, 15 Nov 2017, Peter Zijlstra wrote: On Mon, Nov 13, 2017 at 06:06:02PM +0800, Quan Xu wrote: From: Yang Zhang <yang.zhang...@gmail.com> Implement a g

Re: [Xen-devel] [PATCH RFC v3 0/6] x86/idle: add halt poll support

2017-11-19 Thread Quan Xu
On 2017-11-16 05:31, Konrad Rzeszutek Wilk wrote: On Mon, Nov 13, 2017 at 06:05:59PM +0800, Quan Xu wrote: From: Yang Zhang <yang.zhang...@gmail.com> Some latency-intensive workload have seen obviously performance drop when running inside VM. The main reason is that the overhead is amp

Re: [PATCH 1/2] x86,kvm: move qemu/guest FPU switching out to vcpu_run

2017-11-15 Thread Quan Xu
On 2017-11-16 12:21, Rik van Riel wrote: On Thu, 2017-11-16 at 10:50 +0800, Quan Xu wrote: On 2017-11-15 22:43, Rik van Riel wrote: Can you explain why you believe that? for example, a vcpu thread is running in kvm mode under cretical condition to stop. QEMU send an IPI to cause a VM-exit

Re: [PATCH 1/2] x86,kvm: move qemu/guest FPU switching out to vcpu_run

2017-11-16 Thread Quan Xu
On 2017-11-17 01:50, Paolo Bonzini wrote: On 16/11/2017 15:28, Quan Xu wrote: vcpu->srcu_idx = srcu_read_lock(>srcu); + kvm_load_guest_fpu(vcpu); + for (;;) { if (kvm_vcpu_running(vcpu)) { r = vcpu_enter_guest(vcpu); <<

Re: [PATCH RFC v3 3/6] sched/idle: Add a generic poll before enter real idle path

2017-11-16 Thread Quan Xu
On 2017-11-16 06:03, Thomas Gleixner wrote: On Wed, 15 Nov 2017, Peter Zijlstra wrote: On Mon, Nov 13, 2017 at 06:06:02PM +0800, Quan Xu wrote: From: Yang Zhang <yang.zhang...@gmail.com> Implement a generic idle poll which resembles the functionality found in arch/. Provid

Re: [PATCH RFC v3 3/6] sched/idle: Add a generic poll before enter real idle path

2017-11-16 Thread Quan Xu
On 2017-11-16 16:45, Peter Zijlstra wrote: On Wed, Nov 15, 2017 at 11:03:08PM +0100, Thomas Gleixner wrote: If I understand the problem correctly then he wants to avoid the heavy lifting in tick_nohz_idle_enter() in the first place, but there is already an interesting quirk there which makes

[PATCH] KVM: VMX: drop I/O permission bitmaps

2017-12-08 Thread Quan Xu
From: Quan Xu <quan@gmail.com> Since KVM removes the only I/O port 0x80 bypass on Intel hosts, clear CPU_BASED_USE_IO_BITMAPS and set CPU_BASED_UNCOND_IO_EXITING bit. Then these I/O permission bitmaps are not used at all, so drop I/O permission bitmaps. Signed-off-by: Jim Mattson

[PATCH RFC 0/7] kvm pvtimer

2017-12-08 Thread Quan Xu
From: Ben Luo This patchset introduces a new paravirtualized mechanism to reduce VM-exit caused by guest timer accessing. In general, KVM guest programs tsc-deadline timestamp to MSR_IA32_TSC_DEADLINE MSR. This will cause a VM-exit, and then KVM handles this timer for guest.

[PATCH RFC 2/7] kvm: x86: add a function to exchange value

2017-12-08 Thread Quan Xu
From: Ben Luo <bn0...@gmail.com> Introduce kvm_xchg_guest_cached to exchange value with guest page atomically. Signed-off-by: Yang Zhang <yang.zhang...@gmail.com> Signed-off-by: Quan Xu <quan@gmail.com> Signed-off-by: Ben Luo <bn0...@gmail.com> --- include/linux/kvm

[PATCH RFC 1/7] kvm: x86: emulate MSR_KVM_PV_TIMER_EN MSR

2017-12-08 Thread Quan Xu
From: Ben Luo <bn0...@gmail.com> Guest enables pv timer functionality using this MSR Signed-off-by: Yang Zhang <yang.zhang...@gmail.com> Signed-off-by: Quan Xu <quan@gmail.com> Signed-off-by: Ben Luo <bn0...@gmail.com> --- arch/x86/include/asm/kvm_host.h |5

[PATCH RFC 3/7] KVM: timer: synchronize tsc-deadline timestamp for guest

2017-12-08 Thread Quan Xu
ically working kthread to scan share page and synchronize timer setting for guest on a dedicated CPU. Signed-off-by: Yang Zhang <yang.zhang...@gmail.com> Signed-off-by: Quan Xu <quan@gmail.com> Signed-off-by: Ben Luo <bn0...@gmail.com> --- arc

[PATCH RFC 7/7] kvm: guest: reprogram guest timer

2017-12-08 Thread Quan Xu
guest on a dedicated CPU. The next time event of the periodically working kthread is a threshold to decide whether to program tsc-deadline timestamp to MSR_IA32_TSC_DEADLINE MSR, or to share page. Signed-off-by: Yang Zhang <yang.zhang...@gmail.com> Signed-off-by: Quan Xu <quan@gmail.com>

[PATCH RFC 6/7] Doc/KVM: introduce a new cpuid bit for kvm pvtimer

2017-12-08 Thread Quan Xu
From: Ben Luo <bn0...@gmail.com> KVM_FEATURE_PV_TIMER enables guest to check whether pvtimer can be enabled in guest. Signed-off-by: Yang Zhang <yang.zhang...@gmail.com> Signed-off-by: Quan Xu <quan@gmail.com> Signed-off-by: Ben Luo <bn0...@gmail.com> --- Documentati

[PATCH RFC 5/7] KVM: timer: ignore timer migration if pvtimer is enabled

2017-12-08 Thread Quan Xu
gmail.com> Signed-off-by: Quan Xu <quan@gmail.com> Signed-off-by: Ben Luo <bn0...@gmail.com> --- arch/x86/kvm/lapic.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index 5835a27..265efe6 100644 --- a/arch/x86/kv

[PATCH RFC 4/7] KVM: timer: program timer to a dedicated CPU

2017-12-08 Thread Quan Xu
tering on current CPU. Signed-off-by: Yang Zhang <yang.zhang...@gmail.com> Signed-off-by: Quan Xu <quan@gmail.com> Signed-off-by: Ben Luo <bn0...@gmail.com> --- arch/x86/kvm/lapic.c |8 +++- arch/x86/kvm/x86.c |7 ++- 2 files changed, 13 insertions(+), 2 deletio

Re: [PATCH v3] KVM: X86: Fix load RFLAGS w/o the fixed bit

2017-12-07 Thread Quan Xu
oogle.com> Reviewed-by: David Hildenbrand <da...@redhat.com> Cc: Paolo Bonzini <pbonz...@redhat.com> Cc: Radim Krčmář <rkrc...@redhat.com> Cc: Jim Mattson <jmatt...@google.com> Signed-off-by: Wanpeng Li <wanpeng...@hotmail.com>   Reviewed-by: Quan Xu <quan@gmail.com>

Re: [PATCH] KVM: VMX: drop I/O permission bitmaps

2017-12-10 Thread Quan Xu
On 2017/12/09 00:18, David Hildenbrand wrote: On 08.12.2017 11:22, Quan Xu wrote: From: Quan Xu <quan@gmail.com> Since KVM removes the only I/O port 0x80 bypass on Intel hosts, clear CPU_BASED_USE_IO_BITMAPS and set CPU_BASED_UNCOND_IO_EXITING bit. Then these I/O permission b

Re: [PATCH] KVM: VMX: drop I/O permission bitmaps

2017-12-10 Thread Quan Xu
On 2017/12/09 01:31, Jim Mattson wrote: On Fri, Dec 8, 2017 at 2:22 AM, Quan Xu <quan@gmail.com> wrote: From: Quan Xu <quan@gmail.com> Since KVM removes the only I/O port 0x80 bypass on Intel hosts, clear CPU_BASED_USE_IO_BITMAPS and set CPU_BASED_UNCOND_IO_EXITING bit.

Re: [PATCH] KVM: VMX: drop I/O permission bitmaps

2017-12-12 Thread Quan Xu
VMCS components if an L1 hypervisor tries to access them. I will fix in v2. Quan Alibaba Cloud On Sun, Dec 10, 2017 at 9:37 PM, Quan Xu <quan@gmail.com> wrote: On 2017/12/09 01:31, Jim Mattson wrote: On Fri, Dec 8, 2017 at 2:22 AM, Quan Xu <quan@gmail.com> wrote: F

Re: [PATCH] KVM: VMX: drop I/O permission bitmaps

2017-12-12 Thread Quan Xu
On 2017/12/09 00:18, David Hildenbrand wrote: On 08.12.2017 11:22, Quan Xu wrote: From: Quan Xu <quan@gmail.com> Since KVM removes the only I/O port 0x80 bypass on Intel hosts, clear CPU_BASED_USE_IO_BITMAPS and set CPU_BASED_UNCOND_IO_EXITING bit. Then these I/O permission b

[PATCH v2] KVM: VMX: drop I/O permission bitmaps

2017-12-12 Thread Quan Xu
From: Quan Xu <quan@gmail.com> Since KVM removes the only I/O port 0x80 bypass on Intel hosts, clear CPU_BASED_USE_IO_BITMAPS and set CPU_BASED_UNCOND_IO_EXITING bit. Then these I/O permission bitmaps are not used at all, so drop I/O permission bitmaps. Signed-off-by: Jim Mattson

Re: [PATCH] vfio: mdev: make a couple of functions and structure vfio_mdev_driver static

2017-12-24 Thread Quan Xu
struct device *dev) { vfio_del_group_dev(dev); } -struct mdev_driver vfio_mdev_driver = { +static struct mdev_driver vfio_mdev_driver = { .name = "vfio_mdev", .probe = vfio_mdev_probe, .remove = vfio_mdev_remove, Reviewed-by: Quan Xu <quan@gmail.com>

Re: [PATCH] KVM: nVMX: remove unnecessary vmwrite from L2->L1 vmexit

2018-01-02 Thread Quan Xu
P, vmcs12->host_ia32_sysenter_esp); Reviewed-by: Liran Alon <liran.a...@oracle.com> I would also add to commit message: Fixes: 06a5524f091b ("KVM: nVMX: Fix posted intr delivery when vcpu is in guest mode") Reviewed-by: Quan Xu <quan@gmail.com>

Re: [RFC PATCH v2 3/7] sched/idle: Add poll before enter real idle path

2017-08-31 Thread Quan Xu
on 2017/8/29 20:45, Peter Zijlstra wrote: On Tue, Aug 29, 2017 at 11:46:37AM +, Yang Zhang wrote: Add poll in do_idle. For UP VM, if there are running task, it will not goes into idle path, so we only enable poll in SMP VM. Signed-off-by: Yang Zhang Signed-off-by: Quan Xu Broken SoB

Re: [RFC PATCH v2 3/7] sched/idle: Add poll before enter real idle path

2017-09-01 Thread Quan Xu
on 2017/8/29 22:39, Borislav Petkov wrote: On Tue, Aug 29, 2017 at 11:46:37AM +, Yang Zhang wrote: Add poll in do_idle. For UP VM, if there are running task, it will not goes into idle path, so we only enable poll in SMP VM. Signed-off-by: Yang Zhang Signed-off-by: Quan Xu Cc: Thomas

Re: [RFC PATCH v2 7/7] sched/idle: update poll time when wakeup from idle

2017-09-29 Thread Quan Xu
, but the test result shows no obvious performance gap compare with updating poll in irq handler. one problem is that idle_stamp only used when using CFS scheduler. But it is ok since it is the default policy for scheduler and only consider it should enough. Signed-off-by: Yang Zhang Signed-off-by: Quan Xu

Re: [RFC PATCH v2 3/7] sched/idle: Add poll before enter real idle path

2017-09-29 Thread Quan Xu
On 2017/9/1 14:49, Quan Xu wrote: on 2017/8/29 22:39, Borislav Petkov wrote: On Tue, Aug 29, 2017 at 11:46:37AM +, Yang Zhang wrote: Add poll in do_idle. For UP VM, if there are running task, it will not goes into idle path, so we only enable poll in SMP VM. Signed-off-by: Yang Zhang

Re: [PATCH RFC 0/7] kvm pvtimer

2017-12-14 Thread Quan Xu
On 2017/12/14 19:56, Paolo Bonzini wrote: On 13/12/2017 17:28, Konrad Rzeszutek Wilk wrote: 1) VM idle path and network req/resp services: Does this go away if you don't hit the idle path? Meaning if you loop without hitting HLT/MWAIT? I am assuming the issue you are facing is the latency -

Re: [PATCH] KVM: x86: ioapic: Clear IRR for rtc bit when rtc EOI gotten

2017-12-14 Thread Quan Xu
On 2017/12/14 21:15, Gonglei (Arei) wrote: -Original Message- From: Liran Alon [mailto:liran.a...@oracle.com] Sent: Thursday, December 14, 2017 9:02 PM To: Gonglei (Arei); pbonz...@redhat.com; rkrc...@redhat.com Cc: k...@vger.kernel.org; linux-kernel@vger.kernel.org; Huangweidong (C)

Re: [PATCH] vfio: mdev: make a couple of functions and structure vfio_mdev_driver static

2017-12-24 Thread Quan Xu
) { vfio_del_group_dev(dev); } -struct mdev_driver vfio_mdev_driver = { +static struct mdev_driver vfio_mdev_driver = { .name = "vfio_mdev", .probe = vfio_mdev_probe, .remove = vfio_mdev_remove, Reviewed-by: Quan Xu

Re: [PATCH RFC v3 4/6] Documentation: Add three sysctls for smart idle poll

2017-11-13 Thread Quan Xu
On 2017/11/13 23:08, Ingo Molnar wrote: * Quan Xu wrote: From: Quan Xu To reduce the cost of poll, we introduce three sysctl to control the poll time when running as a virtual machine with paravirt. Signed-off-by: Yang Zhang Signed-off-by: Quan Xu --- Documentation/sysctl/kernel.txt

Re: [PATCH RFC v3 1/6] x86/paravirt: Add pv_idle_ops to paravirt ops

2017-11-13 Thread Quan Xu
On 2017/11/13 18:53, Juergen Gross wrote: On 13/11/17 11:06, Quan Xu wrote: From: Quan Xu So far, pv_idle_ops.poll is the only ops for pv_idle. .poll is called in idle path which will poll for a while before we enter the real idle state. In virtualization, idle path includes several heavy

Re: [PATCH RFC v3 1/6] x86/paravirt: Add pv_idle_ops to paravirt ops

2017-11-14 Thread Quan Xu
On 2017/11/14 15:12, Wanpeng Li wrote: 2017-11-14 15:02 GMT+08:00 Quan Xu : On 2017/11/13 18:53, Juergen Gross wrote: On 13/11/17 11:06, Quan Xu wrote: From: Quan Xu So far, pv_idle_ops.poll is the only ops for pv_idle. .poll is called in idle path which will poll for a while before we

Re: [PATCH RFC v3 1/6] x86/paravirt: Add pv_idle_ops to paravirt ops

2017-11-14 Thread Quan Xu
On 2017/11/14 15:30, Juergen Gross wrote: On 14/11/17 08:02, Quan Xu wrote: On 2017/11/13 18:53, Juergen Gross wrote: On 13/11/17 11:06, Quan Xu wrote: From: Quan Xu So far, pv_idle_ops.poll is the only ops for pv_idle. .poll is called in idle path which will poll for a while before we

Re: [PATCH RFC v3 1/6] x86/paravirt: Add pv_idle_ops to paravirt ops

2017-11-14 Thread Quan Xu
On 2017/11/14 16:22, Wanpeng Li wrote: 2017-11-14 16:15 GMT+08:00 Quan Xu : On 2017/11/14 15:12, Wanpeng Li wrote: 2017-11-14 15:02 GMT+08:00 Quan Xu : On 2017/11/13 18:53, Juergen Gross wrote: On 13/11/17 11:06, Quan Xu wrote: From: Quan Xu So far, pv_idle_ops.poll is the only ops

Re: [PATCH RFC v3 1/6] x86/paravirt: Add pv_idle_ops to paravirt ops

2017-11-14 Thread Quan Xu
On 2017/11/14 18:27, Juergen Gross wrote: On 14/11/17 10:38, Quan Xu wrote: On 2017/11/14 15:30, Juergen Gross wrote: On 14/11/17 08:02, Quan Xu wrote: On 2017/11/13 18:53, Juergen Gross wrote: On 13/11/17 11:06, Quan Xu wrote: From: Quan Xu So far, pv_idle_ops.poll is the only ops

Re: [PATCH RFC v3 3/6] sched/idle: Add a generic poll before enter real idle path

2017-11-19 Thread Quan Xu
On 2017-11-16 17:45, Daniel Lezcano wrote: On 16/11/2017 10:12, Quan Xu wrote: On 2017-11-16 06:03, Thomas Gleixner wrote: On Wed, 15 Nov 2017, Peter Zijlstra wrote: On Mon, Nov 13, 2017 at 06:06:02PM +0800, Quan Xu wrote: From: Yang Zhang Implement a generic idle poll which resembles

Re: [Xen-devel] [PATCH RFC v3 0/6] x86/idle: add halt poll support

2017-11-19 Thread Quan Xu
On 2017-11-16 05:31, Konrad Rzeszutek Wilk wrote: On Mon, Nov 13, 2017 at 06:05:59PM +0800, Quan Xu wrote: From: Yang Zhang Some latency-intensive workload have seen obviously performance drop when running inside VM. The main reason is that the overhead is amplified when running inside VM

Re: [RFC PATCH v2 0/7] x86/idle: add halt poll support

2017-09-14 Thread Quan Xu
on 2017/9/13 19:56, Yang Zhang wrote: On 2017/8/29 22:56, Michael S. Tsirkin wrote: On Tue, Aug 29, 2017 at 11:46:34AM +, Yang Zhang wrote: Some latency-intensive workload will see obviously performance drop when running inside VM. But are we trading a lot of CPU for a bit of lower

Re: [RFC PATCH v2 3/7] sched/idle: Add poll before enter real idle path

2017-09-14 Thread Quan Xu
on 2017/9/1 13:57, Quan Xu wrote: on 2017/8/29 20:45, Peter Zijlstra wrote: On Tue, Aug 29, 2017 at 11:46:37AM +, Yang Zhang wrote: Add poll in do_idle. For UP VM, if there are running task, it will not goes into idle path, so we only enable poll in SMP VM. Signed-off-by: Yang Zhang

Re: [RFC PATCH v2 0/7] x86/idle: add halt poll support

2017-09-14 Thread Quan Xu
On 2017/9/14 17:19, Wanpeng Li wrote: 2017-09-14 16:36 GMT+08:00 Quan Xu : on 2017/9/13 19:56, Yang Zhang wrote: On 2017/8/29 22:56, Michael S. Tsirkin wrote: On Tue, Aug 29, 2017 at 11:46:34AM +, Yang Zhang wrote: Some latency-intensive workload will see obviously performance drop

Re: [PATCH] KVM: nVMX: remove unnecessary vmwrite from L2->L1 vmexit

2018-01-02 Thread Quan Xu
er_esp); Reviewed-by: Liran Alon I would also add to commit message: Fixes: 06a5524f091b ("KVM: nVMX: Fix posted intr delivery when vcpu is in guest mode") Reviewed-by: Quan Xu

Re: [PATCH v3] KVM: X86: Fix load RFLAGS w/o the fixed bit

2017-12-07 Thread Quan Xu
onzini Cc: Radim Krčmář Cc: Jim Mattson Signed-off-by: Wanpeng Li   Reviewed-by: Quan Xu

[PATCH RFC 1/7] kvm: x86: emulate MSR_KVM_PV_TIMER_EN MSR

2017-12-08 Thread Quan Xu
From: Ben Luo Guest enables pv timer functionality using this MSR Signed-off-by: Yang Zhang Signed-off-by: Quan Xu Signed-off-by: Ben Luo --- arch/x86/include/asm/kvm_host.h |5 + arch/x86/include/uapi/asm/kvm_para.h |6 ++ arch/x86/kvm/lapic.c | 22

[PATCH RFC 0/7] kvm pvtimer

2017-12-08 Thread Quan Xu
From: Ben Luo This patchset introduces a new paravirtualized mechanism to reduce VM-exit caused by guest timer accessing. In general, KVM guest programs tsc-deadline timestamp to MSR_IA32_TSC_DEADLINE MSR. This will cause a VM-exit, and then KVM handles this timer for guest. Also kvm always

[PATCH RFC 2/7] kvm: x86: add a function to exchange value

2017-12-08 Thread Quan Xu
From: Ben Luo Introduce kvm_xchg_guest_cached to exchange value with guest page atomically. Signed-off-by: Yang Zhang Signed-off-by: Quan Xu Signed-off-by: Ben Luo --- include/linux/kvm_host.h |3 +++ virt/kvm/kvm_main.c | 42 ++ 2 files

[PATCH RFC 5/7] KVM: timer: ignore timer migration if pvtimer is enabled

2017-12-08 Thread Quan Xu
From: Ben Luo When pvtimer is enabled, KVM programs timer to a dedicated CPU through IPI. Whether the vCPU is on the dedicated CPU or any other CPU, the timer interrupt will be delivered properly. No need to migrate timer. Signed-off-by: Yang Zhang Signed-off-by: Quan Xu Signed-off-by: Ben

[PATCH RFC 3/7] KVM: timer: synchronize tsc-deadline timestamp for guest

2017-12-08 Thread Quan Xu
to scan share page and synchronize timer setting for guest on a dedicated CPU. Signed-off-by: Yang Zhang Signed-off-by: Quan Xu Signed-off-by: Ben Luo --- arch/x86/kvm/lapic.c | 138 ++ arch/x86/kvm/lapic.h |5 ++ 2 files changed, 143 insertions

[PATCH RFC 7/7] kvm: guest: reprogram guest timer

2017-12-08 Thread Quan Xu
. The next time event of the periodically working kthread is a threshold to decide whether to program tsc-deadline timestamp to MSR_IA32_TSC_DEADLINE MSR, or to share page. Signed-off-by: Yang Zhang Signed-off-by: Quan Xu Signed-off-by: Ben Luo --- arch/x86/include/asm/kvm_para.h |9

[PATCH RFC 6/7] Doc/KVM: introduce a new cpuid bit for kvm pvtimer

2017-12-08 Thread Quan Xu
From: Ben Luo KVM_FEATURE_PV_TIMER enables guest to check whether pvtimer can be enabled in guest. Signed-off-by: Yang Zhang Signed-off-by: Quan Xu Signed-off-by: Ben Luo --- Documentation/virtual/kvm/cpuid.txt |4 arch/x86/include/uapi/asm/kvm_para.h |1 + arch/x86/kvm

[PATCH RFC 4/7] KVM: timer: program timer to a dedicated CPU

2017-12-08 Thread Quan Xu
-off-by: Yang Zhang Signed-off-by: Quan Xu Signed-off-by: Ben Luo --- arch/x86/kvm/lapic.c |8 +++- arch/x86/kvm/x86.c |7 ++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index 20a23bb..5835a27 100644 --- a/arch/x86

[PATCH] KVM: VMX: drop I/O permission bitmaps

2017-12-08 Thread Quan Xu
From: Quan Xu Since KVM removes the only I/O port 0x80 bypass on Intel hosts, clear CPU_BASED_USE_IO_BITMAPS and set CPU_BASED_UNCOND_IO_EXITING bit. Then these I/O permission bitmaps are not used at all, so drop I/O permission bitmaps. Signed-off-by: Jim Mattson Signed-off-by: Radim Krčmář

Re: [PATCH] KVM: VMX: drop I/O permission bitmaps

2017-12-10 Thread Quan Xu
On 2017/12/09 00:18, David Hildenbrand wrote: On 08.12.2017 11:22, Quan Xu wrote: From: Quan Xu Since KVM removes the only I/O port 0x80 bypass on Intel hosts, clear CPU_BASED_USE_IO_BITMAPS and set CPU_BASED_UNCOND_IO_EXITING bit. Then these I/O permission bitmaps are not used at all, so

Re: [PATCH] KVM: VMX: drop I/O permission bitmaps

2017-12-10 Thread Quan Xu
On 2017/12/09 01:31, Jim Mattson wrote: On Fri, Dec 8, 2017 at 2:22 AM, Quan Xu wrote: From: Quan Xu Since KVM removes the only I/O port 0x80 bypass on Intel hosts, clear CPU_BASED_USE_IO_BITMAPS and set CPU_BASED_UNCOND_IO_EXITING bit. Then these I/O permission bitmaps are not used at all

Re: [PATCH] KVM: VMX: drop I/O permission bitmaps

2017-12-12 Thread Quan Xu
On 2017/12/09 00:18, David Hildenbrand wrote: On 08.12.2017 11:22, Quan Xu wrote: From: Quan Xu Since KVM removes the only I/O port 0x80 bypass on Intel hosts, clear CPU_BASED_USE_IO_BITMAPS and set CPU_BASED_UNCOND_IO_EXITING bit. Then these I/O permission bitmaps are not used at all, so

Re: [PATCH] KVM: VMX: drop I/O permission bitmaps

2017-12-12 Thread Quan Xu
VMCS components if an L1 hypervisor tries to access them. I will fix in v2. Quan Alibaba Cloud On Sun, Dec 10, 2017 at 9:37 PM, Quan Xu wrote: On 2017/12/09 01:31, Jim Mattson wrote: On Fri, Dec 8, 2017 at 2:22 AM, Quan Xu wrote: From: Quan Xu Since KVM removes the only I/O port 0x80

[PATCH v2] KVM: VMX: drop I/O permission bitmaps

2017-12-12 Thread Quan Xu
From: Quan Xu Since KVM removes the only I/O port 0x80 bypass on Intel hosts, clear CPU_BASED_USE_IO_BITMAPS and set CPU_BASED_UNCOND_IO_EXITING bit. Then these I/O permission bitmaps are not used at all, so drop I/O permission bitmaps. Signed-off-by: Jim Mattson Signed-off-by: Radim Krčmář

Re: [PATCH RFC 3/7] KVM: timer: synchronize tsc-deadline timestamp for guest

2017-12-13 Thread Quan Xu
On 2017/12/08 23:06, Konrad Rzeszutek Wilk wrote: On Fri, Dec 08, 2017 at 04:39:46PM +0800, Quan Xu wrote: From: Ben Luo In general, KVM guest programs tsc-deadline timestamp to MSR_IA32_TSC_DEADLINE MSR. This will cause a VM-exit, and then KVM handles this timer for guest. The tsc

Re: [PATCH RFC 0/7] kvm pvtimer

2017-12-13 Thread Quan Xu
On 2017/12/14 00:28, Konrad Rzeszutek Wilk wrote: On Wed, Dec 13, 2017 at 11:25:13PM +0800, Quan Xu wrote: On Fri, Dec 8, 2017 at 11:10 PM, Konrad Rzeszutek Wilk < konrad.w...@oracle.com> wrote: On Fri, Dec 08, 2017 at 04:39:43PM +0800, Quan Xu wrote: From: Ben Luo This pa

Re: [PATCH] KVM: x86: avoid unnecessary XSETBV on guest entry

2017-12-13 Thread Quan Xu
kvm_set_xcr() also depends on this */ - xsetbv(XCR_XFEATURE_ENABLED_MASK, vcpu->arch.xcr0); + if (vcpu->arch.xcr0 != host_xcr0) + xsetbv(XCR_XFEATURE_ENABLED_MASK, vcpu->arch.xcr0); vcpu->guest_xcr0_loaded = 1; } } Reviewed-by: Quan Xu

Re: [PATCH 1/2] x86,kvm: move qemu/guest FPU switching out to vcpu_run

2017-11-15 Thread Quan Xu
On 2017-11-15 22:43, Rik van Riel wrote: Can you explain why you believe that? for example, a vcpu thread is running in kvm mode under cretical condition to stop. QEMU send an IPI to cause a VM-exit to happen immediately, and this IPI doesn't make vcpu return to QEMU. IIUC this vcpu thread

Re: [PATCH 1/2] x86,kvm: move qemu/guest FPU switching out to vcpu_run

2017-11-15 Thread Quan Xu
On 2017-11-16 12:21, Rik van Riel wrote: On Thu, 2017-11-16 at 10:50 +0800, Quan Xu wrote: On 2017-11-15 22:43, Rik van Riel wrote: Can you explain why you believe that? for example, a vcpu thread is running in kvm mode under cretical condition to stop. QEMU send an IPI to cause a VM-exit

Re: [PATCH RFC v3 3/6] sched/idle: Add a generic poll before enter real idle path

2017-11-16 Thread Quan Xu
On 2017-11-16 06:03, Thomas Gleixner wrote: On Wed, 15 Nov 2017, Peter Zijlstra wrote: On Mon, Nov 13, 2017 at 06:06:02PM +0800, Quan Xu wrote: From: Yang Zhang Implement a generic idle poll which resembles the functionality found in arch/. Provide weak arch_cpu_idle_poll function which

Re: [PATCH RFC v3 3/6] sched/idle: Add a generic poll before enter real idle path

2017-11-16 Thread Quan Xu
On 2017-11-16 16:45, Peter Zijlstra wrote: On Wed, Nov 15, 2017 at 11:03:08PM +0100, Thomas Gleixner wrote: If I understand the problem correctly then he wants to avoid the heavy lifting in tick_nohz_idle_enter() in the first place, but there is already an interesting quirk there which makes

Re: [PATCH 1/2] x86,kvm: move qemu/guest FPU switching out to vcpu_run

2017-11-16 Thread Quan Xu
On 2017-11-16 18:21, Paolo Bonzini wrote: On 16/11/2017 06:06, Quan Xu wrote: when vcpu thread is scheduled out, the pkru value in current->thread.fpu.state may be the host pkru value, instead of guest pkru value (of course, this _assumes_ that the pkru is in current->thread.fpu.state a

Re: [PATCH 1/2] x86,kvm: move qemu/guest FPU switching out to vcpu_run

2017-11-16 Thread Quan Xu
On 2017-11-16 20:18, Paolo Bonzini wrote: On 16/11/2017 13:12, Quan Xu wrote: However it seems there is still some gap.. as Rik said, "at context switch time, the context switch code will save the guest FPU state to current->thread.fpu when the VCPU thread is scheduled out."

Re: [PATCH 1/2] x86,kvm: move qemu/guest FPU switching out to vcpu_run

2017-11-16 Thread Quan Xu
On 2017-11-17 01:50, Paolo Bonzini wrote: On 16/11/2017 15:28, Quan Xu wrote: vcpu->srcu_idx = srcu_read_lock(>srcu); + kvm_load_guest_fpu(vcpu); + for (;;) { if (kvm_vcpu_running(vcpu)) { r = vcpu_enter_guest(vcpu); <<

Re: [PATCH RFC v3 3/6] sched/idle: Add a generic poll before enter real idle path

2017-11-17 Thread Quan Xu
On 2017-11-16 17:53, Thomas Gleixner wrote: On Thu, 16 Nov 2017, Quan Xu wrote: On 2017-11-16 06:03, Thomas Gleixner wrote: --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c @@ -210,6 +210,13 @@ int cpuidle_enter_state(struct cpuidle_device *dev, struct cpuidle_driver *drv

Re: [PATCH RFC v3 3/6] sched/idle: Add a generic poll before enter real idle path

2017-11-17 Thread Quan Xu
On 2017-11-17 19:36, Thomas Gleixner wrote: On Fri, 17 Nov 2017, Quan Xu wrote: On 2017-11-16 17:53, Thomas Gleixner wrote: That's just plain wrong. We don't want to see any of this PARAVIRT crap in anything outside the architecture/hypervisor interfacing code which really needs