From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N0g8o-00042P-Jh for qemu-devel@nongnu.org; Wed, 21 Oct 2009 14:42:34 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N0g8i-0003zf-VS for qemu-devel@nongnu.org; Wed, 21 Oct 2009 14:42:33 -0400 Received: from [199.232.76.173] (port=42824 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N0g8i-0003zb-Qs for qemu-devel@nongnu.org; Wed, 21 Oct 2009 14:42:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:3872) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1N0g8h-0001kj-J0 for qemu-devel@nongnu.org; Wed, 21 Oct 2009 14:42:28 -0400 Message-ID: <4ADF5600.2070500@redhat.com> Date: Wed, 21 Oct 2009 20:42:08 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1256117106-9475-1-git-send-email-agraf@suse.de> <1256117106-9475-2-git-send-email-agraf@suse.de> <4ADF1AE4.8020004@codemonkey.ws> <4ADF3CB5.9090700@codemonkey.ws> <80C7ACF1-A6F3-4212-8AFB-E97C23C98218@suse.de> <4ADF4DAA.1030501@codemonkey.ws> In-Reply-To: <4ADF4DAA.1030501@codemonkey.ws> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH 1/9] Export function for VA defined ram allocation List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Carsten Otte , Alexander Graf , qemu-devel On 10/21/2009 08:06 PM, Anthony Liguori wrote: > Alexander Graf wrote: >> So you would prefer a special #ifdef for s390 in generic code over a >> specifically for this purpose exported function? >> >> Well, you're the boss. I like the special function better, but >> whatever you say. > > How is someone supposed to figure out what _qemu_ram_alloc is for? > Nothing in your patch really indicates that. > > However, an ugly #ifdef immediately tells someone, oh, s390 kvm needs > this terrible hack, so let's keep bugging those guys to eliminate the > need for that. What about this: -ram_addr_t qemu_ram_alloc(ram_addr_t size) +ram_addr_t qemu_ram_alloc_at(ram_addr_t size, void *map_at) { RAMBlock *new_block; size = TARGET_PAGE_ALIGN(size); new_block = qemu_malloc(sizeof(*new_block)); - new_block->host = qemu_vmalloc(size); + if (map_at) { + new_block->host = map_at; + } else { + new_block->host = qemu_vmalloc(size); + } #ifdef MADV_MERGEABLE madvise(new_block->host, size, MADV_MERGEABLE); #endif and calling mmap where you're currently calling _qemu_ram_alloc? Paolo