From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:48907) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S7r32-00005X-Ud for qemu-devel@nongnu.org; Wed, 14 Mar 2012 12:27:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S7r2e-0007zA-EG for qemu-devel@nongnu.org; Wed, 14 Mar 2012 12:27:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51540) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S7r2e-0007yc-6O for qemu-devel@nongnu.org; Wed, 14 Mar 2012 12:27:12 -0400 Date: Wed, 14 Mar 2012 18:27:04 +0200 From: Gleb Natapov Message-ID: <20120314162704.GK2304@redhat.com> References: <4F5F29CE.70806@suse.de> <4F604FF9.8010403@cn.fujitsu.com> <4F6058BE.4060403@redhat.com> <20120314134959.GC14227@dhcp-192-168-178-175.profitbricks.localdomain> <20120314152324.GF2304@redhat.com> <4F60BA15.90506@codemonkey.ws> <20120314153529.GG2304@redhat.com> <4F60BC7A.9000504@codemonkey.ws> <20120314155409.GI2304@redhat.com> <4F60BFDB.40302@codemonkey.ws> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4F60BFDB.40302@codemonkey.ws> Subject: Re: [Qemu-devel] [PATCH 2/7] Convert pc cpu to qdev List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Lai Jiangshan , Jan Kiszka , "qemu-devel@nongnu.org" , Vasilis Liaskovitis , Igor Mammedov , Andreas =?utf-8?Q?F=C3=A4rber?= On Wed, Mar 14, 2012 at 10:57:15AM -0500, Anthony Liguori wrote: > On 03/14/2012 10:54 AM, Gleb Natapov wrote: > >On Wed, Mar 14, 2012 at 10:42:50AM -0500, Anthony Liguori wrote: > >> > >>There's still a few places in QEMU that assume that > >>qemu_ram_get_ptr() returns a pointer that's good indefinitely. > >> > >>We also don't have a mechanism to revoke cpu_physical_map() > >>pointers. Maybe the answer is reference counting and relying on > >>being able to eventually release the memory... Of course, then an > >>unplug followed by an immediate plug would be complicated. > >> > >Hmm, Avi assured me that with the memory API rework it should be easy :( > >grep founds nothing about qemu_ram_get_ptr() and cpu_physical_map() > >though. What should I look for? > > memory_region_get_ptr() and cpu_memory_physical_map(). > cpu_physical_memory_map() and qemu_get_ram_ptr() (called only via memory_region_get_ram_ptr() by device model). According to qemu_get_ram_ptr() comment it should be used only to access device memory, not RAM (it is also used in softmmu code, but lets leave this for now :)). cpu_physical_memory_map() is used for DMA. When guest confirms memory removal by calling _EJ() ACPI methods no DMA should be directed to that memory slot. We can refcount slot during map/unmap and do not remove a slot it refcount > 0, or we can kill guest if this happens. That what real HW would do. -- Gleb.