On 2012-06-13 13:27, Christian Borntraeger wrote: > On 13/06/12 12:58, Jan Kiszka wrote: >>> Thinking about this a bit more, how about >>> >>> } else if (!kvm_arch_vmalloc(size, &new_block->host)) { >>> <normal code> >>> } >>> > > I like that. Of course, we have to have a generic kvm_arch_vmalloc > implementation > then.
Then better go for kvm_vmalloc calling kvm_arch_vmalloc (in the s390 case). However, I do not like the variation of parameters and return value compared to normal *alloc. Better: memory = kvm_vmalloc(size); if (!memory) memory = qemu_vmalloc(size); But more regular (when looking at the Xen block) is guarding the call with kvm_enabled() and embedding qemu_vmalloc in kvm_vmalloc. > >>> Then the arch specific code could do the check and the implementation of >>> vmalloc, but only has to return -1 if we don't need it and things still >>> fall back to the generic code. >> >> But you would have to walk a while to find out that only s390x on (old) >> KVM actually returns success here and does some allocation. > > > It that such a problem? What about adding a comment then, otherwise we just > use ifdef as a comment, which isnt nice either. Any kind of comment is definitely a good idea. Jan -- Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux