Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall\

2017-10-02 Thread Peter Zijlstra
On Mon, Oct 02, 2017 at 02:30:33PM +0200, Paolo Bonzini wrote: > I don't understand why is it correct to delay interrupt injection just > because VCPU0 is running in a spinlock-protected region? I just cannot > see the reason why it's safe and not a recipe for priority inversions. It is indeed

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall\

2017-10-02 Thread Peter Zijlstra
On Mon, Oct 02, 2017 at 02:30:33PM +0200, Paolo Bonzini wrote: > I don't understand why is it correct to delay interrupt injection just > because VCPU0 is running in a spinlock-protected region? I just cannot > see the reason why it's safe and not a recipe for priority inversions. It is indeed

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall\

2017-10-02 Thread Paolo Bonzini
On 29/09/2017 22:17, Marcelo Tosatti wrote: > On Fri, Sep 29, 2017 at 07:05:41PM +0200, Paolo Bonzini wrote: >> On 29/09/2017 18:40, Marcelo Tosatti wrote: >>> Thats not the state of things (userspace in vcpu-0 is not specially tailored >>> to not violate latencies in vcpu-1): that is not all user

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall\

2017-10-02 Thread Paolo Bonzini
On 29/09/2017 22:17, Marcelo Tosatti wrote: > On Fri, Sep 29, 2017 at 07:05:41PM +0200, Paolo Bonzini wrote: >> On 29/09/2017 18:40, Marcelo Tosatti wrote: >>> Thats not the state of things (userspace in vcpu-0 is not specially tailored >>> to not violate latencies in vcpu-1): that is not all user

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall\

2017-09-29 Thread Marcelo Tosatti
On Fri, Sep 29, 2017 at 07:05:41PM +0200, Paolo Bonzini wrote: > On 29/09/2017 18:40, Marcelo Tosatti wrote: > >> If you know you have this kind disk workload, you must use virtio-blk or > >> virtio-scsi with iothreads and place the iothreads on their own physical > >> CPUs. > >> > >> Among "run

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall\

2017-09-29 Thread Marcelo Tosatti
On Fri, Sep 29, 2017 at 07:05:41PM +0200, Paolo Bonzini wrote: > On 29/09/2017 18:40, Marcelo Tosatti wrote: > >> If you know you have this kind disk workload, you must use virtio-blk or > >> virtio-scsi with iothreads and place the iothreads on their own physical > >> CPUs. > >> > >> Among "run

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall\

2017-09-29 Thread Paolo Bonzini
On 29/09/2017 18:40, Marcelo Tosatti wrote: >> If you know you have this kind disk workload, you must use virtio-blk or >> virtio-scsi with iothreads and place the iothreads on their own physical >> CPUs. >> >> Among "run arbitrary workloads", "run real-time workloads", "pack stuff >> into as few

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall\

2017-09-29 Thread Paolo Bonzini
On 29/09/2017 18:40, Marcelo Tosatti wrote: >> If you know you have this kind disk workload, you must use virtio-blk or >> virtio-scsi with iothreads and place the iothreads on their own physical >> CPUs. >> >> Among "run arbitrary workloads", "run real-time workloads", "pack stuff >> into as few

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall\

2017-09-29 Thread Marcelo Tosatti
On Fri, Sep 29, 2017 at 10:18:25AM +0200, Paolo Bonzini wrote: > On 28/09/2017 23:35, Marcelo Tosatti wrote: > > On Thu, Sep 28, 2017 at 09:22:02AM +0200, Paolo Bonzini wrote: > >> On 28/09/2017 02:44, Marcelo Tosatti wrote: > Again: if you have many interruptions, it's not a flaw in KVM or

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall\

2017-09-29 Thread Marcelo Tosatti
On Fri, Sep 29, 2017 at 10:18:25AM +0200, Paolo Bonzini wrote: > On 28/09/2017 23:35, Marcelo Tosatti wrote: > > On Thu, Sep 28, 2017 at 09:22:02AM +0200, Paolo Bonzini wrote: > >> On 28/09/2017 02:44, Marcelo Tosatti wrote: > Again: if you have many interruptions, it's not a flaw in KVM or

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall\

