Re: [PATCH] arch: mips: kvm: Enable after disabling interrupt

2015-03-02 Thread Marcelo Tosatti
On Sun, Feb 22, 2015 at 09:48:21PM +0530, Tapasweni Pathak wrote: Enable disabled interrupt, on unsuccessful operation. Found by Coccinelle. Signed-off-by: Tapasweni Pathak tapaswenipat...@gmail.com Acked-by: Julia Lawall julia.law...@lip6.fr --- arch/mips/kvm/tlb.c |1 + 1 file

Re: [PATCH v2] KVM: SVM: fix interrupt injection (apic-isr_count always 0)

2015-03-02 Thread Marcelo Tosatti
On Fri, Feb 27, 2015 at 04:32:38PM +0100, Radim Krčmář wrote: In commit b4eef9b36db4, we started to use hwapic_isr_update() != NULL instead of kvm_apic_vid_enabled(vcpu-kvm). This didn't work because SVM had it defined and apicv path in apic_{set,clear}_isr() does not change apic-isr_count,

Re: [patch -rt 1/2] KVM: use simple waitqueue for vcpu->wq

2015-02-26 Thread Marcelo Tosatti
On Tue, Feb 17, 2015 at 06:44:19PM +0100, Sebastian Andrzej Siewior wrote: > * Peter Zijlstra | 2015-01-21 16:07:16 [+0100]: > > >On Tue, Jan 20, 2015 at 01:16:13PM -0500, Steven Rostedt wrote: > >> I'm actually wondering if we should just nuke the _interruptible() > >> version of swait. As it

Re: [v3 24/26] KVM: Update Posted-Interrupts Descriptor when vCPU is blocked

2015-02-26 Thread Marcelo Tosatti
On Thu, Feb 26, 2015 at 08:08:15AM +, Wu, Feng wrote: > > > > -Original Message- > > From: Marcelo Tosatti [mailto:mtosa...@redhat.com] > > Sent: Thursday, February 26, 2015 5:50 AM > > To: Wu, Feng > > Cc: t...@linutronix.de; mi...@redhat.com; h.

Re: [v3 24/26] KVM: Update Posted-Interrupts Descriptor when vCPU is blocked

2015-02-26 Thread Marcelo Tosatti
On Fri, Dec 12, 2014 at 11:14:58PM +0800, Feng Wu wrote: > This patch updates the Posted-Interrupts Descriptor when vCPU > is blocked. > > pre-block: > - Add the vCPU to the blocked per-CPU list > - Clear 'SN' > - Set 'NV' to POSTED_INTR_WAKEUP_VECTOR > > post-block: > - Remove the vCPU from the

Re: [PATCH v2 0/4] KVM: APIC improvements (with bonus mixed mode)

2015-02-26 Thread Marcelo Tosatti
On Thu, Feb 26, 2015 at 10:49:53AM +0200, Nadav Amit wrote: > Marcello, Radim, > > As you know - I can run some tests on the patches and whether they comply > with real hardware. Please let me know which version to test and I’ll try to > do next week. > > Regards, > Nadav >From what i

Re: [patch -rt 1/2] KVM: use simple waitqueue for vcpu-wq

2015-02-26 Thread Marcelo Tosatti
On Tue, Feb 17, 2015 at 06:44:19PM +0100, Sebastian Andrzej Siewior wrote: * Peter Zijlstra | 2015-01-21 16:07:16 [+0100]: On Tue, Jan 20, 2015 at 01:16:13PM -0500, Steven Rostedt wrote: I'm actually wondering if we should just nuke the _interruptible() version of swait. As it should only

Re: [v3 24/26] KVM: Update Posted-Interrupts Descriptor when vCPU is blocked

2015-02-26 Thread Marcelo Tosatti
On Thu, Feb 26, 2015 at 08:08:15AM +, Wu, Feng wrote: -Original Message- From: Marcelo Tosatti [mailto:mtosa...@redhat.com] Sent: Thursday, February 26, 2015 5:50 AM To: Wu, Feng Cc: t...@linutronix.de; mi...@redhat.com; h...@zytor.com; x...@kernel.org; g...@kernel.org

Re: [PATCH v2 0/4] KVM: APIC improvements (with bonus mixed mode)

2015-02-26 Thread Marcelo Tosatti
On Thu, Feb 26, 2015 at 10:49:53AM +0200, Nadav Amit wrote: Marcello, Radim, As you know - I can run some tests on the patches and whether they comply with real hardware. Please let me know which version to test and I’ll try to do next week. Regards, Nadav From what i understand Radim

Re: [v3 24/26] KVM: Update Posted-Interrupts Descriptor when vCPU is blocked

2015-02-26 Thread Marcelo Tosatti
On Fri, Dec 12, 2014 at 11:14:58PM +0800, Feng Wu wrote: This patch updates the Posted-Interrupts Descriptor when vCPU is blocked. pre-block: - Add the vCPU to the blocked per-CPU list - Clear 'SN' - Set 'NV' to POSTED_INTR_WAKEUP_VECTOR post-block: - Remove the vCPU from the per-CPU

Re: [PATCH v2 0/4] KVM: APIC improvements (with bonus mixed mode)

2015-02-25 Thread Marcelo Tosatti
Radim, On Thu, Feb 12, 2015 at 07:41:30PM +0100, Radim Krčmář wrote: > Each patch has a diff from v1, here is only a prologue on the mythical > mixed xAPIC and x2APIC mode: > > There is one interesting alias in xAPIC and x2APIC ICR destination, the > 0xff00, which is a broadcast in xAPIC and

Re: [PATCH 1/2] white space formatting in kvm_main.c

2015-02-25 Thread Marcelo Tosatti
On Fri, Feb 20, 2015 at 08:21:36AM -0500, Kevin Mulvey wrote: > Better alignment of loop using tabs rather than spaces, this > makes checkpatch.pl happier. > > Signed-off-by: Kevin Mulvey > --- > virt/kvm/kvm_main.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Applied both, thanks.

