From 30ab804b5878a9f4721fb1de3f03f4a0400a6fb1 Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Sun, 28 Jun 2020 16:26:59 +0200 Subject: [PATCH] kernel: segflush() needs to flush tlb of other processes instruction cache maintenance is done on tlb miss; when a page gets fauled in; with putmmu() checking the page->txtflush cpu bitmap. syssegflush() used to only call flushmmu() after segflush() for the calling process, but when a segment is shared with other processes, we have to flush the other processes tlb as well. this adds the missing procflushseg() call into segflush(). note that procflushseg() leaves the calling process alone, so the flushmmu() call in syssegflush() is still required. segmentioproc() does not need to call flushmmu() after segflush() as it is never going to jump to the modified page, hence the stale icache does not matter. --- sys/src/9/port/segment.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/src/9/port/segment.c b/sys/src/9/port/segment.c index 83b723eb8..bc3e61cb7 100644 --- a/sys/src/9/port/segment.c +++ b/sys/src/9/port/segment.c @@ -704,6 +704,8 @@ segflush(void *va, uintptr len) error(Ebadarg); s->flushme = 1; + if(s->ref > 1) + procflushseg(s); more: len = (s->top < to ? s->top : to) - from; if(s->mapsize > 0){