Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'riscv-for-linus-6.2-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux

Pull RISC-V fixes from Palmer Dabbelt:
"This is a little bigger that I'd hope for this late in the cycle, but
they're all pretty concrete fixes and the only one that's bigger than
a few lines is pmdp_collapse_flush() (which is almost all
boilerplate/comment). It's also all bug fixes for issues that have
been around for a while.

So I think it's not all that scary, just bad timing.

- avoid partial TLB fences for huge pages, which are disallowed by
the ISA

- avoid missing a frame when dumping stacks

- avoid misaligned accesses (and possibly overflows) in kprobes

- fix a race condition in tracking page dirtiness"

* tag 'riscv-for-linus-6.2-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux:
riscv: Fixup race condition on PG_dcache_clean in flush_icache_pte
riscv: kprobe: Fixup misaligned load text
riscv: stacktrace: Fix missing the first frame
riscv: mm: Implement pmdp_collapse_flush for THP

+34 -5
+4
arch/riscv/include/asm/pgtable.h
··· 721 721 page_table_check_pmd_set(vma->vm_mm, address, pmdp, pmd); 722 722 return __pmd(atomic_long_xchg((atomic_long_t *)pmdp, pmd_val(pmd))); 723 723 } 724 + 725 + #define pmdp_collapse_flush pmdp_collapse_flush 726 + extern pmd_t pmdp_collapse_flush(struct vm_area_struct *vma, 727 + unsigned long address, pmd_t *pmdp); 724 728 #endif /* CONFIG_TRANSPARENT_HUGEPAGE */ 725 729 726 730 /*
+5 -3
arch/riscv/kernel/probes/kprobes.c
··· 65 65 66 66 int __kprobes arch_prepare_kprobe(struct kprobe *p) 67 67 { 68 - unsigned long probe_addr = (unsigned long)p->addr; 68 + u16 *insn = (u16 *)p->addr; 69 69 70 - if (probe_addr & 0x1) 70 + if ((unsigned long)insn & 0x1) 71 71 return -EILSEQ; 72 72 73 73 if (!arch_check_kprobe(p)) 74 74 return -EILSEQ; 75 75 76 76 /* copy instruction */ 77 - p->opcode = *p->addr; 77 + p->opcode = (kprobe_opcode_t)(*insn++); 78 + if (GET_INSN_LENGTH(p->opcode) == 4) 79 + p->opcode |= (kprobe_opcode_t)(*insn) << 16; 78 80 79 81 /* decode instruction */ 80 82 switch (riscv_probe_decode_insn(p->addr, &p->ainsn.api)) {
+2 -1
arch/riscv/kernel/stacktrace.c
··· 32 32 fp = (unsigned long)__builtin_frame_address(0); 33 33 sp = current_stack_pointer; 34 34 pc = (unsigned long)walk_stackframe; 35 + level = -1; 35 36 } else { 36 37 /* task blocked in __switch_to */ 37 38 fp = task->thread.s[0]; ··· 44 43 unsigned long low, high; 45 44 struct stackframe *frame; 46 45 47 - if (unlikely(!__kernel_text_address(pc) || (level++ >= 1 && !fn(arg, pc)))) 46 + if (unlikely(!__kernel_text_address(pc) || (level++ >= 0 && !fn(arg, pc)))) 48 47 break; 49 48 50 49 /* Validate frame pointer */
+3 -1
arch/riscv/mm/cacheflush.c
··· 90 90 if (PageHuge(page)) 91 91 page = compound_head(page); 92 92 93 - if (!test_and_set_bit(PG_dcache_clean, &page->flags)) 93 + if (!test_bit(PG_dcache_clean, &page->flags)) { 94 94 flush_icache_all(); 95 + set_bit(PG_dcache_clean, &page->flags); 96 + } 95 97 } 96 98 #endif /* CONFIG_MMU */ 97 99
+20
arch/riscv/mm/pgtable.c
··· 81 81 } 82 82 83 83 #endif /* CONFIG_HAVE_ARCH_HUGE_VMAP */ 84 + #ifdef CONFIG_TRANSPARENT_HUGEPAGE 85 + pmd_t pmdp_collapse_flush(struct vm_area_struct *vma, 86 + unsigned long address, pmd_t *pmdp) 87 + { 88 + pmd_t pmd = pmdp_huge_get_and_clear(vma->vm_mm, address, pmdp); 89 + 90 + VM_BUG_ON(address & ~HPAGE_PMD_MASK); 91 + VM_BUG_ON(pmd_trans_huge(*pmdp)); 92 + /* 93 + * When leaf PTE entries (regular pages) are collapsed into a leaf 94 + * PMD entry (huge page), a valid non-leaf PTE is converted into a 95 + * valid leaf PTE at the level 1 page table. Since the sfence.vma 96 + * forms that specify an address only apply to leaf PTEs, we need a 97 + * global flush here. collapse_huge_page() assumes these flushes are 98 + * eager, so just do the fence here. 99 + */ 100 + flush_tlb_mm(vma->vm_mm); 101 + return pmd; 102 + } 103 + #endif /* CONFIG_TRANSPARENT_HUGEPAGE */