Re: [PATCH v2] x86: svm: use kvm_register_write()/read()

2015-02-25 Thread Marcelo Tosatti
On Sat, Feb 21, 2015 at 12:21:16AM +0100, Borislav Petkov wrote: > On Fri, Feb 20, 2015 at 04:02:10PM -0600, Joel Schopp wrote: > > From: David Kaplan > > > > KVM has nice wrappers to access the register values, clean up a few places > > that should use them but currently do not. > > > >

Re: [v3 24/26] KVM: Update Posted-Interrupts Descriptor when vCPU is blocked

2015-02-25 Thread Marcelo Tosatti
On Fri, Dec 12, 2014 at 11:14:58PM +0800, Feng Wu wrote: > This patch updates the Posted-Interrupts Descriptor when vCPU > is blocked. > > pre-block: > - Add the vCPU to the blocked per-CPU list > - Clear 'SN' > - Set 'NV' to POSTED_INTR_WAKEUP_VECTOR > > post-block: > - Remove the vCPU from the

Re: [v3 24/26] KVM: Update Posted-Interrupts Descriptor when vCPU is blocked

2015-02-25 Thread Marcelo Tosatti
On Fri, Dec 12, 2014 at 11:14:58PM +0800, Feng Wu wrote: This patch updates the Posted-Interrupts Descriptor when vCPU is blocked. pre-block: - Add the vCPU to the blocked per-CPU list - Clear 'SN' - Set 'NV' to POSTED_INTR_WAKEUP_VECTOR post-block: - Remove the vCPU from the per-CPU

Re: [PATCH v2] x86: svm: use kvm_register_write()/read()

2015-02-25 Thread Marcelo Tosatti
On Sat, Feb 21, 2015 at 12:21:16AM +0100, Borislav Petkov wrote: On Fri, Feb 20, 2015 at 04:02:10PM -0600, Joel Schopp wrote: From: David Kaplan david.kap...@amd.com KVM has nice wrappers to access the register values, clean up a few places that should use them but currently do not.

Re: [PATCH 1/2] white space formatting in kvm_main.c

2015-02-25 Thread Marcelo Tosatti
On Fri, Feb 20, 2015 at 08:21:36AM -0500, Kevin Mulvey wrote: Better alignment of loop using tabs rather than spaces, this makes checkpatch.pl happier. Signed-off-by: Kevin Mulvey kmul...@linux.com --- virt/kvm/kvm_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Applied

Re: [PATCH v2 0/4] KVM: APIC improvements (with bonus mixed mode)

2015-02-25 Thread Marcelo Tosatti
Radim, On Thu, Feb 12, 2015 at 07:41:30PM +0100, Radim Krčmář wrote: Each patch has a diff from v1, here is only a prologue on the mythical mixed xAPIC and x2APIC mode: There is one interesting alias in xAPIC and x2APIC ICR destination, the 0xff00, which is a broadcast in xAPIC and

Re: [v3 23/26] KVM: Update Posted-Interrupts Descriptor when vCPU is preempted

2015-02-23 Thread Marcelo Tosatti
On Fri, Dec 12, 2014 at 11:14:57PM +0800, Feng Wu wrote: > This patch updates the Posted-Interrupts Descriptor when vCPU > is preempted. > > sched out: > - Set 'SN' to suppress furture non-urgent interrupts posted for > the vCPU. What wakes the vcpu in the case of a non-urgent interrupt, then?

Re: [v3 21/26] x86, irq: Define a global vector for VT-d Posted-Interrupts

2015-02-23 Thread Marcelo Tosatti
On Fri, Dec 12, 2014 at 11:14:55PM +0800, Feng Wu wrote: > Currently, we use a global vector as the Posted-Interrupts > Notification Event for all the vCPUs in the system. We need > to introduce another global vector for VT-d Posted-Interrtups, > which will be used to wakeup the sleep vCPU when an

Re: [v3 21/26] x86, irq: Define a global vector for VT-d Posted-Interrupts

2015-02-23 Thread Marcelo Tosatti
On Fri, Dec 12, 2014 at 11:14:55PM +0800, Feng Wu wrote: Currently, we use a global vector as the Posted-Interrupts Notification Event for all the vCPUs in the system. We need to introduce another global vector for VT-d Posted-Interrtups, which will be used to wakeup the sleep vCPU when an

Re: [v3 23/26] KVM: Update Posted-Interrupts Descriptor when vCPU is preempted

2015-02-23 Thread Marcelo Tosatti
On Fri, Dec 12, 2014 at 11:14:57PM +0800, Feng Wu wrote: This patch updates the Posted-Interrupts Descriptor when vCPU is preempted. sched out: - Set 'SN' to suppress furture non-urgent interrupts posted for the vCPU. What wakes the vcpu in the case of a non-urgent interrupt, then? I

Re: [PATCH 2/2] KVM: x86: optimize delivery of TSC deadline timer interrupt

2015-02-10 Thread Marcelo Tosatti
On Sat, Feb 07, 2015 at 09:33:09PM +0100, Paolo Bonzini wrote: > > Can remove another 300 cycles from do_div when programming LAPIC > > tscdeadline timer. > > Do you mean using something like lib/reciprocal_div.c? Yes. > Good idea, > though that's not latency, it's just being slow. :) It

Re: [PATCH 2/2] KVM: x86: optimize delivery of TSC deadline timer interrupt

2015-02-10 Thread Marcelo Tosatti
On Sat, Feb 07, 2015 at 09:33:09PM +0100, Paolo Bonzini wrote: Can remove another 300 cycles from do_div when programming LAPIC tscdeadline timer. Do you mean using something like lib/reciprocal_div.c? Yes. Good idea, though that's not latency, it's just being slow. :) It adds to

