Re: [PATCH v2 0/4] implement vcpu preempted check

2016-07-12 Thread Waiman Long
On 07/12/2016 12:16 AM, Juergen Gross wrote: On 11/07/16 17:10, Waiman Long wrote: On 07/06/2016 02:52 AM, Peter Zijlstra wrote: On Tue, Jun 28, 2016 at 10:43:07AM -0400, Pan Xinhui wrote: change fomr v1: a simplier definition of default vcpu_is_preempted skip mahcine type check on

Re: [PATCH v2 0/4] implement vcpu preempted check

2016-07-11 Thread Juergen Gross
On 11/07/16 17:10, Waiman Long wrote: > On 07/06/2016 02:52 AM, Peter Zijlstra wrote: >> On Tue, Jun 28, 2016 at 10:43:07AM -0400, Pan Xinhui wrote: >>> change fomr v1: >>> a simplier definition of default vcpu_is_preempted >>> skip mahcine type check on ppc, and add config. remove

Re: [PATCH v2 0/4] implement vcpu preempted check

2016-07-11 Thread Waiman Long
On 07/06/2016 02:52 AM, Peter Zijlstra wrote: On Tue, Jun 28, 2016 at 10:43:07AM -0400, Pan Xinhui wrote: change fomr v1: a simplier definition of default vcpu_is_preempted skip mahcine type check on ppc, and add config. remove dedicated macro. add one patch to drop

Re: [PATCH v2 0/4] implement vcpu preempted check

