Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp175722pxk; Wed, 2 Sep 2020 18:26:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzVQqSFwqI5/w2FCsGuAH0zzCTNlfQhVAaMDcfMGLDVagQZJc6yR6DJeb/33yIkqjd3ikkZ X-Received: by 2002:a17:906:c447:: with SMTP id ck7mr908439ejb.358.1599096384059; Wed, 02 Sep 2020 18:26:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599096384; cv=none; d=google.com; s=arc-20160816; b=rP/h+VL3Jjn1E29fMDx7pqp9WL+KDipmFsly0PJ7MrrAHPv2YrNpGS/wXce7biZCTc 6U16MlEgL6cOFg842cQZ/U+Qc38sOLWZ2qnqOthp7KgtOFvdpJxIZHtZmIBzb//yz7u0 FvaeR7prAqyPL4JWQIaQo35+MYHhGWu092wEL+3zvf3ZqhmnrRS/L7htKU3pvbuX3+oG yg9CQezgn+UWPAtnoFQCinI6Hy5AoTWCx3Nj26g1ckonWbrN1JPqD1SkURvvKLzMgr5g /qm7H7NJMHx4JcaOp8zCs9/+eDwDsMVbJyT/ICMC1zJMQuTvo8H9g5pIz/jFNIq9JtYU pZXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:ironport-sdr:ironport-sdr; bh=w94fo6A+U7EL8YrDE55VQ4++a3UcK+3COImoMIL6Ohw=; b=xqbncqP3E3mphacStIIEdtsCr5rcHN724y5V8yTEDnhJPHeeJjbRUQ67D4d2+abGS7 gabj5Pycs0xR4c1qjhFQUxWIhbeDtzFoQBWovVjDPxpHdeYqcpm5m1YbK0TmJCKZH2Ox Tj9+XBmsrKnSLaEnnpFITOQaH5GMAk3UruGEQEQF8A1c+5fL6YjHjcyV5xVhrL7KhmSv hvskV7+63mBCZ5n98tGIrX11mwWn+C5W1cVBIjCO7FhSIm9mJuNExqeyVMdgcfnIouVB 8micDm1Z35bjxYRRp2StMiPYn4L80YixIDlxe7doBn0PkokgV0JE97T3OjnDk+GiTBQg BpBQ== 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 s22si622110edt.207.2020.09.02.18.26.00; Wed, 02 Sep 2020 18:26:24 -0700 (PDT) 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 S1727933AbgICBW2 (ORCPT + 99 others); Wed, 2 Sep 2020 21:22:28 -0400 Received: from mga12.intel.com ([192.55.52.136]:36153 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727065AbgICBW2 (ORCPT ); Wed, 2 Sep 2020 21:22:28 -0400 IronPort-SDR: Gqt90s+Jo6MUhApI3q7ht14pitqZW/TA76WHUSPGY1JWFI509zcefWNN7uuHSW2cO1QErf3zVb n8nQay56Ji4w== X-IronPort-AV: E=McAfee;i="6000,8403,9732"; a="137021365" X-IronPort-AV: E=Sophos;i="5.76,384,1592895600"; d="scan'208";a="137021365" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Sep 2020 18:22:27 -0700 IronPort-SDR: fb6E8nq0cilRzQCk73cJ19JBm1IlpMEVdQP8pS0Z3LXavCslpx/43u8vaB8IBe4/7Gfi7Wp7aF iRS8V5zd6+tw== X-IronPort-AV: E=Sophos;i="5.76,384,1592895600"; d="scan'208";a="302034350" Received: from sjchrist-ice.jf.intel.com (HELO sjchrist-ice) ([10.54.31.34]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Sep 2020 18:22:26 -0700 Date: Wed, 2 Sep 2020 18:22:25 -0700 From: Sean Christopherson To: Vitaly Kuznetsov Cc: Lai Jiangshan , linux-kernel@vger.kernel.org, Lai Jiangshan , Paolo Bonzini , Wanpeng Li , Jim Mattson , Joerg Roedel , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" , kvm@vger.kernel.org Subject: Re: [PATCH V2] kvm x86/mmu: use KVM_REQ_MMU_SYNC to sync when needed Message-ID: <20200903012224.GL11695@sjchrist-ice> References: <87y2ltx6gl.fsf@vitty.brq.redhat.com> <20200902135421.31158-1-jiangshanlai@gmail.com> <871rjkp8rc.fsf@vitty.brq.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <871rjkp8rc.fsf@vitty.brq.redhat.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 02, 2020 at 04:12:55PM +0200, Vitaly Kuznetsov wrote: > Lai Jiangshan writes: > > > From: Lai Jiangshan > > > > When kvm_mmu_get_page() gets a page with unsynced children, the spt > > pagetable is unsynchronized with the guest pagetable. But the > > guest might not issue a "flush" operation on it when the pagetable > > entry is changed from zero or other cases. The hypervisor has the > > responsibility to synchronize the pagetables. > > > > The linux kernel behaves as above for many years, But > > 8c8560b83390("KVM: x86/mmu: Use KVM_REQ_TLB_FLUSH_CURRENT for MMU specific flushes) > > Nit: checkpatch.pl complains here with > > ERROR: Please use git commit description style 'commit <12+ chars of > sha1> ("")' - ie: 'commit 8c8560b83390 ("KVM: x86/mmu: Use > KVM_REQ_TLB_FLUSH_CURRENT for MMU specific flushes")' > #118: > 8c8560b83390("KVM: x86/mmu: Use KVM_REQ_TLB_FLUSH_CURRENT for MMU specific flushes) Definitely needs a Fixes: 8c8560b83390("KVM: x86/mmu: Use KVM_REQ_TLB_FLUSH_CURRENT for MMU specific flushes) At that point I'd just have the changelog say "a recent commit". > > inadvertently included a line of code to change it without giving any > > reason in the changelog. It is clear that the commit's intention was to > > change KVM_REQ_TLB_FLUSH -> KVM_REQ_TLB_FLUSH_CURRENT, so we don't > > unneedlesly flush other contexts but one of the hunks changed > > nearby KVM_REQ_MMU_SYNC instead. > > > > The this patch changes it back. > > > > Link: https://lore.kernel.org/lkml/20200320212833.3507-26-sean.j.christopherson@intel.com/ > > Cc: Sean Christopherson <sean.j.christopherson@intel.com> > > Cc: Vitaly Kuznetsov <vkuznets@redhat.com> > > Signed-off-by: Lai Jiangshan <laijs@linux.alibaba.com> > > --- > > Changed from v1: > > update patch description > > > > 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 4e03841f053d..9a93de921f2b 100644 > > --- a/arch/x86/kvm/mmu/mmu.c > > +++ b/arch/x86/kvm/mmu/mmu.c > > @@ -2468,7 +2468,7 @@ static struct kvm_mmu_page *kvm_mmu_get_page(struct kvm_vcpu *vcpu, > > } > > > > if (sp->unsync_children) > > - kvm_make_request(KVM_REQ_TLB_FLUSH_CURRENT, vcpu); > > + kvm_make_request(KVM_REQ_MMU_SYNC, vcpu); > > > > __clear_sp_write_flooding_count(sp); > > FWIW, > > Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com> > > but it'd be great to hear from Sean). I got nothing, AFAICT I was simply overzealous. Reviewed-by: Sean Christopherson <sean.j.christopherson@intel.com>