Re: [PATCH 2/2] KVM: x86: optimize delivery of TSC deadline timer interrupt

2015-02-06 Thread Marcelo Tosatti
On Fri, Feb 06, 2015 at 01:16:59PM +0100, Paolo Bonzini wrote: > The newly-added tracepoint shows the following results on > the tscdeadline_latency test: > > qemu-kvm-8387 [002] 6425.558974: kvm_vcpu_wakeup: poll time > 10407 ns > qemu-kvm-8387 [002] 6425.558984:

Re: [PATCH 2/2] KVM: x86: optimize delivery of TSC deadline timer interrupt

2015-02-06 Thread Marcelo Tosatti
On Fri, Feb 06, 2015 at 01:16:59PM +0100, Paolo Bonzini wrote: The newly-added tracepoint shows the following results on the tscdeadline_latency test: qemu-kvm-8387 [002] 6425.558974: kvm_vcpu_wakeup: poll time 10407 ns qemu-kvm-8387 [002] 6425.558984:

Re: [PATCH RFC] kvm: x86: add halt_poll module parameter

2015-02-05 Thread Marcelo Tosatti
On Thu, Feb 05, 2015 at 09:34:06PM -0200, Marcelo Tosatti wrote: > On Thu, Feb 05, 2015 at 05:05:25PM +0100, Paolo Bonzini wrote: > > This patch introduces a new module parameter for the KVM module; when it > > is present, KVM attempts a bit of polling on every HLT before scheduling

Re: [PATCH RFC] kvm: x86: add halt_poll module parameter

2015-02-05 Thread Marcelo Tosatti
On Thu, Feb 05, 2015 at 05:05:25PM +0100, Paolo Bonzini wrote: > This patch introduces a new module parameter for the KVM module; when it > is present, KVM attempts a bit of polling on every HLT before scheduling > itself out via kvm_vcpu_block. > > This parameter helps a lot for latency-bound

Re: [PATCH RFC] kvm: x86: add halt_poll module parameter

2015-02-05 Thread Marcelo Tosatti
On Thu, Feb 05, 2015 at 05:05:25PM +0100, Paolo Bonzini wrote: This patch introduces a new module parameter for the KVM module; when it is present, KVM attempts a bit of polling on every HLT before scheduling itself out via kvm_vcpu_block. This parameter helps a lot for latency-bound

Re: [PATCH RFC] kvm: x86: add halt_poll module parameter

2015-02-05 Thread Marcelo Tosatti
On Thu, Feb 05, 2015 at 09:34:06PM -0200, Marcelo Tosatti wrote: On Thu, Feb 05, 2015 at 05:05:25PM +0100, Paolo Bonzini wrote: This patch introduces a new module parameter for the KVM module; when it is present, KVM attempts a bit of polling on every HLT before scheduling itself out via

Re: [PATCH -rt] timer: upper bound on loops of __run_timers processing

2015-01-26 Thread Marcelo Tosatti
Ping ? On Wed, Jan 14, 2015 at 03:21:47PM -0200, Marcelo Tosatti wrote: > > Ping? > > On Tue, Dec 30, 2014 at 05:52:28PM -0200, Marcelo Tosatti wrote: > > > > Commit "timers: do not raise softirq unconditionally", allows for timer > > wheel processi

Re: [PATCH -rt] timer: upper bound on loops of __run_timers processing

2015-01-26 Thread Marcelo Tosatti
Ping ? On Wed, Jan 14, 2015 at 03:21:47PM -0200, Marcelo Tosatti wrote: Ping? On Tue, Dec 30, 2014 at 05:52:28PM -0200, Marcelo Tosatti wrote: Commit timers: do not raise softirq unconditionally, allows for timer wheel processing (__run_timers) to be delayed for long periods of time

[patch -rt 1/2] KVM: use simple waitqueue for vcpu->wq

2015-01-21 Thread Marcelo Tosatti
context. cyclictest command line: # cyclictest -m -n -q -p99 -l 100 -h60 -D 1m This patch reduces the average latency in my tests from 14us to 11us. Signed-off-by: Marcelo Tosatti --- arch/arm/kvm/arm.c |4 ++-- arch/arm/kvm/psci.c |4 ++-- arch/mips

[patch -rt 2/2] KVM: lapic: mark LAPIC timer handler as irqsafe

2015-01-21 Thread Marcelo Tosatti
Since lapic timer handler only wakes up a simple waitqueue, it can be executed from hardirq context. Also handle the case where hrtimer_start_expires fails due to -ETIME, by injecting the interrupt to the guest immediately. Reduces average cyclictest latency by 3us. Signed-off-by: Marcelo

[patch -rt 0/2] use simple waitqueue for kvm vcpu waitqueue (v4)

2015-01-21 Thread Marcelo Tosatti
Against v3.14-rt branch of git://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-stable-rt.git The problem: On -RT, an emulated LAPIC timer instance has the following path: 1) hard interrupt 2) ksoftirqd is scheduled 3) ksoftirqd wakes up vcpu thread 4) vcpu thread is scheduled This extra

[patch -rt 2/2] KVM: lapic: mark LAPIC timer handler as irqsafe

2015-01-21 Thread Marcelo Tosatti
Since lapic timer handler only wakes up a simple waitqueue, it can be executed from hardirq context. Also handle the case where hrtimer_start_expires fails due to -ETIME, by injecting the interrupt to the guest immediately. Reduces average cyclictest latency by 3us. Signed-off-by: Marcelo

[patch -rt 0/2] use simple waitqueue for kvm vcpu waitqueue (v4)

2015-01-21 Thread Marcelo Tosatti
Against v3.14-rt branch of git://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-stable-rt.git The problem: On -RT, an emulated LAPIC timer instance has the following path: 1) hard interrupt 2) ksoftirqd is scheduled 3) ksoftirqd wakes up vcpu thread 4) vcpu thread is scheduled This extra

