1. 09 Jan, 2022 16 commits
  2. 07 Jan, 2022 3 commits
    • Nanyong Sun's avatar
      riscv/mm: Enable THP migration · d062a79b
      Nanyong Sun authored
      Add two THP helpers required to create PMD migration swap entries,
      and enable THP migration via ARCH_ENABLE_THP_MIGRATION. This can
      reduce time of THP migration without splitting and guarantee the
      migrated pages are still contiguous.
      Signed-off-by: default avatarNanyong Sun <sunnanyong@huawei.com>
      Signed-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      d062a79b
    • Nanyong Sun's avatar
      riscv/mm: Adjust PAGE_PROT_NONE to comply with THP semantics · fba88ede
      Nanyong Sun authored
      This is a preparation for enabling THP migration.
      As the commit b65399f6("arm64/mm: Change THP helpers
      to comply with generic MM semantics") mentioned, pmd_present()
      and pmd_trans_huge() are expected to behave in the following
      manner:
      -------------------------------------------------------------------------
      |	PMD states	|	pmd_present	|	pmd_trans_huge	|
      -------------------------------------------------------------------------
      |	Mapped		|	Yes		|	Yes		|
      -------------------------------------------------------------------------
      |	Splitting	|	Yes		|	Yes		|
      -------------------------------------------------------------------------
      |	Migration/Swap	|	No		|	No		|
      -------------------------------------------------------------------------
      
      At present the PROT_NONE bit reuses the READ bit could not comply with
      above semantics with two problems:
      1. When splitting a PMD THP, PMD is first invalidated with
      pmdp_invalidate()->pmd_mkinvalid(), which clears the PRESENT bit
      and PROT_NONE bit/READ bit, if the PMD is read-only, then the PAGE_LEAF
      property is also cleared, which results in pmd_present() return false.
      2. When migrating, the swap entry only clear the PRESENT bit
      and PROT_NONE bit/READ bit, the W/X bit may be set, so _PAGE_LEAF may be
      true which results in pmd_present() return true.
      
      Solution:
      Adjust PROT_NONE bit from READ to GLOBAL bit can satisfy the above rules:
      1. GLOBAL bit has no other meanings, not like the R/W/X bit, which is
      also relative with _PAGE_LEAF property.
      2. GLOBAL bit is at bit 5, making swap entry start from bit 6, bit 0-5
      are zero, which means the PRESENT, PROT_NONE, and PAGE_LEAF are
      all false, then the pmd_present() and pmd_trans_huge() return false when
      in migration/swap.
      Signed-off-by: default avatarNanyong Sun <sunnanyong@huawei.com>
      Signed-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      fba88ede
    • hasheddan's avatar
      riscv/head: fix misspelling of guaranteed · 8ee30439
      hasheddan authored
      Fixes misspelling of guaranteed in comment describing why fetching fence
      is guaranteed to work when switching to kernel page tables.
      Signed-off-by: default avatarhasheddan <georgedanielmangum@gmail.com>
      Signed-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      8ee30439
  3. 06 Jan, 2022 21 commits