git: 9front

Download patch

ref: 24b08266a5cfafd7a79e1a9441a217325d0300ed
parent: 031f2a75afc86b21c2488e04c12da5a5898a35e2
author: cinap_lenrek <cinap_lenrek@felloff.net>
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){
--