From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Graf Subject: Re: [PATCH 2/3] Improve DEC handling Date: Mon, 21 Dec 2009 19:20:36 +0100 Message-ID: <4B2FBC74.3080705@suse.de> References: <1261405373-8008-1-git-send-email-agraf@suse.de> <1261405373-8008-3-git-send-email-agraf@suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: kvm-ppc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Hollis Blanchard Return-path: In-Reply-To: Sender: kvm-ppc-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: kvm.vger.kernel.org Hollis Blanchard wrote: > On Mon, Dec 21, 2009 at 10:13 AM, Hollis Blanchard > wrote: > >> void kvmppc_emulate_dec(struct kvm_vcpu *vcpu) >> { >> unsigned long dec_nsec; >> >> pr_debug("mtDEC: %x\n", vcpu->arch.dec); >> #ifdef CONFIG_PPC64 >> /* POWER4+ triggers a dec interrupt if the value is < 0 */ >> if (vcpu->arch.dec & 0x80000000) { >> hrtimer_try_to_cancel(&vcpu->arch.dec_timer); >> kvmppc_core_queue_dec(vcpu); >> + /* keep queuing interrupts until guest clears high MSR bit */ >> + hrtimer_start(&vcpu->arch.dec_timer, ktime_set(0, 100), >> + HRTIMER_MODE_REL); >> return; >> } >> #endif >> > > Of course, removing the hardcoded 100-ns timer would be better, and > indeed we can do that. What we *really* want is to key off of MSR[EE] > changes (there's no point in queuing anything until then). Yes. mtmsr with EE=1 triggers a #VMEXIT which then goes off into a VM entry which on entering checks that the DEC interrupt is still active and fires it. > So why not > move your "AGGRESSIVE_DEC" check into Book 3S's kvmppc_set_msr()? > The idea was to get rid of AGGRESSIVE_DEC :-). Alex