Message ID | 20171010183923.7982-2-nilal@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi Nitesh,
[auto build test ERROR on kvm/linux-next]
[also build test ERROR on v4.14-rc4 next-20171012]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/nilal-redhat-com/KVM-Guest-page-hinting/20171013-181927
base: https://git.kernel.org/pub/scm/virt/kvm/kvm.git linux-next
config: powerpc-defconfig (attached as .config)
compiler: powerpc64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=powerpc
All errors (new ones prefixed by >>):
mm/page_alloc.o: In function `.post_alloc_hook':
(.text+0x3090): undefined reference to `.arch_alloc_page'
mm/page_alloc.o: In function `.get_page_from_freelist':
>> page_alloc.c:(.text+0x5404): undefined reference to `.arch_alloc_page'
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Hi Nitesh,
[auto build test ERROR on kvm/linux-next]
[also build test ERROR on v4.14-rc4 next-20171012]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/nilal-redhat-com/KVM-Guest-page-hinting/20171013-181927
base: https://git.kernel.org/pub/scm/virt/kvm/kvm.git linux-next
config: x86_64-kexec (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
All errors (new ones prefixed by >>):
mm/page_alloc.o: In function `__free_pages_ok':
>> page_alloc.c:(.text+0xfbb): undefined reference to `arch_free_page'
mm/page_alloc.o: In function `post_alloc_hook':
page_alloc.c:(.text+0x1d19): undefined reference to `arch_alloc_page'
mm/page_alloc.o: In function `free_hot_cold_page':
page_alloc.c:(.text+0x2b36): undefined reference to `arch_free_page'
mm/page_alloc.o: In function `get_page_from_freelist':
page_alloc.c:(.text+0x3aa1): undefined reference to `arch_alloc_page'
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
diff --git a/arch/x86/kvm/Makefile b/arch/x86/kvm/Makefile index 09d4b17..6f7c382 100644 --- a/arch/x86/kvm/Makefile +++ b/arch/x86/kvm/Makefile @@ -10,6 +10,7 @@ KVM := ../../../virt/kvm kvm-y += $(KVM)/kvm_main.o $(KVM)/coalesced_mmio.o \ $(KVM)/eventfd.o $(KVM)/irqchip.o $(KVM)/vfio.o kvm-$(CONFIG_KVM_ASYNC_PF) += $(KVM)/async_pf.o +kvm-$(CONFIG_KVM_FREE_PAGE_HINTING) += $(KVM)/page_hinting.o kvm-y += x86.o mmu.o emulate.o i8259.o irq.o lapic.o \ i8254.o ioapic.o irq_comm.o cpuid.o pmu.o mtrr.o \ diff --git a/include/linux/gfp.h b/include/linux/gfp.h index f780718..a74371f 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -452,6 +452,13 @@ static inline struct zonelist *node_zonelist(int nid, gfp_t flags) return NODE_DATA(nid)->node_zonelists + gfp_zonelist(flags); } +#ifdef CONFIG_KVM_FREE_PAGE_HINTING +#define HAVE_ARCH_ALLOC_PAGE +#define HAVE_ARCH_FREE_PAGE +void arch_free_page(struct page *page, int order); +void arch_alloc_page(struct page *page, int order); +#endif + #ifndef HAVE_ARCH_FREE_PAGE static inline void arch_free_page(struct page *page, int order) { } #endif diff --git a/virt/kvm/Kconfig b/virt/kvm/Kconfig index b0cc1a3..57f1c7b 100644 --- a/virt/kvm/Kconfig +++ b/virt/kvm/Kconfig @@ -50,3 +50,7 @@ config KVM_COMPAT config HAVE_KVM_IRQ_BYPASS bool + +config KVM_FREE_PAGE_HINTING + def_bool m + depends on KVM diff --git a/virt/kvm/page_hinting.c b/virt/kvm/page_hinting.c new file mode 100644 index 0000000..39d2b1d --- /dev/null +++ b/virt/kvm/page_hinting.c @@ -0,0 +1,46 @@ +#include <linux/gfp.h> +#include <linux/mm.h> +#include <linux/page_ref.h> +#include <linux/kvm_host.h> +#include <linux/sort.h> + +#include <trace/events/kvm.h> + +#define MAX_FGPT_ENTRIES 1000 +#define HYPERLIST_THRESHOLD 500 +/* + * struct kvm_free_pages - Tracks the pages which are freed by the guest. + * @pfn - page frame number for the page which is to be freed + * @pages - number of pages which are supposed to be freed. + * A global array object is used to hold the list of pfn and number of pages + * which are freed by the guest. This list may also have fragmentated pages so + * defragmentation is a must prior to the hypercall. + */ +struct kvm_free_pages { + unsigned long pfn; + unsigned int pages; +}; + +/* + * hypervisor_pages - It is a dummy structure passed with the hypercall. + * @pfn - page frame number for the page which is to be freed. + * @pages - number of pages which are supposed to be freed. + * A global array object is used to to hold the list of pfn and pages and is + * passed as part of the hypercall. + */ +struct hypervisor_pages { + unsigned long pfn; + unsigned int pages; +}; + +DEFINE_PER_CPU(struct kvm_free_pages [MAX_FGPT_ENTRIES], kvm_pt); +DEFINE_PER_CPU(int, kvm_pt_idx); +struct hypervisor_pages hypervisor_pagelist[MAX_FGPT_ENTRIES]; + +void arch_alloc_page(struct page *page, int order) +{ +} + +void arch_free_page(struct page *page, int order) +{ +}