Date: Mon, 6 Apr 2020 22:31:31 +0000 (UTC) From: Jessica Clarke <jrtc27@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r359672 - head/sys/riscv/riscv Message-ID: <202004062231.036MVVvO079571@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jrtc27 Date: Mon Apr 6 22:31:30 2020 New Revision: 359672 URL: https://svnweb.freebsd.org/changeset/base/359672 Log: riscv: Make sure local hart's icache is synced in pmap_sync_icache The only way to flush the local hart's icache is with a FENCE.I (or an equivalent SBI call); a normal FENCE is insufficient and, for the single-hart case, unnecessary. Reviewed by: jhb (mentor), markj Approved by: jhb (mentor), markj Differential Revision: https://reviews.freebsd.org/D24317 Modified: head/sys/riscv/riscv/pmap.c Modified: head/sys/riscv/riscv/pmap.c ============================================================================== --- head/sys/riscv/riscv/pmap.c Mon Apr 6 22:29:15 2020 (r359671) +++ head/sys/riscv/riscv/pmap.c Mon Apr 6 22:31:30 2020 (r359672) @@ -4335,13 +4335,20 @@ pmap_sync_icache(pmap_t pmap, vm_offset_t va, vm_size_ * RISC-V harts, the writing hart has to execute a data FENCE * before requesting that all remote RISC-V harts execute a * FENCE.I." + * + * However, this is slightly misleading; we still need to + * perform a FENCE.I for the local hart, as FENCE does nothing + * for its icache. FENCE.I alone is also sufficient for the + * local hart. */ sched_pin(); mask = all_harts; CPU_CLR(PCPU_GET(hart), &mask); - fence(); - if (!CPU_EMPTY(&mask) && smp_started) + fence_i() + if (!CPU_EMPTY(&mask) && smp_started) { + fence(); sbi_remote_fence_i(mask.__bits); + } sched_unpin(); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202004062231.036MVVvO079571>