From: "Jan Beulich" Subject: Re: [PATCH] vmx, apicv: fix save/restore issue with apicv Date: Tue, 14 Oct 2014 14:31:09 +0100 Message-ID: <543D41BD020000780003EC24@mail.emea.novell.com> References: <1413014093-23050-1-git-send-email-yang.z.zhang@intel.com> <543BAA74020000780003E1F1@mail.emea.novell.com> <543D0EA9020000780003E9A8@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Yang Z Zhang Cc: Kevin Tian , "Andrew.Cooper3@citrix.com" , "olaf@aepfle.de" , "malcolm.crossley@citrix.com" , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org >>> On 14.10.14 at 15:10, wrote: > Jan Beulich wrote on 2014-10-14: >> >>> On 14.10.14 at 07:43, wrote: >> > Jan Beulich wrote on 2014-10-13: >> >> >>> On 11.10.14 at 09:54, wrote: >> >> > @@ -1597,6 +1599,29 @@ static void vmx_process_isr(int isr, struct >> >> > vcpu >> >> *v) >> >> > status |= isr << VMX_GUEST_INTR_STATUS_SVI_OFFSET; >> >> > __vmwrite(GUEST_INTR_STATUS, status); >> >> > } >> >> > + >> >> > + eoi_exit_bitmap = (unsigned int >> >> > + *)v->arch.hvm_vmx.eoi_exit_bitmap; >> >> >> >> No casts like this please. This is a bitmap and would hence >> >> preferably be treated that way consistently. The code here isn't >> performance critical. >> > >> > Yes, it's performance critical from the live migration's point and >> > that's why I use the cast here and >> >> Compared to everything else involved in migration, a few extra cycles here > > Xen is far behind KVM on live migration. If we want to remain the > competitive, I'd suggest doing a cleanup on current migration logic to make > it more effective. But that surely needs to be done elsewhere, where more than a couple of nanoseconds are to be gained. >> >> > + { >> >> > + val = vlapic_get_reg(vlapic, APIC_IRR + i); >> >> > + val |= vlapic_get_reg(vlapic, APIC_ISR + i); >> >> >> >> The comment above doesn't really make clear why not just IRR. >> > >> > Upon acceptance of an interrupt into the IRR, the corresponding TMR >> > will be changed. This means an interrupt either in IRR or in ISR has >> > no chance to update the TMR and eoi exit bitmap. So we need to check >> > IRR + ISR while rebuilding the eoi exit bitmap. It is not enough to check only >> IRR. >> >> But then why not look at TMR right away? It's being kept up to date as long as >> the guest is running, and gets migrated over afterwards. Considering what >> vmx_update_eoi_exit_bitmap()) does, you really want to or TMR into >> EOI_EXIT_BITMAP (which post-migration could just be an assignment rather >> than an or). > > No, we cannot use TMR directly. As I said in the comments, the periodic > timer interrupt is tricky which is edge-trigger but need an EOI vmexit to let > the pending interrupts have the chance to be injected for compensation. The respective "normal" (non-migration) handling of this being in vmx_intr_assist(), involving pt_vector? If so, I think I understand now. Thanks, Jan