From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D5FBC43331 for ; Mon, 11 Nov 2019 22:12:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3E16B2173B for ; Mon, 11 Nov 2019 22:12:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727047AbfKKWMb (ORCPT ); Mon, 11 Nov 2019 17:12:31 -0500 Received: from mga03.intel.com ([134.134.136.65]:2932 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726924AbfKKWMa (ORCPT ); Mon, 11 Nov 2019 17:12:30 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Nov 2019 14:12:30 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,294,1569308400"; d="scan'208";a="287302344" Received: from sjchrist-coffee.jf.intel.com ([10.54.74.41]) by orsmga001.jf.intel.com with ESMTP; 11 Nov 2019 14:12:29 -0800 From: Sean Christopherson To: Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= Cc: Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Adam Borowski , David Hildenbrand , Dan Williams Subject: [PATCH v2 2/3] KVM: x86/mmu: Remove superfluous is_error_pfn() check from THP adjust Date: Mon, 11 Nov 2019 14:12:28 -0800 Message-Id: <20191111221229.24732-3-sean.j.christopherson@intel.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191111221229.24732-1-sean.j.christopherson@intel.com> References: <20191111221229.24732-1-sean.j.christopherson@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Replace the is_error_noslot_pfn() check in transparent_hugepage_adjust() with an is_noslot_pfn() check. thp_adjust() cannot be reached with an error pfn as it is always called after handle_abnormal_pfn(), which aborts the page fault handler if an error pfn is encountered. Don't bother future proofing thp_adjust() with a WARN on is_error_pfn(), as calling thp_adjust() before handle_abnormal_pfn() is impossible for all intents and purposes, e.g. thp_adjust() relies on being called after mmu_notifier_retry() and while holding mmu_lock, thus moving it would essentially require a complete rewrite of KVM's page fault handlers. No functional change intended. Reported-by: Paolo Bonzini Signed-off-by: Sean Christopherson --- arch/x86/kvm/mmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index bf82b1f2e834..c35c6fb2635a 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -3305,7 +3305,7 @@ static void transparent_hugepage_adjust(struct kvm_vcpu *vcpu, * PT_PAGE_TABLE_LEVEL and there would be no adjustment done * here. */ - if (!is_error_noslot_pfn(pfn) && !kvm_is_reserved_pfn(pfn) && + if (!is_noslot_pfn(pfn) && !kvm_is_reserved_pfn(pfn) && !kvm_is_zone_device_pfn(pfn) && level == PT_PAGE_TABLE_LEVEL && PageTransCompoundMap(pfn_to_page(pfn)) && !mmu_gfn_lpage_is_disallowed(vcpu, gfn, PT_DIRECTORY_LEVEL)) { -- 2.24.0