Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4049669pxb; Tue, 26 Jan 2021 11:02:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJzOQ5eJ9OopVnq9IwOYm1ecmUTBy/Fnq6zBGeWjnk3NwpjQC5FpncGGGh7/cYMU2rybLMcw X-Received: by 2002:a17:906:3ce:: with SMTP id c14mr4481357eja.497.1611687726351; Tue, 26 Jan 2021 11:02:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611687726; cv=none; d=google.com; s=arc-20160816; b=bN1YYaRF+TaYk8CZLm2XZ7BtAzP3ndRzBAa2hbT3Gl3xFIDxzHMRmGqCe4/QdZ94Hf 38al7cLc7tKgsFstRi+TKXxIMqufe+qxWIH0nEw533+tUWLwErgweSXwPzn4Q5Ankf4V yXI7B8se+t9TBDgD1uVO0ojnY13z2hm9h54xTP8txEK9pvo9fBup1pvg2vHla/FW4iYO g4UgfCKnrMOhX261P/4roeHO7lFpDF+GOWJrb4yy9UJ08JtrjcVVdy8CUQP8vqCs0aNk xtOgZxNl8PdnMqiqARrbCPRVxgOdb/xT+QiaOsh+NL3Xjg2qQp74O18Vqy7n9DUEkp74 01CQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=+FfUC8pPpfdQVvhEBkqdD27/fzBCKp42GUzkMusueU4=; b=QQ23kVElh5LYIqwYiaJVR1NSX/9LegBTZrsJzcXMWy3eiCdiaa51M6v1oQjEdUr7r1 YCvrCM/40VE7lpvJBfZ0xjQwJV0cRMT4N/NnP4fxlWqI+Kd+LfWhPNDIrLvrKkwhKIdr MJiPglc0nUvN7ocNCKbjUS7PKMzAbk1ZJDSebGjM9E4Eg+EMFqaWgclAx5EwXhwA1MXT W18pRI2yReoVRsu/AKi4c/1mFI9rfqS4rO4bqbH5afvOeStexBSKIzG9zlebXrXcgbvw Y3VFZ9GM87IMkhm2MHpnPcENxBC7KrmoeAFyrWRmw6/vV8Pt1K6FeGOEv/y5Jvao8YNo zWdw== 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 gy4si1958394ejb.4.2021.01.26.11.01.40; Tue, 26 Jan 2021 11:02:06 -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 S2404982AbhAZNrt (ORCPT + 99 others); Tue, 26 Jan 2021 08:47:49 -0500 Received: from mga02.intel.com ([134.134.136.20]:7861 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405244AbhAZNrY (ORCPT ); Tue, 26 Jan 2021 08:47:24 -0500 IronPort-SDR: p9W/ZFS9zMtBBroU7k4wgd5u3b8RADYlSvDJBo98YTg3lcwDAG5mFs/yRKiAkJ92xxaIbc2LtG 3ZJcRCyWwduQ== X-IronPort-AV: E=McAfee;i="6000,8403,9875"; a="167000998" X-IronPort-AV: E=Sophos;i="5.79,375,1602572400"; d="scan'208";a="167000998" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jan 2021 05:45:38 -0800 IronPort-SDR: UC2V7B//+ecyvrs0PY7ylxbVBW9iLV8zAt9QDO7mFxVVVu+XeGwYluE2DT8SOF+J2rQe0ughHi 8qrtw7HOVSjQ== X-IronPort-AV: E=Sophos;i="5.79,375,1602572400"; d="scan'208";a="387831564" Received: from haotongw-mobl2.ccr.corp.intel.com (HELO localhost) ([10.255.28.153]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jan 2021 05:45:35 -0800 Date: Tue, 26 Jan 2021 21:45:31 +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: Re: [PATCH] KVM: x86/MMU: Do not check unsync status for root SP. Message-ID: <20210126134531.ctj326k3xwvmniwd@linux.intel.com> References: <20210116002100.17339-1-yu.c.zhang@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210116002100.17339-1-yu.c.zhang@linux.intel.com> User-Agent: NeoMutt/20171215 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Paolo, Any comments? Thanks! B.R. Yu On Sat, Jan 16, 2021 at 08:21:00AM +0800, Yu Zhang wrote: > 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 >