From patchwork Sun Apr 19 14:28:04 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gleb Natapov X-Patchwork-Id: 18930 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n3JESW8o018039 for ; Sun, 19 Apr 2009 14:28:33 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758927AbZDSO2Q (ORCPT ); Sun, 19 Apr 2009 10:28:16 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1760769AbZDSO2Q (ORCPT ); Sun, 19 Apr 2009 10:28:16 -0400 Received: from mx2.redhat.com ([66.187.237.31]:51743 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758437AbZDSO2P (ORCPT ); Sun, 19 Apr 2009 10:28:15 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n3JES78B020850; Sun, 19 Apr 2009 10:28:07 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n3JES6wd031659; Sun, 19 Apr 2009 10:28:06 -0400 Received: from dhcp-1-237.tlv.redhat.com (dhcp-1-237.tlv.redhat.com [10.35.1.237]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n3JES4gw031792; Sun, 19 Apr 2009 10:28:05 -0400 Received: by dhcp-1-237.tlv.redhat.com (Postfix, from userid 587) id 611F618D48F; Sun, 19 Apr 2009 17:28:04 +0300 (IDT) Date: Sun, 19 Apr 2009 17:28:04 +0300 From: Gleb Natapov To: Jan Kiszka Cc: Dmitry Eremin-Solenikov , kvm@vger.kernel.org, Avi Kivity , Joerg Roedel , Alexander Graf , qemu-devel Subject: Re: [PATCH 05/15] Coalesce userspace/kernel irqchip interrupt injection logic. Message-ID: <20090419142804.GQ10126@redhat.com> References: <1239616545-25199-1-git-send-email-gleb@redhat.com> <1239616545-25199-6-git-send-email-gleb@redhat.com> <49E99A7F.7000902@web.de> <20090418162820.GI27675@redhat.com> <20090419135745.GO10126@redhat.com> <49EB2FA1.2090305@web.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <49EB2FA1.2090305@web.de> X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Sun, Apr 19, 2009 at 04:05:21PM +0200, Jan Kiszka wrote: > > And this is not the only problem I saw, but the one that caused my guest > > to hang. > > OK, good to know. I added Alex (though he's said to be on vacation ATM) > and qemu to CC. Maybe you can quickly list the other issues you've > stumbled over, for the records and for motivating contributors... > Another one that I remember (because this was my first suspect) is interrupt shadow handling. HF_INHIBIT_IRQ_MASK is cleared on exit when shadow bit is set in int_state and is not set on entry if hypervisor set shadow bit by itself. I am not sure how real HW actually handles this, but patch below demonstrates how I think it does it :) And of cause comments like /* FIXME: this should respect TPR */ don't look promising. --- Gleb. -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/target-i386/op_helper.c b/target-i386/op_helper.c index be09263..691a7f0 100644 --- a/target-i386/op_helper.c +++ b/target-i386/op_helper.c @@ -4971,6 +4997,15 @@ void helper_vmrun(int aflag, int next_eip_addend) env->dr[6] = ldq_phys(env->vm_vmcb + offsetof(struct vmcb, save.dr6)); cpu_x86_set_cpl(env, ldub_phys(env->vm_vmcb + offsetof(struct vmcb, save.cpl))); + { + uint32_t aaa; + aaa = ldl_phys(env->vm_vmcb + offsetof(struct vmcb, control.int_state)); + if (aaa & SVM_INTERRUPT_SHADOW_MASK) + helper_set_inhibit_irq(); + else + helper_reset_inhibit_irq(); + } + /* FIXME: guest state consistency checks */ switch(ldub_phys(env->vm_vmcb + offsetof(struct vmcb, control.tlb_ctl))) { @@ -5243,7 +5280,6 @@ void helper_vmexit(uint32_t exit_code, uint64_t exit_info_1) if(env->hflags & HF_INHIBIT_IRQ_MASK) { stl_phys(env->vm_vmcb + offsetof(struct vmcb, control.int_state), SVM_INTERRUPT_SHADOW_MASK); - env->hflags &= ~HF_INHIBIT_IRQ_MASK; } else { stl_phys(env->vm_vmcb + offsetof(struct vmcb, control.int_state), 0); }