From patchwork Thu Mar 8 04:18:48 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoder Stuart-B08248 X-Patchwork-Id: 145448 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id CC84BB6EEC for ; Thu, 8 Mar 2012 15:18:55 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752271Ab2CHESx (ORCPT ); Wed, 7 Mar 2012 23:18:53 -0500 Received: from tx2ehsobe001.messaging.microsoft.com ([65.55.88.11]:48277 "EHLO tx2outboundpool.messaging.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751753Ab2CHESw convert rfc822-to-8bit (ORCPT ); Wed, 7 Mar 2012 23:18:52 -0500 Received: from mail58-tx2-R.bigfish.com (10.9.14.242) by TX2EHSOBE008.bigfish.com (10.9.40.28) with Microsoft SMTP Server id 14.1.225.23; Thu, 8 Mar 2012 04:18:51 +0000 Received: from mail58-tx2 (localhost [127.0.0.1]) by mail58-tx2-R.bigfish.com (Postfix) with ESMTP id E54DCE04BE; Thu, 8 Mar 2012 04:18:51 +0000 (UTC) X-SpamScore: -16 X-BigFish: VS-16(zzbb2dI9371I146fK542M1432N98dKzz1202hzz8275dhz2dh2a8h668h839h8e2h8e3h944hbe9k) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI Received: from mail58-tx2 (localhost.localdomain [127.0.0.1]) by mail58-tx2 (MessageSwitch) id 1331180330978083_23610; Thu, 8 Mar 2012 04:18:50 +0000 (UTC) Received: from TX2EHSMHS015.bigfish.com (unknown [10.9.14.242]) by mail58-tx2.bigfish.com (Postfix) with ESMTP id E05F720004B; Thu, 8 Mar 2012 04:18:50 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by TX2EHSMHS015.bigfish.com (10.9.99.115) with Microsoft SMTP Server (TLS) id 14.1.225.23; Thu, 8 Mar 2012 04:18:50 +0000 Received: from 039-SN1MPN1-003.039d.mgd.msft.net ([169.254.3.183]) by 039-SN1MMR1-003.039d.mgd.msft.net ([10.84.1.16]) with mapi id 14.01.0355.003; Wed, 7 Mar 2012 22:18:49 -0600 From: Yoder Stuart-B08248 To: Alexander Graf , Wood Scott-B07421 CC: "kvm-ppc@vger.kernel.org" , "kvm@vger.kernel.org" Subject: RE: [PATCH v9 2/4] KVM: PPC: epapr: Add idle hcall support for host Thread-Topic: [PATCH v9 2/4] KVM: PPC: epapr: Add idle hcall support for host Thread-Index: AQHM/LgAOJ2xIde1kUapP9yC5Gp08pZf3tQAgAACx4CAAABpgP//6FkQ Date: Thu, 8 Mar 2012 04:18:48 +0000 Message-ID: <9F6FE96B71CF29479FF1CDC8046E150331148C@039-SN1MPN1-003.039d.mgd.msft.net> References: <1331161979-12759-1-git-send-email-stuart.yoder@freescale.com> <1331161979-12759-3-git-send-email-stuart.yoder@freescale.com> <3C0902B7-B7F3-4B78-BC8F-F99DEC2F73BD@suse.de> <4F57F12D.20502@freescale.com> <89678BAD-C166-4114-9BDB-82AF15ACF6DA@suse.de> In-Reply-To: <89678BAD-C166-4114-9BDB-82AF15ACF6DA@suse.de> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.214.82.74] MIME-Version: 1.0 X-OriginatorOrg: freescale.com Sender: kvm-ppc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm-ppc@vger.kernel.org > -----Original Message----- > From: Alexander Graf [mailto:agraf@suse.de] > Sent: Wednesday, March 07, 2012 5:39 PM > To: Wood Scott-B07421 > Cc: Yoder Stuart-B08248; kvm-ppc@vger.kernel.org; kvm@vger.kernel.org > Subject: Re: [PATCH v9 2/4] KVM: PPC: epapr: Add idle hcall support for host > > > On 08.03.2012, at 00:37, Scott Wood wrote: > > > On 03/07/2012 05:27 PM, Alexander Graf wrote: > >> On 08.03.2012, at 00:12, Stuart Yoder wrote: > >>> > >>> if (vcpu->requests) { > >>> + /* kvm_vcpu_block() sets KVM_REQ_UNHALT, but it is > >>> + * not cleared elsewhere as on x86. Clear it here > >>> + * for now, otherwise we never go idle. > >>> + */ > >>> + clear_bit(KVM_REQ_UNHALT, &vcpu->requests); > >> > >> Shouldn't the same thing hit us on non-booke as well? Also, it sounds unrelated to me and probably > shouldn't be in this patch. > > > > Until recently we didn't check for requests in kvm_arch_vcpu_runnable(). > > > > And yes, book3s will need this too. Where should this go? Something like this? > >>> if (kvm_check_request(KVM_REQ_PENDING_TIMER, vcpu)) { > >>> smp_mb(); > >>> update_timer_ints(vcpu); > >>> diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c > >>> index ee489f4..2595916 100644 > >>> --- a/arch/powerpc/kvm/powerpc.c > >>> +++ b/arch/powerpc/kvm/powerpc.c > >>> @@ -48,8 +48,7 @@ static unsigned int perfmon_refcount; > >>> > >>> int kvm_arch_vcpu_runnable(struct kvm_vcpu *v) { > >>> - bool ret = !(v->arch.shared->msr & MSR_WE) || > >>> - !!(v->arch.pending_exceptions) || > >>> + bool ret = !!(v->arch.pending_exceptions) || > >>> v->requests; > >> > >> Huh? > > > > MSR_WE is not going to get set if the idle hcall is used, so this > > check was preventing us from blocking. > > > > The check isn't needed anyway, as nothing can actually change MSR_WE > > while we're in kvm_vcpu_block(), which is the only user of > > kvm_arch_vcpu_runnable(), and the MSR_WE path won't call > > kvm_vcpu_block() if MSR_WE isn't set. > > Ah, this is only removing the MSR_WE check. Ok. I'll add an additional comment to the patch description. Stuart --- To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- a/arch/powerpc/kvm/book3s.c +++ b/arch/powerpc/kvm/book3s.c @@ -283,6 +283,8 @@ int kvmppc_core_prepare_to_enter(struct kvm_vcpu *vcpu) /* Tell the guest about our interrupt status */ kvmppc_update_int_pending(vcpu, *pending, old_pending); + clear_bit(KVM_REQ_UNHALT, &vcpu->requests); + return 0; }