From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=46173 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OBUuX-00065O-DZ for qemu-devel@nongnu.org; Mon, 10 May 2010 11:28:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OBUuR-0002Od-8H for qemu-devel@nongnu.org; Mon, 10 May 2010 11:28:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60930) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OBUuQ-0002OX-VL for qemu-devel@nongnu.org; Mon, 10 May 2010 11:28:43 -0400 Message-ID: <4BE82623.4000905@redhat.com> Date: Mon, 10 May 2010 18:28:35 +0300 From: Avi Kivity MIME-Version: 1.0 References: <1271872408-22842-1-git-send-email-cam@cs.ualberta.ca> <1271872408-22842-2-git-send-email-cam@cs.ualberta.ca> <1271872408-22842-3-git-send-email-cam@cs.ualberta.ca> <1271872408-22842-4-git-send-email-cam@cs.ualberta.ca> <1271872408-22842-5-git-send-email-cam@cs.ualberta.ca> <4BE7F517.5010707@redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH v5 4/5] Inter-VM shared memory PCI device List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Cam Macdonell Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org On 05/10/2010 06:22 PM, Cam Macdonell wrote: > >> >>> + >>> + /* if the position is -1, then it's shared memory region fd */ >>> + if (incoming_posn == -1) { >>> + >>> + s->num_eventfds = 0; >>> + >>> + if (check_shm_size(s, incoming_fd) == -1) { >>> + exit(-1); >>> + } >>> + >>> + /* creating a BAR in qemu_chr callback may be crazy */ >>> + create_shared_memory_BAR(s, incoming_fd); >>> >>> >> It probably is... why can't you create it during initialization? >> > This is for the shared memory server implementation, so the fd for the > shared memory has to be received (over the qemu char device) from the > server before the BAR can be created via qemu_ram_mmap() which adds > the necessary memory > > We could do the handshake during initialization. I'm worried that the device will appear without the BAR, and strange things will happen. But the chardev API is probably not geared for passing data during init. Anthony, any ideas? > Otherwise, if the BAR is allocated during initialization, I would have > to use MAP_FIXED to mmap the memory. This is what I did before the > qemu_ram_mmap() function was added. > What would happen to any data written to the BAR before the the handshake completed? I think it would disappear. So it's a good idea to make the initialization process atomic. -- error compiling committee.c: too many arguments to function