From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Noz5f-0008PH-NH for qemu-devel@nongnu.org; Tue, 09 Mar 2010 08:03:15 -0500 Received: from [199.232.76.173] (port=52249 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Noz5f-0008Os-Dr for qemu-devel@nongnu.org; Tue, 09 Mar 2010 08:03:15 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1Noz5e-0007Zc-EG for qemu-devel@nongnu.org; Tue, 09 Mar 2010 08:03:15 -0500 Received: from mx1.redhat.com ([209.132.183.28]:62243) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Noz5d-0007ZY-W4 for qemu-devel@nongnu.org; Tue, 09 Mar 2010 08:03:14 -0500 Message-ID: <4B964709.6040202@redhat.com> Date: Tue, 09 Mar 2010 15:03:05 +0200 From: Avi Kivity MIME-Version: 1.0 References: <1267833161-25267-1-git-send-email-cam@cs.ualberta.ca> <4B94C9B3.1060904@redhat.com> <8286e4ee1003080957v9bb4837x187cebb8477348c2@mail.gmail.com> <201003091349.51344.arnd@arndb.de> In-Reply-To: <201003091349.51344.arnd@arndb.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH] Inter-VM shared memory PCI device List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Arnd Bergmann Cc: Cam Macdonell , qemu-devel@nongnu.org, kvm@vger.kernel.org On 03/09/2010 02:49 PM, Arnd Bergmann wrote: > On Monday 08 March 2010, Cam Macdonell wrote: > >> enum ivshmem_registers { >> IntrMask = 0, >> IntrStatus = 2, >> Doorbell = 4, >> IVPosition = 6, >> IVLiveList = 8 >> }; >> >> The first two registers are the interrupt mask and status registers. >> Interrupts are triggered when a message is received on the guest's eventfd from >> another VM. Writing to the 'Doorbell' register is how synchronization messages >> are sent to other VMs. >> >> The IVPosition register is read-only and reports the guest's ID number. The >> IVLiveList register is also read-only and reports a bit vector of currently >> live VM IDs. >> >> The Doorbell register is 16-bits, but is treated as two 8-bit values. The >> upper 8-bits are used for the destination VM ID. The lower 8-bits are the >> value which will be written to the destination VM and what the guest status >> register will be set to when the interrupt is trigger is the destination guest. >> A value of 255 in the upper 8-bits will trigger a broadcast where the message >> will be sent to all other guests. >> > This means you have at least two intercepts for each message: > > 1. Sender writes to doorbell > 2. Receiver gets interrupted > > With optionally two more intercepts in order to avoid interrupting the > receiver every time: > > 3. Receiver masks interrupt in order to process data > 4. Receiver unmasks interrupt when it's done and status is no longer pending > > I believe you can do much better than this, you combine status and mask > bits, making this level triggered, and move to a bitmask of all guests: > > In order to send an interrupt to another guest, the sender first checks > the bit for the receiver. If it's '1', no need for any intercept, the > receiver will come back anyway. If it's zero, write a '1' bit, which > gets OR'd into the bitmask by the host. The receiver gets interrupted > at a raising edge and just leaves the bit on, until it's done processing, > then turns the bit off by writing a '1' into its own location in the mask. > We could make the masking in RAM, not in registers, like virtio, which would require no exits. It would then be part of the application specific protocol and out of scope of of this spec. -- error compiling committee.c: too many arguments to function