From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anthony Liguori Date: Wed, 05 Nov 2008 20:08:18 +0000 Subject: Re: large page size virtio issues Message-Id: <4911FD32.9050301@us.ibm.com> List-Id: References: <1225836860.15410.32.camel@localhost.localdomain> <200811052316.47127.rusty@rustcorp.com.au> <1225914634.26835.102.camel@localhost.localdomain> In-Reply-To: <1225914634.26835.102.camel@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Hollis Blanchard Cc: Rusty Russell , kvm-ppc , kvm Hollis Blanchard wrote: > Actually there's an additional complication: PAGE_SIZE is entrenched in > the layout of the ring structure itself (large "struct vring" comment in > include/linux/virtio_ring.h). Callers of vring_size() demonstrate this > problem. > > I believe the vring is split across two pages so that it could be > directly mapped by two untrusted guests: the producer would have RW > access to the descriptors and the "available" fields, while the consumer > would have only RO access. I don't think this is yet implemented; is it > still planned? > Rusty experimented with it but I don't think anyone has done anything seriously with it. > It looks like vring_size() et al were carefully written to allow > arbitrary page sizes, so for now I'll assume that a struct vring that is > contained completely within a single guest mapping is OK and work up a > patch. > It was written that way so that vring_size() could be used in userspace where there isn't a PAGE_SIZE defined. Rusty just passes in getpagesize() in the lguest userspace. Pure evil if you ask me :-) > It's worth noting that the PFN_SHIFT question (in the other thread) is a > separate issue. I could have PFN_SHIFT but define VRING_PAGE_SIZE=4K > for internal alignment. I'm a little nervous about making PPC the only > arch with VRING_PAGE_SIZE=1K, since that might affect my vring layout in > "unusual" ways if it expands beyond 1K but stays inside 4K. > This is starting to get a little hairy. Maybe 64k guest pages is asking for trouble? Are you sure other things aren't breaking all over the place with these patches in place? Regards, Anthony Liguori From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anthony Liguori Subject: Re: large page size virtio issues Date: Wed, 05 Nov 2008 14:08:18 -0600 Message-ID: <4911FD32.9050301@us.ibm.com> References: <1225836860.15410.32.camel@localhost.localdomain> <200811052316.47127.rusty@rustcorp.com.au> <1225914634.26835.102.camel@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Rusty Russell , kvm-ppc , kvm To: Hollis Blanchard Return-path: Received: from e8.ny.us.ibm.com ([32.97.182.138]:43431 "EHLO e8.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755461AbYKEUIW (ORCPT ); Wed, 5 Nov 2008 15:08:22 -0500 In-Reply-To: <1225914634.26835.102.camel@localhost.localdomain> Sender: kvm-owner@vger.kernel.org List-ID: Hollis Blanchard wrote: > Actually there's an additional complication: PAGE_SIZE is entrenched in > the layout of the ring structure itself (large "struct vring" comment in > include/linux/virtio_ring.h). Callers of vring_size() demonstrate this > problem. > > I believe the vring is split across two pages so that it could be > directly mapped by two untrusted guests: the producer would have RW > access to the descriptors and the "available" fields, while the consumer > would have only RO access. I don't think this is yet implemented; is it > still planned? > Rusty experimented with it but I don't think anyone has done anything seriously with it. > It looks like vring_size() et al were carefully written to allow > arbitrary page sizes, so for now I'll assume that a struct vring that is > contained completely within a single guest mapping is OK and work up a > patch. > It was written that way so that vring_size() could be used in userspace where there isn't a PAGE_SIZE defined. Rusty just passes in getpagesize() in the lguest userspace. Pure evil if you ask me :-) > It's worth noting that the PFN_SHIFT question (in the other thread) is a > separate issue. I could have PFN_SHIFT=10 but define VRING_PAGE_SIZE=4K > for internal alignment. I'm a little nervous about making PPC the only > arch with VRING_PAGE_SIZE=1K, since that might affect my vring layout in > "unusual" ways if it expands beyond 1K but stays inside 4K. > This is starting to get a little hairy. Maybe 64k guest pages is asking for trouble? Are you sure other things aren't breaking all over the place with these patches in place? Regards, Anthony Liguori