From: Fabio Fantoni Subject: Re: [PATCH] x86/hvm: implement save/restore for posted interrupts Date: Thu, 09 Oct 2014 14:49:17 +0200 Message-ID: <5436844D.6030304@m2r.biz> References: <20140805103224.GA15563@aepfle.de> <20140919133227.GA2611@aepfle.de> <542AF41C020000780003B2EC@mail.emea.novell.com> <20141001080706.GA11230@aepfle.de> <542BD772020000780003B5ED@mail.emea.novell.com> <20141001201302.GA30085@aepfle.de> <20141008082846.GA4978@aepfle.de> <20141008085411.GA6512@aepfle.de> <54364A25.7050803@m2r.biz> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: "Zhang, Yang Z" , Olaf Hering Cc: "Tian, Kevin" , "Dong, Eddie" , Jan Beulich , "Nakajima, Jun" , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org Il 09/10/2014 10:43, Zhang, Yang Z ha scritto: > Fabio Fantoni wrote on 2014-10-09: >> Il 09/10/2014 09:24, Zhang, Yang Z ha scritto: >> >> >> Olaf Hering wrote on 2014-10-08: >> >> On Wed, Oct 08, Zhang, Yang Z wrote: >> >> >> Olaf Hering wrote on 2014-10-08: >> >> On Wed, Oct 08, Zhang, Yang Z wrote: >> >> Can you reproduce it with APICv disabled? You can add apicv=0 >> into your grub to disable it. >> >> Using 'apicv=0' with staging helps, the guest resumes properly. >> >> Does 'resumes properly' mean there are two sysrq in dmesg after >> resume? >> >> >> Yes. >> >> >> Will now try the patch you mentioned in the other mail. >> >> Thanks. I am set upping the environment for testing now. >> >> >> That patch (Message-ID: <20140804075007.GA11609@aepfle.de> >> ) does not >> help. >> >> >> Sorry. I forget to tell that that patch must combine with one fixing >> from your patch. >> I rebased it based on latest Xen and the attached patch includes all fixings. >> Could you have a try? It works on my side, hope it helps. >> >> >> Hi, I want test this fix to see if it solves one strange save/restore >> bug. Before this should be applied also another patch or can be >> applied only that on xen-unstable? I ask because I not see "x86/hvm: >> implement save/restore for posted interrupts" patch in xen-unstable that I suppose is required for this. > This patch includes all fixings that I know. So just apply it into latest Xen and have a try. Thanks for reply. I tested the patch with windows 7 domUs with newer pv drivers, unfortunately does not solve the problem after the save/restore with qxl vga but at least I haven't noticed any regression. Initial post about my save/restore problem is here if someone want take a look: http://lists.xen.org/archives/html/xen-devel/2014-07/msg01021.html Latest xen-unstable remove the warning I saw previously in xl dmesg, so I not have any useful debug informations to help to solves it :( Thanks for any reply and sorry for my bad english. > >> Thanks for any reply and sorry for my bad english. >> >> >> >> >> >> diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c >> index 99ae1be..e702ed3 100644 >> --- a/xen/arch/x86/hvm/vlapic.c >> +++ b/xen/arch/x86/hvm/vlapic.c >> @@ -1259,6 +1259,9 @@ static int lapic_save_regs(struct domain *d, >> hvm_domain_context_t *h) >> >> for_each_vcpu ( d, v ) { + if ( >> hvm_funcs.sync_pir_to_irr ) + hvm_funcs.sync_pir_to_irr(v); >> + s = vcpu_vlapic(v); if ( (rc = >> hvm_save_entry(LAPIC_REGS, v->vcpu_id, h, s->regs)) != 0 ) >> break; diff --git a/xen/arch/x86/hvm/vmx/vmx.c >> b/xen/arch/x86/hvm/vmx/vmx.c index 304aeea..7c4d796 100644 --- >> a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ >> -1584,6 +1584,8 @@ static void vmx_process_isr(int isr, struct vcpu *v) >> { unsigned long status; u8 old; + int vector; + >> struct vlapic *s = vcpu_vlapic(v); >> >> if ( isr < 0 ) isr = 0; @@ -1597,6 +1599,14 @@ static >> void vmx_process_isr(int isr, struct vcpu *v) status |= isr << >> VMX_GUEST_INTR_STATUS_SVI_OFFSET; __vmwrite(GUEST_INTR_STATUS, >> status); } + for ( vector = 0; vector < NR_VECTORS; vector++ ) >> + if (vlapic_test_vector(vector, &s->regs->data[APIC_TMR])) + >> set_bit(vector, v->arch.hvm_vmx.eoi_exit_bitmap); + + >> __vmwrite(0x201c, v->arch.hvm_vmx.eoi_exit_bitmap[0]); + >> __vmwrite(0x201e, v->arch.hvm_vmx.eoi_exit_bitmap[1]); + >> __vmwrite(0x2020, v->arch.hvm_vmx.eoi_exit_bitmap[2]); + >> __vmwrite(0x2022, v->arch.hvm_vmx.eoi_exit_bitmap[3]); >> vmx_vmcs_exit(v); } >> >> diff --git a/xen/include/asm-x86/hvm/vlapic.h >> b/xen/include/asm-x86/hvm/vlapic.h index bf59b95..fc8d131 100644 --- >> a/xen/include/asm-x86/hvm/vlapic.h +++ >> b/xen/include/asm-x86/hvm/vlapic.h @@ -61,6 +61,8 @@ >> >> #define VEC_POS(v) ((v) % 32) #define REG_POS(v) (((v) / 32) * 0x10) >> +#define vlapic_test_vector(vec, bitmap) \ + >> test_bit(VEC_POS(vec), (uint32_t *)((bitmap) + REG_POS(vec))) #define >> vlapic_test_and_set_vector(vec, bitmap) \ >> test_and_set_bit(VEC_POS(vec), (uint32_t *)((bitmap) + REG_POS(vec))) >> #define vlapic_test_and_clear_vector(vec, bitmap) >> >> >> >> Olaf >> >> >> >> Best regards, >> Yang >> >> >> >> >> >> _______________________________________________ >> Xen-devel mailing list >> Xen-devel@lists.xen.org >> http://lists.xen.org/xen-devel >> > > Best regards, > Yang > >