From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 00/10] PV-IO v3 Date: Wed, 22 Aug 2007 14:47:12 +0300 Message-ID: <46CC2240.30400@qumranet.com> References: <20070816231357.8044.55943.stgit@ghaskins-t60p.haskins.net> <1187714864.4363.358.camel@ghaskins-t60p.haskins.net> <1187753365.6174.26.camel@localhost.localdomain> <200708221118.00990.borntraeger@de.ibm.com> <64F9B87B6B770947A9F8391472E032160D503D81@ehost011-8.exch011.intermedia.net> <1187779205.6174.87.camel@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org, Christian Borntraeger , virtualization-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: Rusty Russell Return-path: In-Reply-To: <1187779205.6174.87.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org Rusty Russell wrote: > On Wed, 2007-08-22 at 02:26 -0700, Dor Laor wrote: > >> Actually while playing with virtio for kvm Avi saw that and recommended >> to do the following: >> struct desc_pages >> { >> /* Page of descriptors. */ >> union { >> struct virtio_desc desc[NUM_DESCS]; >> char pad1[PAGE_SIZE]; >> }; >> >> /* Next page: how we tell other side what buffers are available. */ >> union { >> struct { >> unsigned int avail_idx; >> unsigned int available[NUM_DESCS]; >> }; >> char pad2[PAGE_SIZE]; >> }; >> >> /* Third page: how other side tells us what's used. */ >> union { >> struct { >> unsigned int used_idx; >> struct virtio_used used[NUM_DESCS]; >> }; >> char pad3[PAGE_SIZE]; >> }; >> }; >> >> It saves useless pointer arithmetic. >> > > Hi Dor! > > Please consider moving the "used" field into the descriptor (maybe as a > ptr for cache reasons, 'cept I'd really like to trim descriptor size). > That makes the avail and used rings identical, plus the current model > means we can't trust the used length if we don't trust the other side > (this is one of my FIXMEs). > > Of course, we could go further and break the fixed structure: there's no > reason for the first and second part to be on separate pages, nor for > the third to be consecutive. But there is no need until be have an > untrusted demonstration... > > Another thing that occurs to me is that alignment should be explicit to 64 bits, so that mixed 32/64 bit guest/hosts can be used. -- error compiling committee.c: too many arguments to function ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/