Skip to content

Commit a5b3d5d

Browse files
committed
Merge tag 'riscv-for-linus-6.13-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux
Pull RISC-V fixes from Palmer Dabbelt: - avoid taking a mutex while resolving jump_labels in the mutex implementation - avoid trying to resolve the early boot DT pointer via the linear map - avoid trying to IPI kfence TLB flushes, as kfence might flush with IRQs disabled - avoid calling PMD destructors on PMDs that were never constructed * tag 'riscv-for-linus-6.13-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux: riscv: mm: Do not call pmd dtor on vmemmap page table teardown riscv: Fix IPIs usage in kfence_protect_page() riscv: Fix wrong usage of __pa() on a fixmap address riscv: Fixup boot failure when CONFIG_DEBUG_RT_MUTEXES=y
2 parents 243f750 + 21f1b85 commit a5b3d5d

File tree

4 files changed

+17
-8
lines changed

4 files changed

+17
-8
lines changed

arch/riscv/include/asm/kfence.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ static inline bool kfence_protect_page(unsigned long addr, bool protect)
2222
else
2323
set_pte(pte, __pte(pte_val(ptep_get(pte)) | _PAGE_PRESENT));
2424

25-
flush_tlb_kernel_range(addr, addr + PAGE_SIZE);
25+
preempt_disable();
26+
local_flush_tlb_kernel_range(addr, addr + PAGE_SIZE);
27+
preempt_enable();
2628

2729
return true;
2830
}

arch/riscv/kernel/jump_label.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,15 @@ bool arch_jump_label_transform_queue(struct jump_entry *entry,
3636
insn = RISCV_INSN_NOP;
3737
}
3838

39-
mutex_lock(&text_mutex);
40-
patch_insn_write(addr, &insn, sizeof(insn));
41-
mutex_unlock(&text_mutex);
39+
if (early_boot_irqs_disabled) {
40+
riscv_patch_in_stop_machine = 1;
41+
patch_insn_write(addr, &insn, sizeof(insn));
42+
riscv_patch_in_stop_machine = 0;
43+
} else {
44+
mutex_lock(&text_mutex);
45+
patch_insn_write(addr, &insn, sizeof(insn));
46+
mutex_unlock(&text_mutex);
47+
}
4248

4349
return true;
4450
}

arch/riscv/kernel/setup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ static void __init init_resources(void)
227227
static void __init parse_dtb(void)
228228
{
229229
/* Early scan of device tree from init memory */
230-
if (early_init_dt_scan(dtb_early_va, __pa(dtb_early_va))) {
230+
if (early_init_dt_scan(dtb_early_va, dtb_early_pa)) {
231231
const char *name = of_flat_dt_get_machine_name();
232232

233233
if (name) {

arch/riscv/mm/init.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1566,7 +1566,7 @@ static void __meminit free_pte_table(pte_t *pte_start, pmd_t *pmd)
15661566
pmd_clear(pmd);
15671567
}
15681568

1569-
static void __meminit free_pmd_table(pmd_t *pmd_start, pud_t *pud)
1569+
static void __meminit free_pmd_table(pmd_t *pmd_start, pud_t *pud, bool is_vmemmap)
15701570
{
15711571
struct page *page = pud_page(*pud);
15721572
struct ptdesc *ptdesc = page_ptdesc(page);
@@ -1579,7 +1579,8 @@ static void __meminit free_pmd_table(pmd_t *pmd_start, pud_t *pud)
15791579
return;
15801580
}
15811581

1582-
pagetable_pmd_dtor(ptdesc);
1582+
if (!is_vmemmap)
1583+
pagetable_pmd_dtor(ptdesc);
15831584
if (PageReserved(page))
15841585
free_reserved_page(page);
15851586
else
@@ -1703,7 +1704,7 @@ static void __meminit remove_pud_mapping(pud_t *pud_base, unsigned long addr, un
17031704
remove_pmd_mapping(pmd_base, addr, next, is_vmemmap, altmap);
17041705

17051706
if (pgtable_l4_enabled)
1706-
free_pmd_table(pmd_base, pudp);
1707+
free_pmd_table(pmd_base, pudp, is_vmemmap);
17071708
}
17081709
}
17091710

0 commit comments

Comments
 (0)