From: Andrew Jones <ajones@ventanamicro.com>
To: Alexandre Ghiti <alexghiti@rivosinc.com>
Cc: Anup Patel <anup@brainfault.org>,
Atish Patra <atishp@atishpatra.org>,
Paul Walmsley <paul.walmsley@sifive.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
kvm@vger.kernel.org, kvm-riscv@lists.infradead.org,
linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] KVM: RISC-V: Fix wrong usage of PGDIR_SIZE to check page sizes
Date: Mon, 23 Jan 2023 12:03:37 +0100 [thread overview]
Message-ID: <20230123110337.3pmsk7nvip3sxlc4@orel> (raw)
In-Reply-To: <20230123092928.808014-1-alexghiti@rivosinc.com>
On Mon, Jan 23, 2023 at 10:29:28AM +0100, Alexandre Ghiti wrote:
> At the moment, riscv only supports PMD and PUD hugepages. For sv39,
> PGDIR_SIZE == PUD_SIZE but not for sv48 and sv57. So fix this by changing
> PGDIR_SIZE into PUD_SIZE.
Can you please add a sentence as to how you found this? Some test case
or just by analysis?
Anyway,
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
>
> Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
> ---
> arch/riscv/kvm/mmu.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/arch/riscv/kvm/mmu.c b/arch/riscv/kvm/mmu.c
> index 34b57e0be2ef..dbc4ca060174 100644
> --- a/arch/riscv/kvm/mmu.c
> +++ b/arch/riscv/kvm/mmu.c
> @@ -585,7 +585,7 @@ bool kvm_age_gfn(struct kvm *kvm, struct kvm_gfn_range *range)
> if (!kvm->arch.pgd)
> return false;
>
> - WARN_ON(size != PAGE_SIZE && size != PMD_SIZE && size != PGDIR_SIZE);
> + WARN_ON(size != PAGE_SIZE && size != PMD_SIZE && size != PUD_SIZE);
>
> if (!gstage_get_leaf_entry(kvm, range->start << PAGE_SHIFT,
> &ptep, &ptep_level))
> @@ -603,7 +603,7 @@ bool kvm_test_age_gfn(struct kvm *kvm, struct kvm_gfn_range *range)
> if (!kvm->arch.pgd)
> return false;
>
> - WARN_ON(size != PAGE_SIZE && size != PMD_SIZE && size != PGDIR_SIZE);
> + WARN_ON(size != PAGE_SIZE && size != PMD_SIZE && size != PUD_SIZE);
>
> if (!gstage_get_leaf_entry(kvm, range->start << PAGE_SHIFT,
> &ptep, &ptep_level))
> @@ -645,12 +645,12 @@ int kvm_riscv_gstage_map(struct kvm_vcpu *vcpu,
> if (logging || (vma->vm_flags & VM_PFNMAP))
> vma_pagesize = PAGE_SIZE;
>
> - if (vma_pagesize == PMD_SIZE || vma_pagesize == PGDIR_SIZE)
> + if (vma_pagesize == PMD_SIZE || vma_pagesize == PUD_SIZE)
> gfn = (gpa & huge_page_mask(hstate_vma(vma))) >> PAGE_SHIFT;
>
> mmap_read_unlock(current->mm);
>
> - if (vma_pagesize != PGDIR_SIZE &&
> + if (vma_pagesize != PUD_SIZE &&
> vma_pagesize != PMD_SIZE &&
> vma_pagesize != PAGE_SIZE) {
> kvm_err("Invalid VMA page size 0x%lx\n", vma_pagesize);
> --
> 2.37.2
>
>
> --
> kvm-riscv mailing list
> kvm-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kvm-riscv
next prev parent reply other threads:[~2023-01-23 11:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-23 9:29 Alexandre Ghiti
2023-01-23 9:31 ` Alexandre Ghiti
2023-01-23 11:28 ` Anup Patel
2023-01-23 14:34 ` Alexandre Ghiti
2023-01-27 5:38 ` Anup Patel
2023-01-23 11:03 ` Andrew Jones [this message]
2023-01-23 11:16 ` Alexandre Ghiti
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=20230123110337.3pmsk7nvip3sxlc4@orel \
--to=ajones@ventanamicro.com \
--cc=alexghiti@rivosinc.com \
--cc=anup@brainfault.org \
--cc=aou@eecs.berkeley.edu \
--cc=atishp@atishpatra.org \
--cc=kvm-riscv@lists.infradead.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.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
all inboxes | Powered by JetHome®