From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: Re: [PATCH 16/38] KVM: PPC: BookE: Add check_requests helper function Date: Wed, 15 Aug 2012 15:28:54 -0300 Message-ID: <20120815182854.GB21271@amt.cnet> References: <1344985483-7440-1-git-send-email-agraf@suse.de> <1344985483-7440-17-git-send-email-agraf@suse.de> <502AE903.3080707@freescale.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Alexander Graf , kvm-ppc@vger.kernel.org, KVM list To: Scott Wood Return-path: Received: from mx1.redhat.com ([209.132.183.28]:55543 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753873Ab2HOTJm (ORCPT ); Wed, 15 Aug 2012 15:09:42 -0400 Content-Disposition: inline In-Reply-To: <502AE903.3080707@freescale.com> Sender: kvm-owner@vger.kernel.org List-ID: On Tue, Aug 14, 2012 at 07:10:43PM -0500, Scott Wood wrote: > On 08/14/2012 06:04 PM, Alexander Graf wrote: > > We need a central place to check for pending requests in. Add one that > > only does the timer check we already do in a different place. > > > > Later, this central function can be extended by more checks. > > > > Signed-off-by: Alexander Graf > > --- > > arch/powerpc/kvm/booke.c | 24 +++++++++++++++++------- > > 1 files changed, 17 insertions(+), 7 deletions(-) > > > > diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c > > index 1d4ce9a..bcf87fe 100644 > > --- a/arch/powerpc/kvm/booke.c > > +++ b/arch/powerpc/kvm/booke.c > > @@ -419,13 +419,6 @@ static void kvmppc_core_check_exceptions(struct kvm_vcpu *vcpu) > > unsigned long *pending = &vcpu->arch.pending_exceptions; > > unsigned int priority; > > > > - if (vcpu->requests) { > > - if (kvm_check_request(KVM_REQ_PENDING_TIMER, vcpu)) { > > - smp_mb(); > > - update_timer_ints(vcpu); > > - } > > - } > > - > > priority = __ffs(*pending); > > while (priority < BOOKE_IRQPRIO_MAX) { > > if (kvmppc_booke_irqprio_deliver(vcpu, priority)) > > @@ -461,6 +454,14 @@ int kvmppc_core_prepare_to_enter(struct kvm_vcpu *vcpu) > > return r; > > } > > > > +static void kvmppc_check_requests(struct kvm_vcpu *vcpu) > > +{ > > + if (vcpu->requests) { > > + if (kvm_check_request(KVM_REQ_PENDING_TIMER, vcpu)) > > + update_timer_ints(vcpu); > > + } > > +} > > + > > /* > > * Common checks before entering the guest world. Call with interrupts > > * disabled. > > @@ -485,6 +486,15 @@ static int kvmppc_prepare_to_enter(struct kvm_vcpu *vcpu) > > break; > > } > > > > + smp_mb(); > > + if (vcpu->requests) { > > + /* Make sure we process requests preemptable */ > > + local_irq_enable(); > > + kvmppc_check_requests(vcpu); > > + local_irq_disable(); > > + continue; > > + } > > What previous memory access is the smp_mb() ordering against? > > -Scott It is good practice to document each memory barrier.