|
| From: | Paolo Bonzini |
| Subject: | [Qemu-devel] Re: [PATCH 1/9] Export function for VA defined ram allocation |
| Date: | Wed, 21 Oct 2009 20:42:08 +0200 |
| User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.4pre) Gecko/20091014 Fedora/3.0-2.8.b4.fc11 Lightning/1.0pre Thunderbird/3.0b4 |
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
| [Prev in Thread] | Current Thread | [Next in Thread] |