From: Cam Macdonell Subject: Re: [PATCH] Inter-VM shared memory PCI device Date: Wed, 10 Mar 2010 09:36:55 -0700 Message-ID: <8286e4ee1003100836g35da5f07ye01fe272dee18dc2@mail.gmail.com> References: <1267833161-25267-1-git-send-email-cam@cs.ualberta.ca> <1267833161-25267-2-git-send-email-cam@cs.ualberta.ca> <4B94C9B3.1060904@redhat.com> <8286e4ee1003080957v9bb4837x187cebb8477348c2@mail.gmail.com> <4B962301.3030008@redhat.com> <8286e4ee1003090724m1ef0b571g8b705a24e36e1753@mail.gmail.com> <8286e4ee1003090727j1d45e5dq3bc5d2ae89c354c@mail.gmail.com> <4B968521.7000208@redhat.com> <8286e4ee1003091034n236f1c07w6b121d76f138e706@mail.gmail.com> <4B9764A9.9050003@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: kvm@vger.kernel.org, qemu-devel@nongnu.org To: Avi Kivity Return-path: Received: from mail-gw0-f46.google.com ([74.125.83.46]:48667 "EHLO mail-gw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756856Ab0CJQg4 convert rfc822-to-8bit (ORCPT ); Wed, 10 Mar 2010 11:36:56 -0500 Received: by gwb15 with SMTP id 15so4261777gwb.19 for ; Wed, 10 Mar 2010 08:36:55 -0800 (PST) In-Reply-To: <4B9764A9.9050003@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, Mar 10, 2010 at 2:21 AM, Avi Kivity wrote: > On 03/09/2010 08:34 PM, Cam Macdonell wrote: >> >> On Tue, Mar 9, 2010 at 10:28 AM, Avi Kivity =A0wrote= : >> >>> >>> On 03/09/2010 05:27 PM, Cam Macdonell wrote: >>> >>>> >>>> >>>>> >>>>> >>>>>> >>>>>> =A0Registers are used >>>>>> for synchronization between guests sharing the same memory objec= t when >>>>>> interrupts are supported (this requires using the shared memory >>>>>> server). >>>>>> >>>>>> >>>>>> >>>>> >>>>> How does the driver detect whether interrupts are supported or no= t? >>>>> >>>>> >>>> >>>> At the moment, the VM ID is set to -1 if interrupts aren't support= ed, >>>> but that may not be the clearest way to do things. =A0With UIO is = there >>>> a way to detect if the interrupt pin is on? >>>> >>>> >>> >>> I suggest not designing the device to uio. =A0Make it a good >>> guest-independent >>> device, and if uio doesn't fit it, change it. >>> >>> Why not support interrupts unconditionally? =A0Is the device useful= without >>> interrupts? >>> >> >> Currently my patch works with or without the shared memory server. =A0= If >> you give the parameter >> >> -ivshmem 256,foo >> >> then this will create (if necessary) and map /dev/shm/foo as the >> shared region without interrupt support. =A0Some users of shared mem= ory >> are using it this way. >> >> Going forward we can require the shared memory server and always hav= e >> interrupts enabled. >> > > Can you explain how they synchronize? =A0Polling? =A0Using the networ= k? =A0Using > it as a shared cache? > > If it's a reasonable use case it makes sense to keep it. > Do you mean how they synchronize without interrupts? One project I've been contacted about uses the shared region directly for synchronization for simulations running in different VMs that share data in the memory region. In my tests spinlocks in the shared region work between guests. If we want to keep the serverless implementation, do we need to support shm_open with -chardev somehow? Something like -chardev shm,name=3Dfoo. Right now my qdev implementation just passes the name to the -device option and opens it. > Another thing comes to mind - a shared memory ID, in case a guest has > multiple cards. Sure, a number that can be passed on the command-line and stored in a r= egister? Cam