[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] Re: [PATCH 07/15] [swiotlb] In 'swiotlb_free' check iommu_sw pointer.



* Konrad Rzeszutek Wilk (konrad.wilk@xxxxxxxxxx) wrote:
> On Thu, Jan 14, 2010 at 06:02:40PM -0800, Chris Wright wrote:
> > * Konrad Rzeszutek Wilk (konrad.wilk@xxxxxxxxxx) 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.

Ah, right.

> 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.

That one is ok, since kfree(NULL) is safe.

thanks,
-chris

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.