2017-09-29 Thread Paolo Bonzini
On 28/09/2017 23:35, Marcelo Tosatti wrote: > On Thu, Sep 28, 2017 at 09:22:02AM +0200, Paolo Bonzini wrote: >> On 28/09/2017 02:44, Marcelo Tosatti wrote: Again: if you have many interruptions, it's not a flaw in KVM or QEMU's design, it's just that someone is doing something stupid.

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall\

2017-09-29 Thread Paolo Bonzini
On 28/09/2017 23:35, Marcelo Tosatti wrote: > On Thu, Sep 28, 2017 at 09:22:02AM +0200, Paolo Bonzini wrote: >> On 28/09/2017 02:44, Marcelo Tosatti wrote: Again: if you have many interruptions, it's not a flaw in KVM or QEMU's design, it's just that someone is doing something stupid.

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall\

2017-09-28 Thread Marcelo Tosatti
On Thu, Sep 28, 2017 at 06:35:08PM -0300, Marcelo Tosatti wrote: > On Thu, Sep 28, 2017 at 09:22:02AM +0200, Paolo Bonzini wrote: > > On 28/09/2017 02:44, Marcelo Tosatti wrote: > > >> Again: if you have many interruptions, it's not a flaw in KVM or QEMU's > > >> design, it's just that someone is

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall\

2017-09-28 Thread Marcelo Tosatti
On Thu, Sep 28, 2017 at 06:35:08PM -0300, Marcelo Tosatti wrote: > On Thu, Sep 28, 2017 at 09:22:02AM +0200, Paolo Bonzini wrote: > > On 28/09/2017 02:44, Marcelo Tosatti wrote: > > >> Again: if you have many interruptions, it's not a flaw in KVM or QEMU's > > >> design, it's just that someone is

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall\

2017-09-28 Thread Marcelo Tosatti
On Thu, Sep 28, 2017 at 09:22:02AM +0200, Paolo Bonzini wrote: > On 28/09/2017 02:44, Marcelo Tosatti wrote: > >> Again: if you have many interruptions, it's not a flaw in KVM or QEMU's > >> design, it's just that someone is doing something stupid. It could be > >> the guest (e.g. unnecessary

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall\

2017-09-28 Thread Marcelo Tosatti
On Thu, Sep 28, 2017 at 09:22:02AM +0200, Paolo Bonzini wrote: > On 28/09/2017 02:44, Marcelo Tosatti wrote: > >> Again: if you have many interruptions, it's not a flaw in KVM or QEMU's > >> design, it's just that someone is doing something stupid. It could be > >> the guest (e.g. unnecessary

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall\

2017-09-28 Thread Paolo Bonzini
On 28/09/2017 02:44, Marcelo Tosatti wrote: >> Again: if you have many interruptions, it's not a flaw in KVM or QEMU's >> design, it's just that someone is doing something stupid. It could be >> the guest (e.g. unnecessary devices or daemons as in the example above), >> QEMU (e.g. the RTC

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall\

2017-09-28 Thread Paolo Bonzini
On 28/09/2017 02:44, Marcelo Tosatti wrote: >> Again: if you have many interruptions, it's not a flaw in KVM or QEMU's >> design, it's just that someone is doing something stupid. It could be >> the guest (e.g. unnecessary devices or daemons as in the example above), >> QEMU (e.g. the RTC

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall\

2017-09-27 Thread Marcelo Tosatti
On Wed, Sep 27, 2017 at 11:37:48AM +0200, Paolo Bonzini wrote: > On 27/09/2017 00:49, Marcelo Tosatti wrote: > > On Mon, Sep 25, 2017 at 05:12:42PM +0200, Paolo Bonzini wrote: > >> On 25/09/2017 11:13, Peter Zijlstra wrote: > >>> On Sun, Sep 24, 2017 at 11:57:53PM -0300, Marcelo Tosatti wrote: >

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall\

2017-09-27 Thread Marcelo Tosatti
On Wed, Sep 27, 2017 at 11:37:48AM +0200, Paolo Bonzini wrote: > On 27/09/2017 00:49, Marcelo Tosatti wrote: > > On Mon, Sep 25, 2017 at 05:12:42PM +0200, Paolo Bonzini wrote: > >> On 25/09/2017 11:13, Peter Zijlstra wrote: > >>> On Sun, Sep 24, 2017 at 11:57:53PM -0300, Marcelo Tosatti wrote: >

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall\

