From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: Re: [PATCH RFC V6 1/5] kvm hypervisor : Add a hypercall to KVM hypervisor to support pv-ticketlocks Date: Sun, 29 Apr 2012 16:20:30 +0300 Message-ID: <20120429132030.GB15413@redhat.com> References: <20120423095937.30893.14776.sendpatchset@codeblue.in.ibm.com> <20120423095947.30893.84029.sendpatchset@codeblue.in.ibm.com> <20120424095923.GS15413@redhat.com> <4F9D3F8B.9010805@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <4F9D3F8B.9010805@redhat.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: virtualization-bounces@lists.linux-foundation.org Errors-To: virtualization-bounces@lists.linux-foundation.org To: Avi Kivity Cc: X86 , Jeremy Fitzhardinge , Greg Kroah-Hartman , KVM , Konrad Rzeszutek Wilk , linux-doc@vger.kernel.org, LKML , Raghavendra K T , Virtualization , Ingo Molnar , Srivatsa Vaddagiri , Sasha Levin , "H. Peter Anvin" , Xen , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org On Sun, Apr 29, 2012 at 04:18:03PM +0300, Avi Kivity wrote: > On 04/24/2012 12:59 PM, Gleb Natapov wrote: > > > > > > +/* > > > + * kvm_pv_kick_cpu_op: Kick a vcpu. > > > + * > > > + * @apicid - apicid of vcpu to be kicked. > > > + */ > > > +static void kvm_pv_kick_cpu_op(struct kvm *kvm, int apicid) > > > +{ > > > + struct kvm_vcpu *vcpu = NULL; > > > + int i; > > > + > > > + kvm_for_each_vcpu(i, vcpu, kvm) { > > > + if (!kvm_apic_present(vcpu)) > > > + continue; > > > + > > > + if (kvm_apic_match_dest(vcpu, 0, 0, apicid, 0)) > > > + break; > > > + } > > > + if (vcpu) { > > > + /* > > > + * Setting unhalt flag here can result in spurious runnable > > > + * state when unhalt reset does not happen in vcpu_block. > > > + * But that is harmless since that should soon result in halt. > > > + */ > > > + vcpu->arch.pv.pv_unhalted = 1; > > > + /* We need everybody see unhalt before vcpu unblocks */ > > > + smp_mb(); > > > + kvm_vcpu_kick(vcpu); > > > + } > > > +} > > This is too similar to kvm_irq_delivery_to_apic(). Why not reuse it. We > > can use one of reserved delivery modes as PV delivery mode. We will > > disallow guest to trigger it through apic interface, so this will not be > > part of ABI and can be changed at will. > > > > I'm not thrilled about this. Those delivery modes will eventually > become unreserved. We can have a kvm_lookup_apic_id() that is shared > among implementations. > This is only internal implementation. If they become unreserved we will use something else. -- Gleb.