From patchwork Mon Jun 11 15:18:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nitesh Lal X-Patchwork-Id: 10458397 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8F3A26020F for ; Mon, 11 Jun 2018 15:19:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7EE0328500 for ; Mon, 11 Jun 2018 15:19:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 70681284FF; Mon, 11 Jun 2018 15:19:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F0D96284FF for ; Mon, 11 Jun 2018 15:19:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932914AbeFKPTO (ORCPT ); Mon, 11 Jun 2018 11:19:14 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:34098 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932795AbeFKPTN (ORCPT ); Mon, 11 Jun 2018 11:19:13 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7FA7640BC064; Mon, 11 Jun 2018 15:19:12 +0000 (UTC) Received: from Dungeon.bos.redhat.com (dhcp-17-200.bos.redhat.com [10.18.17.200]) by smtp.corp.redhat.com (Postfix) with ESMTP id EF8B284441; Mon, 11 Jun 2018 15:19:11 +0000 (UTC) From: nilal@redhat.com To: kvm@vger.kernel.org, pbonzini@redhat.com, lcapitulino@redhat.com, pagupta@redhat.com, wei.w.wang@intel.com, yang.zhang.wz@gmail.com, riel@surriel.com, david@redhat.com, mst@redhat.com, dodgen@google.com, konrad.wilk@oracle.com, dhildenb@redhat.com Subject: [RFC][Patch V7 1/7] KVM: Support for guest page hinting Date: Mon, 11 Jun 2018 11:18:56 -0400 Message-Id: <20180611151902.14383-2-nilal@redhat.com> In-Reply-To: <20180611151902.14383-1-nilal@redhat.com> References: <20180611151902.14383-1-nilal@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Mon, 11 Jun 2018 15:19:12 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Mon, 11 Jun 2018 15:19:12 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'nilal@redhat.com' RCPT:'' Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Nitesh Narayan Lal This patch includes the following: 1. Basic skeleton for the support 2. Enablement of x86 platform to use the same Signed-off-by: Nitesh Narayan Lal --- arch/x86/Kbuild | 2 +- arch/x86/kvm/Kconfig | 6 ++++++ arch/x86/kvm/Makefile | 2 ++ include/linux/gfp.h | 7 +++++++ 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/arch/x86/Kbuild b/arch/x86/Kbuild index 0038a2d..7d39d7d 100644 --- a/arch/x86/Kbuild +++ b/arch/x86/Kbuild @@ -2,7 +2,7 @@ obj-y += entry/ obj-$(CONFIG_PERF_EVENTS) += events/ -obj-$(CONFIG_KVM) += kvm/ +obj-$(subst m,y,$(CONFIG_KVM)) += kvm/ # Xen paravirtualization support obj-$(CONFIG_XEN) += xen/ diff --git a/arch/x86/kvm/Kconfig b/arch/x86/kvm/Kconfig index 92fd433..e8b1291 100644 --- a/arch/x86/kvm/Kconfig +++ b/arch/x86/kvm/Kconfig @@ -96,6 +96,12 @@ config KVM_MMU_AUDIT This option adds a R/W kVM module parameter 'mmu_audit', which allows auditing of KVM MMU events at runtime. +config KVM_FREE_PAGE_HINTING + def_bool y + depends on KVM + select VIRTIO + select VIRTIO_BALLOON + # OK, it's a little counter-intuitive to do this, but it puts it neatly under # the virtualization menu. source drivers/vhost/Kconfig diff --git a/arch/x86/kvm/Makefile b/arch/x86/kvm/Makefile index dc4f2fd..866dd56 100644 --- a/arch/x86/kvm/Makefile +++ b/arch/x86/kvm/Makefile @@ -16,6 +16,8 @@ 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 \ hyperv.o page_track.o debugfs.o +obj-$(CONFIG_KVM_FREE_PAGE_HINTING) += $(KVM)/page_hinting.o + kvm-intel-y += vmx.o pmu_intel.o kvm-amd-y += svm.o pmu_amd.o diff --git a/include/linux/gfp.h b/include/linux/gfp.h index a6afcec..72cd41b 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -439,6 +439,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