From: "Jan Beulich" Subject: Re: [xen-unstable test] 10882: regressions - FAIL Date: Thu, 19 Jan 2012 09:06:20 +0000 Message-ID: <4F17EB1C020000780006D974@nat28.tlf.novell.com> References: <4F17E2B1020000780006D965@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <4F17E2B1020000780006D965@nat28.tlf.novell.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Wei Wang2 Cc: xen-devel@lists.xensource.com, ian.jackson@eu.citrix.com List-Id: xen-devel@lists.xenproject.org >>> On 19.01.12 at 09:30, "Jan Beulich" wrote: >>>> On 18.01.12 at 19:19, xen.org wrote: >> flight 10882 xen-unstable real [real] >> http://www.chiark.greenend.org.uk/~xensrcts/logs/10882/ >> >> Regressions :-( >> >> Tests which did not succeed and are blocking, >> including tests which could not be run: >> test-i386-i386-xl-win 7 windows-install fail REGR. vs. 10649 >> test-i386-i386-win 7 windows-install fail REGR. vs. 10649 > > Finally spotted an actual crash in the logs here, pointing at a relatively > obvious problem: guest_iommu_mmio_range() is apparently lacking a > NULL check. Was this code ever tested on an Intel system? > > I'll add this, but will first check whether I can spot other functions > missing such. Below the patch I'm going to commit. Jan add NULL checks in code added by 24492:6c104b46ef89 Also a couple of missing is_hvm_domain() checks. Further properly pass the PCI segment in a call to pci_get_pdev(). Signed-off-by: Jan Beulich --- a/xen/drivers/passthrough/amd/iommu_guest.c +++ b/xen/drivers/passthrough/amd/iommu_guest.c @@ -182,7 +182,13 @@ void guest_iommu_add_ppr_log(struct doma ppr_entry_t *log, *log_base; struct guest_iommu *iommu; + if ( !is_hvm_domain(d) ) + return; + iommu = domain_iommu(d); + if ( !iommu ) + return; + tail = iommu_get_rb_pointer(iommu->ppr_log.reg_tail.lo); head = iommu_get_rb_pointer(iommu->ppr_log.reg_head.lo); @@ -225,7 +231,13 @@ void guest_iommu_add_event_log(struct do event_entry_t *log, *log_base; struct guest_iommu *iommu; + if ( !is_hvm_domain(d) ) + return; + iommu = domain_iommu(d); + if ( !iommu ) + return; + tail = iommu_get_rb_pointer(iommu->event_log.reg_tail.lo); head = iommu_get_rb_pointer(iommu->event_log.reg_head.lo); @@ -793,6 +805,9 @@ int guest_iommu_set_base(struct domain * p2m_type_t t; struct guest_iommu *iommu = domain_iommu(d); + if ( !iommu ) + return -EACCES; + iommu->mmio_base = base; base >>= PAGE_SHIFT; @@ -882,6 +897,8 @@ void guest_iommu_destroy(struct domain * return; iommu = domain_iommu(d); + if ( !iommu ) + return; tasklet_kill(&iommu->cmd_buffer_tasklet); xfree(iommu); @@ -893,7 +910,7 @@ static int guest_iommu_mmio_range(struct { struct guest_iommu *iommu = vcpu_iommu(v); - return addr >= iommu->mmio_base && + return iommu && addr >= iommu->mmio_base && addr < iommu->mmio_base + IOMMU_MMIO_SIZE; } --- a/xen/drivers/passthrough/amd/iommu_init.c +++ b/xen/drivers/passthrough/amd/iommu_init.c @@ -651,7 +651,7 @@ void parse_ppr_log_entry(struct amd_iomm local_irq_enable(); spin_lock(&pcidevs_lock); - pdev = pci_get_pdev(0, bus, devfn); + pdev = pci_get_pdev(iommu->seg, bus, devfn); spin_unlock(&pcidevs_lock); local_irq_disable();