2016-07-07 Thread Peter Zijlstra
On Thu, Jul 07, 2016 at 11:42:15AM +0200, Peter Zijlstra wrote: > +static void update_steal_time_preempt(struct kvm_vcpu *vcpu) > +{ > + struct kvm_steal_time *st; > + > + if (!(vcpu->arch.st.msr_val & KVM_MSR_ENABLED)) > + return; > + > + if

Re: [PATCH v2 0/4] implement vcpu preempted check

2016-07-07 Thread Peter Zijlstra
On Thu, Jul 07, 2016 at 06:27:26PM +0800, Wanpeng Li wrote: > In addition, I see xen's vcpu_runstate_info::state is updated during > schedule, so I think I can do this similarly through kvm preemption > notifier. IIUC, xen hypervisor has VCPUOP_get_runstate_info hypercall > implemention, so the

Re: [PATCH v2 0/4] implement vcpu preempted check

2016-07-07 Thread Peter Zijlstra
On Thu, Jul 07, 2016 at 11:42:15AM +0200, Peter Zijlstra wrote: > I suspect you want something like so; except this has holes in. > > We clear KVM_ST_PAD_PREEMPT before disabling preemption and we set it > after enabling it, this means that if we get preempted in between, the > vcpu is reported

Re: [PATCH v2 0/4] implement vcpu preempted check

2016-07-07 Thread Peter Zijlstra
On Thu, Jul 07, 2016 at 06:12:51PM +0800, Wanpeng Li wrote: > Btw, do this in preemption > notifier means that the vCPU is real preempted on host, however, > depends on vmexit is different semantic I think. Not sure; suppose the vcpu is about to reenter, eg, we're in vcpu_enter_guest() but

Re: [PATCH v2 0/4] implement vcpu preempted check

2016-07-07 Thread Wanpeng Li
2016-07-07 18:12 GMT+08:00 Wanpeng Li : > 2016-07-07 17:42 GMT+08:00 Peter Zijlstra : >> On Thu, Jul 07, 2016 at 04:48:05PM +0800, Wanpeng Li wrote: >>> 2016-07-06 20:28 GMT+08:00 Paolo Bonzini : >>> > Hmm, you're right. We can use

Re: [PATCH v2 0/4] implement vcpu preempted check

2016-07-07 Thread Wanpeng Li
2016-07-07 17:42 GMT+08:00 Peter Zijlstra : > On Thu, Jul 07, 2016 at 04:48:05PM +0800, Wanpeng Li wrote: >> 2016-07-06 20:28 GMT+08:00 Paolo Bonzini : >> > Hmm, you're right. We can use bit 0 of struct kvm_steal_time's flags to >> > indicate that pad[0]

Re: [PATCH v2 0/4] implement vcpu preempted check

2016-07-07 Thread Peter Zijlstra
On Thu, Jul 07, 2016 at 04:48:05PM +0800, Wanpeng Li wrote: > 2016-07-06 20:28 GMT+08:00 Paolo Bonzini : > > Hmm, you're right. We can use bit 0 of struct kvm_steal_time's flags to > > indicate that pad[0] is a "VCPU preempted" field; if pad[0] is 1, the > > VCPU has been

Re: [PATCH v2 0/4] implement vcpu preempted check

2016-07-07 Thread Wanpeng Li
2016-07-06 20:28 GMT+08:00 Paolo Bonzini : > > > On 06/07/2016 14:08, Wanpeng Li wrote: >> 2016-07-06 18:44 GMT+08:00 Paolo Bonzini : >>> >>> >>> On 06/07/2016 08:52, Peter Zijlstra wrote: On Tue, Jun 28, 2016 at 10:43:07AM -0400, Pan Xinhui wrote:

Re: [PATCH v2 0/4] implement vcpu preempted check

2016-07-06 Thread Christian Borntraeger
On 07/06/2016 10:19 AM, Peter Zijlstra wrote: > On Wed, Jul 06, 2016 at 09:47:18AM +0200, Juergen Gross wrote: >> On 06/07/16 08:52, Peter Zijlstra wrote: > >>> Paolo, could you help out with an (x86) KVM interface for this? >> >> Xen support of this interface should be rather easy. Could you

Re: [PATCH v2 0/4] implement vcpu preempted check

2016-07-06 Thread Wanpeng Li
2016-07-06 20:28 GMT+08:00 Paolo Bonzini : > > > On 06/07/2016 14:08, Wanpeng Li wrote: >> 2016-07-06 18:44 GMT+08:00 Paolo Bonzini : >>> >>> >>> On 06/07/2016 08:52, Peter Zijlstra wrote: On Tue, Jun 28, 2016 at 10:43:07AM -0400, Pan Xinhui wrote:

Re: [PATCH v2 0/4] implement vcpu preempted check

2016-07-06 Thread Paolo Bonzini
On 06/07/2016 10:19, Peter Zijlstra wrote: >>> Paolo, could you help out with an (x86) KVM interface for this? >> > >> > Xen support of this interface should be rather easy. Could you please >> > Cc: xen-devel-requ...@lists.xenproject.org in the next version? > So meta question; aren't all you

Re: [PATCH v2 0/4] implement vcpu preempted check

2016-07-06 Thread Paolo Bonzini
On 06/07/2016 14:08, Wanpeng Li wrote: > 2016-07-06 18:44 GMT+08:00 Paolo Bonzini : >> >> >> On 06/07/2016 08:52, Peter Zijlstra wrote: >>> On Tue, Jun 28, 2016 at 10:43:07AM -0400, Pan Xinhui wrote: change fomr v1: a simplier definition of default

Re: [PATCH v2 0/4] implement vcpu preempted check

2016-07-06 Thread Wanpeng Li
2016-07-06 18:44 GMT+08:00 Paolo Bonzini : > > > On 06/07/2016 08:52, Peter Zijlstra wrote: >> On Tue, Jun 28, 2016 at 10:43:07AM -0400, Pan Xinhui wrote: >>> change fomr v1: >>> a simplier definition of default vcpu_is_preempted >>> skip mahcine type check on ppc,

Re: [PATCH v2 0/4] implement vcpu preempted check

2016-07-06 Thread Peter Zijlstra
On Wed, Jul 06, 2016 at 12:44:58PM +0200, Paolo Bonzini wrote: > > Paolo, could you help out with an (x86) KVM interface for this? > > If it's just for spin loops, you can check if the version field in the > steal time structure has changed. That would require remembering the old value, no?

Re: [PATCH v2 0/4] implement vcpu preempted check

2016-07-06 Thread Paolo Bonzini
On 06/07/2016 08:52, Peter Zijlstra wrote: > On Tue, Jun 28, 2016 at 10:43:07AM -0400, Pan Xinhui wrote: >> change fomr v1: >> a simplier definition of default vcpu_is_preempted >> skip mahcine type check on ppc, and add config. remove dedicated macro. >> add one patch to drop

Re: [PATCH v2 0/4] implement vcpu preempted check

2016-07-06 Thread xinhui
On 2016年07月06日 14:52, Peter Zijlstra wrote: On Tue, Jun 28, 2016 at 10:43:07AM -0400, Pan Xinhui wrote: change fomr v1: a simplier definition of default vcpu_is_preempted skip mahcine type check on ppc, and add config. remove dedicated macro. add one patch to drop

Re: [PATCH v2 0/4] implement vcpu preempted check

2016-07-06 Thread Juergen Gross
On 06/07/16 10:19, Peter Zijlstra wrote: > On Wed, Jul 06, 2016 at 09:47:18AM +0200, Juergen Gross wrote: >> On 06/07/16 08:52, Peter Zijlstra wrote: > >>> Paolo, could you help out with an (x86) KVM interface for this? >> >> Xen support of this interface should be rather easy. Could you please

Re: [PATCH v2 0/4] implement vcpu preempted check

2016-07-06 Thread Peter Zijlstra
On Wed, Jul 06, 2016 at 09:47:18AM +0200, Juergen Gross wrote: > On 06/07/16 08:52, Peter Zijlstra wrote: > > Paolo, could you help out with an (x86) KVM interface for this? > > Xen support of this interface should be rather easy. Could you please > Cc: xen-devel-requ...@lists.xenproject.org in

Re: [PATCH v2 0/4] implement vcpu preempted check

2016-07-06 Thread Juergen Gross
On 06/07/16 08:52, Peter Zijlstra wrote: > On Tue, Jun 28, 2016 at 10:43:07AM -0400, Pan Xinhui wrote: >> change fomr v1: >> a simplier definition of default vcpu_is_preempted >> skip mahcine type check on ppc, and add config. remove dedicated macro. >> add one patch to drop

Re: [PATCH v2 0/4] implement vcpu preempted check

2016-07-06 Thread Peter Zijlstra
On Tue, Jun 28, 2016 at 10:43:07AM -0400, Pan Xinhui wrote: > change fomr v1: > a simplier definition of default vcpu_is_preempted > skip mahcine type check on ppc, and add config. remove dedicated macro. > add one patch to drop overload of rwsem_spin_on_owner and >

[PATCH v2 0/4] implement vcpu preempted check

2016-06-28 Thread Pan Xinhui
change fomr v1: a simplier definition of default vcpu_is_preempted skip mahcine type check on ppc, and add config. remove dedicated macro. add one patch to drop overload of rwsem_spin_on_owner and mutex_spin_on_owner. add more comments thanks boqun and