Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp111555pxb; Fri, 15 Jan 2021 08:42:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJwpxjBeHSnIaXkpDhE8YFu5+k672GgK7kWMXcH04Hv25+qxbxrx5tD0tvYtT73riXRR58D6 X-Received: by 2002:a05:6402:704:: with SMTP id w4mr2370922edx.237.1610728977863; Fri, 15 Jan 2021 08:42:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610728977; cv=none; d=google.com; s=arc-20160816; b=XcMrFqfqkO7J5eiXVYJ/1+G5nJ6POcFK4oeP//yTPPQMA/829KFcDYvol5yJ5+nDFd dpTmDYolZq0vEsq36VD9er+6kvSRNZFqudzWlEt4lX541yVZcqomRqPMpDiXKhmh3rWd TcABk+Qkj7RVJa7nIjrwcsVSgGPEtMUYRvrE3Cx7BB/1+j0eXNopcG1AOxmUb+dYutNr jDeYwO38TlZC0ASTedVHncLm8UGFloxaCVXvslR6woTR/PwiXaTuxPjPsKzRc4wXWOMA wBE0EKBTFoRPKiB8xo94NzmFvJUNTY6etppUK2A7XEeC4iqcc1CEbrrAKGAhTdGe6qUc Ylrg== 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:ironport-sdr:ironport-sdr; bh=+eIuBV3hglHYulsSJteLvFbahN53NveUfcAT/Yntjw8=; b=OvIdDGtTVOc5f+XoNpqfQOIn2ZvTlZo5P1PlI0o7IdCrBhWU5yGj27dt+MuI4NEIHc ww4Tky13DkrJJGqTjHgm9HICA197bcF562p8EfG9q1qelyYdAJKmRENaVeksMA4mRiMW tdkgInJ870/FXnd4GITEO0fLLoP6aDR3GkC33BATRIsAMgZVHes0rJgRKQ2OAaYugw7a ezhjkKQPgdtzjoPk5B7QGMiyzxBAmryYK6jNEucVlQcXB6X5dh5OGlNXxVEiWu8K6j4X DPKTvyYGONjwneVgapCPWoxdfHVT4qOmd/5X9+NFwZeJ/541ZfACImF6xY0g22s8ZHof 3oHA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b21si2890291ejk.520.2021.01.15.08.42.33; Fri, 15 Jan 2021 08:42:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727049AbhAOQle (ORCPT + 99 others); Fri, 15 Jan 2021 11:41:34 -0500 Received: from mga01.intel.com ([192.55.52.88]:47243 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726560AbhAOQle (ORCPT ); Fri, 15 Jan 2021 11:41:34 -0500 IronPort-SDR: X61q8rdyMaBJMgQGl8judovh7+fqShB3BxGyzrAn6o5dujqVj/CPg8fVHGFge5kW7uVOoeKOIc Br3XY1gCx+KQ== X-IronPort-AV: E=McAfee;i="6000,8403,9864"; a="197242510" X-IronPort-AV: E=Sophos;i="5.79,349,1602572400"; d="scan'208";a="197242510" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jan 2021 08:39:47 -0800 IronPort-SDR: RrEB2VPQ6fmVivwsyoWos3bubN3OdgSMLVj/pIs2xh2DeSGw07aXxNksiS65+g4n7oEugX9lyP uJmyM3VgL68w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,349,1602572400"; d="scan'208";a="354358704" Received: from zhangyu-optiplex-7040.bj.intel.com ([10.238.154.148]) by fmsmga008.fm.intel.com with ESMTP; 15 Jan 2021 08:39:45 -0800 From: Yu Zhang To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, seanjc@google.com, vkuznets@redhat.com, wanpengli@tencent.com, jmattson@google.com, joro@8bytes.org Subject: [PATCH] KVM: x86/MMU: Do not check unsync status for root SP. Date: Sat, 16 Jan 2021 08:21:00 +0800 Message-Id: <20210116002100.17339-1-yu.c.zhang@linux.intel.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In shadow page table, only leaf SPs may be marked as unsync. And for non-leaf SPs, we use unsync_children to keep the number of the unsynced children. In kvm_mmu_sync_root(), sp->unsync shall always be zero for the root SP, hence no need to check it. Signed-off-by: Yu Zhang --- arch/x86/kvm/mmu/mmu.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c index 6d16481a..1a6bb03 100644 --- a/arch/x86/kvm/mmu/mmu.c +++ b/arch/x86/kvm/mmu/mmu.c @@ -3412,8 +3412,7 @@ void kvm_mmu_sync_roots(struct kvm_vcpu *vcpu) * mmu_need_write_protect() describe what could go wrong if this * requirement isn't satisfied. */ - if (!smp_load_acquire(&sp->unsync) && - !smp_load_acquire(&sp->unsync_children)) + if (!smp_load_acquire(&sp->unsync_children)) return; spin_lock(&vcpu->kvm->mmu_lock); -- 1.9.1