From patchwork Tue Apr 14 05:51:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wanpeng Li X-Patchwork-Id: 6213831 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4FA599F443 for ; Tue, 14 Apr 2015 06:10:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 979B320117 for ; Tue, 14 Apr 2015 06:10:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BC6D0200FF for ; Tue, 14 Apr 2015 06:10:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751349AbbDNGJy (ORCPT ); Tue, 14 Apr 2015 02:09:54 -0400 Received: from mga09.intel.com ([134.134.136.24]:4855 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750992AbbDNGJx (ORCPT ); Tue, 14 Apr 2015 02:09:53 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP; 13 Apr 2015 23:09:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,574,1422950400"; d="scan'208";a="694868521" Received: from kernel.bj.intel.com ([10.238.154.51]) by fmsmga001.fm.intel.com with ESMTP; 13 Apr 2015 23:09:50 -0700 From: Wanpeng Li To: Paolo Bonzini Cc: Andres Lagar-Cavilla , Xiao Guangrong , Eric Northup , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Wanpeng Li Subject: [PATCH 1/2] kvm: mmu: fix catch transparent huge page backing Date: Tue, 14 Apr 2015 13:51:29 +0800 Message-Id: <1428990690-20119-1-git-send-email-wanpeng.li@linux.intel.com> X-Mailer: git-send-email 1.9.1 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP PageTransCompound() can't guarantee the page is a transparent huge page since it returns true for both transparent huge and hugetlbfs pages. This patch fixes it by checking the page is also !hugetlbfs page. Signed-off-by: Wanpeng Li --- arch/x86/kvm/mmu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 146f295..2a0d77e 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -4487,7 +4487,8 @@ static bool kvm_mmu_zap_collapsible_spte(struct kvm *kvm, */ if (sp->role.direct && !kvm_is_reserved_pfn(pfn) && - PageTransCompound(pfn_to_page(pfn))) { + !PageHuge(pfn_to_page(pfn)) && + PageTransHuge(pfn_to_page(pfn))) { drop_spte(kvm, sptep); sptep = rmap_get_first(*rmapp, &iter); need_tlb_flush = 1;