Re: [PATCH v2 1/9] KVM: add kvm_request_pending

2017-04-11 Thread Radim Krčmář
2017-04-08 15:32-0400, Paolo Bonzini: > > > Makes sense. My pitch at the documentation after dropping READ_ONCE(): > > > > I'm confused again, I thought you wanted to keep READ_ONCE(). > > > > > > > > /* > > >* The return value of kvm_request_pending() is implicitly volatile > > > >

Re: [PATCH v2 1/9] KVM: add kvm_request_pending

2017-04-08 Thread Paolo Bonzini
> > Makes sense. My pitch at the documentation after dropping READ_ONCE(): > > I'm confused again, I thought you wanted to keep READ_ONCE(). > > > > > /* > >* The return value of kvm_request_pending() is implicitly volatile > > why is that, actually? > > >* and must be protected

Re: [PATCH v2 1/9] KVM: add kvm_request_pending

2017-04-08 Thread Christoffer Dall
On Fri, Apr 07, 2017 at 03:15:37PM +0200, Radim Krčmář wrote: > 2017-04-06 16:25+0200, Christoffer Dall: > > On Wed, Apr 05, 2017 at 10:20:17PM +0200, Radim Krčmář wrote: > >> 2017-04-05 19:39+0200, Christoffer Dall: > >> > On Wed, Apr 05, 2017 at 03:10:50PM +0200, Radim Krčmář wrote: > >> x86

Re: [PATCH v2 1/9] KVM: add kvm_request_pending

2017-04-08 Thread Christoffer Dall
On Fri, Apr 07, 2017 at 11:33:33PM +0800, Paolo Bonzini wrote: > > > On 06/04/2017 23:08, Andrew Jones wrote: > > My own made-up lingo to state that each time the variable is accessed it > > must be loaded anew, taken care of by the volatile use in READ_ONCE. As > > vcpu->requests can be

Re: [PATCH v2 1/9] KVM: add kvm_request_pending

2017-04-07 Thread Paolo Bonzini
On 06/04/2017 23:08, Andrew Jones wrote: > My own made-up lingo to state that each time the variable is accessed it > must be loaded anew, taken care of by the volatile use in READ_ONCE. As > vcpu->requests can be written by other threads, then I prefer READ_ONCE > being used to read it, as it

Re: [PATCH v2 1/9] KVM: add kvm_request_pending

2017-04-07 Thread Radim Krčmář
2017-04-06 16:25+0200, Christoffer Dall: > On Wed, Apr 05, 2017 at 10:20:17PM +0200, Radim Krčmář wrote: >> 2017-04-05 19:39+0200, Christoffer Dall: >> > On Wed, Apr 05, 2017 at 03:10:50PM +0200, Radim Krčmář wrote: >> x86 uses KVM_REQ_MCLOCK_INPROGRESS for synchronization between cores and >> the

Re: [PATCH v2 1/9] KVM: add kvm_request_pending

2017-04-06 Thread Andrew Jones
On Thu, Apr 06, 2017 at 04:37:51PM +0200, Christoffer Dall wrote: > > FWIW, I first suggested using READ_ONCE() for the freshness argument, > > What is the 'freshness argument' ? My own made-up lingo to state that each time the variable is accessed it must be loaded anew, taken care of by the

Re: [PATCH v2 1/9] KVM: add kvm_request_pending

2017-04-06 Thread Christoffer Dall
Hi Drew, On Thu, Apr 06, 2017 at 02:02:12PM +0200, Andrew Jones wrote: > On Wed, Apr 05, 2017 at 10:20:17PM +0200, Radim Krčmář wrote: > > 2017-04-05 19:39+0200, Christoffer Dall: > > > On Wed, Apr 05, 2017 at 03:10:50PM +0200, Radim Krčmář wrote: > > >> 2017-04-04 18:41+0200, Andrew Jones: > >

Re: [PATCH v2 1/9] KVM: add kvm_request_pending

