Please help with kernel BUG at include/linux/gfp.h:80 with ndiswrapperon x86_64

From: Orion Poplawski
Date: Fri Dec 09 2005 - 16:15:42 EST


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

With kernel 2.6.15-rc5, gfp_zone has the following BUG_ON:

static inline int gfp_zone(gfp_t gfp)
{
int zone = GFP_ZONEMASK & (__force int) gfp;
BUG_ON(zone >= GFP_ZONETYPES);
return zone;
}

This is being tripped by ndiswrapper on x86_64 when it calls:

dma_alloc_coherent(&pci_dev->dev,size,dma_handle, \
GFP_KERNEL | __GFP_REPEAT | GFP_DMA)

because dma_alloc_coherent does:

dma_mask = dev->coherent_dma_mask;
if (dma_mask == 0)
dma_mask = 0xffffffff;

/* Kludge to make it bug-to-bug compatible with i386. i386
uses the normal dma_mask for alloc_coherent. */
dma_mask &= *dev->dma_mask;

/* Why <=? Even when the mask is smaller than 4GB it is often larger
than 16MB and in this case we have a chance of finding
fitting memory
in the next higher zone first. If not retry with true
GFP_DMA. -AK */
if (dma_mask <= 0xffffffff)
gfp |= GFP_DMA32;

again:
memory = dma_alloc_pages(dev, gfp, get_order(size));


so it appears that gfp becomes GFP_DMA | GFP_DMA32 = 5 and triggers the BUG.

So, what should ndiswrapper be using in it's call to dma_alloc_coherent?
GFP_DMA32?

Thanks!

Orion Poplawski

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iD8DBQFDmfNoORnzrtFC2/sRAsp2AKCiK/VAMoIGvxn3uvSuapcop7GUCwCgq9U+
HZShybTsF7LZyG1yXSJceFo=
=iInr
-----END PGP SIGNATURE-----

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/