From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konrad Rzeszutek Wilk Subject: Re: [PATCH 07/15] [swiotlb] In 'swiotlb_free' check iommu_sw pointer. Date: Tue, 19 Jan 2010 12:45:26 -0500 Message-ID: <20100119174526.GN11986@phenom.dumpdata.com> References: <1263510064-16788-1-git-send-email-konrad.wilk@oracle.com> <1263510064-16788-2-git-send-email-konrad.wilk@oracle.com> <1263510064-16788-3-git-send-email-konrad.wilk@oracle.com> <1263510064-16788-4-git-send-email-konrad.wilk@oracle.com> <1263510064-16788-5-git-send-email-konrad.wilk@oracle.com> <1263510064-16788-6-git-send-email-konrad.wilk@oracle.com> <1263510064-16788-7-git-send-email-konrad.wilk@oracle.com> <1263510064-16788-8-git-send-email-konrad.wilk@oracle.com> <20100115020240.GG6021@sequoia.sous-sol.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20100115020240.GG6021@sequoia.sous-sol.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Chris Wright Cc: Ian.Campbell@eu.citrix.com, jeremy@goop.org, xen-devel@lists.xensource.com, joerg.roedel@amd.com, fujita.tomonori@lab.ntt.co.jp, iommu@lists.linux-foundation.org, dwmw2@infradead.org, alex.williamson@hp.com List-Id: xen-devel@lists.xenproject.org On Thu, Jan 14, 2010 at 06:02:40PM -0800, Chris Wright wrote: > * Konrad Rzeszutek Wilk (konrad.wilk@oracle.com) wrote: > > --- a/lib/swiotlb.c > > +++ b/lib/swiotlb.c > > @@ -364,7 +364,7 @@ cleanup1: > > > > void __init swiotlb_free(void) > > { > > - if (!iommu_sw->overflow_buffer) > > + if (!iommu_sw) > > return; > > > > Sure this is safe for the case where allocation failed? Wouldn't this > do free_late_bootmem(__pa(0))? That would indeed fail, but alloc_bootmem_low_pages (___alloc_bootmem) panics the machine if it can't allocate the buffer. So we would never actually get to swiotlb_free if we failed to allocate the buffers for SWIOTLB. But for the case where the SWIOTLB allocation happens when using swiotlb_late_init_with_default_size, and it fails, this check is not sufficient. I will add a check for that or just make swiotlb_late_init_with_default_size set iommu_sw to NULL when the allocation fails.