public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Oliver Upton <oliver.upton@linux.dev>
To: Raghavendra Rao Ananta <rananta@google.com>
Cc: Oliver Upton <oupton@google.com>, Marc Zyngier <maz@kernel.org>,
	Ricardo Koller <ricarkol@google.com>,
	Reiji Watanabe <reijiw@google.com>,
	James Morse <james.morse@arm.com>,
	Alexandru Elisei <alexandru.elisei@arm.com>,
	Suzuki K Poulose <suzuki.poulose@arm.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	Jing Zhang <jingzhangos@google.com>,
	Colton Lewis <coltonlewis@google.com>,
	linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev,
	linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Subject: Re: [RFC PATCH 4/6] KVM: arm64: Optimize TLBIs in the dirty logging path
Date: Tue, 24 Jan 2023 14:54:00 -0800	[thread overview]
Message-ID: <Y9BhiOyvMvu/L0J4@thinky-boi> (raw)
In-Reply-To: <20230109215347.3119271-5-rananta@google.com>

Hi Raghavendra,

I find the commit title rather ambiguous. May I suggest:

  KVM: arm64: Use range-based TLBIs for write protection

On Mon, Jan 09, 2023 at 09:53:45PM +0000, Raghavendra Rao Ananta wrote:
> Currently the dirty-logging paths, including
> kvm_arch_flush_remote_tlbs_memslot() and kvm_mmu_wp_memory_region()
> ivalidates the entire VM's TLB entries using kvm_flush_remote_tlbs().
> As the range of IPAs is provided by these functions, this is highly
> inefficient on the systems which support FEAT_TLBIRANGE. Hence,
> use kvm_flush_remote_tlbs_range() to flush the TLBs instead.

This commit message gives a rather mechanical description of the commit.
Instead of describing the change, could you describe _why_ this is an
improvement over the VM-wide invalidation?

--
Thanks,
Oliver

> Signed-off-by: Raghavendra Rao Ananta <rananta@google.com>
> ---
>  arch/arm64/kvm/arm.c | 7 ++++++-
>  arch/arm64/kvm/mmu.c | 2 +-
>  2 files changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c
> index 00da570ed72bd..179520888c697 100644
> --- a/arch/arm64/kvm/arm.c
> +++ b/arch/arm64/kvm/arm.c
> @@ -1433,7 +1433,12 @@ void kvm_arch_sync_dirty_log(struct kvm *kvm, struct kvm_memory_slot *memslot)
>  void kvm_arch_flush_remote_tlbs_memslot(struct kvm *kvm,
>  					const struct kvm_memory_slot *memslot)
>  {
> -	kvm_flush_remote_tlbs(kvm);
> +	phys_addr_t start, end;
> +
> +	start = memslot->base_gfn << PAGE_SHIFT;
> +	end = (memslot->base_gfn + memslot->npages) << PAGE_SHIFT;
> +
> +	kvm_flush_remote_tlbs_range(kvm, start, end);
>  }
>  
>  static int kvm_vm_ioctl_set_device_addr(struct kvm *kvm,
> diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c
> index 70f76bc909c5d..e34b81f5922ce 100644
> --- a/arch/arm64/kvm/mmu.c
> +++ b/arch/arm64/kvm/mmu.c
> @@ -976,7 +976,7 @@ static void kvm_mmu_wp_memory_region(struct kvm *kvm, int slot)
>  	write_lock(&kvm->mmu_lock);
>  	stage2_wp_range(&kvm->arch.mmu, start, end);
>  	write_unlock(&kvm->mmu_lock);
> -	kvm_flush_remote_tlbs(kvm);
> +	kvm_flush_remote_tlbs_range(kvm, start, end);
>  }
>  
>  /**
> -- 
> 2.39.0.314.g84b9a713c41-goog
> 
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2023-01-24 22:55 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-09 21:53 [RFC PATCH 0/6] KVM: arm64: Add support for FEAT_TLBIRANGE Raghavendra Rao Ananta
2023-01-09 21:53 ` [RFC PATCH 1/6] arm64: tlb: Refactor the core flush algorithm of __flush_tlb_range Raghavendra Rao Ananta
2023-01-09 21:53 ` [RFC PATCH 2/6] KVM: arm64: Add support for FEAT_TLBIRANGE Raghavendra Rao Ananta
2023-01-09 21:53 ` [RFC PATCH 3/6] KVM: Define kvm_flush_remote_tlbs_range Raghavendra Rao Ananta
2023-01-09 23:41   ` David Matlack
2023-01-09 23:45     ` David Matlack
2023-01-10 17:35     ` Raghavendra Rao Ananta
2023-01-09 21:53 ` [RFC PATCH 4/6] KVM: arm64: Optimize TLBIs in the dirty logging path Raghavendra Rao Ananta
2023-01-24 22:54   ` Oliver Upton [this message]
2023-01-25 21:52     ` Raghavendra Rao Ananta
2023-01-09 21:53 ` [RFC PATCH 5/6] KVM: arm64: Optimize the stage2 map path with TLBI range instructions Raghavendra Rao Ananta
2023-01-24 23:25   ` Oliver Upton
2023-01-25 22:20     ` Raghavendra Rao Ananta
2023-01-09 21:53 ` [RFC PATCH 6/6] KVM: arm64: Create a fast stage-2 unmap path Raghavendra Rao Ananta

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=Y9BhiOyvMvu/L0J4@thinky-boi \
    --to=oliver.upton@linux.dev \
    --cc=alexandru.elisei@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=coltonlewis@google.com \
    --cc=james.morse@arm.com \
    --cc=jingzhangos@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=oupton@google.com \
    --cc=pbonzini@redhat.com \
    --cc=rananta@google.com \
    --cc=reijiw@google.com \
    --cc=ricarkol@google.com \
    --cc=suzuki.poulose@arm.com \
    --cc=will@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox