Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp316571pxb; Thu, 7 Apr 2022 06:32:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwqe/5f0Gwdzmboua7HEHFUDseLdoyHkC6THfe5ZZpw9SXp3O/nEdY+lXrcMUtsFjFv2kZb X-Received: by 2002:a17:903:110f:b0:154:c7a4:9371 with SMTP id n15-20020a170903110f00b00154c7a49371mr14044766plh.75.1649338347227; Thu, 07 Apr 2022 06:32:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649338347; cv=none; d=google.com; s=arc-20160816; b=KLiMgxP/MwygU2iGY0kD77pLO4lQB6BfUsRtsOPBzW9g8C0IJPen6nIaxVsyzktbj4 VRnPSUgoCOu8lKYagqvdcQ6cYNOVlASGGYVmhNXTJrd7FNMLD/7aWEMF8iZV4196M0Ys GOGGrbqyRzZ//phPZsA4gcY1Bhoj5RptrsDgvtknncVDkva7oOZ1u0nT+7ctg36Im5Up lqAzwCQ4VYxWrF0Y4iZPIv6HsmlJzYsihRRXLiXdVRPt7N/YjMiYiZSA+nIZO7JiRXQ8 0+5MNRhTsIrTnfLmO6QopX5rZFkAAY5aQzriNwLFI/zUpWIdVhpWPFv5agQEmAPCRGG6 ytOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=1elD0kK+vkQlTZi1siPqVVntNQOt4VPToa3I5GzjiIc=; b=lFd2Yt5PPR4o5SG984F3StYYl44wzUW8PrkvnEsjlQpeSwTF2g5ZYhk44aNzQcNXk9 qI18phkfU8+Q2vEFtTbEow6nqE0PXUMi9oeZWdib5s9fUIuMU/V3Q+uxT80xzbQda9xC 1ekeScN8o2e1+HQbWJh9fZJOThp2ae9OkCTaQEoyY1jZLezYvSLpfnDTD047dZKAnjHU Zl/crnrF2E7BfBLgahAG7bVqi2FGmeX0qKha7G4kEp9bKJlXYOcoCiFoOoS2mTHqEndR 7ao9plsgqFqMWf+uiG0ytS6Yn2ASRDyMG53EwCdxyV5nJ2vlITYe8ffvag+yrd8bw3xl Pmgw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 207-20020a6307d8000000b0039905cd17c7si13540345pgh.437.2022.04.07.06.32.10; Thu, 07 Apr 2022 06:32:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237848AbiDGCUW (ORCPT + 99 others); Wed, 6 Apr 2022 22:20:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236780AbiDGCUR (ORCPT ); Wed, 6 Apr 2022 22:20:17 -0400 X-Greylist: delayed 2169 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Wed, 06 Apr 2022 19:18:13 PDT Received: from spam.unicloud.com (smgmail.unic2.com.cn [220.194.70.58]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9932E329B8; Wed, 6 Apr 2022 19:18:11 -0700 (PDT) Received: from spam.unicloud.com (localhost [127.0.0.2] (may be forged)) by spam.unicloud.com with ESMTP id 2371g3vt034159; Thu, 7 Apr 2022 09:42:03 +0800 (GMT-8) (envelope-from luofei@unicloud.com) Received: from eage.unicloud.com ([220.194.70.35]) by spam.unicloud.com with ESMTP id 2371eVLN032798; Thu, 7 Apr 2022 09:40:31 +0800 (GMT-8) (envelope-from luofei@unicloud.com) Received: from localhost.localdomain (10.10.1.7) by zgys-ex-mb09.Unicloud.com (10.10.0.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2375.17; Thu, 7 Apr 2022 09:40:30 +0800 From: luofei To: , , , , CC: , , , , , , , , , luofei Subject: [PATCH] KVM: x86/mmu: remove unnecessary kvm_shadow_root_allocated() check Date: Wed, 6 Apr 2022 21:40:16 -0400 Message-ID: <20220407014016.1266469-1-luofei@unicloud.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.10.1.7] X-ClientProxiedBy: zgys-ex-mb06.Unicloud.com (10.10.0.52) To zgys-ex-mb09.Unicloud.com (10.10.0.24) X-DNSRBL: X-MAIL: spam.unicloud.com 2371g3vt034159 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When we reach here, the return value of kvm_shadow_root_allocated() has already been checked to false under kvm->slots_arch_lock. So remove the unnecessary recheck. Signed-off-by: luofei --- arch/x86/kvm/mmu/mmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c index 8f19ea752704..1978ee527298 100644 --- a/arch/x86/kvm/mmu/mmu.c +++ b/arch/x86/kvm/mmu/mmu.c @@ -3394,7 +3394,7 @@ static int mmu_first_shadow_root_alloc(struct kvm *kvm) * Check if anything actually needs to be allocated, e.g. all metadata * will be allocated upfront if TDP is disabled. */ - if (kvm_memslots_have_rmaps(kvm) && + if (!is_tdp_mmu_enabled(kvm) && kvm_page_track_write_tracking_enabled(kvm)) goto out_success; -- 2.27.0