From mboxrd@z Thu Jan 1 00:00:00 1970 From: Barret Rhoden Subject: Re: [RFC PATCH] kvm: Use huge pages for DAX-backed files Date: Tue, 6 Nov 2018 16:05:53 -0500 Message-ID: <20181106160553.5a8025ed@gnomeregan.cam.corp.google.com> References: <20181029210716.212159-1-brho@google.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20181029210716.212159-1-brho-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-nvdimm-bounces-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org Sender: "Linux-nvdimm" To: Dan Williams , Dave Jiang , Ross Zwisler , Vishal Verma , Paolo Bonzini , Radim =?UTF-8?B?S3LEjW3DocWZ?= , Thomas Gleixner , Ingo Molnar , Borislav Petkov Cc: kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, yu.c.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org, linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org, x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, "H. Peter Anvin" , yi.z.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org List-Id: linux-nvdimm@lists.01.org On 2018-10-29 at 17:07 Barret Rhoden wrote: > Another issue is that kvm_mmu_zap_collapsible_spte() also uses > PageTransCompoundMap() to detect huge pages, but we don't have a way to > get the HVA easily. Can we just aggressively zap DAX pages there? Any thoughts about this? Is there a way to determine the HVA or GFN in this function: static bool kvm_mmu_zap_collapsible_spte(struct kvm *kvm, struct kvm_rmap_head *rmap_head) { u64 *sptep; struct rmap_iterator iter; int need_tlb_flush = 0; kvm_pfn_t pfn; struct kvm_mmu_page *sp; restart: for_each_rmap_spte(rmap_head, &iter, sptep) { sp = page_header(__pa(sptep)); pfn = spte_to_pfn(*sptep); /* * We cannot do huge page mapping for indirect shadow pages, * which are found on the last rmap (level = 1) when not using * tdp; such shadow pages are synced with the page table in * the guest, and the guest page table is using 4K page size * mapping if the indirect sp has level = 1. */ if (sp->role.direct && !kvm_is_reserved_pfn(pfn) && PageTransCompoundMap(pfn_to_page(pfn))) { pte_list_remove(rmap_head, sptep); need_tlb_flush = 1; goto restart; } } return need_tlb_flush; } If not, I was thinking of changing that loop to always remove PTEs for DAX mappings, with the understanding that they'll get faulted back in later. Ideally, we'd like to check if the page is huge, but DAX can't use the PageTransCompoundMap check. Thanks, Barret