ref: 30ab804b5878a9f4721fb1de3f03f4a0400a6fb1
parent: 675ebaeca3c38d2684b249faae1fc24c5c2b6e0e
author: cinap_lenrek <[email protected]>
date: Sun Jun 28 12:26:59 EDT 2020
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.
--- a/sys/src/9/port/segment.c
+++ b/sys/src/9/port/segment.c
@@ -704,6 +704,8 @@
error(Ebadarg);
s->flushme = 1;
+ if(s->ref > 1)
+ procflushseg(s);
more:
len = (s->top < to ? s->top : to) - from;
if(s->mapsize > 0){