2017-09-27 Thread Paolo Bonzini
On 27/09/2017 00:49, Marcelo Tosatti wrote: > On Mon, Sep 25, 2017 at 05:12:42PM +0200, Paolo Bonzini wrote: >> On 25/09/2017 11:13, Peter Zijlstra wrote: >>> On Sun, Sep 24, 2017 at 11:57:53PM -0300, Marcelo Tosatti wrote: I think you are missing the following point: "vcpu0 can be

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall\

2017-09-27 Thread Paolo Bonzini
On 27/09/2017 00:49, Marcelo Tosatti wrote: > On Mon, Sep 25, 2017 at 05:12:42PM +0200, Paolo Bonzini wrote: >> On 25/09/2017 11:13, Peter Zijlstra wrote: >>> On Sun, Sep 24, 2017 at 11:57:53PM -0300, Marcelo Tosatti wrote: I think you are missing the following point: "vcpu0 can be

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall\

2017-09-26 Thread Marcelo Tosatti
On Mon, Sep 25, 2017 at 05:12:42PM +0200, Paolo Bonzini wrote: > On 25/09/2017 11:13, Peter Zijlstra wrote: > > On Sun, Sep 24, 2017 at 11:57:53PM -0300, Marcelo Tosatti wrote: > >> I think you are missing the following point: > >> > >> "vcpu0 can be interrupted when its not in a spinlock

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall

2017-09-26 Thread Marcelo Tosatti
On Mon, Sep 25, 2017 at 11:13:16AM +0200, Peter Zijlstra wrote: > On Sun, Sep 24, 2017 at 11:57:53PM -0300, Marcelo Tosatti wrote: > > I think you are missing the following point: > > > > "vcpu0 can be interrupted when its not in a spinlock protected section, > > otherwise it can't." > > > > So

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall\

2017-09-26 Thread Marcelo Tosatti
On Mon, Sep 25, 2017 at 05:12:42PM +0200, Paolo Bonzini wrote: > On 25/09/2017 11:13, Peter Zijlstra wrote: > > On Sun, Sep 24, 2017 at 11:57:53PM -0300, Marcelo Tosatti wrote: > >> I think you are missing the following point: > >> > >> "vcpu0 can be interrupted when its not in a spinlock

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall

2017-09-26 Thread Marcelo Tosatti
On Mon, Sep 25, 2017 at 11:13:16AM +0200, Peter Zijlstra wrote: > On Sun, Sep 24, 2017 at 11:57:53PM -0300, Marcelo Tosatti wrote: > > I think you are missing the following point: > > > > "vcpu0 can be interrupted when its not in a spinlock protected section, > > otherwise it can't." > > > > So

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall\

2017-09-25 Thread Jan Kiszka
On 2017-09-25 12:41, Thomas Gleixner wrote: > On Sun, 24 Sep 2017, Marcelo Tosatti wrote: >> On Fri, Sep 22, 2017 at 03:01:41PM +0200, Peter Zijlstra wrote: >> What the patch does is the following: >> It reduces the window where SCHED_FIFO is applied vcpu0 >> to those were a spinlock is shared

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall\

2017-09-25 Thread Jan Kiszka
On 2017-09-25 12:41, Thomas Gleixner wrote: > On Sun, 24 Sep 2017, Marcelo Tosatti wrote: >> On Fri, Sep 22, 2017 at 03:01:41PM +0200, Peter Zijlstra wrote: >> What the patch does is the following: >> It reduces the window where SCHED_FIFO is applied vcpu0 >> to those were a spinlock is shared

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall

2017-09-25 Thread Konrad Rzeszutek Wilk
> I think you are missing the following point: > > "vcpu0 can be interrupted when its not in a spinlock protected section, > otherwise it can't." > > So you _have_ to communicate to the host when the guest enters/leaves a > critical section. How would this work for Windows or FreeBSD?

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall

