Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

riscv: tlb flush improvements #6

Closed
wants to merge 5 commits into from
Closed

Commits on Nov 6, 2023

  1. adding ci files

    Björn Töpel committed Nov 6, 2023
    Configuration menu
    Copy the full SHA
    3119b42 View commit details
    Browse the repository at this point in the history
  2. riscv: Improve tlb_flush()

    For now, tlb_flush() simply calls flush_tlb_mm() which results in a
    flush of the whole TLB. So let's use mmu_gather fields to provide a more
    fine-grained flush of the TLB.
    
    Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
    Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
    Reviewed-by: Samuel Holland <samuel.holland@sifive.com>
    Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> # On RZ/Five SMARC
    Signed-off-by: Björn Töpel <bjorn@rivosinc.com>
    Alexandre Ghiti authored and Björn Töpel committed Nov 6, 2023
    Configuration menu
    Copy the full SHA
    70687b5 View commit details
    Browse the repository at this point in the history
  3. riscv: Improve flush_tlb_range() for hugetlb pages

    flush_tlb_range() uses a fixed stride of PAGE_SIZE and in its current form,
    when a hugetlb mapping needs to be flushed, flush_tlb_range() flushes the
    whole tlb: so set a stride of the size of the hugetlb mapping in order to
    only flush the hugetlb mapping. However, if the hugepage is a NAPOT region,
    all PTEs that constitute this mapping must be invalidated, so the stride
    size must actually be the size of the PTE.
    
    Note that THPs are directly handled by flush_pmd_tlb_range().
    
    Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
    Reviewed-by: Samuel Holland <samuel.holland@sifive.com>
    Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> # On RZ/Five SMARC
    Signed-off-by: Björn Töpel <bjorn@rivosinc.com>
    Alexandre Ghiti authored and Björn Töpel committed Nov 6, 2023
    Configuration menu
    Copy the full SHA
    e28e124 View commit details
    Browse the repository at this point in the history
  4. riscv: Make __flush_tlb_range() loop over pte instead of flushing the…

    … whole tlb
    
    Currently, when the range to flush covers more than one page (a 4K page or
    a hugepage), __flush_tlb_range() flushes the whole tlb. Flushing the whole
    tlb comes with a greater cost than flushing a single entry so we should
    flush single entries up to a certain threshold so that:
    threshold * cost of flushing a single entry < cost of flushing the whole
    tlb.
    
    Co-developed-by: Mayuresh Chitale <mchitale@ventanamicro.com>
    Signed-off-by: Mayuresh Chitale <mchitale@ventanamicro.com>
    Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
    Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
    Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> # On RZ/Five SMARC
    Reviewed-by: Samuel Holland <samuel.holland@sifive.com>
    Tested-by: Samuel Holland <samuel.holland@sifive.com>
    Signed-off-by: Björn Töpel <bjorn@rivosinc.com>
    Alexandre Ghiti authored and Björn Töpel committed Nov 6, 2023
    Configuration menu
    Copy the full SHA
    59abe21 View commit details
    Browse the repository at this point in the history
  5. riscv: Improve flush_tlb_kernel_range()

    This function used to simply flush the whole tlb of all harts, be more
    subtile and try to only flush the range.
    
    The problem is that we can only use PAGE_SIZE as stride since we don't know
    the size of the underlying mapping and then this function will be improved
    only if the size of the region to flush is < threshold * PAGE_SIZE.
    
    Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
    Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
    Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> # On RZ/Five SMARC
    Reviewed-by: Samuel Holland <samuel.holland@sifive.com>
    Tested-by: Samuel Holland <samuel.holland@sifive.com>
    Signed-off-by: Björn Töpel <bjorn@rivosinc.com>
    Alexandre Ghiti authored and Björn Töpel committed Nov 6, 2023
    Configuration menu
    Copy the full SHA
    047d076 View commit details
    Browse the repository at this point in the history