* [PATCH] RISC-V: KVM: Use find_vma_intersection() to search for intersecting VMAs
@ 2025-06-17 13:04 zhouquan
2025-07-17 6:50 ` Anup Patel
0 siblings, 1 reply; 2+ messages in thread
From: zhouquan @ 2025-06-17 13:04 UTC (permalink / raw)
To: anup, ajones, atishp, paul.walmsley, palmer
Cc: linux-kernel, linux-riscv, kvm, kvm-riscv, Quan Zhou
From: Quan Zhou <zhouquan@iscas.ac.cn>
There is already a helper function find_vma_intersection() in KVM
for searching intersecting VMAs, use it directly.
Signed-off-by: Quan Zhou <zhouquan@iscas.ac.cn>
---
arch/riscv/kvm/mmu.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/arch/riscv/kvm/mmu.c b/arch/riscv/kvm/mmu.c
index b63650f9b966..3452a8b77af3 100644
--- a/arch/riscv/kvm/mmu.c
+++ b/arch/riscv/kvm/mmu.c
@@ -487,10 +487,11 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm,
* +--------------------------------------------+
*/
do {
- struct vm_area_struct *vma = find_vma(current->mm, hva);
+ struct vm_area_struct *vma;
hva_t vm_start, vm_end;
- if (!vma || vma->vm_start >= reg_end)
+ vma = find_vma_intersection(current->mm, hva, reg_end);
+ if (!vma)
break;
/*
--
2.34.1
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] RISC-V: KVM: Use find_vma_intersection() to search for intersecting VMAs
2025-06-17 13:04 [PATCH] RISC-V: KVM: Use find_vma_intersection() to search for intersecting VMAs zhouquan
@ 2025-07-17 6:50 ` Anup Patel
0 siblings, 0 replies; 2+ messages in thread
From: Anup Patel @ 2025-07-17 6:50 UTC (permalink / raw)
To: zhouquan
Cc: ajones, atishp, paul.walmsley, palmer, linux-kernel, linux-riscv,
kvm, kvm-riscv
On Tue, Jun 17, 2025 at 6:43 PM <zhouquan@iscas.ac.cn> wrote:
>
> From: Quan Zhou <zhouquan@iscas.ac.cn>
>
> There is already a helper function find_vma_intersection() in KVM
> for searching intersecting VMAs, use it directly.
>
> Signed-off-by: Quan Zhou <zhouquan@iscas.ac.cn>
LGTM.
Reviewed-by: Anup Patel <anup@brainfault.org>
Queued this patch for Linux-6.17
Thanks,
Anup
> ---
> arch/riscv/kvm/mmu.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/arch/riscv/kvm/mmu.c b/arch/riscv/kvm/mmu.c
> index b63650f9b966..3452a8b77af3 100644
> --- a/arch/riscv/kvm/mmu.c
> +++ b/arch/riscv/kvm/mmu.c
> @@ -487,10 +487,11 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm,
> * +--------------------------------------------+
> */
> do {
> - struct vm_area_struct *vma = find_vma(current->mm, hva);
> + struct vm_area_struct *vma;
> hva_t vm_start, vm_end;
>
> - if (!vma || vma->vm_start >= reg_end)
> + vma = find_vma_intersection(current->mm, hva, reg_end);
> + if (!vma)
> break;
>
> /*
> --
> 2.34.1
>
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-07-17 6:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-17 13:04 [PATCH] RISC-V: KVM: Use find_vma_intersection() to search for intersecting VMAs zhouquan
2025-07-17 6:50 ` Anup Patel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).