From: Paolo Bonzini <pbonzini@redhat.com>
To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Cc: chenhuacai@kernel.org, aleksandar.qemu.devel@gmail.com,
seanjc@google.com, linux-mips@vger.kernel.org
Subject: [PATCH 4/4] KVM: MIPS: defer flush to generic MMU notifier code
Date: Fri, 2 Apr 2021 17:58:07 +0200 [thread overview]
Message-ID: <20210402155807.49976-5-pbonzini@redhat.com> (raw)
In-Reply-To: <20210402155807.49976-1-pbonzini@redhat.com>
Return 1 from kvm_unmap_hva_range and kvm_set_spte_hva if a flush is
needed, so that the generic code can coalesce the flushes.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
arch/mips/kvm/mmu.c | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/arch/mips/kvm/mmu.c b/arch/mips/kvm/mmu.c
index 2cedf908d744..a3a49b009dc4 100644
--- a/arch/mips/kvm/mmu.c
+++ b/arch/mips/kvm/mmu.c
@@ -489,9 +489,7 @@ static int kvm_unmap_hva_handler(struct kvm *kvm, gfn_t gfn, gfn_t gfn_end,
int kvm_unmap_hva_range(struct kvm *kvm, unsigned long start, unsigned long end,
unsigned flags)
{
- handle_hva_to_gpa(kvm, start, end, &kvm_unmap_hva_handler, NULL);
- kvm_flush_remote_tlbs(kvm);
- return 0;
+ return handle_hva_to_gpa(kvm, start, end, &kvm_unmap_hva_handler, NULL);
}
static int kvm_set_spte_handler(struct kvm *kvm, gfn_t gfn, gfn_t gfn_end,
@@ -528,12 +526,7 @@ static int kvm_set_spte_handler(struct kvm *kvm, gfn_t gfn, gfn_t gfn_end,
int kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte)
{
unsigned long end = hva + PAGE_SIZE;
- int ret;
-
- ret = handle_hva_to_gpa(kvm, hva, end, &kvm_set_spte_handler, &pte);
- if (ret)
- kvm_flush_remote_tlbs(kvm);
- return 0;
+ return handle_hva_to_gpa(kvm, hva, end, &kvm_set_spte_handler, &pte);
}
static int kvm_age_hva_handler(struct kvm *kvm, gfn_t gfn, gfn_t gfn_end,
--
2.30.1
prev parent reply other threads:[~2021-04-02 15:58 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-02 15:58 [PATCH 0/4] KVM: MIPS: cleanup TLB flushing callbacks Paolo Bonzini
2021-04-02 15:58 ` [PATCH 1/4] KVM: constify kvm_arch_flush_remote_tlbs_memslot Paolo Bonzini
2021-04-03 2:28 ` Huacai Chen
2021-04-02 15:58 ` [PATCH 2/4] KVM: MIPS: rework flush_shadow_* callbacks into one that prepares the flush Paolo Bonzini
2021-04-03 2:31 ` Huacai Chen
2021-04-03 7:08 ` Paolo Bonzini
2021-04-03 10:43 ` Paolo Bonzini
2021-04-06 1:36 ` Huacai Chen
2021-04-06 6:05 ` Paolo Bonzini
2021-04-06 11:39 ` Thomas Bogendoerfer
2021-04-06 11:55 ` Paolo Bonzini
2021-04-02 15:58 ` [PATCH 3/4] KVM: MIPS: let generic code call prepare_flush_shadow Paolo Bonzini
2021-04-02 15:58 ` Paolo Bonzini [this message]
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=20210402155807.49976-5-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=aleksandar.qemu.devel@gmail.com \
--cc=chenhuacai@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=seanjc@google.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox