I just spent a number of hours tracking this one down, and I'm not too
thrilled about it. vp_find_vq() does the memory allocation for virtio
PCI rings, and it uses kzalloc() to do it. This is bad because the ring
memory *must* be page-aligned.

According to Anthony, at the time this code was written, various slab
allocators were checked and all happened to return page-aligned buffers.
So how did I hit a problem? I had enabled CONFIG_SLUB_DEBUG_ON while
investigating an unrelated problem, which offset the address by 64
bytes.

One option is to add a BUG_ON(addr & ~PAGE_MASK) to vp_find_vq(). That's
better than nothing, but still stinks.

Another is to use Kconfig to express that slab debugging breaks virtio.
Also pretty lame IMHO, will look pretty funny in the Kconfig file, and
that only solves today's problem. Another slab allocator or a change in
behavior of an existing allocator could mean that "ordinary" allocations
also become non-page-aligned.

Finally, we could use the interface intended for exactly this purpose:
the page allocator. If there's some problem with high memory, don't
allocate it with GFP_HIGHMEM.

-- 
Hollis Blanchard
IBM Linux Technology Center

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to