2017-04-06 Thread Christoffer Dall
On Wed, Apr 05, 2017 at 10:20:17PM +0200, Radim Krčmář wrote: > 2017-04-05 19:39+0200, Christoffer Dall: > > On Wed, Apr 05, 2017 at 03:10:50PM +0200, Radim Krčmář wrote: > >> 2017-04-04 18:41+0200, Andrew Jones: > >> > On Tue, Apr 04, 2017 at 05:30:14PM +0200, Christoffer Dall wrote: > >> >> On

Re: [PATCH v2 1/9] KVM: add kvm_request_pending

2017-04-06 Thread Andrew Jones
On Wed, Apr 05, 2017 at 10:20:17PM +0200, Radim Krčmář wrote: > 2017-04-05 19:39+0200, Christoffer Dall: > > On Wed, Apr 05, 2017 at 03:10:50PM +0200, Radim Krčmář wrote: > >> 2017-04-04 18:41+0200, Andrew Jones: > >> > On Tue, Apr 04, 2017 at 05:30:14PM +0200, Christoffer Dall wrote: > >> >> On

Re: [PATCH v2 1/9] KVM: add kvm_request_pending

2017-04-05 Thread Paolo Bonzini
On 05/04/2017 19:39, Christoffer Dall wrote: >> Uses of vcpu->requests should already have barriers that take care of >> the ordering. I think the main reason for READ_ONCE() is to tell >> programmers that requests are special, but predictable. > > I don't know what to do with "special, but

Re: [PATCH v2 1/9] KVM: add kvm_request_pending

2017-04-05 Thread Christoffer Dall
On Wed, Apr 05, 2017 at 03:10:50PM +0200, Radim Krčmář wrote: > 2017-04-04 18:41+0200, Andrew Jones: > > On Tue, Apr 04, 2017 at 05:30:14PM +0200, Christoffer Dall wrote: > >> On Fri, Mar 31, 2017 at 06:06:50PM +0200, Andrew Jones wrote: > >> > From: Radim Krčmář > >> > > >>

Re: [PATCH v2 1/9] KVM: add kvm_request_pending

2017-04-05 Thread Radim Krčmář
2017-04-04 18:41+0200, Andrew Jones: > On Tue, Apr 04, 2017 at 05:30:14PM +0200, Christoffer Dall wrote: >> On Fri, Mar 31, 2017 at 06:06:50PM +0200, Andrew Jones wrote: >> > From: Radim Krčmář >> > >> > A first step in vcpu->requests encapsulation. >> >> Could we have a

Re: [PATCH v2 1/9] KVM: add kvm_request_pending

2017-04-04 Thread Andrew Jones
On Tue, Apr 04, 2017 at 05:30:14PM +0200, Christoffer Dall wrote: > On Fri, Mar 31, 2017 at 06:06:50PM +0200, Andrew Jones wrote: > > From: Radim Krčmář > > > > A first step in vcpu->requests encapsulation. > > Could we have a note here on why we need to access

Re: [PATCH v2 1/9] KVM: add kvm_request_pending

2017-04-04 Thread Christoffer Dall
On Fri, Mar 31, 2017 at 06:06:50PM +0200, Andrew Jones wrote: > From: Radim Krčmář > > A first step in vcpu->requests encapsulation. Could we have a note here on why we need to access vcpu->requests using READ_ONCE now? Thanks, -Christoffer > > Signed-off-by: Radim Krčmář

[PATCH v2 1/9] KVM: add kvm_request_pending

2017-03-31 Thread Andrew Jones
From: Radim Krčmář A first step in vcpu->requests encapsulation. Signed-off-by: Radim Krčmář Signed-off-by: Andrew Jones --- arch/mips/kvm/trap_emul.c | 2 +- arch/powerpc/kvm/booke.c | 2 +- arch/powerpc/kvm/powerpc.c | 5 ++---