[patch -rt 1/2] KVM: use simple waitqueue for vcpu-wq

2015-01-21 Thread Marcelo Tosatti
context. cyclictest command line: # cyclictest -m -n -q -p99 -l 100 -h60 -D 1m This patch reduces the average latency in my tests from 14us to 11us. Signed-off-by: Marcelo Tosatti mtosa...@redhat.com --- arch/arm/kvm/arm.c |4 ++-- arch/arm/kvm/psci.c

Re: [patch -rt 1/2] KVM: use simple waitqueue for vcpu->wq

2015-01-19 Thread Marcelo Tosatti
On Fri, Jan 16, 2015 at 11:48:46AM -0500, Steven Rostedt wrote: > > @@ -971,8 +971,8 @@ > > kvm_mips_callbacks->queue_timer_int(vcpu); > > > > vcpu->arch.wait = 0; > > - if (waitqueue_active(>wq)) { > > - wake_up_interruptible(>wq); > > + if (swaitqueue_active(>wq)) { > > +

Re: [patch -rt 1/2] KVM: use simple waitqueue for vcpu-wq

2015-01-19 Thread Marcelo Tosatti
On Fri, Jan 16, 2015 at 11:48:46AM -0500, Steven Rostedt wrote: @@ -971,8 +971,8 @@ kvm_mips_callbacks-queue_timer_int(vcpu); vcpu-arch.wait = 0; - if (waitqueue_active(vcpu-wq)) { - wake_up_interruptible(vcpu-wq); + if (swaitqueue_active(vcpu-wq)) { +

Re: [PATCH -rt] timer: upper bound on loops of __run_timers processing

2015-01-14 Thread Marcelo Tosatti
Ping? On Tue, Dec 30, 2014 at 05:52:28PM -0200, Marcelo Tosatti wrote: > > Commit "timers: do not raise softirq unconditionally", allows for timer > wheel processing (__run_timers) to be delayed for long periods of time. > > The effect is that > > loops

[patch -rt 0/2] use simple waitqueue for kvm vcpu waitqueue (v3)

2015-01-14 Thread Marcelo Tosatti
Against v3.14-rt branch of git://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-stable-rt.git The problem: On -RT, an emulated LAPIC timer instance has the following path: 1) hard interrupt 2) ksoftirqd is scheduled 3) ksoftirqd wakes up vcpu thread 4) vcpu thread is scheduled This extra

[patch -rt 1/2] KVM: use simple waitqueue for vcpu->wq

2015-01-14 Thread Marcelo Tosatti
context. cyclictest command line: # cyclictest -m -n -q -p99 -l 100 -h60 -D 1m This patch reduces the average latency in my tests from 14us to 11us. Signed-off-by: Marcelo Tosatti --- arch/arm/kvm/arm.c |4 ++-- arch/arm/kvm/psci.c |4 ++-- arch/mips

[patch -rt 2/2] KVM: lapic: mark LAPIC timer handler as irqsafe

2015-01-14 Thread Marcelo Tosatti
Since lapic timer handler only wakes up a simple waitqueue, it can be executed from hardirq context. Reduces average cyclictest latency by 3us. Signed-off-by: Marcelo Tosatti --- arch/x86/kvm/lapic.c | 42 +++--- 1 file changed, 39 insertions(+), 3

[patch -rt 0/2] use simple waitqueue for kvm vcpu waitqueue (v3)

2015-01-14 Thread Marcelo Tosatti
Against v3.14-rt branch of git://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-stable-rt.git The problem: On -RT, an emulated LAPIC timer instance has the following path: 1) hard interrupt 2) ksoftirqd is scheduled 3) ksoftirqd wakes up vcpu thread 4) vcpu thread is scheduled This extra

[patch -rt 2/2] KVM: lapic: mark LAPIC timer handler as irqsafe

2015-01-14 Thread Marcelo Tosatti
Since lapic timer handler only wakes up a simple waitqueue, it can be executed from hardirq context. Reduces average cyclictest latency by 3us. Signed-off-by: Marcelo Tosatti mtosa...@redhat.com --- arch/x86/kvm/lapic.c | 42 +++--- 1 file changed, 39

[patch -rt 1/2] KVM: use simple waitqueue for vcpu-wq

2015-01-14 Thread Marcelo Tosatti
context. cyclictest command line: # cyclictest -m -n -q -p99 -l 100 -h60 -D 1m This patch reduces the average latency in my tests from 14us to 11us. Signed-off-by: Marcelo Tosatti mtosa...@redhat.com --- arch/arm/kvm/arm.c |4 ++-- arch/arm/kvm/psci.c

Re: [PATCH -rt] timer: upper bound on loops of __run_timers processing

2015-01-14 Thread Marcelo Tosatti
Ping? On Tue, Dec 30, 2014 at 05:52:28PM -0200, Marcelo Tosatti wrote: Commit timers: do not raise softirq unconditionally, allows for timer wheel processing (__run_timers) to be delayed for long periods of time. The effect is that loops = jiffies - base-timer_jiffies Can grow

Re: [RFC 2/2] x86, vdso, pvclock: Simplify and speed up the vdso pvclock reader

2015-01-08 Thread Marcelo Tosatti
On Tue, Jan 06, 2015 at 11:49:09AM -0800, Andy Lutomirski wrote: > On Tue, Jan 6, 2015 at 10:45 AM, Marcelo Tosatti wrote: > > On Tue, Jan 06, 2015 at 10:26:22AM -0800, Andy Lutomirski wrote: > >> On Tue, Jan 6, 2015 at 10:13 AM, Marcelo Tosatti > >> wrote: > >

Re: [RFC 2/2] x86, vdso, pvclock: Simplify and speed up the vdso pvclock reader

2015-01-08 Thread Marcelo Tosatti
On Tue, Jan 06, 2015 at 11:49:09AM -0800, Andy Lutomirski wrote: On Tue, Jan 6, 2015 at 10:45 AM, Marcelo Tosatti mtosa...@redhat.com wrote: On Tue, Jan 06, 2015 at 10:26:22AM -0800, Andy Lutomirski wrote: On Tue, Jan 6, 2015 at 10:13 AM, Marcelo Tosatti mtosa...@redhat.com wrote

Re: [RFC 2/2] x86, vdso, pvclock: Simplify and speed up the vdso pvclock reader

2015-01-07 Thread Marcelo Tosatti
On Tue, Jan 06, 2015 at 11:18:21PM -0800, Andy Lutomirski wrote: > On Tue, Jan 6, 2015 at 9:38 PM, Paolo Bonzini wrote: > > > > > > On 06/01/2015 17:56, Andy Lutomirski wrote: > >> Still no good. We can migrate a bunch of times so we see the same CPU > >> all three times > > > > There are no

Re: [RFC 2/2] x86, vdso, pvclock: Simplify and speed up the vdso pvclock reader

2015-01-07 Thread Marcelo Tosatti
On Tue, Jan 06, 2015 at 11:18:21PM -0800, Andy Lutomirski wrote: On Tue, Jan 6, 2015 at 9:38 PM, Paolo Bonzini pbonz...@redhat.com wrote: On 06/01/2015 17:56, Andy Lutomirski wrote: Still no good. We can migrate a bunch of times so we see the same CPU all three times There are no

Re: [RFC 2/2] x86, vdso, pvclock: Simplify and speed up the vdso pvclock reader

2015-01-06 Thread Marcelo Tosatti
On Tue, Jan 06, 2015 at 11:49:09AM -0800, Andy Lutomirski wrote: > > What is the point with the new flags bit though? > > To try to work around the problem on old hosts. I'm not at all > convinced that this is worthwhile or that it helps, though. Don't think so. Just fix the host bug. > >>

Re: [RFC 2/2] x86, vdso, pvclock: Simplify and speed up the vdso pvclock reader

2015-01-06 Thread Marcelo Tosatti
On Tue, Jan 06, 2015 at 10:26:22AM -0800, Andy Lutomirski wrote: > On Tue, Jan 6, 2015 at 10:13 AM, Marcelo Tosatti wrote: > > On Tue, Jan 06, 2015 at 08:56:40AM -0800, Andy Lutomirski wrote: > >> On Jan 6, 2015 4:01 AM, "Paolo Bonzini" wrote: > >> >

Re: [RFC 2/2] x86, vdso, pvclock: Simplify and speed up the vdso pvclock reader

2015-01-06 Thread Marcelo Tosatti
On Tue, Jan 06, 2015 at 08:56:40AM -0800, Andy Lutomirski wrote: > On Jan 6, 2015 4:01 AM, "Paolo Bonzini" wrote: > > > > > > > > On 06/01/2015 09:42, Paolo Bonzini wrote: > > > > > Still confused. So we can freeze all vCPUs in the host, then update > > > > > pvti 1, then resume vCPU 1, then

Re: [RFC 2/2] x86, vdso, pvclock: Simplify and speed up the vdso pvclock reader

2015-01-06 Thread Marcelo Tosatti
On Tue, Jan 06, 2015 at 11:49:09AM -0800, Andy Lutomirski wrote: What is the point with the new flags bit though? To try to work around the problem on old hosts. I'm not at all convinced that this is worthwhile or that it helps, though. Don't think so. Just fix the host bug. Also, if

Re: [RFC 2/2] x86, vdso, pvclock: Simplify and speed up the vdso pvclock reader

2015-01-06 Thread Marcelo Tosatti
On Tue, Jan 06, 2015 at 10:26:22AM -0800, Andy Lutomirski wrote: On Tue, Jan 6, 2015 at 10:13 AM, Marcelo Tosatti mtosa...@redhat.com wrote: On Tue, Jan 06, 2015 at 08:56:40AM -0800, Andy Lutomirski wrote: On Jan 6, 2015 4:01 AM, Paolo Bonzini pbonz...@redhat.com wrote: On 06/01

Re: [RFC 2/2] x86, vdso, pvclock: Simplify and speed up the vdso pvclock reader

2015-01-06 Thread Marcelo Tosatti
On Tue, Jan 06, 2015 at 08:56:40AM -0800, Andy Lutomirski wrote: On Jan 6, 2015 4:01 AM, Paolo Bonzini pbonz...@redhat.com wrote: On 06/01/2015 09:42, Paolo Bonzini wrote: Still confused. So we can freeze all vCPUs in the host, then update pvti 1, then resume vCPU 1, then

Re: [RFC 2/2] x86, vdso, pvclock: Simplify and speed up the vdso pvclock reader

2015-01-05 Thread Marcelo Tosatti
On Mon, Jan 05, 2015 at 02:38:46PM -0800, Andy Lutomirski wrote: > On Mon, Jan 5, 2015 at 11:17 AM, Marcelo Tosatti wrote: > > On Mon, Jan 05, 2015 at 10:56:07AM -0800, Andy Lutomirski wrote: > >> On Mon, Jan 5, 2015 at 7:25 AM, Marcelo Tosatti > >> wrote: > >

Re: [RFC 2/2] x86, vdso, pvclock: Simplify and speed up the vdso pvclock reader

2015-01-05 Thread Marcelo Tosatti
On Mon, Jan 05, 2015 at 10:56:07AM -0800, Andy Lutomirski wrote: > On Mon, Jan 5, 2015 at 7:25 AM, Marcelo Tosatti wrote: > > On Mon, Dec 22, 2014 at 04:39:57PM -0800, Andy Lutomirski wrote: > >> The pvclock vdso code was too abstracted to understand easily and > &g

Re: [RFC 2/2] x86, vdso, pvclock: Simplify and speed up the vdso pvclock reader

2015-01-05 Thread Marcelo Tosatti
On Mon, Dec 22, 2014 at 04:39:57PM -0800, Andy Lutomirski wrote: > The pvclock vdso code was too abstracted to understand easily and > excessively paranoid. Simplify it for a huge speedup. > > This opens the door for additional simplifications, as the vdso no > longer accesses the pvti for any

Re: [RFC 2/2] x86, vdso, pvclock: Simplify and speed up the vdso pvclock reader

2015-01-05 Thread Marcelo Tosatti
On Mon, Jan 05, 2015 at 10:56:07AM -0800, Andy Lutomirski wrote: On Mon, Jan 5, 2015 at 7:25 AM, Marcelo Tosatti mtosa...@redhat.com wrote: On Mon, Dec 22, 2014 at 04:39:57PM -0800, Andy Lutomirski wrote: The pvclock vdso code was too abstracted to understand easily and excessively paranoid

Re: [RFC 2/2] x86, vdso, pvclock: Simplify and speed up the vdso pvclock reader

2015-01-05 Thread Marcelo Tosatti
On Mon, Jan 05, 2015 at 02:38:46PM -0800, Andy Lutomirski wrote: On Mon, Jan 5, 2015 at 11:17 AM, Marcelo Tosatti mtosa...@redhat.com wrote: On Mon, Jan 05, 2015 at 10:56:07AM -0800, Andy Lutomirski wrote: On Mon, Jan 5, 2015 at 7:25 AM, Marcelo Tosatti mtosa...@redhat.com wrote: On Mon

Re: [RFC 2/2] x86, vdso, pvclock: Simplify and speed up the vdso pvclock reader

2015-01-05 Thread Marcelo Tosatti
On Mon, Dec 22, 2014 at 04:39:57PM -0800, Andy Lutomirski wrote: The pvclock vdso code was too abstracted to understand easily and excessively paranoid. Simplify it for a huge speedup. This opens the door for additional simplifications, as the vdso no longer accesses the pvti for any vcpu

[PATCH -rt] timer: upper bound on loops of __run_timers processing

2014-12-30 Thread Marcelo Tosatti
milliseconds to execute. Fix by creating an upper bound on the number of loops to be processed. This allows a nohz=off kernel to achieve desired latencies. Signed-off-by: Marcelo Tosatti diff --git a/kernel/timer.c b/kernel/timer.c index f59e18c..c128416 100644 --- a/kernel/timer.c +++ b/k

[PATCH -rt] timer: upper bound on loops of __run_timers processing

2014-12-30 Thread Marcelo Tosatti
to execute. Fix by creating an upper bound on the number of loops to be processed. This allows a nohz=off kernel to achieve desired latencies. Signed-off-by: Marcelo Tosatti mtosa...@redhat.com diff --git a/kernel/timer.c b/kernel/timer.c index f59e18c..c128416 100644 --- a/kernel/timer.c +++ b/kernel

Re: Cleaning up the KVM clock

2014-12-22 Thread Marcelo Tosatti
On Mon, Dec 22, 2014 at 11:34:30AM -0200, Marcelo Tosatti wrote: > > It would be even nicer, though, if we could do much the same thing but > > without worrying about which vcpu we're on. > > > > Thoughts? Am I missing some considerations here? > > Maybe we

Re: Cleaning up the KVM clock

2014-12-22 Thread Marcelo Tosatti
On Sat, Dec 20, 2014 at 07:31:19PM -0800, Andy Lutomirski wrote: > I'm looking at the vdso timing code, and I'm puzzled by the pvclock > code. My motivation is comprehensibility, performance, and > correctness. > > # for i in `seq 10`; do ./timing_test_64 10 vclock_gettime 0; done > 1000

Re: Cleaning up the KVM clock

2014-12-22 Thread Marcelo Tosatti
On Sat, Dec 20, 2014 at 07:31:19PM -0800, Andy Lutomirski wrote: > I'm looking at the vdso timing code, and I'm puzzled by the pvclock > code. My motivation is comprehensibility, performance, and > correctness. > > # for i in `seq 10`; do ./timing_test_64 10 vclock_gettime 0; done > 1000

Re: Cleaning up the KVM clock

2014-12-22 Thread Marcelo Tosatti
On Sat, Dec 20, 2014 at 07:31:19PM -0800, Andy Lutomirski wrote: I'm looking at the vdso timing code, and I'm puzzled by the pvclock code. My motivation is comprehensibility, performance, and correctness. # for i in `seq 10`; do ./timing_test_64 10 vclock_gettime 0; done 1000 loops in

Re: Cleaning up the KVM clock

2014-12-22 Thread Marcelo Tosatti
On Sat, Dec 20, 2014 at 07:31:19PM -0800, Andy Lutomirski wrote: I'm looking at the vdso timing code, and I'm puzzled by the pvclock code. My motivation is comprehensibility, performance, and correctness. # for i in `seq 10`; do ./timing_test_64 10 vclock_gettime 0; done 1000 loops in

Re: Cleaning up the KVM clock

2014-12-22 Thread Marcelo Tosatti
On Mon, Dec 22, 2014 at 11:34:30AM -0200, Marcelo Tosatti wrote: It would be even nicer, though, if we could do much the same thing but without worrying about which vcpu we're on. Thoughts? Am I missing some considerations here? Maybe we can find another optimization opportunities

Re: [patch -rt 2/2] KVM: lapic: mark LAPIC timer handler as irqsafe

2014-12-05 Thread Marcelo Tosatti
On Thu, Dec 04, 2014 at 02:53:26PM +0100, Paolo Bonzini wrote: > > > On 25/11/2014 21:24, Thomas Gleixner wrote: > > On Tue, 25 Nov 2014, Rik van Riel wrote: > >> On 11/25/2014 12:21 PM, Marcelo Tosatti wrote: > >>> Since lapic timer handler only wakes

Re: [patch -rt 2/2] KVM: lapic: mark LAPIC timer handler as irqsafe

2014-12-05 Thread Marcelo Tosatti
On Thu, Dec 04, 2014 at 02:53:26PM +0100, Paolo Bonzini wrote: On 25/11/2014 21:24, Thomas Gleixner wrote: On Tue, 25 Nov 2014, Rik van Riel wrote: On 11/25/2014 12:21 PM, Marcelo Tosatti wrote: Since lapic timer handler only wakes up a simple waitqueue, it can be executed from

Re: [patch -rt 2/2] KVM: lapic: mark LAPIC timer handler as irqsafe

2014-12-04 Thread Marcelo Tosatti
On Tue, Nov 25, 2014 at 06:38:04PM +0100, Paolo Bonzini wrote: > > > On 25/11/2014 18:21, Marcelo Tosatti wrote: > > + > > + if (r == HRTIMER_RESTART) { > > + do { > > + ret = hrtimer_start_expires(data, HRTIMER_MODE_ABS); > >

Re: [patch -rt 2/2] KVM: lapic: mark LAPIC timer handler as irqsafe

2014-12-04 Thread Marcelo Tosatti
On Tue, Nov 25, 2014 at 06:38:04PM +0100, Paolo Bonzini wrote: On 25/11/2014 18:21, Marcelo Tosatti wrote: + + if (r == HRTIMER_RESTART) { + do { + ret = hrtimer_start_expires(data, HRTIMER_MODE_ABS); + if (ret == -ETIME

Re: [patch -rt 1/2] KVM: use simple waitqueue for vcpu->wq

2014-11-25 Thread Marcelo Tosatti
On Tue, Nov 25, 2014 at 01:57:37PM -0500, Rik van Riel wrote: > On 11/25/2014 12:21 PM, Marcelo Tosatti wrote: > > The problem: > > > > On -RT, an emulated LAPIC timer instances has the following path: > > > > 1) hard interrupt > > 2) ksoftirqd is schedule

[patch -rt 1/2] KVM: use simple waitqueue for vcpu->wq

2014-11-25 Thread Marcelo Tosatti
context. cyclictest command line: # cyclictest -m -n -q -p99 -l 100 -h60 -D 1m This patch reduces the average latency in my tests from 14us to 11us. Signed-off-by: Marcelo Tosatti --- arch/arm/kvm/arm.c |4 ++-- arch/arm/kvm/psci.c |4 ++-- arch/mips

[patch -rt 2/2] KVM: lapic: mark LAPIC timer handler as irqsafe

2014-11-25 Thread Marcelo Tosatti
Since lapic timer handler only wakes up a simple waitqueue, it can be executed from hardirq context. Reduces average cyclictest latency by 3us. Signed-off-by: Marcelo Tosatti --- arch/x86/kvm/lapic.c | 42 +++--- 1 file changed, 39 insertions(+), 3

[patch -rt 0/2] use simple waitqueue for kvm vcpu waitqueue (v2)

2014-11-25 Thread Marcelo Tosatti
The problem: On -RT, an emulated LAPIC timer instances has the following path: 1) hard interrupt 2) ksoftirqd is scheduled 3) ksoftirqd wakes up vcpu thread 4) vcpu thread is scheduled This extra context switch introduces unnecessary latency in the LAPIC path for a KVM guest. The solution:

[patch -rt 2/2] KVM: lapic: mark LAPIC timer handler as irqsafe

2014-11-25 Thread Marcelo Tosatti
Since lapic timer handler only wakes up a simple waitqueue, it can be executed from hardirq context. Reduces average cyclictest latency by 3us. Signed-off-by: Marcelo Tosatti --- arch/x86/kvm/lapic.c | 42 +++--- 1 file changed, 39 insertions(+), 3

[patch -rt 1/2] KVM: use simple waitqueue for vcpu->wq

2014-11-25 Thread Marcelo Tosatti
This allows waking up vcpu thread from hardirq context. Signed-off-by: Marcelo Tosatti --- arch/arm/kvm/arm.c |4 ++-- arch/arm/kvm/psci.c |4 ++-- arch/mips/kvm/kvm_mips.c|8 arch/powerpc/include/asm/kvm_host.h |4

[patch -rt 0/2] use simple waitqueue for kvm vcpu waitqueue

2014-11-25 Thread Marcelo Tosatti
Which allows waking up vcpu from hardirq context. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

[patch -rt 0/2] use simple waitqueue for kvm vcpu waitqueue

2014-11-25 Thread Marcelo Tosatti
Which allows waking up vcpu from hardirq context. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

[patch -rt 2/2] KVM: lapic: mark LAPIC timer handler as irqsafe

2014-11-25 Thread Marcelo Tosatti
Since lapic timer handler only wakes up a simple waitqueue, it can be executed from hardirq context. Reduces average cyclictest latency by 3us. Signed-off-by: Marcelo Tosatti mtosa...@redhat.com --- arch/x86/kvm/lapic.c | 42 +++--- 1 file changed, 39

[patch -rt 1/2] KVM: use simple waitqueue for vcpu-wq

2014-11-25 Thread Marcelo Tosatti
This allows waking up vcpu thread from hardirq context. Signed-off-by: Marcelo Tosatti mtosa...@redhat.com --- arch/arm/kvm/arm.c |4 ++-- arch/arm/kvm/psci.c |4 ++-- arch/mips/kvm/kvm_mips.c|8 arch/powerpc/include/asm

[patch -rt 0/2] use simple waitqueue for kvm vcpu waitqueue (v2)

2014-11-25 Thread Marcelo Tosatti
The problem: On -RT, an emulated LAPIC timer instances has the following path: 1) hard interrupt 2) ksoftirqd is scheduled 3) ksoftirqd wakes up vcpu thread 4) vcpu thread is scheduled This extra context switch introduces unnecessary latency in the LAPIC path for a KVM guest. The solution:

