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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70B5AC433EF for ; Fri, 25 Mar 2022 11:15:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355220AbiCYLRG (ORCPT ); Fri, 25 Mar 2022 07:17:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346207AbiCYLRE (ORCPT ); Fri, 25 Mar 2022 07:17:04 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id BC762D1CFB for ; Fri, 25 Mar 2022 04:15:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1648206929; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XwoB2DdMS8Re/gd/jZzrIHA3Gl2fwa+gau/YeDMTlPs=; b=BbeKBZ1ab2EY1Rgmgefy7A9BGJtquTzEb6OymwtobKcCDNHCYFsx2b8NsjA3EYxFLYhHmU BApjJf/+EpdKR3KctgbmiywZlZaKK/CHa0uHK7jKxxbQEeJy9bJEU2q8aQvIHFa3T3p45u 9Q9jtf7ZcqS/LM91kmW5q3RkmYyVT7Y= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-102-32rx6RLHPQKjv4QLyU_R0w-1; Fri, 25 Mar 2022 07:15:24 -0400 X-MC-Unique: 32rx6RLHPQKjv4QLyU_R0w-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 499263C01B8E; Fri, 25 Mar 2022 11:15:23 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id A3B5340D296B; Fri, 25 Mar 2022 11:15:22 +0000 (UTC) From: Paolo Bonzini To: Hou Wenlong Cc: kvm@vger.kernel.org, Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H . Peter Anvin" , Lai Jiangshan , linux-kernel@vger.kernel.org Subject: Re: [PATCH] KVM: x86/mmu: Don't rebuild page when the page is synced and no tlb flushing is required Date: Fri, 25 Mar 2022 07:14:34 -0400 Message-Id: <20220325111432.2959162-1-pbonzini@redhat.com> In-Reply-To: <0dabeeb789f57b0d793f85d073893063e692032d.1647336064.git.houwenlong.hwl@antgroup.com> References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > Before Commit c3e5e415bc1e6 ("KVM: X86: Change kvm_sync_page() > to return true when remote flush is needed"), the return value > of kvm_sync_page() indicates whether the page is synced, and > kvm_mmu_get_page() would rebuild page when the sync fails. > But now, kvm_sync_page() returns false when the page is > synced and no tlb flushing is required, which leads to > rebuild page in kvm_mmu_get_page(). So return the return > value of mmu->sync_page() directly and check it in > kvm_mmu_get_page(). If the sync fails, the page will be > zapped and the invalid_list is not empty, so set flush as > true is accepted in mmu_sync_children(). > > Fixes: c3e5e415bc1e6 ("KVM: X86: Change kvm_sync_page() to return true when remote flush is needed") > Signed-off-by: Hou Wenlong Queued and Cc'ed to stable@, thanks. Paolo