From mboxrd@z Thu Jan 1 00:00:00 1970 From: Scott Wood Subject: Re: [PATCH 2/2 v2] KVM: PPC: booke: Add watchdog emulation Date: Tue, 17 Jul 2012 11:37:35 -0500 Message-ID: <500594CF.9070601@freescale.com> References: <1341830087-12728-1-git-send-email-Bharat.Bhushan@freescale.com> <50044CF1.8070806@suse.de> <5004B995.8060303@freescale.com> <6A3DF150A5B70D4F9B66A25E3F7C888D03DCB1A9@039-SN2MPN1-023.039d.mgd.msft.net> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Cc: Wood Scott-B07421 , Alexander Graf , "kvm-ppc@vger.kernel.org" , "kvm@vger.kernel.org" , "bharatb.yadav@gmail.com" , Benjamin Herrenschmidt , Kumar Gala To: Bhushan Bharat-R65777 Return-path: Received: from am1ehsobe004.messaging.microsoft.com ([213.199.154.207]:12207 "EHLO am1outboundpool.messaging.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752517Ab2GQQhk (ORCPT ); Tue, 17 Jul 2012 12:37:40 -0400 In-Reply-To: <6A3DF150A5B70D4F9B66A25E3F7C888D03DCB1A9@039-SN2MPN1-023.039d.mgd.msft.net> Sender: kvm-owner@vger.kernel.org List-ID: On 07/17/2012 06:31 AM, Bhushan Bharat-R65777 wrote: >>>> int kvm_arch_vcpu_runnable(struct kvm_vcpu *v) { >>>> - return !(v->arch.shared->msr & MSR_WE) || >>>> - !!(v->arch.pending_exceptions) || >>>> - v->requests; >>>> + bool ret = !(v->arch.shared->msr & MSR_WE) || >>>> + !!(v->arch.pending_exceptions) || >>>> + v->requests; >>>> + >>>> + ret = ret || kvmppc_get_tsr_wrc(v); >>> >>> Why do you need to declare the cpu as non-runnable when a watchdog >>> event occured? >> >> It's the other way around -- it's always runnable when a watchdog exit is >> pending. It's like a pending exception. > > With the above check, Are we trying to handle the case where watchdog > interrupt bit in pending_exception is cleared by guest after final > expiry but before the qemu exit? No, we're just trying to test the actual condition we want to exit on. The watchdog interrupt might be masked (either with WIE or CE). > And we want that if TSR.WRS update > wins the race with clearing of watchdog interrupt condition from > guest then anyways let QEMU exit with reason KVM_EXIT_WDT? What race? If ENW and WIS are both set when the watchdog timer fires, it's a final expiration. It's irrelevant what happens to WIS after that point, before enforcement kicks in. > What if we do not allow guest clear watchdog interrupt condition if > final expiry already happened? What would that solve? -Scott