[patch -rt 2/2] KVM: lapic: mark LAPIC timer handler as irqsafe

2014-11-25 Thread Marcelo Tosatti
Since lapic timer handler only wakes up a simple waitqueue, it can be executed from hardirq context. Reduces average cyclictest latency by 3us. Signed-off-by: Marcelo Tosatti mtosa...@redhat.com --- arch/x86/kvm/lapic.c | 42 +++--- 1 file changed, 39

[patch -rt 1/2] KVM: use simple waitqueue for vcpu-wq

2014-11-25 Thread Marcelo Tosatti
context. cyclictest command line: # cyclictest -m -n -q -p99 -l 100 -h60 -D 1m This patch reduces the average latency in my tests from 14us to 11us. Signed-off-by: Marcelo Tosatti mtosa...@redhat.com --- arch/arm/kvm/arm.c |4 ++-- arch/arm/kvm/psci.c

Re: [patch -rt 1/2] KVM: use simple waitqueue for vcpu-wq

2014-11-25 Thread Marcelo Tosatti
On Tue, Nov 25, 2014 at 01:57:37PM -0500, Rik van Riel wrote: On 11/25/2014 12:21 PM, Marcelo Tosatti wrote: The problem: On -RT, an emulated LAPIC timer instances has the following path: 1) hard interrupt 2) ksoftirqd is scheduled 3) ksoftirqd wakes up vcpu thread 4) vcpu

