From: Lukas Hejtmanek Subject: Re: Question regarding SLAB corruption Date: Mon, 9 Jul 2007 14:07:34 +0200 Message-ID: <20070709120734.GH3885@ics.muni.cz> References: <20070709073804.GZ3885@ics.muni.cz> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-2 Content-Transfer-Encoding: quoted-printable Return-path: Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Keir Fraser Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org On Mon, Jul 09, 2007 at 09:31:16AM +0100, Keir Fraser wrote: > Nope. To get contiguous pages on Xen you need to use pci_alloc_consiste= nt, > or pci_map_single, or similar. Most drivers are okay with this, because= you > are not supposed to program DMA without having got a dma_addr_t from Li= nux's > DMA API, and we hook into the DMA API to serve up contiguous regions (v= ia > the swiotlb [ie. bounce buffers], if necessary). According to IB developers, it uses alloc_pages and then pci_map_sg which= they state that is DMA API. So, is it correct approach? I did debug like this - so it prints physical and virtual addresses and t= hey=20 seems to be perfectly contiguous. Are the physical addresses real physica= l=20 addresses or virtualized by Xen hypervisor? static int mthca_alloc_icm_pages(struct mthca_dev *pdev, struct device *d= ev, struct scatterlist *mem, int order, gfp_t gfp_mask) { int o; void *page; mem->page =3D alloc_pages(gfp_mask, order); if (!mem->page) return -ENOMEM; mthca_err(pdev, "Alloc pages starts\n"); page =3D page_address(mem->page); o =3D PAGE_SIZE << order; while(o > 0) { mthca_err(pdev, "Page phys. addr %p, virt %p\n", virt_to_= phys(page), page); o -=3D PAGE_SIZE; page +=3D PAGE_SIZE; } mem->length =3D PAGE_SIZE << order; mem->offset =3D 0; return 0; } --=20 Luk=E1=B9 Hejtm=E1nek