2017-09-25 Thread Konrad Rzeszutek Wilk
> I think you are missing the following point: > > "vcpu0 can be interrupted when its not in a spinlock protected section, > otherwise it can't." > > So you _have_ to communicate to the host when the guest enters/leaves a > critical section. How would this work for Windows or FreeBSD?

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall

2017-09-25 Thread Paolo Bonzini
On 25/09/2017 11:13, Peter Zijlstra wrote: > On Sun, Sep 24, 2017 at 11:57:53PM -0300, Marcelo Tosatti wrote: >> I think you are missing the following point: >> >> "vcpu0 can be interrupted when its not in a spinlock protected section, >> otherwise it can't." Who says that? Certainly a driver

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall

2017-09-25 Thread Paolo Bonzini
On 25/09/2017 11:13, Peter Zijlstra wrote: > On Sun, Sep 24, 2017 at 11:57:53PM -0300, Marcelo Tosatti wrote: >> I think you are missing the following point: >> >> "vcpu0 can be interrupted when its not in a spinlock protected section, >> otherwise it can't." Who says that? Certainly a driver

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall\

2017-09-25 Thread Thomas Gleixner
On Sun, 24 Sep 2017, Marcelo Tosatti wrote: > On Fri, Sep 22, 2017 at 03:01:41PM +0200, Peter Zijlstra wrote: > What the patch does is the following: > It reduces the window where SCHED_FIFO is applied vcpu0 > to those were a spinlock is shared between -RT vcpus and vcpu0 > (why: because

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall\

2017-09-25 Thread Thomas Gleixner
On Sun, 24 Sep 2017, Marcelo Tosatti wrote: > On Fri, Sep 22, 2017 at 03:01:41PM +0200, Peter Zijlstra wrote: > What the patch does is the following: > It reduces the window where SCHED_FIFO is applied vcpu0 > to those were a spinlock is shared between -RT vcpus and vcpu0 > (why: because

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall

2017-09-25 Thread Peter Zijlstra
On Sun, Sep 24, 2017 at 11:57:53PM -0300, Marcelo Tosatti wrote: > I think you are missing the following point: > > "vcpu0 can be interrupted when its not in a spinlock protected section, > otherwise it can't." > > So you _have_ to communicate to the host when the guest enters/leaves a >

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall

2017-09-25 Thread Peter Zijlstra
On Sun, Sep 24, 2017 at 11:57:53PM -0300, Marcelo Tosatti wrote: > I think you are missing the following point: > > "vcpu0 can be interrupted when its not in a spinlock protected section, > otherwise it can't." > > So you _have_ to communicate to the host when the guest enters/leaves a >

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall\

2017-09-25 Thread Peter Zijlstra
On Sun, Sep 24, 2017 at 11:22:38PM -0300, Marcelo Tosatti wrote: > On Fri, Sep 22, 2017 at 03:01:41PM +0200, Peter Zijlstra wrote: > > On Fri, Sep 22, 2017 at 09:40:05AM -0300, Marcelo Tosatti wrote: > > > > > Are you arguing its invalid for the following application to execute on > > >

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall\

2017-09-25 Thread Peter Zijlstra
On Sun, Sep 24, 2017 at 11:22:38PM -0300, Marcelo Tosatti wrote: > On Fri, Sep 22, 2017 at 03:01:41PM +0200, Peter Zijlstra wrote: > > On Fri, Sep 22, 2017 at 09:40:05AM -0300, Marcelo Tosatti wrote: > > > > > Are you arguing its invalid for the following application to execute on > > >

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall

2017-09-25 Thread Peter Zijlstra
On Sun, Sep 24, 2017 at 10:52:58PM -0300, Marcelo Tosatti wrote: > On Fri, Sep 22, 2017 at 02:59:51PM +0200, Peter Zijlstra wrote: > > Your patch is voodoo programming. You don't solve the actual problem, > > you try and paper over it. > > Priority boosting on a particular section of code is

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall

2017-09-25 Thread Peter Zijlstra
On Sun, Sep 24, 2017 at 10:52:58PM -0300, Marcelo Tosatti wrote: > On Fri, Sep 22, 2017 at 02:59:51PM +0200, Peter Zijlstra wrote: > > Your patch is voodoo programming. You don't solve the actual problem, > > you try and paper over it. > > Priority boosting on a particular section of code is

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall

2017-09-24 Thread Marcelo Tosatti
osa...@redhat.com>, "Konrad Rzeszutek Wilk" > > <konrad.w...@oracle.com>, mi...@redhat.com, > > k...@vger.kernel.org, linux-kernel@vger.kernel.org, "Thomas Gleixner" > > <t...@linutronix.de> > > Sent: Saturday, September 23, 2017 3:41:14 P

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall

2017-09-24 Thread Marcelo Tosatti
dhat.com, > > k...@vger.kernel.org, linux-kernel@vger.kernel.org, "Thomas Gleixner" > > > > Sent: Saturday, September 23, 2017 3:41:14 PM > > Subject: Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO > > hypercall > > > > On Sat, Sep 2

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall

2017-09-24 Thread Marcelo Tosatti
On Fri, Sep 22, 2017 at 02:59:51PM +0200, Peter Zijlstra wrote: > On Fri, Sep 22, 2017 at 09:36:39AM -0300, Marcelo Tosatti wrote: > > On Fri, Sep 22, 2017 at 02:31:07PM +0200, Peter Zijlstra wrote: > > > On Fri, Sep 22, 2017 at 09:16:40AM -0300, Marcelo Tosatti wrote: > > > > On Fri, Sep 22, 2017

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall\

2017-09-24 Thread Marcelo Tosatti
On Fri, Sep 22, 2017 at 03:01:41PM +0200, Peter Zijlstra wrote: > On Fri, Sep 22, 2017 at 09:40:05AM -0300, Marcelo Tosatti wrote: > > > Are you arguing its invalid for the following application to execute on > > housekeeping vcpu of a realtime system: > > > > void main(void) > > { > > > >

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall

2017-09-24 Thread Marcelo Tosatti
On Fri, Sep 22, 2017 at 02:59:51PM +0200, Peter Zijlstra wrote: > On Fri, Sep 22, 2017 at 09:36:39AM -0300, Marcelo Tosatti wrote: > > On Fri, Sep 22, 2017 at 02:31:07PM +0200, Peter Zijlstra wrote: > > > On Fri, Sep 22, 2017 at 09:16:40AM -0300, Marcelo Tosatti wrote: > > > > On Fri, Sep 22, 2017

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall\

2017-09-24 Thread Marcelo Tosatti
On Fri, Sep 22, 2017 at 03:01:41PM +0200, Peter Zijlstra wrote: > On Fri, Sep 22, 2017 at 09:40:05AM -0300, Marcelo Tosatti wrote: > > > Are you arguing its invalid for the following application to execute on > > housekeeping vcpu of a realtime system: > > > > void main(void) > > { > > > >

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall

2017-09-24 Thread Paolo Bonzini
>, mi...@redhat.com, > k...@vger.kernel.org, linux-kernel@vger.kernel.org, "Thomas Gleixner" > <t...@linutronix.de> > Sent: Saturday, September 23, 2017 3:41:14 PM > Subject: Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO > hypercall > > On Sat

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall

2017-09-24 Thread Paolo Bonzini
gt; Sent: Saturday, September 23, 2017 3:41:14 PM > Subject: Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO > hypercall > > On Sat, Sep 23, 2017 at 12:56:12PM +0200, Paolo Bonzini wrote: > > On 22/09/2017 14:55, Peter Zijlstra wrote: > > > You just

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall

2017-09-23 Thread Peter Zijlstra
On Sat, Sep 23, 2017 at 12:56:12PM +0200, Paolo Bonzini wrote: > On 22/09/2017 14:55, Peter Zijlstra wrote: > > You just explained it yourself. If the thread that needs to complete > > what you're waiting on has lower priority, it will _never_ get to run if > > you're busy waiting on it. > > > >

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall

2017-09-23 Thread Peter Zijlstra
On Sat, Sep 23, 2017 at 12:56:12PM +0200, Paolo Bonzini wrote: > On 22/09/2017 14:55, Peter Zijlstra wrote: > > You just explained it yourself. If the thread that needs to complete > > what you're waiting on has lower priority, it will _never_ get to run if > > you're busy waiting on it. > > > >

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall

2017-09-23 Thread Paolo Bonzini
On 22/09/2017 14:55, Peter Zijlstra wrote: > You just explained it yourself. If the thread that needs to complete > what you're waiting on has lower priority, it will _never_ get to run if > you're busy waiting on it. > > This is _trivial_. > > And even for !RT it can be quite costly, because

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall

2017-09-23 Thread Paolo Bonzini
On 22/09/2017 14:55, Peter Zijlstra wrote: > You just explained it yourself. If the thread that needs to complete > what you're waiting on has lower priority, it will _never_ get to run if > you're busy waiting on it. > > This is _trivial_. > > And even for !RT it can be quite costly, because

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall\

2017-09-22 Thread Peter Zijlstra
On Fri, Sep 22, 2017 at 09:40:05AM -0300, Marcelo Tosatti wrote: > Are you arguing its invalid for the following application to execute on > housekeeping vcpu of a realtime system: > > void main(void) > { > > submit_IO(); > do { >computation(); > } while (!interrupted()); >

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall\

2017-09-22 Thread Peter Zijlstra
On Fri, Sep 22, 2017 at 09:40:05AM -0300, Marcelo Tosatti wrote: > Are you arguing its invalid for the following application to execute on > housekeeping vcpu of a realtime system: > > void main(void) > { > > submit_IO(); > do { >computation(); > } while (!interrupted()); >

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall

2017-09-22 Thread Peter Zijlstra
On Fri, Sep 22, 2017 at 09:36:39AM -0300, Marcelo Tosatti wrote: > On Fri, Sep 22, 2017 at 02:31:07PM +0200, Peter Zijlstra wrote: > > On Fri, Sep 22, 2017 at 09:16:40AM -0300, Marcelo Tosatti wrote: > > > On Fri, Sep 22, 2017 at 12:00:05PM +0200, Peter Zijlstra wrote: > > > > On Thu, Sep 21, 2017

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall

2017-09-22 Thread Peter Zijlstra
On Fri, Sep 22, 2017 at 09:36:39AM -0300, Marcelo Tosatti wrote: > On Fri, Sep 22, 2017 at 02:31:07PM +0200, Peter Zijlstra wrote: > > On Fri, Sep 22, 2017 at 09:16:40AM -0300, Marcelo Tosatti wrote: > > > On Fri, Sep 22, 2017 at 12:00:05PM +0200, Peter Zijlstra wrote: > > > > On Thu, Sep 21, 2017

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall

2017-09-22 Thread Peter Zijlstra
On Fri, Sep 22, 2017 at 09:33:05AM -0300, Marcelo Tosatti wrote: > > That is, running a RT guest and not having _all_ VCPUs being RT tasks on > > the host is absolutely and completely insane and broken. > > Can you explain why, please? You just explained it yourself. If the thread that needs to

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall

2017-09-22 Thread Peter Zijlstra
On Fri, Sep 22, 2017 at 09:33:05AM -0300, Marcelo Tosatti wrote: > > That is, running a RT guest and not having _all_ VCPUs being RT tasks on > > the host is absolutely and completely insane and broken. > > Can you explain why, please? You just explained it yourself. If the thread that needs to

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall\

2017-09-22 Thread Marcelo Tosatti
On Fri, Sep 22, 2017 at 02:31:07PM +0200, Peter Zijlstra wrote: > On Fri, Sep 22, 2017 at 09:16:40AM -0300, Marcelo Tosatti wrote: > > On Fri, Sep 22, 2017 at 12:00:05PM +0200, Peter Zijlstra wrote: > > > On Thu, Sep 21, 2017 at 10:10:41PM -0300, Marcelo Tosatti wrote: > > > > When executing guest

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall\

2017-09-22 Thread Marcelo Tosatti
On Fri, Sep 22, 2017 at 02:31:07PM +0200, Peter Zijlstra wrote: > On Fri, Sep 22, 2017 at 09:16:40AM -0300, Marcelo Tosatti wrote: > > On Fri, Sep 22, 2017 at 12:00:05PM +0200, Peter Zijlstra wrote: > > > On Thu, Sep 21, 2017 at 10:10:41PM -0300, Marcelo Tosatti wrote: > > > > When executing guest

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall

2017-09-22 Thread Marcelo Tosatti
On Fri, Sep 22, 2017 at 12:56:09PM +0200, Peter Zijlstra wrote: > On Fri, Sep 22, 2017 at 12:00:04PM +0200, Peter Zijlstra wrote: > > On Thu, Sep 21, 2017 at 10:10:41PM -0300, Marcelo Tosatti wrote: > > > When executing guest vcpu-0 with FIFO:1 priority, which is necessary > > > to > > > deal with

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall

2017-09-22 Thread Marcelo Tosatti
On Fri, Sep 22, 2017 at 02:31:07PM +0200, Peter Zijlstra wrote: > On Fri, Sep 22, 2017 at 09:16:40AM -0300, Marcelo Tosatti wrote: > > On Fri, Sep 22, 2017 at 12:00:05PM +0200, Peter Zijlstra wrote: > > > On Thu, Sep 21, 2017 at 10:10:41PM -0300, Marcelo Tosatti wrote: > > > > When executing guest

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall

2017-09-22 Thread Marcelo Tosatti
On Fri, Sep 22, 2017 at 12:56:09PM +0200, Peter Zijlstra wrote: > On Fri, Sep 22, 2017 at 12:00:04PM +0200, Peter Zijlstra wrote: > > On Thu, Sep 21, 2017 at 10:10:41PM -0300, Marcelo Tosatti wrote: > > > When executing guest vcpu-0 with FIFO:1 priority, which is necessary > > > to > > > deal with

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall

2017-09-22 Thread Marcelo Tosatti
On Fri, Sep 22, 2017 at 02:31:07PM +0200, Peter Zijlstra wrote: > On Fri, Sep 22, 2017 at 09:16:40AM -0300, Marcelo Tosatti wrote: > > On Fri, Sep 22, 2017 at 12:00:05PM +0200, Peter Zijlstra wrote: > > > On Thu, Sep 21, 2017 at 10:10:41PM -0300, Marcelo Tosatti wrote: > > > > When executing guest

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall

2017-09-22 Thread Peter Zijlstra
On Fri, Sep 22, 2017 at 09:16:40AM -0300, Marcelo Tosatti wrote: > On Fri, Sep 22, 2017 at 12:00:05PM +0200, Peter Zijlstra wrote: > > On Thu, Sep 21, 2017 at 10:10:41PM -0300, Marcelo Tosatti wrote: > > > When executing guest vcpu-0 with FIFO:1 priority, which is necessary > > > to > > > deal

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall

2017-09-22 Thread Peter Zijlstra
On Fri, Sep 22, 2017 at 09:16:40AM -0300, Marcelo Tosatti wrote: > On Fri, Sep 22, 2017 at 12:00:05PM +0200, Peter Zijlstra wrote: > > On Thu, Sep 21, 2017 at 10:10:41PM -0300, Marcelo Tosatti wrote: > > > When executing guest vcpu-0 with FIFO:1 priority, which is necessary > > > to > > > deal

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall

2017-09-22 Thread Marcelo Tosatti
On Fri, Sep 22, 2017 at 12:00:05PM +0200, Peter Zijlstra wrote: > On Thu, Sep 21, 2017 at 10:10:41PM -0300, Marcelo Tosatti wrote: > > When executing guest vcpu-0 with FIFO:1 priority, which is necessary > > to > > deal with the following situation: > > > > VCPU-0 (housekeeping VCPU)

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall

2017-09-22 Thread Marcelo Tosatti
On Fri, Sep 22, 2017 at 12:00:05PM +0200, Peter Zijlstra wrote: > On Thu, Sep 21, 2017 at 10:10:41PM -0300, Marcelo Tosatti wrote: > > When executing guest vcpu-0 with FIFO:1 priority, which is necessary > > to > > deal with the following situation: > > > > VCPU-0 (housekeeping VCPU)

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall

2017-09-22 Thread Peter Zijlstra
On Fri, Sep 22, 2017 at 12:00:04PM +0200, Peter Zijlstra wrote: > On Thu, Sep 21, 2017 at 10:10:41PM -0300, Marcelo Tosatti wrote: > > When executing guest vcpu-0 with FIFO:1 priority, which is necessary > > to > > deal with the following situation: > > > > VCPU-0 (housekeeping VCPU)

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall

2017-09-22 Thread Peter Zijlstra
On Fri, Sep 22, 2017 at 12:00:04PM +0200, Peter Zijlstra wrote: > On Thu, Sep 21, 2017 at 10:10:41PM -0300, Marcelo Tosatti wrote: > > When executing guest vcpu-0 with FIFO:1 priority, which is necessary > > to > > deal with the following situation: > > > > VCPU-0 (housekeeping VCPU)

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall

2017-09-22 Thread Peter Zijlstra
On Thu, Sep 21, 2017 at 10:10:41PM -0300, Marcelo Tosatti wrote: > When executing guest vcpu-0 with FIFO:1 priority, which is necessary > to > deal with the following situation: > > VCPU-0 (housekeeping VCPU) VCPU-1 (realtime VCPU) > > raw_spin_lock(A) > interrupted, schedule task

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall

2017-09-22 Thread Peter Zijlstra
On Thu, Sep 21, 2017 at 10:10:41PM -0300, Marcelo Tosatti wrote: > When executing guest vcpu-0 with FIFO:1 priority, which is necessary > to > deal with the following situation: > > VCPU-0 (housekeeping VCPU) VCPU-1 (realtime VCPU) > > raw_spin_lock(A) > interrupted, schedule task

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall

2017-09-21 Thread Marcelo Tosatti
On Thu, Sep 21, 2017 at 04:06:28PM +0200, Peter Zijlstra wrote: > On Thu, Sep 21, 2017 at 09:36:53AM -0400, Konrad Rzeszutek Wilk wrote: > > On Thu, Sep 21, 2017 at 08:38:38AM -0300, Marcelo Tosatti wrote: > > > Add hypercalls to spinlock/unlock to set/unset FIFO priority > > > for the vcpu,

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall

2017-09-21 Thread Marcelo Tosatti
On Thu, Sep 21, 2017 at 04:06:28PM +0200, Peter Zijlstra wrote: > On Thu, Sep 21, 2017 at 09:36:53AM -0400, Konrad Rzeszutek Wilk wrote: > > On Thu, Sep 21, 2017 at 08:38:38AM -0300, Marcelo Tosatti wrote: > > > Add hypercalls to spinlock/unlock to set/unset FIFO priority > > > for the vcpu,

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall

2017-09-21 Thread Peter Zijlstra
On Thu, Sep 21, 2017 at 09:36:53AM -0400, Konrad Rzeszutek Wilk wrote: > On Thu, Sep 21, 2017 at 08:38:38AM -0300, Marcelo Tosatti wrote: > > Add hypercalls to spinlock/unlock to set/unset FIFO priority > > for the vcpu, protected by a static branch to avoid performance > > increase in the normal

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall

2017-09-21 Thread Peter Zijlstra
On Thu, Sep 21, 2017 at 09:36:53AM -0400, Konrad Rzeszutek Wilk wrote: > On Thu, Sep 21, 2017 at 08:38:38AM -0300, Marcelo Tosatti wrote: > > Add hypercalls to spinlock/unlock to set/unset FIFO priority > > for the vcpu, protected by a static branch to avoid performance > > increase in the normal

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall

2017-09-21 Thread Konrad Rzeszutek Wilk
On Thu, Sep 21, 2017 at 08:38:38AM -0300, Marcelo Tosatti wrote: > Add hypercalls to spinlock/unlock to set/unset FIFO priority > for the vcpu, protected by a static branch to avoid performance > increase in the normal kernels. > > Enable option by "kvmfifohc" kernel command line parameter

Re: [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall

2017-09-21 Thread Konrad Rzeszutek Wilk
On Thu, Sep 21, 2017 at 08:38:38AM -0300, Marcelo Tosatti wrote: > Add hypercalls to spinlock/unlock to set/unset FIFO priority > for the vcpu, protected by a static branch to avoid performance > increase in the normal kernels. > > Enable option by "kvmfifohc" kernel command line parameter