Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp2143750pxb; Fri, 25 Mar 2022 11:52:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwuPfyHINMJ1LybtNkCMQXEyEfvhXcUEiGidVshByHlc17Ve6Kuk6NzZb+5UOYq+bJeESyy X-Received: by 2002:a65:5803:0:b0:382:5f9c:79b9 with SMTP id g3-20020a655803000000b003825f9c79b9mr766773pgr.51.1648234360142; Fri, 25 Mar 2022 11:52:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648234360; cv=none; d=google.com; s=arc-20160816; b=NRIHWe8GJ9OTZBnCxHqIY4VSNTYJj9ghsVDejOhYGZl4ednTKN8DYx2LCg5gErFiJ7 vUMncG1zbqi7FSRygF5QiXO1Qfd314LfKctVemEzbiJ4xWtyUVYbhl9ddGGb3ozUvLnE MzJjkoOtjZ65UuJ5sWK2t57QQMgjH3XzElvKWY2VXfLuAb2dbU/5EYi1aQpQZOpKe4AG QzOO1j3sgmIcu+HfKb3f7aMau9RaoVZNa0jw/N/sgK1wKpWvN0/tGK4lcgW0PDRQynfh NkRLRV8ifKOml4kUzFZN8GDb/SVQijrTNkj/3J/mm9EIT9UltSb6GO21YY0CsmijEggA WHZg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=XwoB2DdMS8Re/gd/jZzrIHA3Gl2fwa+gau/YeDMTlPs=; b=hK8Wv6Ha4JaAwCz8PFcLiJ0Uxe8TF/r6DJJTY+XbiMiupqWeidygTrupOStg5egs/H ruL0ynrOx8gxb61J6jHPs7df8oq7We/Kb2UDxQGNJCNzHaHbSvr0DnzVac/gXnk1h7RE qRluEOqzK6YFqGCVeIHY5WEOpAx6DaiZmis+Yr4HIlLKpOg76wE8hY48u8Cf4Nw65BAN w7r/zeK1FbduOwv7OYpcNSr0PXtRmlDvlmM46NYe3sbViV6T2+fpHjV/F0nedwM1HCQm utQp0JrBH4I3u7grg4b9cWTTP8IORgXAlY9oDN7P7b6uU2DJGH5eOn9+UalpKd5YWvCz O1Sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BbeKBZ1a; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id o12-20020a056a00214c00b004fa3a8dffd0si3398084pfk.135.2022.03.25.11.52.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Mar 2022 11:52:40 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BbeKBZ1a; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 033381C3935; Fri, 25 Mar 2022 11:05:25 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355158AbiCYLRF (ORCPT + 99 others); Fri, 25 Mar 2022 07:17:05 -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 X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 > 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