From: Paolo Bonzini <pbonzini@redhat.com>
To: Sean Christopherson <seanjc@google.com>,
Hou Wenlong <houwenlong.hwl@antgroup.com>
Cc: kvm@vger.kernel.org, Vitaly Kuznetsov <vkuznets@redhat.com>,
Wanpeng Li <wanpengli@tencent.com>,
Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
Lai Jiangshan <laijs@linux.alibaba.com>,
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 12:26:56 +0100 [thread overview]
Message-ID: <c7309380-c7d5-419d-6ba5-25d3243c469b@redhat.com> (raw)
In-Reply-To: <YjzRwDSPQNbpTrZ9@google.com>
On 3/24/22 21:17, Sean Christopherson wrote:
>> +static int kvm_sync_page(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp,
>> struct list_head *invalid_list)
>> {
>> int ret = vcpu->arch.mmu->sync_page(vcpu, sp);
>>
>> - if (ret < 0) {
>> + if (ret < 0)
>> kvm_mmu_prepare_zap_page(vcpu->kvm, sp, invalid_list);
>> - return false;
>> - }
>> -
>> - return !!ret;
>> + return ret;
> Hrm, this creates an oddity in mmu_sync_children(), which does a logical-OR of
> the result into a boolean. It doesn't actually change the functionality since
> kvm_mmu_remote_flush_or_zap() will prioritize invalid_list, but it's weird.
>
> What about checking invalid_list directly and keeping the boolean return? Compile
> tested only.
It's even better to check
flush |= kvm_sync_page(vcpu, sp, &invalid_list) > 0;
in mmu_sync_children. If the returned value is <0, then the page is
added to invalid_list and there is no need to set flush = true, just
like there is no need to call kvm_flush_remote_tlbs() in kvm_mmu_get_page().
Paolo
next prev parent reply other threads:[~2022-03-25 11:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-15 9:35 [PATCH] KVM: x86/mmu: Don't rebuild page when the page is synced and no tlb flushing is required Hou Wenlong
2022-03-16 2:19 ` Lai Jiangshan
2022-03-24 20:17 ` Sean Christopherson
2022-03-25 11:26 ` Paolo Bonzini [this message]
2022-03-25 11:14 ` Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c7309380-c7d5-419d-6ba5-25d3243c469b@redhat.com \
--to=pbonzini@redhat.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=houwenlong.hwl@antgroup.com \
--cc=hpa@zytor.com \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=laijs@linux.alibaba.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=seanjc@google.com \
--cc=tglx@linutronix.de \
--cc=vkuznets@redhat.com \
--cc=wanpengli@tencent.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.