Re: [PATCH] kvm: x86: add trace event for pvclock updates

2014-11-10 Thread Marcelo Tosatti
On Wed, Nov 05, 2014 at 11:46:42AM -0800, David Matlack wrote: > The new trace event records: > * the id of vcpu being updated > * the pvclock_vcpu_time_info struct being written to guest memory > > This is useful for debugging pvclock bugs, such as the bug fixed by > "[PATCH] kvm: x86: Fix

Re: [PATCH] kvm: x86: add trace event for pvclock updates

2014-11-10 Thread Marcelo Tosatti
On Wed, Nov 05, 2014 at 11:46:42AM -0800, David Matlack wrote: The new trace event records: * the id of vcpu being updated * the pvclock_vcpu_time_info struct being written to guest memory This is useful for debugging pvclock bugs, such as the bug fixed by [PATCH] kvm: x86: Fix kvm

Re: [x86, kvm] WARNING: at arch/x86/kernel/pvclock.c:182 pvclock_init_vsyscall()

2014-09-30 Thread Marcelo Tosatti
On Tue, Sep 30, 2014 at 02:05:09PM +0200, Paolo Bonzini wrote: > Il 30/09/2014 09:59, Fengguang Wu ha scritto: > > +--++++ > > | | 71056ae22d

Re: [x86, kvm] WARNING: at arch/x86/kernel/pvclock.c:182 pvclock_init_vsyscall()

2014-09-30 Thread Marcelo Tosatti
On Tue, Sep 30, 2014 at 02:05:09PM +0200, Paolo Bonzini wrote: Il 30/09/2014 09:59, Fengguang Wu ha scritto: +--++++ | | 71056ae22d |

Re: [PATCH] kvm: don't take vcpu mutex for obviously invalid vcpu ioctls

2014-09-22 Thread Marcelo Tosatti
On Mon, Sep 22, 2014 at 03:58:16PM -0700, David Matlack wrote: > > Should not be executing vcpu ioctls without interrupt KVM_RUN in the > > first place. > > This patch is trying to be nice to code that isn't aware it's > probing kvm file descriptors. We saw long hangs with some generic > process

Re: [PATCH] kvm: don't take vcpu mutex for obviously invalid vcpu ioctls

2014-09-22 Thread Marcelo Tosatti
On Mon, Sep 22, 2014 at 11:29:16PM +0200, Paolo Bonzini wrote: > Il 22/09/2014 22:08, Marcelo Tosatti ha scritto: > > > This patch does not change functionality, it just makes invalid ioctls > > > fail faster. > > > > Should not be executing vcpu ioctls without i

Re: [PATCH] kvm: don't take vcpu mutex for obviously invalid vcpu ioctls

2014-09-22 Thread Marcelo Tosatti
On Fri, Sep 19, 2014 at 04:03:25PM -0700, David Matlack wrote: > vcpu ioctls can hang the calling thread if issued while a vcpu is > running. There is a mutex per-vcpu, so thats expected, OK... > If we know ioctl is going to be rejected as invalid anyway, > we can fail before trying to take the

