WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] Question regarding SLAB corruption

To: Keir Fraser <keir@xxxxxxxxxxxxx>
Subject: Re: [Xen-devel] Question regarding SLAB corruption
From: Lukas Hejtmanek <xhejtman@xxxxxxxxxxx>
Date: Mon, 9 Jul 2007 14:07:34 +0200
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Mon, 09 Jul 2007 05:04:27 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <C2B7B0E4.12103%keir@xxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <20070709073804.GZ3885@xxxxxxxxxxx> <C2B7B0E4.12103%keir@xxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.16 (2007-06-11)
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_consistent,
> 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 Linux's
> DMA API, and we hook into the DMA API to serve up contiguous regions (via
> 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 they 
seems to be perfectly contiguous. Are the physical addresses real physical 
addresses or virtualized by Xen hypervisor?

static int mthca_alloc_icm_pages(struct mthca_dev *pdev, struct device *dev, 
struct scatterlist *mem, int order, gfp_t gfp_mask)
{
        int o;
        void *page;
        mem->page = alloc_pages(gfp_mask, order);
        if (!mem->page)
                return -ENOMEM;
        mthca_err(pdev, "Alloc pages starts\n");
        page = page_address(mem->page);
        o = PAGE_SIZE << order;
        while(o > 0) {
                mthca_err(pdev, "Page phys. addr %p, virt %p\n", 
virt_to_phys(page), page);
                o  -= PAGE_SIZE;
                page += PAGE_SIZE;
        }
        mem->length = PAGE_SIZE << order;
        mem->offset = 0;
        return 0;
}

-- 
Lukáš Hejtmánek

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