On Thu, Mar 16, 2017 at 11:25:36PM +0100, Paolo Bonzini wrote: > The kvmclock memory is initially zero so there is no need for the > hypervisor to allocate anything; the point of these patches is just to > access the data in a natural way from Linux source code. I realize that. > I also don't really like the patch as is (plus it fails modpost), but > IMO reusing __change_page_attr and __split_large_page is the right thing > to do. Right, so teaching pageattr.c about memblock could theoretically come around and bite us later when a page allocated with memblock gets freed with free_page(). And looking at this more, we have all this kernel pagetable preparation code down the init_mem_mapping() call and the pagetable setup in arch/x86/mm/init_{32,64}.c And that code even does some basic page splitting. Oh and it uses alloc_low_pages() which knows whether to do memblock reservation or the common __get_free_pages() when slabs are up. So what would be much cleaner, IMHO, is if one would reuse that code to change init_mm.pgd mappings early without copying pageattr.c. init_mem_mapping() gets called before kvm_guest_init() in setup_arch() so the guest would simply fixup its pagetable right there. -- Regards/Gruss, Boris. SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg) --