Re: [PATCH] kvm: don't take vcpu mutex for obviously invalid vcpu ioctls

2014-09-22 Thread Marcelo Tosatti
On Fri, Sep 19, 2014 at 04:03:25PM -0700, David Matlack wrote: vcpu ioctls can hang the calling thread if issued while a vcpu is running. There is a mutex per-vcpu, so thats expected, OK... If we know ioctl is going to be rejected as invalid anyway, we can fail before trying to take the

Re: [PATCH] kvm: don't take vcpu mutex for obviously invalid vcpu ioctls

2014-09-22 Thread Marcelo Tosatti
On Mon, Sep 22, 2014 at 11:29:16PM +0200, Paolo Bonzini wrote: Il 22/09/2014 22:08, Marcelo Tosatti ha scritto: This patch does not change functionality, it just makes invalid ioctls fail faster. Should not be executing vcpu ioctls without interrupt KVM_RUN in the first place

Re: [PATCH] kvm: don't take vcpu mutex for obviously invalid vcpu ioctls

2014-09-22 Thread Marcelo Tosatti
On Mon, Sep 22, 2014 at 03:58:16PM -0700, David Matlack wrote: Should not be executing vcpu ioctls without interrupt KVM_RUN in the first place. This patch is trying to be nice to code that isn't aware it's probing kvm file descriptors. We saw long hangs with some generic process

<    3   4   5   6   7   8   9   10   11   12   >