From: visa Date: Thu, 22 Jun 2017 14:40:20 +0000 (+0000) Subject: Improve the coalescing of instruction cache flushes on R8000 in order X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=8929cd64b26afc524177459660f1e98e79a37c3d;p=openbsd Improve the coalescing of instruction cache flushes on R8000 in order not to perform redundant work. There is no direct way to flush the cache; rather, the kernel evicts unwanted bits from the cache by executing a block of instructions, which is expensive. With this diff, make build time decreases about 0.4%. Diff from miod@ --- diff --git a/sys/arch/mips64/mips64/cache_tfp.c b/sys/arch/mips64/mips64/cache_tfp.c index 50e47d5fa62..8dbb66584d1 100644 --- a/sys/arch/mips64/mips64/cache_tfp.c +++ b/sys/arch/mips64/mips64/cache_tfp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cache_tfp.c,v 1.6 2016/01/05 05:27:54 visa Exp $ */ +/* $OpenBSD: cache_tfp.c,v 1.7 2017/06/22 14:40:20 visa Exp $ */ /* * Copyright (c) 2012 Miodrag Vallat. @@ -128,9 +128,11 @@ tfp_InvalidateICache(struct cpu_info *ci, vaddr_t _va, size_t _sz) vsize_t sz; void (*inval_subr)(vsize_t); + if (ci->ci_cachepending_l1i != 0) + return; + if (_sz >= ci->ci_l1inst.size) { - tfp_inval_icache(ci->ci_l1inst.size); - ci->ci_cachepending_l1i = 0; + ci->ci_cachepending_l1i = 1; } else { /* extend the range to multiple of 32 bytes */ va = _va & ~(32UL - 1);