From: Lukas Hejtmanek Subject: Re: Question regarding SLAB corruption Date: Mon, 9 Jul 2007 15:24:49 +0200 Message-ID: <20070709132449.GJ3885@ics.muni.cz> References: <20070709120734.GH3885@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 01:47:34PM +0100, Keir Fraser wrote: > Well, we currently assume that segments of a scatterlist (as passed to > pci_map_sg) do not cross page boundaries. It looks like this assumption= is > broken (certainly for the infiniband driver!). >=20 > I've just checked in the attached patch to fix this issue. Please give = it a > try in your dom0 tree. for some reason, insmod/rmmod works fine even without the patch in Dom0. = The patch wasn't applied cleanly anyway, I'm using stock Xen 3.1 which does n= ot=20 have the code: dma =3D gnttab_dma_map_page(virt_to_page(ptr)) + =20 offset_in_page(ptr);=20 Anyway, in DomU it produced message (but also an oops): Fatal DMA error! Please use 'swiotlb=3Dforce' ----------- cut here --------- please bite here --------- Kernel BUG at arch/x86_64/kernel/../../i386/kernel/pci-dma-xen.c:100 > > I did debug like this - so it prints physical and virtual addresses a= nd they > > seems to be perfectly contiguous. Are the physical addresses real phy= sical > > addresses or virtualized by Xen hypervisor? >=20 > You want to use virt_to_machine(). As you say, the addresses returned b= y > virt_to_phys() are virtual-physical, which is not what you want. Well, we got it. The virt_to_machine shows that although the pages are=20 contiguous, they are in the reversed order! As can be seen below. Should = the=20 swiotlb=3Dforce solve the problem? ib_mthca 0000:08:00.0: Alloc pages starts ib_mthca 0000:08:00.0: Page phys. addr 0000000025455000, virt ffff880099d= 40000 ib_mthca 0000:08:00.0: Page phys. addr 0000000025454000, virt ffff880099d= 41000 ib_mthca 0000:08:00.0: Page phys. addr 0000000025453000, virt ffff880099d= 42000 ib_mthca 0000:08:00.0: Page phys. addr 0000000025452000, virt ffff880099d= 43000 ib_mthca 0000:08:00.0: Page phys. addr 0000000025451000, virt ffff880099d= 44000 ib_mthca 0000:08:00.0: Page phys. addr 0000000025450000, virt ffff880099d= 45000 ib_mthca 0000:08:00.0: Page phys. addr 000000002544f000, virt ffff880099d= 46000 ib_mthca 0000:08:00.0: Page phys. addr 000000002544e000, virt ffff880099d= 47000 ib_mthca 0000:08:00.0: Page phys. addr 000000002544d000, virt ffff880099d= 48000 ib_mthca 0000:08:00.0: Page phys. addr 000000002544c000, virt ffff880099d= 49000 ib_mthca 0000:08:00.0: Page phys. addr 000000002544b000, virt ffff880099d= 4a000 ib_mthca 0000:08:00.0: Page phys. addr 000000002544a000, virt ffff880099d= 4b000 --=20 Luk=E1=B9 Hejtm=E1nek