]> err.no Git - linux-2.6/commit
virtio: Force use of power-of-two for descriptor ring sizes
authorRusty Russell <rusty@rustcorp.com.au>
Mon, 12 Nov 2007 02:39:18 +0000 (13:39 +1100)
committerRusty Russell <rusty@rustcorp.com.au>
Mon, 12 Nov 2007 02:59:40 +0000 (13:59 +1100)
commit42b36cc0ce717deeb10030141a43dede763a3ebe
treeb2dc48b4f16c5dc59461ad24b027d631edda1da4
parent1200e646ae238afc536be70257290eb33fb6e364
virtio: Force use of power-of-two for descriptor ring sizes

The virtio descriptor rings of size N-1 were nicely set up to be
aligned to an N-byte boundary.  But as Anthony Liguori points out, the
free-running indices used by virtio require that the sizes be a power
of 2, otherwise we get problems on wrap (demonstrated with lguest).

So we replace the clever "2^n-1" scheme with a simple "align to page
boundary" scheme: this means that all virtio rings take at least two
pages, but it's safer than guessing cache alignment.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Documentation/lguest/lguest.c
drivers/lguest/lguest_device.c
drivers/virtio/virtio_ring.c
include/linux/virtio_ring.h