From 0b4ced0e52c81c7a003ebf7b1f8a65239042c001 Mon Sep 17 00:00:00 2001 From: jeff murphy Date: Mon, 13 Dec 2021 21:32:26 -0500 Subject: [PATCH 01/39] turn off debug --- runtime/gc/debug.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/gc/debug.h b/runtime/gc/debug.h index 835c3c9ee..13d8a00fc 100755 --- a/runtime/gc/debug.h +++ b/runtime/gc/debug.h @@ -35,13 +35,13 @@ enum { DEBUG_SOURCES = FALSE, DEBUG_STACKS = FALSE, DEBUG_STACK_GROW = FALSE, - DEBUG_THREADS = TRUE, + DEBUG_THREADS = FALSE, DEBUG_WEAK = FALSE, DEBUG_WORLD = FALSE, FORCE_GENERATIONAL = FALSE, FORCE_MARK_COMPACT = FALSE, DEBUG_OLD = FALSE, - DEBUG_RTGC = TRUE, + DEBUG_RTGC = FALSE, DEBUG_RTGC_MARKING = FALSE, DEBUG_WB = FALSE, DISPLAY_GC_STATS = FALSE From b0d1f439b5d843356c0d159fc9ed47544f1ccfd3 Mon Sep 17 00:00:00 2001 From: jeff murphy Date: Sun, 19 Dec 2021 14:52:24 -0500 Subject: [PATCH 02/39] add instrumentation functions --- .gitignore | 1 + basis-library/mlton/primthread.sig | 60 +++++++++++++++------------- basis-library/mlton/primthread.sml | 14 +++++-- bin/mlton-script | 2 +- doc/rt/rtems6.md | 7 ++++ runtime/gc/realtime_thread.c | 55 ++++++++++++++++++++++++++ runtime/gc/realtime_thread.h | 3 ++ ub/rtems/thread-message/message.sml | 61 +++++++++++++++++++++++++++++ 8 files changed, 170 insertions(+), 33 deletions(-) create mode 100644 ub/rtems/thread-message/message.sml diff --git a/.gitignore b/.gitignore index ffcefa8c5..7c1400cda 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +ub/rtems/thread-message/message runtime/constants-rtems/waf ub/rtems/justprint/.lock-waf_linux2_build ub/rtems/justprint/waf diff --git a/basis-library/mlton/primthread.sig b/basis-library/mlton/primthread.sig index 8c5439083..e81a9bcda 100755 --- a/basis-library/mlton/primthread.sig +++ b/basis-library/mlton/primthread.sig @@ -9,35 +9,39 @@ signature PRIM_THREAD = sig - structure PreThread : - sig - type t - end - - structure Thread : - sig - type t - end - - structure PThread : - sig - type preThread = PreThread.t - type thread = Thread.t - val savedPre: unit -> preThread - val copyCurrent: unit -> unit - val copy: preThread -> Thread.t - val spawnp: (unit->unit) -> unit - val run: unit ->unit - end + structure PreThread : + sig + type t + end + + structure Thread : + sig + type t + end + + structure PThread : + sig + type preThread = PreThread.t + type thread = Thread.t + val savedPre: unit -> preThread + val copyCurrent: unit -> unit + val copy: preThread -> Thread.t + val spawnp: (unit->unit) -> unit + val run: unit ->unit + end - type 'a t - - val rtlock : int -> unit - val rtunlock : int -> unit - val pspawn: (unit->unit) * int -> unit - val thread_main: unit -> unit - val gcstate: Primitive.MLton.GCState.t + type 'a t - val getMyPriority: unit -> int + val get_ticks_since_boot : unit -> int + val dump_instrument_stderr : int -> unit + val instrument : int -> unit + + val rtlock : int -> unit + val rtunlock : int -> unit + val pspawn: (unit->unit) * int -> unit + val thread_main: unit -> unit + val gcstate: Primitive.MLton.GCState.t + + val getMyPriority: unit -> int end diff --git a/basis-library/mlton/primthread.sml b/basis-library/mlton/primthread.sml index b202ce332..e16920805 100755 --- a/basis-library/mlton/primthread.sml +++ b/basis-library/mlton/primthread.sml @@ -135,11 +135,17 @@ struct end local - val lock__ = _import "User_lock" : int -> unit; - val unlock__ = _import "User_unlock" : int -> unit; + val inst__ = _import "User_instrument" : int -> unit; + val dise__ = _import "Dump_instrument_stderr" : int -> unit; + val gtsb__ = _import "get_ticks_since_boot" : unit -> int; + val lock__ = _import "User_lock" : int -> unit; + val unlock__ = _import "User_unlock" : int -> unit; in - fun rtlock a = if a <=9 then lock__ a else print "Invalid lock. Valid locks are [0-9]\n" - fun rtunlock a = if a<=9 then unlock__ a else print "Invalid lock. Valid locks are [0-9]\n" + fun instrument a = inst__ a + fun dump_instrument_stderr a = dise__ a + fun get_ticks_since_boot () = gtsb__ () + fun rtlock a = if a <=9 then lock__ a else print "Invalid lock. Valid locks are [0-9]\n" + fun rtunlock a = if a<=9 then unlock__ a else print "Invalid lock. Valid locks are [0-9]\n" end diff --git a/bin/mlton-script b/bin/mlton-script index d3f8071d9..71bfad91c 100755 --- a/bin/mlton-script +++ b/bin/mlton-script @@ -97,7 +97,7 @@ doit "$lib" \ -ar-script "$lib/static-library" \ -cc "$gcc" \ -cc-opt-quote "-I$lib/include" \ - -cc-opt '-O1 -fno-common -D_GNU_SOURCE -D__USE_GNU' \ + -cc-opt '-O0 -fno-common -D_GNU_SOURCE -D__USE_GNU' \ -cc-opt '-fno-strict-aliasing -fomit-frame-pointer -w' \ -link-opt '-lm -lgmp' \ -llvm-llc-opt '-O2' \ diff --git a/doc/rt/rtems6.md b/doc/rt/rtems6.md index 9209efd44..82fc72f37 100644 --- a/doc/rt/rtems6.md +++ b/doc/rt/rtems6.md @@ -121,4 +121,11 @@ more stuff +## RTEMS API Useful Links + +Periodic task code samples + +https://cpp.hotexamples.com/examples/-/-/rtems_clock_get_ticks_since_boot/cpp-rtems_clock_get_ticks_since_boot-function-examples.html + + diff --git a/runtime/gc/realtime_thread.c b/runtime/gc/realtime_thread.c index 031a48c76..acb74d2cf 100755 --- a/runtime/gc/realtime_thread.c +++ b/runtime/gc/realtime_thread.c @@ -106,6 +106,15 @@ void InitializeMutexes(void) { } +unsigned int get_ticks_since_boot(void) { + rtems_status_code sc; + rtems_interval time_buffer; + + sc = rtems_clock_get(RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, (void *)&time_buffer); + assert (rc == RTEMS_SUCCESSFUL); + return (unsigned int)time_buffer; +} + #else /* TID of holding thread or -1 if no one*/ @@ -174,8 +183,50 @@ void InitializeMutexes(void) { } } +/* returns milliseconds */ +unsigned int get_ticks_since_boot(void) { + long ms; // Milliseconds + time_t s; // Seconds + struct timespec spec; + + clock_gettime(CLOCK_MONOTONIC, &spec); + + s = spec.tv_sec; + ms = round(spec.tv_nsec / 1.0e6); // Convert nanoseconds to milliseconds + if (ms > 999) { + s++; + ms = 0; + } + + return (s*1000) + ms; +} #endif +// must be a multiple of 2*sizeof(int) +#define MAX_INSTRUMENT 1024 + +unsigned int instrument_offset[MAXPRI+1]; +unsigned int instrument_buffer[MAXPRI+1][MAX_INSTRUMENT]; + +void User_instrument (Int32 p) { + instrument_buffer[PTHREAD_NUM][instrument_offset[MAXPRI]] = get_ticks_since_boot(); + instrument_buffer[PTHREAD_NUM][instrument_offset[MAXPRI]+1] = (unsigned int)p; + instrument_offset[MAXPRI] = (instrument_offset[MAXPRI]+2) % MAX_INSTRUMENT; +} + +void Dump_instrument_stderr (Int32 p) { + if (p == -1) p = PTHREAD_NUM; + + for(unsigned int i = 0 ; i < MAX_INSTRUMENT ; i += 2) { + if (instrument_buffer[p][i] != 0) { + fprintf(stderr, "%d, %u, %u\n", p, + instrument_buffer[p][i], + instrument_buffer[p][i+1] + ); + } + } +} + void realtimeThreadWaitForInit (void) { @@ -234,6 +285,10 @@ void RT_init (GC_state state) if(DEBUG_THREADS) fprintf(stderr, "%d] "RED("RT_init")"\n", PTHREAD_NUM); + + memset(instrument_offset, 0, sizeof(instrument_offset[0]) * (MAXPRI+1)); + memset(instrument_buffer, 0, sizeof(instrument_buffer[0][0]) * (MAXPRI+1) * MAX_INSTRUMENT); + //fprintf(stderr, "%d] "FMTPTR" "FMTPTR" \n", // PTHREAD_NUM, // state->currentThread[PTHREAD_NUM], diff --git a/runtime/gc/realtime_thread.h b/runtime/gc/realtime_thread.h index 66af2e04a..214ced76a 100755 --- a/runtime/gc/realtime_thread.h +++ b/runtime/gc/realtime_thread.h @@ -31,6 +31,9 @@ void ML_lock (void); void ML_unlock (void); void User_lock (Int32); void User_unlock (Int32); +void User_instrument (Int32 p); +void Dump_instrument_stderr (Int32 p); +unsigned int get_ticks_since_boot(void); #endif #endif /* _REALTIME_THREAD_H_ */ diff --git a/ub/rtems/thread-message/message.sml b/ub/rtems/thread-message/message.sml new file mode 100644 index 000000000..2e9d9d3ce --- /dev/null +++ b/ub/rtems/thread-message/message.sml @@ -0,0 +1,61 @@ + +open MLton.PrimThread +open MLton.Thread +open Posix.Signal + +fun gettime () = get_ticks_since_boot () + +fun printit s = print (Int.toString(getMyPriority ())^"] "^s^"\n") + +val _ = printit "Hello World\n"; + +val buffer = ref 0 + +fun sleep () = +let + val _ = Posix.Process.sleep (Time.fromSeconds 1) +in + () +end + +fun sender () = +let +in + while true do ( + sleep () + ; printit ("sender: "^Int.toString(!buffer)^"\n") + ; rtlock 0 ; instrument 0 + ; buffer := !buffer + 1 + ; rtunlock 0 ; instrument 1 + ) +end + +fun receiver () = +let +in + while true do ( + sleep () + ; rtlock 0 ; instrument 2 + ; printit ("receiver: "^Int.toString(!buffer)^"\n") + ; rtunlock 0 ; instrument 3 + ) +end + +fun instrument_dumper () = +let +in + while true do ( + sleep () + ; rtlock 0 + ; dump_instrument_stderr 3 + ; dump_instrument_stderr 2 + ; rtunlock 0 + ) +end + +val _ = pspawn (fn () => receiver (), 3) +val _ = pspawn (fn () => sender (), 2) +val _ = pspawn (fn () => instrument_dumper (), 4); + + +val _ = printit "Main end\n" From 8ea2375bf42c9c146b68adca5638628464219ba3 Mon Sep 17 00:00:00 2001 From: jeff murphy Date: Sat, 25 Dec 2021 16:55:37 -0500 Subject: [PATCH 03/39] working on concurrency --- basis-library/mlton/exn.sml | 2 +- basis-library/mlton/primthread.sml | 35 ++++++++++++++---------- doc/{rt/notes.md => rtmlton/rt-notes.md} | 0 doc/{rt => rtmlton}/rtems4.md | 0 doc/{rt => rtmlton}/rtems5.md | 0 doc/{rt => rtmlton}/rtems6.md | 0 include/c-common.h | 5 +++- runtime/gc/garbage-collection.c | 2 -- runtime/gc/realtime_thread.c | 3 ++ runtime/gc/realtime_thread.h | 6 +++- runtime/gc/um.c | 20 ++++++++++---- runtime/gc/umheap.c | 8 +++--- 12 files changed, 52 insertions(+), 29 deletions(-) rename doc/{rt/notes.md => rtmlton/rt-notes.md} (100%) rename doc/{rt => rtmlton}/rtems4.md (100%) rename doc/{rt => rtmlton}/rtems5.md (100%) rename doc/{rt => rtmlton}/rtems6.md (100%) diff --git a/basis-library/mlton/exn.sml b/basis-library/mlton/exn.sml index b2f6c321b..e9934996b 100644 --- a/basis-library/mlton/exn.sml +++ b/basis-library/mlton/exn.sml @@ -50,7 +50,7 @@ structure MLtonExn = ; Exit.halt Exit.Status.failure ; raise Fail "MLton.Exn.wrapHandler") val defaultHandler = fn exn => - (message (concat ["unhandled exception: ", exnMessage exn, "\n"]) + (message (concat ["[basis-library/mlton/exn.sml] unhandled exception: ", exnMessage exn, "\n"]) ; (case history exn of [] => () | l => diff --git a/basis-library/mlton/primthread.sml b/basis-library/mlton/primthread.sml index e16920805..db7d21dc0 100755 --- a/basis-library/mlton/primthread.sml +++ b/basis-library/mlton/primthread.sml @@ -161,24 +161,31 @@ struct struct datatype 'a t = T of 'a list Array.array - fun new () = T (Array.tabulate(numberOfPThreads (), fn _ => [])) - + (* note: this model creates a workq for each pthread, but the main thread is + thread ID 0 and the GC is thread ID 1 (see realtime_thread.c realtimeThreadInit) + *) + fun new () = T (print "workq.new\n"; Array.tabulate(numberOfPThreads (), fn _ => [])) + (*fun mysleep () = (Posix.Process.sleep (Time.fromSeconds 1); ())*) + fun addWork (T wq, w, p) = - let + let + val maxpri = numberOfPThreads () in - lock (); - Array.unsafeUpdate (wq, p, Array.unsafeSub (wq, p) @ [w]); - unlock () + if (Array.length wq) <= p then raise Subscript else ( + lock (); print ("addWork: workqlen="^Int.toString(Array.length wq)^" p="^Int.toString(p)^"\n"); + Array.update (wq, p, Array.sub (wq, p) @ [w]); + print "work added\n"; unlock () + ) end - handle Subscript => ( unlock(); die "Invalid priority") + handle Subscript => die "Invalid priority" fun getWork (T wq, p) = let in - lock (); - case Array.unsafeSub (wq, p) of - [] => (unlock(); NONE) - | w :: l => (Array.unsafeUpdate (wq, p, l); unlock(); SOME w) + lock (); (*print ("workq.getwork: p="^Int.toString(p)^"\n");*) + case Array.sub (wq, p) of + [] => (unlock (); NONE) + | w :: l => (Array.update (wq, p, l); unlock(); SOME w) end handle Subscript => (unlock (); die "Invalid priority") @@ -199,13 +206,11 @@ struct val getMyPriority = _import "GC_myPriority": unit -> int; - fun test () = print "Parallel_run::thread_main running!\n"; + fun test () = print (Int.toString(getMyPriority ())^"] Parallel_run::thread_main running!\n"); fun pspawn (f: unit->unit, p: int) = WorkQueue.addWork(workQ, f, p) - fun thread_main () = (*MLtonThread.run ()print - "\n\nParallel_run::thread_main running!\n\n"*) ( dbg "looping...\n"; - WorkQueue.addWork(workQ, test, 2); loop (pthreadNum ()) ) + fun thread_main () = loop (pthreadNum ()) val gcstate = Primitive.MLton.GCState.gcState diff --git a/doc/rt/notes.md b/doc/rtmlton/rt-notes.md similarity index 100% rename from doc/rt/notes.md rename to doc/rtmlton/rt-notes.md diff --git a/doc/rt/rtems4.md b/doc/rtmlton/rtems4.md similarity index 100% rename from doc/rt/rtems4.md rename to doc/rtmlton/rtems4.md diff --git a/doc/rt/rtems5.md b/doc/rtmlton/rtems5.md similarity index 100% rename from doc/rt/rtems5.md rename to doc/rtmlton/rtems5.md diff --git a/doc/rt/rtems6.md b/doc/rtmlton/rtems6.md similarity index 100% rename from doc/rt/rtems6.md rename to doc/rtmlton/rtems6.md diff --git a/include/c-common.h b/include/c-common.h index 39e477c84..3b6942bce 100755 --- a/include/c-common.h +++ b/include/c-common.h @@ -9,7 +9,10 @@ #ifndef _C_COMMON_H_ #define _C_COMMON_H_ -#define MAXPRI 6 /* XXX dup'd in runtime/realtime_thread.h */ +/* maxpri is an upper array bound, not a count. see + * realtime_thread.c realtimeThreadInit loop (~line 251) + */ +#define MAXPRI 3 /* XXX dup'd in runtime/realtime_thread.h */ #define PTHREAD_MAX MAXPRI #ifndef DEBUG_CCODEGEN #define DEBUG_CCODEGEN FALSE diff --git a/runtime/gc/garbage-collection.c b/runtime/gc/garbage-collection.c index c0259cdd5..7ffcf537a 100755 --- a/runtime/gc/garbage-collection.c +++ b/runtime/gc/garbage-collection.c @@ -15,8 +15,6 @@ #include #include -#undef DEBUG -#define DEBUG 1 struct thrctrl { pthread_mutex_t lock; diff --git a/runtime/gc/realtime_thread.c b/runtime/gc/realtime_thread.c index acb74d2cf..041d35d4f 100755 --- a/runtime/gc/realtime_thread.c +++ b/runtime/gc/realtime_thread.c @@ -335,6 +335,9 @@ void RT_init (GC_state state) UNLOCK_RT_THREADS; } +/* be careful when using this in SML code. remember that maxpri + * includes the main thread and the GC + */ Int32 RTThread_maxpri (void) { return MAXPRI; diff --git a/runtime/gc/realtime_thread.h b/runtime/gc/realtime_thread.h index 214ced76a..8d9a10396 100755 --- a/runtime/gc/realtime_thread.h +++ b/runtime/gc/realtime_thread.h @@ -1,7 +1,11 @@ #ifndef _REALTIME_THREAD_H_ #define _REALTIME_THREAD_H_ -#define MAXPRI 6 /* 0 = main, 1 = GC, also in include/c-common.h */ +/* maxpri is an upper array bound, not a count. see + * realtime_thread.c realtimeThreadInit loop (~line 251) + */ + +#define MAXPRI 3 /* 0 = main, 1 = GC, also in include/c-common.h */ #define PTHREAD_MAX MAXPRI /* transitioning to this instead of MAXPRI */ #define NUM_USER_MUTEXES 10 diff --git a/runtime/gc/um.c b/runtime/gc/um.c index c7b3b8b1d..d1cd03c96 100755 --- a/runtime/gc/um.c +++ b/runtime/gc/um.c @@ -201,7 +201,12 @@ void writeBarrier(GC_state s,Pointer dstbase, Pointer srcbase) if (DEBUG_WB) { if(isSrcOnUMHeap || isDstOnUMHeap) - fprintf(stderr,"%d]In writebarrier, srcbase= "FMTPTR", dstbase= "FMTPTR" , is dst marked? %s, is src marked? %s \n",PTHREAD_NUM,(uintptr_t)srcbase,(uintptr_t)dstbase, (dstMarked)?"YES":"NO", (srcMarked)?"YES":"NO" ); + fprintf(stderr,"%d] In writebarrier, srcbase= "FMTPTR", dstbase= "FMTPTR" , is dst marked? %s, is src marked? %s \n", + PTHREAD_NUM, + (uintptr_t)srcbase, + (uintptr_t)dstbase, + (dstMarked)?"YES":"NO", + (srcMarked)?"YES":"NO"); } } @@ -210,13 +215,13 @@ Pointer UM_Array_offset(GC_state gc_stat, Pointer base, C_Size_t index, Pointer heap_end = (gc_stat->umheap).start + (gc_stat->umheap).size; if (DEBUG_ARRAY_OFFSET) - fprintf(stderr, "UM_Array_offset(base="FMTPTR", index=%d, elemSize=%d, offset=%d)\n", - (uintptr_t)base, index, elemSize, offset); + fprintf(stderr, "%d] UM_Array_offset(base="FMTPTR", index=%d, elemSize=%d, offset=%d)\n", + PTHREAD_NUM, (uintptr_t)base, index, elemSize, offset); if (base < gc_stat->umheap.start || base >= heap_end) { if (DEBUG_ARRAY_OFFSET) { - fprintf(stderr, "UM_Array_offset: not current heap: "FMTPTR" offset: %d\n", - (uintptr_t)base, offset); + fprintf(stderr, "%d] UM_Array_offset: not current heap: "FMTPTR" offset: %d\n", + PTHREAD_NUM, (uintptr_t)base, offset); } return base + index * elemSize + offset; } @@ -261,6 +266,11 @@ Pointer UM_Array_offset(GC_state gc_stat, Pointer base, C_Size_t index, assert (root->array_height > 0); assert (root->array_chunk_magic == UM_ARRAY_SENTINEL); + if (root->array_chunk_type != UM_CHUNK_ARRAY_INTERNAL) { + fprintf(stderr, "%d] root-not-internal UM_Array_offset(base="FMTPTR", index=%d, elemSize=%d, offset=%d)\n", + PTHREAD_NUM, (uintptr_t)base, index, elemSize, offset); + + } assert (root->array_chunk_type == UM_CHUNK_ARRAY_INTERNAL); /* to find the chunk that the index is in: diff --git a/runtime/gc/umheap.c b/runtime/gc/umheap.c index 800fbea60..62da6c453 100755 --- a/runtime/gc/umheap.c +++ b/runtime/gc/umheap.c @@ -351,9 +351,9 @@ bool createUMHeap(GC_state s, size_t step = max_chunk_size + sizeof(UM_header); /*account for size of chunktype field*/ pointer end = h->start + h->size - step; if (DEBUG) { - fprintf(stderr, "%d] sizeof(struct GC_UM_Chunk) = %d\n", PTHREAD_NUM, (int)sizeof(struct GC_UM_Chunk)); - fprintf(stderr, " sizeof(struct GC_UM_Array_Chunk) = %d\n", (int)sizeof(struct GC_UM_Array_Chunk)); - fprintf(stderr, " final chunk size = %d\n", (int)max_chunk_size); + fprintf(stderr, "%d] sizeof(struct GC_UM_Chunk)=%d ", PTHREAD_NUM, (int)sizeof(struct GC_UM_Chunk)); + fprintf(stderr, "sizeof(struct GC_UM_Array_Chunk)=%d ", (int)sizeof(struct GC_UM_Array_Chunk)); + fprintf(stderr, "final chunk size=%d\n", (int)max_chunk_size); } struct timeval t0, t1; gettimeofday(&t0, NULL); @@ -391,7 +391,7 @@ bool createUMHeap(GC_state s, (uintptr_t)(h->start), uintmaxToCommaString(h->size)); fprintf(stderr, - "[GC: mapped freelist over the heap\n]"); + "[GC: mapped freelist over the heap]\n"); } From 73c924cdd3631cf563a45bdbc53c09791b6513f9 Mon Sep 17 00:00:00 2001 From: jeff murphy Date: Wed, 29 Dec 2021 22:55:31 -0500 Subject: [PATCH 04/39] concurrency --- basis-library/mlton/primthread.sml | 19 ++++++++------- include/c-common.h | 2 +- mlton/backend/ssa-to-rssa.fun | 2 +- runtime/gc/array.c | 2 +- runtime/gc/array.h | 2 +- runtime/gc/realtime_thread.c | 37 +++++++++++++++++++++++------- runtime/gc/realtime_thread.h | 2 +- 7 files changed, 45 insertions(+), 21 deletions(-) diff --git a/basis-library/mlton/primthread.sml b/basis-library/mlton/primthread.sml index db7d21dc0..dfb059199 100755 --- a/basis-library/mlton/primthread.sml +++ b/basis-library/mlton/primthread.sml @@ -148,6 +148,7 @@ struct fun rtunlock a = if a<=9 then unlock__ a else print "Invalid lock. Valid locks are [0-9]\n" end + val getMyPriority = _import "GC_myPriority": unit -> int; structure WorkQueue: @@ -164,7 +165,10 @@ struct (* note: this model creates a workq for each pthread, but the main thread is thread ID 0 and the GC is thread ID 1 (see realtime_thread.c realtimeThreadInit) *) - fun new () = T (print "workq.new\n"; Array.tabulate(numberOfPThreads (), fn _ => [])) + fun new () = T ( + print ("make wq, size "^Int.toString(numberOfPThreads ())^"\n"); + Array.tabulate(numberOfPThreads (), fn _ => []) + ) (*fun mysleep () = (Posix.Process.sleep (Time.fromSeconds 1); ())*) fun addWork (T wq, w, p) = @@ -172,22 +176,22 @@ struct val maxpri = numberOfPThreads () in if (Array.length wq) <= p then raise Subscript else ( - lock (); print ("addWork: workqlen="^Int.toString(Array.length wq)^" p="^Int.toString(p)^"\n"); + lock (); (*print ("addWork: workqlen="^Int.toString(Array.length wq)^" p="^Int.toString(p)^"\n"); *) Array.update (wq, p, Array.sub (wq, p) @ [w]); - print "work added\n"; unlock () + unlock () ) end - handle Subscript => die "Invalid priority" + handle Subscript => die (Int.toString(getMyPriority ())^"] Invalid priority (raise) p:"^Int.toString(p)^" alen:"^Int.toString(Array.length wq)) fun getWork (T wq, p) = let in - lock (); (*print ("workq.getwork: p="^Int.toString(p)^"\n");*) + lock (); (* print (Int.toString(getMyPriority ())^"] workq.getwork: len(wq)="^Int.toString(Array.length wq)^"\n"); *) case Array.sub (wq, p) of [] => (unlock (); NONE) | w :: l => (Array.update (wq, p, l); unlock(); SOME w) end - handle Subscript => (unlock (); die "Invalid priority") + handle Subscript => (unlock (); die (Int.toString(getMyPriority ())^"] Invalid priority (die): p:"^Int.toString(p)^" alen:"^Int.toString(Array.length wq))) end @@ -202,9 +206,8 @@ struct fun loop p = case WorkQueue.getWork (workQ, p) of NONE => loop p - | SOME w => (dbg "Working .. \n";w () ; loop p) + | SOME w => (dbg "Working .. \n"; w () ; loop p) - val getMyPriority = _import "GC_myPriority": unit -> int; fun test () = print (Int.toString(getMyPriority ())^"] Parallel_run::thread_main running!\n"); diff --git a/include/c-common.h b/include/c-common.h index 3b6942bce..49992548d 100755 --- a/include/c-common.h +++ b/include/c-common.h @@ -12,7 +12,7 @@ /* maxpri is an upper array bound, not a count. see * realtime_thread.c realtimeThreadInit loop (~line 251) */ -#define MAXPRI 3 /* XXX dup'd in runtime/realtime_thread.h */ +#define MAXPRI 6 /* XXX dup'd in runtime/realtime_thread.h */ #define PTHREAD_MAX MAXPRI #ifndef DEBUG_CCODEGEN #define DEBUG_CCODEGEN FALSE diff --git a/mlton/backend/ssa-to-rssa.fun b/mlton/backend/ssa-to-rssa.fun index 613541e4c..342fae0b6 100644 --- a/mlton/backend/ssa-to-rssa.fun +++ b/mlton/backend/ssa-to-rssa.fun @@ -1071,7 +1071,7 @@ fun convert (program as S.Program.T {functions, globals, main, ...}, then yes t else no ()) | _ => Error.bug "SsaToRssa.ifIsWeakPointer" - fun arrayOrVectorLength () = + fun arrayOrVectorLength () = move (Offset {base = a 0, offset = Runtime.arrayLengthOffset (), diff --git a/runtime/gc/array.c b/runtime/gc/array.c index 649af0590..9845517eb 100755 --- a/runtime/gc/array.c +++ b/runtime/gc/array.c @@ -23,7 +23,7 @@ GC_arrayLength* getArrayLengthp (pointer a) { */ GC_arrayLength getArrayLength (pointer a) { GC_UM_Array_Chunk root = (GC_UM_Array_Chunk)(a - GC_HEADER_SIZE - sizeof(Word32_t)); - //assert (root->array_chunk_magic == UM_ARRAY_SENTINEL); + assert (root->array_chunk_magic == UM_ARRAY_SENTINEL); return root->num_els; } diff --git a/runtime/gc/array.h b/runtime/gc/array.h index d75e1dddf..a3b3523f2 100644 --- a/runtime/gc/array.h +++ b/runtime/gc/array.h @@ -32,7 +32,7 @@ typedef GC_ARRLEN_TYPE GC_arrayLength; #define PRIxARRLEN PRIxARRLEN_(GC_MODEL_ARRLEN_SIZE) #define FMTARRLEN "%"PRIxARRLEN typedef GC_arrayLength GC_arrayCounter; -#define GC_ARRAY_COUNTER_SIZE sizeof(GC_arrayCounter) +#define GC_ARRAY_COUNTER_SIZE 0 //sizeof(GC_arrayCounter) #define PRIxARRCTR PRIxARRLEN #define FMTARRCTR "%"PRIxARRCTR #define GC_ARRAY_HEADER_SIZE (GC_ARRAY_COUNTER_SIZE + GC_ARRAY_LENGTH_SIZE + GC_HEADER_SIZE) diff --git a/runtime/gc/realtime_thread.c b/runtime/gc/realtime_thread.c index 041d35d4f..de51b2964 100755 --- a/runtime/gc/realtime_thread.c +++ b/runtime/gc/realtime_thread.c @@ -352,6 +352,12 @@ Int32 RTThread_get_pthread_num(void) #define COPYIN2(s,EL) s->EL[2] = s->EL[0] void Parallel_run(void); +/* +void client_thread2 (void); +void client_thread3 (void); +void client_thread4 (void); +void client_thread5 (void); +*/ __attribute__((noreturn)) void * @@ -374,15 +380,30 @@ realtimeRunner (void *paramsPtr) BLOCK_RT_THREADS; UNLOCK_RT_THREADS; } - - - fprintf (stderr, "%d] calling parallel_run \n", tNum); - state->rtSync[PTHREAD_NUM]= true; - Parallel_run (); - fprintf (stderr, "%d] back from Parallel_run (shouldnt happen)\n", - tNum); - exit (-1); + fprintf (stderr, "%d] calling parallel_run \n", tNum); + state->rtSync[PTHREAD_NUM] = true; + +/* + switch (tNum) { + case 2: + fprintf(stderr, "call client_thread2\n"); + client_thread2(); + break; + case 3: + client_thread3(); + case 4: + client_thread4(); + case 5: + client_thread5(); + } + sleep(300); +*/ + + Parallel_run (); + fprintf (stderr, "%d] back from Parallel_run (shouldnt happen)\n", + tNum); + exit (-1); #if 0 /*Using same lock to BLOCK again. This time it wont be unblocked. * TODO: Define what RT threads should do*/ diff --git a/runtime/gc/realtime_thread.h b/runtime/gc/realtime_thread.h index 8d9a10396..28c24c326 100755 --- a/runtime/gc/realtime_thread.h +++ b/runtime/gc/realtime_thread.h @@ -5,7 +5,7 @@ * realtime_thread.c realtimeThreadInit loop (~line 251) */ -#define MAXPRI 3 /* 0 = main, 1 = GC, also in include/c-common.h */ +#define MAXPRI 6 /* 0 = main, 1 = GC, also in include/c-common.h */ #define PTHREAD_MAX MAXPRI /* transitioning to this instead of MAXPRI */ #define NUM_USER_MUTEXES 10 From 615b5a538ecd627a35a781285ef9683f60ebf07e Mon Sep 17 00:00:00 2001 From: jeff murphy Date: Mon, 3 Jan 2022 15:01:37 -0500 Subject: [PATCH 05/39] concurrency fix for mult threads --- basis-library/mlton/primthread.sig | 2 +- basis-library/mlton/primthread.sml | 2 +- runtime/gc/debug.h | 4 +- runtime/gc/garbage-collection.c | 82 +- runtime/gc/realtime_thread.c | 48 +- runtime/gc/realtime_thread.h | 2 +- runtime/gc/ummark.c | 6 +- ub/rtlinux/kernel-config | 4924 ++++++++++++++++++++++++++++ 8 files changed, 4990 insertions(+), 80 deletions(-) create mode 100644 ub/rtlinux/kernel-config diff --git a/basis-library/mlton/primthread.sig b/basis-library/mlton/primthread.sig index e81a9bcda..abea7eae6 100755 --- a/basis-library/mlton/primthread.sig +++ b/basis-library/mlton/primthread.sig @@ -32,7 +32,7 @@ signature PRIM_THREAD = type 'a t - val get_ticks_since_boot : unit -> int + val get_ticks_since_boot : unit -> real val dump_instrument_stderr : int -> unit val instrument : int -> unit diff --git a/basis-library/mlton/primthread.sml b/basis-library/mlton/primthread.sml index dfb059199..d74fe5eb2 100755 --- a/basis-library/mlton/primthread.sml +++ b/basis-library/mlton/primthread.sml @@ -137,7 +137,7 @@ struct local val inst__ = _import "User_instrument" : int -> unit; val dise__ = _import "Dump_instrument_stderr" : int -> unit; - val gtsb__ = _import "get_ticks_since_boot" : unit -> int; + val gtsb__ = _import "get_ticks_since_boot" : unit -> real; val lock__ = _import "User_lock" : int -> unit; val unlock__ = _import "User_unlock" : int -> unit; in diff --git a/runtime/gc/debug.h b/runtime/gc/debug.h index 13d8a00fc..a7ea5ef3a 100755 --- a/runtime/gc/debug.h +++ b/runtime/gc/debug.h @@ -41,8 +41,8 @@ enum { FORCE_GENERATIONAL = FALSE, FORCE_MARK_COMPACT = FALSE, DEBUG_OLD = FALSE, - DEBUG_RTGC = FALSE, - DEBUG_RTGC_MARKING = FALSE, + DEBUG_RTGC = TRUE, + DEBUG_RTGC_MARKING = TRUE, DEBUG_WB = FALSE, DISPLAY_GC_STATS = FALSE }; diff --git a/runtime/gc/garbage-collection.c b/runtime/gc/garbage-collection.c index 7ffcf537a..09e6da963 100755 --- a/runtime/gc/garbage-collection.c +++ b/runtime/gc/garbage-collection.c @@ -45,10 +45,10 @@ struct thrctrl { #define RTSYNC_BLOCK IFED(pthread_cond_wait(&s->rtSync_cond,&s->rtSync_lock)) #define RTSYNC_TRYLOCK pthread_mutex_trylock(&s->rtSync_lock) -#define TC_LOCK if (DEBUG) fprintf(stderr, "%d] TC_LOCK thr:%d boot:%d\n", PTHREAD_NUM, TC.running_threads, TC.booted); IFED(pthread_mutex_lock(&TC.lock)) -#define TC_UNLOCK if (DEBUG) fprintf(stderr, "%d] TC_UNLOCK thr:%d boot:%d\n", PTHREAD_NUM, TC.running_threads, TC.booted); IFED(pthread_mutex_unlock(&TC.lock)) -#define TCSP_LOCK if (DEBUG) fprintf(stderr, "%d] TCSP_LOCK thr:%d boot:%d\n", PTHREAD_NUM, TC.running_threads, TC.booted); IFED(pthread_mutex_lock(&TC.safepoint_lock)) -#define TCSP_UNLOCK if (DEBUG) fprintf(stderr, "%d] TCSP_UNLOCK thr:%d boot:%d\n", PTHREAD_NUM, TC.running_threads, TC.booted); IFED(pthread_mutex_unlock(&TC.safepoint_lock)) +#define TC_LOCK if (DEBUG or DEBUG_RTGC) fprintf(stderr, "%d] TC_LOCK thr:%d boot:%d\n", PTHREAD_NUM, TC.running_threads, TC.booted); IFED(pthread_mutex_lock(&TC.lock)) +#define TC_UNLOCK if (DEBUG or DEBUG_RTGC) fprintf(stderr, "%d] TC_UNLOCK thr:%d boot:%d\n", PTHREAD_NUM, TC.running_threads, TC.booted); IFED(pthread_mutex_unlock(&TC.lock)) +#define TCSP_LOCK if (DEBUG or DEBUG_RTGC) fprintf(stderr, "%d] TCSP_LOCK thr:%d boot:%d\n", PTHREAD_NUM, TC.running_threads, TC.booted); IFED(pthread_mutex_lock(&TC.safepoint_lock)) +#define TCSP_UNLOCK if (DEBUG or DEBUG_RTGC) fprintf(stderr, "%d] TCSP_UNLOCK thr:%d boot:%d\n", PTHREAD_NUM, TC.running_threads, TC.booted); IFED(pthread_mutex_unlock(&TC.safepoint_lock)) /* * - threads can ask for GC's by setting gc_needed to 1 @@ -75,25 +75,25 @@ struct thrctrl { #define pthread_yield sched_yield #define REQUESTGC do { \ - if (DEBUG) fprintf(stderr, "%d] REQUESTGC start thr:%d\n", PTHREAD_NUM, TC.running_threads); \ + if (DEBUG or DEBUG_RTGC) fprintf(stderr, "%d] REQUESTGC start thr:%d\n", PTHREAD_NUM, TC.running_threads); \ TC_LOCK; TC.gc_needed = 1; TC.requested_by = PTHREAD_NUM; setup_for_gc(s); TC_UNLOCK; \ - if (DEBUG) fprintf(stderr, "%d] REQUESTGC end thr:%d\n", PTHREAD_NUM, TC.running_threads); \ + if (DEBUG or DEBUG_RTGC) fprintf(stderr, "%d] REQUESTGC end thr:%d\n", PTHREAD_NUM, TC.running_threads); \ } while(0) #define COMPLETEGC do { \ - if (DEBUG) fprintf(stderr, "%d] COMPLETEGC start thr:%d\n", PTHREAD_NUM, TC.running_threads); \ + if (DEBUG or DEBUG_RTGC) fprintf(stderr, "%d] COMPLETEGC start thr:%d\n", PTHREAD_NUM, TC.running_threads); \ finish_for_gc(s); \ - if (DEBUG) fprintf(stderr, "%d] COMPLETEGC end thr:%d\n", PTHREAD_NUM, TC.running_threads); \ + if (DEBUG or DEBUG_RTGC) fprintf(stderr, "%d] COMPLETEGC end thr:%d\n", PTHREAD_NUM, TC.running_threads); \ } while(0) #define ENTER_SAFEPOINT do { \ - if (DEBUG) fprintf(stderr, "%d] ENTER_SAFEPOINT start thr:%d\n", PTHREAD_NUM, TC.running_threads); \ + if (DEBUG or DEBUG_RTGC) fprintf(stderr, "%d] ENTER_SAFEPOINT start thr:%d\n", PTHREAD_NUM, TC.running_threads); \ TC_LOCK; TC.running_threads--; pthread_cond_signal(&TC.cond); TC_UNLOCK; \ - if (DEBUG) fprintf(stderr, "%d] ENTER_SAFEPOINT end thr:%d\n", PTHREAD_NUM, TC.running_threads); \ + if (DEBUG or DEBUG_RTGC) fprintf(stderr, "%d] ENTER_SAFEPOINT end thr:%d\n", PTHREAD_NUM, TC.running_threads); \ } while(0) #define LEAVE_SAFEPOINT do { \ - if (DEBUG) fprintf(stderr, "%d] LEAVE_SAFEPOINT start thr:%d\n", PTHREAD_NUM, TC.running_threads); \ + if (DEBUG or DEBUG_RTGC) fprintf(stderr, "%d] LEAVE_SAFEPOINT start thr:%d\n", PTHREAD_NUM, TC.running_threads); \ TCSP_LOCK; while (TC.gc_needed) pthread_cond_wait(&TC.safepoint_cond, &TC.safepoint_lock); TCSP_UNLOCK; \ TC_LOCK; TC.running_threads++; TC_UNLOCK; \ - if (DEBUG) fprintf(stderr, "%d] LEAVE_SAFEPOINT end thr:%d\n", PTHREAD_NUM, TC.running_threads); \ + if (DEBUG or DEBUG_RTGC) fprintf(stderr, "%d] LEAVE_SAFEPOINT end thr:%d\n", PTHREAD_NUM, TC.running_threads); \ } while(0) @@ -166,7 +166,7 @@ count_stack_chunks(GC_state s, GC_thread thread) */ void maybe_growstack(GC_state s, GC_thread thread, bool force_grow) { - if (DEBUG_STACK_GROW) + if (DEBUG_STACK_GROW or DEBUG_RTGC) fprintf(stderr, "%d] "YELLOW("%s\n"), PTHREAD_NUM, __FUNCTION__); if ((s->controls.ratios.stackCurrentGrowThreshold >= 1.0) && force_grow) { @@ -297,7 +297,7 @@ void *GCrunner(void *_s) { pthread_cond_init(&TC.cond, NULL); pthread_cond_init(&TC.safepoint_cond, NULL); - if (DEBUG) + if (DEBUG or DEBUG_RTGC or DEBUG_RTGC_MARKING) fprintf(stderr, "%d] GC_Runner Thread running.\n", PTHREAD_NUM); s->GCrunnerRunning = TRUE; @@ -346,10 +346,13 @@ void *GCrunner(void *_s) { /* 2 less than MAXPRI because: * GC thread is never blocked * RT thread is always blocked*/ - if (s->threadsBlockedForGC == (MAXPRI - 2)) + fprintf(stderr, "%d] threadsBlockedForGC %d MAXPRI-2=%d attempts=%d\n", PTHREAD_NUM, s->threadsBlockedForGC, MAXPRI-2, s->attempts); + + if (s->threadsBlockedForGC == (MAXPRI - 2)) { s->attempts++; - else + } else { s->attempts = 0; + } if (s->attempts > 2) { die("Insuffient Memory\n"); @@ -368,7 +371,8 @@ void *GCrunner(void *_s) { s->dirty = false; /*Change this to reset all rtSync values for all RT threads*/ - s->rtSync[0] = false; + for (int i = 0 ; i < MAXPRI ; i++) + s->rtSync[i] = false; s->threadsBlockedForGC = 0; @@ -450,7 +454,7 @@ performGC(GC_state s, // forceMajor, mayResize); #endif } -#endif +#endif void markStack(GC_state s, pointer thread_) { @@ -476,7 +480,7 @@ void markStack(GC_state s, pointer thread_) { do { if (DEBUG_RTGC) - fprintf(stderr, "mark SF "FMTPTR"\n", (uintptr_t)stackFrame); + fprintf(stderr, "%d] "YELLOW("mark stackframe")" "FMTPTR"\n", PTHREAD_NUM, (uintptr_t)stackFrame); assert (stackFrame->sentinel == UM_STACK_SENTINEL); assert (stackFrame->ra != 0); markChunk((((pointer)stackFrame) + GC_HEADER_SIZE), STACK_TAG, MARK_MODE, s, 0); @@ -592,10 +596,10 @@ void sweep(GC_state s, size_t ensureObjectChunksAvailable, { assert(ISUNMARKED(header)); - if (DEBUG_MEM) { - fprintf(stderr, "Collecting: " + if (DEBUG_MEM or DEBUG_RTGC) { + fprintf(stderr, "%d] Collecting: " FMTPTR - ", %d, %d\n", + ", %d, %d\n", PTHREAD_NUM, (uintptr_t) pc, (int)pc->sentinel, (int)pc->chunk_header); } @@ -665,10 +669,10 @@ void sweep(GC_state s, size_t ensureObjectChunksAvailable, } else { - if (DEBUG_MEM) { - fprintf(stderr, "Collecting array: " + if (DEBUG_MEM or DEBUG_RTGC) { + fprintf(stderr, "%d] Collecting array: " FMTPTR - ", %d, %d\n", + ", %d, %d\n", PTHREAD_NUM, (uintptr_t) pc, pc->array_chunk_magic, pc->array_chunk_header); } @@ -714,7 +718,7 @@ void sweep(GC_state s, size_t ensureObjectChunksAvailable, if (DEBUG_RTGC) { fprintf(stderr, "%d] Finished one sweep cycle and freed %d chunks\n", PTHREAD_NUM, freed); - fprintf(stderr, "%d]Chunks; Visited: %d, Marked: %d, Greys: %d Reds: %d\n", PTHREAD_NUM, visited, marked, grey, + fprintf(stderr, "%d] Chunks; Visited: %d, Marked: %d, Greys: %d Reds: %d\n", PTHREAD_NUM, visited, marked, grey, red); } } @@ -829,7 +833,7 @@ void performGC_helper(GC_state s, gcTime = 0; /* Assign gcTime to quell gcc warning. */ /* Send a GC signal. */ if (s->signalsInfo.gcSignalHandled and s->signalHandlerThread[PTHREAD_NUM] != BOGUS_OBJPTR) { - if (DEBUG_SIGNALS) + if (DEBUG_SIGNALS or DEBUG_RTGC) fprintf(stderr, "GC Signal pending.\n"); s->signalsInfo.gcSignalPending = TRUE; unless(s->signalsInfo.amInSignalHandler) @@ -869,26 +873,16 @@ bool ensureChunksAvailable(GC_state s) { void GC_collect_real(GC_state s, size_t bytesRequested, bool force) { + if (DEBUG_RTGC) { + fprintf(stderr, "%d] Marking my stack\n", PTHREAD_NUM); + } + enter(s); - /* When the mutator requests zero bytes, it may actually need as - * much as GC_HEAP_LIMIT_SLOP. - */ - /*if (0 == bytesRequested) - bytesRequested = GC_HEAP_LIMIT_SLOP; - getThreadCurrent(s)->bytesNeeded = bytesRequested; - switchToSignalHandlerThreadIfNonAtomicAndSignalPending (s); - ensureInvariantForMutator (s, force); - - assert (invariantForMutatorFrontier(s)); - assert (invariantForMutatorStack(s)); - */ - markStack(s, GC_getCurrentThread(s)); - leave(s); - if (DEBUG_MEM) { - fprintf(stderr, "GC_collect done\n"); + if (DEBUG_RTGC) { + fprintf(stderr, "%d] GC_collect done\n", PTHREAD_NUM); } } @@ -939,7 +933,7 @@ void GC_collect(GC_state s, size_t bytesRequested, bool force, bool collectRed) if (DEBUG_RTGC) { - fprintf(stderr, "%d] GC_collect: Is dirty bit set? %s, Are enough Chunks Avialable? %s\n", PTHREAD_NUM, + fprintf(stderr, "%d] GC_collect: Is dirty bit set? %s, Are enough Chunks Available? %s\n", PTHREAD_NUM, s->dirty ? "Y" : "N", ensureChunksAvailable(s) ? "Y" : "N"); fprintf(stderr, "%d] ChunksAllocated = %s, FC = %d\n", PTHREAD_NUM, uintmaxToCommaString(s->cGCStats.numChunksAllocated), s->fl_chunks); diff --git a/runtime/gc/realtime_thread.c b/runtime/gc/realtime_thread.c index de51b2964..9a6a93969 100755 --- a/runtime/gc/realtime_thread.c +++ b/runtime/gc/realtime_thread.c @@ -106,13 +106,13 @@ void InitializeMutexes(void) { } -unsigned int get_ticks_since_boot(void) { +double get_ticks_since_boot(void) { rtems_status_code sc; rtems_interval time_buffer; sc = rtems_clock_get(RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, (void *)&time_buffer); assert (rc == RTEMS_SUCCESSFUL); - return (unsigned int)time_buffer; + return (double)time_buffer; } #else @@ -183,22 +183,12 @@ void InitializeMutexes(void) { } } -/* returns milliseconds */ -unsigned int get_ticks_since_boot(void) { - long ms; // Milliseconds - time_t s; // Seconds +/* returns seconds */ +double get_ticks_since_boot(void) { struct timespec spec; clock_gettime(CLOCK_MONOTONIC, &spec); - - s = spec.tv_sec; - ms = round(spec.tv_nsec / 1.0e6); // Convert nanoseconds to milliseconds - if (ms > 999) { - s++; - ms = 0; - } - - return (s*1000) + ms; + return spec.tv_sec + spec.tv_nsec / 1.0e9; } #endif @@ -206,22 +196,25 @@ unsigned int get_ticks_since_boot(void) { #define MAX_INSTRUMENT 1024 unsigned int instrument_offset[MAXPRI+1]; -unsigned int instrument_buffer[MAXPRI+1][MAX_INSTRUMENT]; +double instrument_buffer[MAXPRI+1][MAX_INSTRUMENT]; -void User_instrument (Int32 p) { +void User_instrument (Int32 icode) { instrument_buffer[PTHREAD_NUM][instrument_offset[MAXPRI]] = get_ticks_since_boot(); - instrument_buffer[PTHREAD_NUM][instrument_offset[MAXPRI]+1] = (unsigned int)p; + instrument_buffer[PTHREAD_NUM][instrument_offset[MAXPRI]+1] = (double)icode; instrument_offset[MAXPRI] = (instrument_offset[MAXPRI]+2) % MAX_INSTRUMENT; } -void Dump_instrument_stderr (Int32 p) { - if (p == -1) p = PTHREAD_NUM; +void Dump_instrument_stderr (Int32 thrnum) { + if (thrnum == -1) thrnum = PTHREAD_NUM; + + fprintf(stderr, "thread-id, time-stamp, code-number\n"); for(unsigned int i = 0 ; i < MAX_INSTRUMENT ; i += 2) { - if (instrument_buffer[p][i] != 0) { - fprintf(stderr, "%d, %u, %u\n", p, - instrument_buffer[p][i], - instrument_buffer[p][i+1] + if (instrument_buffer[thrnum][i] > 0 || instrument_buffer[thrnum][i] < 0) { + fprintf(stderr, "%d, %f, %f\n", + thrnum, + instrument_buffer[thrnum][i], + instrument_buffer[thrnum][i+1] ); } } @@ -369,7 +362,7 @@ realtimeRunner (void *paramsPtr) set_pthread_num (params->tNum); - state->rtSync[PTHREAD_NUM]= true; + state->rtSync[PTHREAD_NUM] = true; LOCK_RT_THREADS; while(!rtinitfromML) @@ -382,7 +375,7 @@ realtimeRunner (void *paramsPtr) } fprintf (stderr, "%d] calling parallel_run \n", tNum); - state->rtSync[PTHREAD_NUM] = true; + state->rtSync[PTHREAD_NUM] = false; /* switch (tNum) { @@ -401,8 +394,7 @@ realtimeRunner (void *paramsPtr) */ Parallel_run (); - fprintf (stderr, "%d] back from Parallel_run (shouldnt happen)\n", - tNum); + fprintf (stderr, "%d] back from Parallel_run (shouldnt happen)\n", tNum); exit (-1); #if 0 /*Using same lock to BLOCK again. This time it wont be unblocked. diff --git a/runtime/gc/realtime_thread.h b/runtime/gc/realtime_thread.h index 28c24c326..bc3686ee6 100755 --- a/runtime/gc/realtime_thread.h +++ b/runtime/gc/realtime_thread.h @@ -37,7 +37,7 @@ void User_lock (Int32); void User_unlock (Int32); void User_instrument (Int32 p); void Dump_instrument_stderr (Int32 p); -unsigned int get_ticks_since_boot(void); +double get_ticks_since_boot(void); #endif #endif /* _REALTIME_THREAD_H_ */ diff --git a/runtime/gc/ummark.c b/runtime/gc/ummark.c index ddb487301..25a26f73d 100755 --- a/runtime/gc/ummark.c +++ b/runtime/gc/ummark.c @@ -124,7 +124,7 @@ bool isObjectShaded(GC_state s, objptr *opp) { } else verdict = isContainerChunkMarkedByMode(p, GREY_MODE, tag); - if (DEBUG) + if (DEBUG_RTGC_MARKING) fprintf(stderr, "%d] %s verdict %d\n", PTHREAD_NUM, __func__, verdict); return verdict; @@ -141,7 +141,7 @@ bool isObjectMarked(GC_state s, objptr *opp) { bool verdict = isContainerChunkMarkedByMode(p, MARK_MODE, tag); - if (DEBUG) { + if (DEBUG_RTGC_MARKING) { printTag(__func__, tag, p); fprintf(stderr, "%d] %s verdict %d\n", PTHREAD_NUM, __func__, verdict); } @@ -166,7 +166,7 @@ void umShadeObject(GC_state s, objptr *opp) { splitHeader(s, header, &tag, NULL, &bytesNonObjptrs, &numObjptrs); markChunk(p, tag, GREY_MODE, s, numObjptrs); - if (DEBUG) { + if (DEBUG_RTGC_MARKING) { printTag(__func__, tag, p); fprintf(stderr, "%d] shade "FMTPTR"\n", PTHREAD_NUM, (uintptr_t) p); } diff --git a/ub/rtlinux/kernel-config b/ub/rtlinux/kernel-config new file mode 100644 index 000000000..f45b65d72 --- /dev/null +++ b/ub/rtlinux/kernel-config @@ -0,0 +1,4924 @@ +# +# Automatically generated file; DO NOT EDIT. +# Linux/x86 4.16.18 Kernel Configuration +# +# CONFIG_64BIT is not set +CONFIG_X86_32=y +CONFIG_X86=y +CONFIG_INSTRUCTION_DECODER=y +CONFIG_OUTPUT_FORMAT="elf32-i386" +CONFIG_ARCH_DEFCONFIG="arch/x86/configs/i386_defconfig" +CONFIG_LOCKDEP_SUPPORT=y +CONFIG_STACKTRACE_SUPPORT=y +CONFIG_MMU=y +CONFIG_ARCH_MMAP_RND_BITS_MIN=8 +CONFIG_ARCH_MMAP_RND_BITS_MAX=16 +CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=8 +CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=16 +CONFIG_NEED_SG_DMA_LENGTH=y +CONFIG_GENERIC_ISA_DMA=y +CONFIG_GENERIC_BUG=y +CONFIG_GENERIC_HWEIGHT=y +CONFIG_ARCH_MAY_HAVE_PC_FDC=y +CONFIG_RWSEM_GENERIC_SPINLOCK=y +# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set +CONFIG_GENERIC_CALIBRATE_DELAY=y +CONFIG_ARCH_HAS_CPU_RELAX=y +CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y +CONFIG_HAVE_SETUP_PER_CPU_AREA=y +CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y +CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y +CONFIG_ARCH_HIBERNATION_POSSIBLE=y +CONFIG_ARCH_SUSPEND_POSSIBLE=y +CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y +CONFIG_ARCH_WANT_GENERAL_HUGETLB=y +CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y +CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y +CONFIG_X86_32_SMP=y +CONFIG_ARCH_SUPPORTS_UPROBES=y +CONFIG_FIX_EARLYCON_MEM=y +CONFIG_PGTABLE_LEVELS=2 +CONFIG_IRQ_WORK=y +CONFIG_BUILDTIME_EXTABLE_SORT=y +CONFIG_THREAD_INFO_IN_TASK=y + +# +# General setup +# +CONFIG_INIT_ENV_ARG_LIMIT=32 +CONFIG_CROSS_COMPILE="" +# CONFIG_COMPILE_TEST is not set +CONFIG_LOCALVERSION="" +CONFIG_LOCALVERSION_AUTO=y +CONFIG_HAVE_KERNEL_GZIP=y +CONFIG_HAVE_KERNEL_BZIP2=y +CONFIG_HAVE_KERNEL_LZMA=y +CONFIG_HAVE_KERNEL_XZ=y +CONFIG_HAVE_KERNEL_LZO=y +CONFIG_HAVE_KERNEL_LZ4=y +CONFIG_KERNEL_GZIP=y +# CONFIG_KERNEL_BZIP2 is not set +# CONFIG_KERNEL_LZMA is not set +# CONFIG_KERNEL_XZ is not set +# CONFIG_KERNEL_LZO is not set +# CONFIG_KERNEL_LZ4 is not set +CONFIG_DEFAULT_HOSTNAME="(none)" +CONFIG_SWAP=y +CONFIG_SYSVIPC=y +CONFIG_SYSVIPC_SYSCTL=y +# CONFIG_POSIX_MQUEUE is not set +CONFIG_CROSS_MEMORY_ATTACH=y +# CONFIG_USELIB is not set +# CONFIG_AUDIT is not set +CONFIG_HAVE_ARCH_AUDITSYSCALL=y + +# +# IRQ subsystem +# +CONFIG_GENERIC_IRQ_PROBE=y +CONFIG_GENERIC_IRQ_SHOW=y +CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK=y +CONFIG_GENERIC_PENDING_IRQ=y +CONFIG_GENERIC_IRQ_MIGRATION=y +CONFIG_IRQ_DOMAIN=y +CONFIG_IRQ_DOMAIN_HIERARCHY=y +CONFIG_GENERIC_IRQ_MATRIX_ALLOCATOR=y +CONFIG_GENERIC_IRQ_RESERVATION_MODE=y +CONFIG_IRQ_FORCED_THREADING=y +CONFIG_SPARSE_IRQ=y +CONFIG_CLOCKSOURCE_WATCHDOG=y +CONFIG_ARCH_CLOCKSOURCE_DATA=y +CONFIG_CLOCKSOURCE_VALIDATE_LAST_CYCLE=y +CONFIG_GENERIC_TIME_VSYSCALL=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y +CONFIG_GENERIC_CLOCKEVENTS_MIN_ADJUST=y +CONFIG_GENERIC_CMOS_UPDATE=y + +# +# Timers subsystem +# +CONFIG_TICK_ONESHOT=y +CONFIG_HZ_PERIODIC=y +# CONFIG_NO_HZ_IDLE is not set +# CONFIG_NO_HZ is not set +CONFIG_HIGH_RES_TIMERS=y + +# +# CPU/Task time and stats accounting +# +CONFIG_TICK_CPU_ACCOUNTING=y +# CONFIG_IRQ_TIME_ACCOUNTING is not set +# CONFIG_BSD_PROCESS_ACCT is not set +# CONFIG_TASKSTATS is not set +CONFIG_CPU_ISOLATION=y + +# +# RCU Subsystem +# +CONFIG_PREEMPT_RCU=y +# CONFIG_RCU_EXPERT is not set +CONFIG_SRCU=y +CONFIG_TREE_SRCU=y +CONFIG_TASKS_RCU=y +CONFIG_RCU_STALL_COMMON=y +CONFIG_RCU_NEED_SEGCBLIST=y +# CONFIG_BUILD_BIN2C is not set +# CONFIG_IKCONFIG is not set +CONFIG_LOG_BUF_SHIFT=18 +CONFIG_LOG_CPU_MAX_BUF_SHIFT=12 +CONFIG_PRINTK_SAFE_LOG_BUF_SHIFT=13 +CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y +CONFIG_ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH=y +CONFIG_CGROUPS=y +# CONFIG_MEMCG is not set +# CONFIG_BLK_CGROUP is not set +# CONFIG_CGROUP_SCHED is not set +# CONFIG_CGROUP_PIDS is not set +# CONFIG_CGROUP_RDMA is not set +# CONFIG_CGROUP_FREEZER is not set +# CONFIG_CPUSETS is not set +# CONFIG_CGROUP_DEVICE is not set +# CONFIG_CGROUP_CPUACCT is not set +# CONFIG_CGROUP_PERF is not set +# CONFIG_SOCK_CGROUP_DATA is not set +CONFIG_NAMESPACES=y +CONFIG_UTS_NS=y +CONFIG_IPC_NS=y +# CONFIG_USER_NS is not set +CONFIG_PID_NS=y +CONFIG_NET_NS=y +# CONFIG_SCHED_AUTOGROUP is not set +# CONFIG_SYSFS_DEPRECATED is not set +# CONFIG_RELAY is not set +CONFIG_BLK_DEV_INITRD=y +CONFIG_INITRAMFS_SOURCE="" +CONFIG_RD_GZIP=y +CONFIG_RD_BZIP2=y +CONFIG_RD_LZMA=y +CONFIG_RD_XZ=y +CONFIG_RD_LZO=y +CONFIG_RD_LZ4=y +CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y +# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set +CONFIG_SYSCTL=y +CONFIG_ANON_INODES=y +CONFIG_HAVE_UID16=y +CONFIG_SYSCTL_EXCEPTION_TRACE=y +CONFIG_HAVE_PCSPKR_PLATFORM=y +CONFIG_BPF=y +# CONFIG_EXPERT is not set +CONFIG_UID16=y +CONFIG_MULTIUSER=y +CONFIG_SGETMASK_SYSCALL=y +CONFIG_SYSFS_SYSCALL=y +# CONFIG_SYSCTL_SYSCALL is not set +CONFIG_FHANDLE=y +CONFIG_POSIX_TIMERS=y +CONFIG_PRINTK=y +CONFIG_PRINTK_NMI=y +CONFIG_BUG=y +CONFIG_ELF_CORE=y +CONFIG_PCSPKR_PLATFORM=y +CONFIG_BASE_FULL=y +CONFIG_FUTEX=y +CONFIG_FUTEX_PI=y +CONFIG_EPOLL=y +CONFIG_SIGNALFD=y +CONFIG_TIMERFD=y +CONFIG_EVENTFD=y +CONFIG_SHMEM=y +CONFIG_AIO=y +CONFIG_ADVISE_SYSCALLS=y +CONFIG_MEMBARRIER=y +# CONFIG_CHECKPOINT_RESTORE is not set +CONFIG_KALLSYMS=y +# CONFIG_KALLSYMS_ABSOLUTE_PERCPU is not set +CONFIG_KALLSYMS_BASE_RELATIVE=y +# CONFIG_BPF_SYSCALL is not set +# CONFIG_USERFAULTFD is not set +CONFIG_ARCH_HAS_MEMBARRIER_SYNC_CORE=y +# CONFIG_EMBEDDED is not set +CONFIG_HAVE_PERF_EVENTS=y +CONFIG_PC104=y + +# +# Kernel Performance Events And Counters +# +CONFIG_PERF_EVENTS=y +CONFIG_VM_EVENT_COUNTERS=y +CONFIG_SLUB_DEBUG=y +CONFIG_COMPAT_BRK=y +CONFIG_SLUB=y +CONFIG_SLAB_MERGE_DEFAULT=y +# CONFIG_SLAB_FREELIST_RANDOM is not set +# CONFIG_SLAB_FREELIST_HARDENED is not set +# CONFIG_SYSTEM_DATA_VERIFICATION is not set +# CONFIG_PROFILING is not set +CONFIG_HAVE_OPROFILE=y +CONFIG_OPROFILE_NMI_TIMER=y +# CONFIG_KPROBES is not set +CONFIG_JUMP_LABEL=y +# CONFIG_STATIC_KEYS_SELFTEST is not set +# CONFIG_UPROBES is not set +# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set +CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y +CONFIG_ARCH_USE_BUILTIN_BSWAP=y +CONFIG_HAVE_IOREMAP_PROT=y +CONFIG_HAVE_KPROBES=y +CONFIG_HAVE_KRETPROBES=y +CONFIG_HAVE_OPTPROBES=y +CONFIG_HAVE_KPROBES_ON_FTRACE=y +CONFIG_HAVE_FUNCTION_ERROR_INJECTION=y +CONFIG_HAVE_NMI=y +CONFIG_HAVE_ARCH_TRACEHOOK=y +CONFIG_HAVE_DMA_CONTIGUOUS=y +CONFIG_GENERIC_SMP_IDLE_THREAD=y +CONFIG_ARCH_HAS_FORTIFY_SOURCE=y +CONFIG_ARCH_HAS_SET_MEMORY=y +CONFIG_HAVE_ARCH_THREAD_STRUCT_WHITELIST=y +CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT=y +CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y +CONFIG_HAVE_CLK=y +CONFIG_HAVE_DMA_API_DEBUG=y +CONFIG_HAVE_HW_BREAKPOINT=y +CONFIG_HAVE_MIXED_BREAKPOINTS_REGS=y +CONFIG_HAVE_USER_RETURN_NOTIFIER=y +CONFIG_HAVE_PERF_EVENTS_NMI=y +CONFIG_HAVE_HARDLOCKUP_DETECTOR_PERF=y +CONFIG_HAVE_PERF_REGS=y +CONFIG_HAVE_PERF_USER_STACK_DUMP=y +CONFIG_HAVE_ARCH_JUMP_LABEL=y +CONFIG_HAVE_RCU_TABLE_FREE=y +CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG=y +CONFIG_HAVE_ALIGNED_STRUCT_PAGE=y +CONFIG_HAVE_CMPXCHG_LOCAL=y +CONFIG_HAVE_CMPXCHG_DOUBLE=y +CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y +CONFIG_HAVE_ARCH_SECCOMP_FILTER=y +CONFIG_SECCOMP_FILTER=y +CONFIG_HAVE_GCC_PLUGINS=y +# CONFIG_GCC_PLUGINS is not set +CONFIG_HAVE_CC_STACKPROTECTOR=y +# CONFIG_CC_STACKPROTECTOR_NONE is not set +# CONFIG_CC_STACKPROTECTOR_REGULAR is not set +# CONFIG_CC_STACKPROTECTOR_STRONG is not set +CONFIG_CC_STACKPROTECTOR_AUTO=y +CONFIG_THIN_ARCHIVES=y +CONFIG_HAVE_ARCH_WITHIN_STACK_FRAMES=y +CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y +CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE=y +CONFIG_HAVE_MOD_ARCH_SPECIFIC=y +CONFIG_MODULES_USE_ELF_REL=y +CONFIG_ARCH_HAS_ELF_RANDOMIZE=y +CONFIG_HAVE_ARCH_MMAP_RND_BITS=y +CONFIG_HAVE_EXIT_THREAD=y +CONFIG_ARCH_MMAP_RND_BITS=8 +CONFIG_HAVE_COPY_THREAD_TLS=y +# CONFIG_HAVE_ARCH_HASH is not set +# CONFIG_ISA_BUS_API is not set +CONFIG_CLONE_BACKWARDS=y +CONFIG_OLD_SIGSUSPEND3=y +CONFIG_OLD_SIGACTION=y +# CONFIG_CPU_NO_EFFICIENT_FFS is not set +# CONFIG_HAVE_ARCH_VMAP_STACK is not set +# CONFIG_ARCH_OPTIONAL_KERNEL_RWX is not set +# CONFIG_ARCH_OPTIONAL_KERNEL_RWX_DEFAULT is not set +CONFIG_ARCH_HAS_STRICT_KERNEL_RWX=y +CONFIG_STRICT_KERNEL_RWX=y +CONFIG_ARCH_HAS_STRICT_MODULE_RWX=y +CONFIG_STRICT_MODULE_RWX=y +CONFIG_ARCH_HAS_PHYS_TO_DMA=y +CONFIG_ARCH_HAS_REFCOUNT=y +# CONFIG_REFCOUNT_FULL is not set + +# +# GCOV-based kernel profiling +# +CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y +CONFIG_HAVE_GENERIC_DMA_COHERENT=y +CONFIG_RT_MUTEXES=y +CONFIG_BASE_SMALL=0 +CONFIG_MODULES=y +# CONFIG_MODULE_FORCE_LOAD is not set +# CONFIG_MODULE_UNLOAD is not set +# CONFIG_MODVERSIONS is not set +# CONFIG_MODULE_SRCVERSION_ALL is not set +# CONFIG_MODULE_SIG is not set +# CONFIG_MODULE_COMPRESS is not set +CONFIG_MODULES_TREE_LOOKUP=y +CONFIG_BLOCK=y +CONFIG_LBDAF=y +CONFIG_BLK_SCSI_REQUEST=y +CONFIG_BLK_DEV_BSG=y +CONFIG_BLK_DEV_BSGLIB=y +# CONFIG_BLK_DEV_INTEGRITY is not set +# CONFIG_BLK_DEV_ZONED is not set +# CONFIG_BLK_CMDLINE_PARSER is not set +# CONFIG_BLK_WBT is not set +# CONFIG_BLK_SED_OPAL is not set + +# +# Partition Types +# +# CONFIG_PARTITION_ADVANCED is not set +CONFIG_AMIGA_PARTITION=y +CONFIG_MSDOS_PARTITION=y +CONFIG_EFI_PARTITION=y +CONFIG_BLK_MQ_PCI=y +CONFIG_BLK_MQ_VIRTIO=y + +# +# IO Schedulers +# +CONFIG_IOSCHED_NOOP=y +CONFIG_IOSCHED_DEADLINE=y +CONFIG_IOSCHED_CFQ=y +# CONFIG_DEFAULT_DEADLINE is not set +CONFIG_DEFAULT_CFQ=y +# CONFIG_DEFAULT_NOOP is not set +CONFIG_DEFAULT_IOSCHED="cfq" +CONFIG_MQ_IOSCHED_DEADLINE=y +CONFIG_MQ_IOSCHED_KYBER=y +# CONFIG_IOSCHED_BFQ is not set +CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y +CONFIG_ARCH_USE_QUEUED_SPINLOCKS=y +CONFIG_QUEUED_SPINLOCKS=y +CONFIG_ARCH_USE_QUEUED_RWLOCKS=y +CONFIG_QUEUED_RWLOCKS=y +CONFIG_ARCH_HAS_SYNC_CORE_BEFORE_USERMODE=y +CONFIG_FREEZER=y + +# +# Processor type and features +# +CONFIG_ZONE_DMA=y +CONFIG_SMP=y +CONFIG_X86_FEATURE_NAMES=y +CONFIG_X86_FAST_FEATURE_TESTS=y +CONFIG_X86_MPPARSE=y +# CONFIG_GOLDFISH is not set +CONFIG_RETPOLINE=y +# CONFIG_INTEL_RDT is not set +# CONFIG_X86_BIGSMP is not set +CONFIG_X86_EXTENDED_PLATFORM=y +# CONFIG_X86_GOLDFISH is not set +# CONFIG_X86_INTEL_MID is not set +# CONFIG_X86_INTEL_LPSS is not set +# CONFIG_X86_AMD_PLATFORM_DEVICE is not set +CONFIG_IOSF_MBI=y +# CONFIG_X86_RDC321X is not set +# CONFIG_X86_32_NON_STANDARD is not set +# CONFIG_X86_32_IRIS is not set +CONFIG_SCHED_OMIT_FRAME_POINTER=y +# CONFIG_HYPERVISOR_GUEST is not set +CONFIG_NO_BOOTMEM=y +# CONFIG_M486 is not set +CONFIG_M586=y +# CONFIG_M586TSC is not set +# CONFIG_M586MMX is not set +# CONFIG_M686 is not set +# CONFIG_MPENTIUMII is not set +# CONFIG_MPENTIUMIII is not set +# CONFIG_MPENTIUMM is not set +# CONFIG_MPENTIUM4 is not set +# CONFIG_MK6 is not set +# CONFIG_MK7 is not set +# CONFIG_MK8 is not set +# CONFIG_MCRUSOE is not set +# CONFIG_MEFFICEON is not set +# CONFIG_MWINCHIPC6 is not set +# CONFIG_MWINCHIP3D is not set +# CONFIG_MELAN is not set +# CONFIG_MGEODEGX1 is not set +# CONFIG_MGEODE_LX is not set +# CONFIG_MCYRIXIII is not set +# CONFIG_MVIAC3_2 is not set +# CONFIG_MVIAC7 is not set +# CONFIG_MCORE2 is not set +# CONFIG_MATOM is not set +CONFIG_X86_GENERIC=y +CONFIG_X86_INTERNODE_CACHE_SHIFT=6 +CONFIG_X86_L1_CACHE_SHIFT=6 +CONFIG_X86_F00F_BUG=y +CONFIG_X86_ALIGNMENT_16=y +CONFIG_X86_INTEL_USERCOPY=y +CONFIG_X86_MINIMUM_CPU_FAMILY=4 +CONFIG_CPU_SUP_INTEL=y +CONFIG_CPU_SUP_CYRIX_32=y +CONFIG_CPU_SUP_AMD=y +CONFIG_CPU_SUP_CENTAUR=y +CONFIG_CPU_SUP_TRANSMETA_32=y +# CONFIG_HPET_TIMER is not set +CONFIG_DMI=y +CONFIG_NR_CPUS_RANGE_BEGIN=2 +CONFIG_NR_CPUS_RANGE_END=8 +CONFIG_NR_CPUS_DEFAULT=8 +CONFIG_NR_CPUS=8 +# CONFIG_SCHED_SMT is not set +CONFIG_SCHED_MC=y +CONFIG_SCHED_MC_PRIO=y +CONFIG_PREEMPT=y +CONFIG_PREEMPT_RT_BASE=y +CONFIG_HAVE_PREEMPT_LAZY=y +CONFIG_PREEMPT_LAZY=y +# CONFIG_PREEMPT_NONE is not set +# CONFIG_PREEMPT_VOLUNTARY is not set +# CONFIG_PREEMPT__LL is not set +# CONFIG_PREEMPT_RTB is not set +CONFIG_PREEMPT_RT_FULL=y +CONFIG_PREEMPT_COUNT=y +CONFIG_X86_LOCAL_APIC=y +CONFIG_X86_IO_APIC=y +# CONFIG_X86_REROUTE_FOR_BROKEN_BOOT_IRQS is not set +CONFIG_X86_MCE=y +# CONFIG_X86_MCELOG_LEGACY is not set +CONFIG_X86_MCE_INTEL=y +CONFIG_X86_MCE_AMD=y +# CONFIG_X86_ANCIENT_MCE is not set +CONFIG_X86_MCE_THRESHOLD=y +CONFIG_X86_THERMAL_VECTOR=y + +# +# Performance monitoring +# +CONFIG_PERF_EVENTS_INTEL_UNCORE=y +CONFIG_PERF_EVENTS_INTEL_RAPL=y +CONFIG_PERF_EVENTS_INTEL_CSTATE=y +# CONFIG_PERF_EVENTS_AMD_POWER is not set +# CONFIG_X86_LEGACY_VM86 is not set +# CONFIG_VM86 is not set +CONFIG_X86_16BIT=y +CONFIG_X86_ESPFIX32=y +# CONFIG_TOSHIBA is not set +# CONFIG_I8K is not set +# CONFIG_X86_REBOOTFIXUPS is not set +CONFIG_MICROCODE=y +CONFIG_MICROCODE_INTEL=y +# CONFIG_MICROCODE_AMD is not set +CONFIG_MICROCODE_OLD_INTERFACE=y +# CONFIG_X86_MSR is not set +# CONFIG_X86_CPUID is not set +# CONFIG_NOHIGHMEM is not set +CONFIG_HIGHMEM4G=y +CONFIG_PAGE_OFFSET=0xC0000000 +CONFIG_HIGHMEM=y +CONFIG_ARCH_HAS_MEM_ENCRYPT=y +CONFIG_NEED_NODE_MEMMAP_SIZE=y +CONFIG_ARCH_FLATMEM_ENABLE=y +CONFIG_ARCH_SPARSEMEM_ENABLE=y +CONFIG_ARCH_SELECT_MEMORY_MODEL=y +CONFIG_ILLEGAL_POINTER_VALUE=0 +CONFIG_SELECT_MEMORY_MODEL=y +# CONFIG_FLATMEM_MANUAL is not set +CONFIG_SPARSEMEM_MANUAL=y +CONFIG_SPARSEMEM=y +CONFIG_HAVE_MEMORY_PRESENT=y +CONFIG_SPARSEMEM_STATIC=y +CONFIG_HAVE_MEMBLOCK=y +CONFIG_HAVE_MEMBLOCK_NODE_MAP=y +CONFIG_HAVE_GENERIC_GUP=y +CONFIG_ARCH_DISCARD_MEMBLOCK=y +# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set +# CONFIG_MEMORY_HOTPLUG is not set +CONFIG_SPLIT_PTLOCK_CPUS=4 +CONFIG_COMPACTION=y +CONFIG_MIGRATION=y +# CONFIG_PHYS_ADDR_T_64BIT is not set +CONFIG_BOUNCE=y +CONFIG_VIRT_TO_BUS=y +# CONFIG_KSM is not set +CONFIG_DEFAULT_MMAP_MIN_ADDR=65536 +# CONFIG_ARCH_WANTS_THP_SWAP is not set +# CONFIG_CLEANCACHE is not set +# CONFIG_FRONTSWAP is not set +# CONFIG_CMA is not set +# CONFIG_ZPOOL is not set +# CONFIG_ZBUD is not set +# CONFIG_ZSMALLOC is not set +CONFIG_GENERIC_EARLY_IOREMAP=y +# CONFIG_DEFERRED_STRUCT_PAGE_INIT is not set +# CONFIG_IDLE_PAGE_TRACKING is not set +# CONFIG_PERCPU_STATS is not set +# CONFIG_GUP_BENCHMARK is not set +# CONFIG_HIGHPTE is not set +# CONFIG_X86_CHECK_BIOS_CORRUPTION is not set +CONFIG_X86_RESERVE_LOW=64 +# CONFIG_MATH_EMULATION is not set +CONFIG_MTRR=y +CONFIG_MTRR_SANITIZER=y +CONFIG_MTRR_SANITIZER_ENABLE_DEFAULT=0 +CONFIG_MTRR_SANITIZER_SPARE_REG_NR_DEFAULT=1 +CONFIG_X86_PAT=y +CONFIG_ARCH_USES_PG_UNCACHED=y +CONFIG_ARCH_RANDOM=y +CONFIG_X86_SMAP=y +CONFIG_X86_INTEL_UMIP=y +# CONFIG_EFI is not set +CONFIG_SECCOMP=y +# CONFIG_HZ_100 is not set +CONFIG_HZ_250=y +# CONFIG_HZ_300 is not set +# CONFIG_HZ_1000 is not set +CONFIG_HZ=250 +CONFIG_SCHED_HRTICK=y +# CONFIG_KEXEC is not set +# CONFIG_CRASH_DUMP is not set +CONFIG_PHYSICAL_START=0x1000000 +CONFIG_RELOCATABLE=y +CONFIG_RANDOMIZE_BASE=y +CONFIG_X86_NEED_RELOCS=y +CONFIG_PHYSICAL_ALIGN=0x200000 +CONFIG_HOTPLUG_CPU=y +# CONFIG_BOOTPARAM_HOTPLUG_CPU0 is not set +# CONFIG_DEBUG_HOTPLUG_CPU0 is not set +# CONFIG_COMPAT_VDSO is not set +# CONFIG_CMDLINE_BOOL is not set +CONFIG_MODIFY_LDT_SYSCALL=y +CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y + +# +# Power management and ACPI options +# +CONFIG_SUSPEND=y +CONFIG_SUSPEND_FREEZER=y +CONFIG_HIBERNATE_CALLBACKS=y +CONFIG_HIBERNATION=y +CONFIG_PM_STD_PARTITION="" +CONFIG_PM_SLEEP=y +CONFIG_PM_SLEEP_SMP=y +# CONFIG_PM_AUTOSLEEP is not set +# CONFIG_PM_WAKELOCKS is not set +CONFIG_PM=y +CONFIG_PM_DEBUG=y +# CONFIG_PM_ADVANCED_DEBUG is not set +# CONFIG_PM_TEST_SUSPEND is not set +CONFIG_PM_SLEEP_DEBUG=y +# CONFIG_PM_TRACE_RTC is not set +CONFIG_PM_CLK=y +# CONFIG_WQ_POWER_EFFICIENT_DEFAULT is not set +CONFIG_ACPI=y +CONFIG_ACPI_LEGACY_TABLES_LOOKUP=y +CONFIG_ARCH_MIGHT_HAVE_ACPI_PDC=y +CONFIG_ACPI_SYSTEM_POWER_STATES_SUPPORT=y +CONFIG_ACPI_DEBUGGER=y +CONFIG_ACPI_SPCR_TABLE=y +CONFIG_ACPI_SLEEP=y +# CONFIG_ACPI_PROCFS_POWER is not set +CONFIG_ACPI_REV_OVERRIDE_POSSIBLE=y +# CONFIG_ACPI_EC_DEBUGFS is not set +CONFIG_ACPI_AC=y +CONFIG_ACPI_BATTERY=y +CONFIG_ACPI_BUTTON=y +# CONFIG_ACPI_VIDEO is not set +CONFIG_ACPI_FAN=y +# CONFIG_ACPI_DOCK is not set +CONFIG_ACPI_CPU_FREQ_PSS=y +CONFIG_ACPI_PROCESSOR_CSTATE=y +CONFIG_ACPI_PROCESSOR_IDLE=y +CONFIG_ACPI_PROCESSOR=y +# CONFIG_ACPI_IPMI is not set +CONFIG_ACPI_HOTPLUG_CPU=y +# CONFIG_ACPI_PROCESSOR_AGGREGATOR is not set +CONFIG_ACPI_THERMAL=y +CONFIG_ACPI_CUSTOM_DSDT_FILE="" +# CONFIG_ACPI_CUSTOM_DSDT is not set +CONFIG_ARCH_HAS_ACPI_TABLE_UPGRADE=y +CONFIG_ACPI_TABLE_UPGRADE=y +CONFIG_ACPI_DEBUG=y +# CONFIG_ACPI_PCI_SLOT is not set +CONFIG_ACPI_CONTAINER=y +CONFIG_ACPI_HOTPLUG_IOAPIC=y +# CONFIG_ACPI_SBS is not set +# CONFIG_ACPI_HED is not set +# CONFIG_ACPI_REDUCED_HARDWARE_ONLY is not set +CONFIG_HAVE_ACPI_APEI=y +CONFIG_HAVE_ACPI_APEI_NMI=y +# CONFIG_ACPI_APEI is not set +# CONFIG_DPTF_POWER is not set +# CONFIG_PMIC_OPREGION is not set +# CONFIG_ACPI_CONFIGFS is not set +CONFIG_X86_PM_TIMER=y +# CONFIG_SFI is not set +# CONFIG_APM is not set + +# +# CPU Frequency scaling +# +CONFIG_CPU_FREQ=y +# CONFIG_CPU_FREQ_STAT is not set +CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y +# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL is not set +CONFIG_CPU_FREQ_GOV_PERFORMANCE=y +# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set +# CONFIG_CPU_FREQ_GOV_USERSPACE is not set +# CONFIG_CPU_FREQ_GOV_ONDEMAND is not set +# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set +# CONFIG_CPU_FREQ_GOV_SCHEDUTIL is not set + +# +# CPU frequency scaling drivers +# +# CONFIG_CPUFREQ_DT is not set +CONFIG_X86_INTEL_PSTATE=y +# CONFIG_X86_PCC_CPUFREQ is not set +# CONFIG_X86_ACPI_CPUFREQ is not set +# CONFIG_X86_POWERNOW_K6 is not set +# CONFIG_X86_POWERNOW_K7 is not set +# CONFIG_X86_GX_SUSPMOD is not set +# CONFIG_X86_SPEEDSTEP_CENTRINO is not set +# CONFIG_X86_SPEEDSTEP_ICH is not set +# CONFIG_X86_SPEEDSTEP_SMI is not set +# CONFIG_X86_P4_CLOCKMOD is not set +# CONFIG_X86_CPUFREQ_NFORCE2 is not set +# CONFIG_X86_LONGRUN is not set +# CONFIG_X86_LONGHAUL is not set +# CONFIG_X86_E_POWERSAVER is not set + +# +# shared options +# +# CONFIG_X86_SPEEDSTEP_LIB is not set + +# +# CPU Idle +# +CONFIG_CPU_IDLE=y +CONFIG_CPU_IDLE_GOV_LADDER=y +# CONFIG_CPU_IDLE_GOV_MENU is not set +# CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED is not set +# CONFIG_INTEL_IDLE is not set + +# +# Bus options (PCI etc.) +# +CONFIG_PCI=y +# CONFIG_PCI_GOBIOS is not set +# CONFIG_PCI_GOMMCONFIG is not set +# CONFIG_PCI_GODIRECT is not set +CONFIG_PCI_GOANY=y +CONFIG_PCI_BIOS=y +CONFIG_PCI_DIRECT=y +CONFIG_PCI_MMCONFIG=y +CONFIG_PCI_DOMAINS=y +CONFIG_PCIEPORTBUS=y +# CONFIG_HOTPLUG_PCI_PCIE is not set +CONFIG_PCIEAER=y +# CONFIG_PCIE_ECRC is not set +# CONFIG_PCIEAER_INJECT is not set +CONFIG_PCIEASPM=y +# CONFIG_PCIEASPM_DEBUG is not set +CONFIG_PCIEASPM_DEFAULT=y +# CONFIG_PCIEASPM_POWERSAVE is not set +# CONFIG_PCIEASPM_POWER_SUPERSAVE is not set +# CONFIG_PCIEASPM_PERFORMANCE is not set +CONFIG_PCIE_PME=y +# CONFIG_PCIE_DPC is not set +# CONFIG_PCIE_PTM is not set +# CONFIG_PCI_MSI is not set +CONFIG_PCI_QUIRKS=y +# CONFIG_PCI_STUB is not set +CONFIG_PCI_ATS=y +CONFIG_PCI_LOCKLESS_CONFIG=y +# CONFIG_PCI_IOV is not set +CONFIG_PCI_PRI=y +CONFIG_PCI_PASID=y +CONFIG_PCI_LABEL=y +CONFIG_HOTPLUG_PCI=y +# CONFIG_HOTPLUG_PCI_COMPAQ is not set +# CONFIG_HOTPLUG_PCI_IBM is not set +# CONFIG_HOTPLUG_PCI_ACPI is not set +# CONFIG_HOTPLUG_PCI_CPCI is not set +CONFIG_HOTPLUG_PCI_SHPC=y + +# +# Cadence PCIe controllers support +# +# CONFIG_PCIE_CADENCE_HOST is not set + +# +# DesignWare PCI Core Support +# + +# +# PCI host controller drivers +# + +# +# PCI Endpoint +# +# CONFIG_PCI_ENDPOINT is not set + +# +# PCI switch controller drivers +# +# CONFIG_PCI_SW_SWITCHTEC is not set +CONFIG_ISA_DMA_API=y +# CONFIG_ISA is not set +# CONFIG_SCx200 is not set +# CONFIG_OLPC is not set +# CONFIG_ALIX is not set +# CONFIG_NET5501 is not set +# CONFIG_GEOS is not set +CONFIG_AMD_NB=y +CONFIG_PCCARD=y +CONFIG_PCMCIA=y +CONFIG_PCMCIA_LOAD_CIS=y +CONFIG_CARDBUS=y + +# +# PC-card bridges +# +# CONFIG_YENTA is not set +# CONFIG_PD6729 is not set +# CONFIG_I82092 is not set +# CONFIG_RAPIDIO is not set +# CONFIG_X86_SYSFB is not set + +# +# Executable file formats / Emulations +# +CONFIG_BINFMT_ELF=y +CONFIG_ELFCORE=y +CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y +CONFIG_BINFMT_SCRIPT=y +CONFIG_HAVE_AOUT=y +# CONFIG_BINFMT_AOUT is not set +# CONFIG_BINFMT_MISC is not set +CONFIG_COREDUMP=y +CONFIG_COMPAT_32=y +CONFIG_HAVE_ATOMIC_IOMAP=y +CONFIG_NET=y +CONFIG_NET_INGRESS=y + +# +# Networking options +# +CONFIG_PACKET=y +# CONFIG_PACKET_DIAG is not set +CONFIG_UNIX=y +# CONFIG_UNIX_DIAG is not set +# CONFIG_TLS is not set +CONFIG_XFRM=y +# CONFIG_XFRM_USER is not set +# CONFIG_XFRM_SUB_POLICY is not set +# CONFIG_XFRM_MIGRATE is not set +# CONFIG_XFRM_STATISTICS is not set +# CONFIG_NET_KEY is not set +CONFIG_INET=y +CONFIG_IP_MULTICAST=y +# CONFIG_IP_ADVANCED_ROUTER is not set +CONFIG_IP_PNP=y +CONFIG_IP_PNP_DHCP=y +CONFIG_IP_PNP_BOOTP=y +CONFIG_IP_PNP_RARP=y +# CONFIG_NET_IPIP is not set +# CONFIG_NET_IPGRE_DEMUX is not set +CONFIG_NET_IP_TUNNEL=y +# CONFIG_IP_MROUTE is not set +CONFIG_SYN_COOKIES=y +# CONFIG_NET_IPVTI is not set +# CONFIG_NET_UDP_TUNNEL is not set +# CONFIG_NET_FOU is not set +# CONFIG_NET_FOU_IP_TUNNELS is not set +# CONFIG_INET_AH is not set +# CONFIG_INET_ESP is not set +# CONFIG_INET_IPCOMP is not set +# CONFIG_INET_XFRM_TUNNEL is not set +CONFIG_INET_TUNNEL=y +CONFIG_INET_XFRM_MODE_TRANSPORT=y +CONFIG_INET_XFRM_MODE_TUNNEL=y +CONFIG_INET_XFRM_MODE_BEET=y +CONFIG_INET_DIAG=y +CONFIG_INET_TCP_DIAG=y +# CONFIG_INET_UDP_DIAG is not set +# CONFIG_INET_RAW_DIAG is not set +# CONFIG_INET_DIAG_DESTROY is not set +CONFIG_TCP_CONG_ADVANCED=y +CONFIG_TCP_CONG_BIC=m +CONFIG_TCP_CONG_CUBIC=y +CONFIG_TCP_CONG_WESTWOOD=m +CONFIG_TCP_CONG_HTCP=m +# CONFIG_TCP_CONG_HSTCP is not set +# CONFIG_TCP_CONG_HYBLA is not set +# CONFIG_TCP_CONG_VEGAS is not set +# CONFIG_TCP_CONG_NV is not set +# CONFIG_TCP_CONG_SCALABLE is not set +# CONFIG_TCP_CONG_LP is not set +# CONFIG_TCP_CONG_VENO is not set +# CONFIG_TCP_CONG_YEAH is not set +# CONFIG_TCP_CONG_ILLINOIS is not set +# CONFIG_TCP_CONG_DCTCP is not set +# CONFIG_TCP_CONG_CDG is not set +# CONFIG_TCP_CONG_BBR is not set +CONFIG_DEFAULT_CUBIC=y +# CONFIG_DEFAULT_RENO is not set +CONFIG_DEFAULT_TCP_CONG="cubic" +# CONFIG_TCP_MD5SIG is not set +CONFIG_IPV6=y +# CONFIG_IPV6_ROUTER_PREF is not set +# CONFIG_IPV6_OPTIMISTIC_DAD is not set +# CONFIG_INET6_AH is not set +# CONFIG_INET6_ESP is not set +# CONFIG_INET6_IPCOMP is not set +# CONFIG_IPV6_MIP6 is not set +# CONFIG_IPV6_ILA is not set +# CONFIG_INET6_XFRM_TUNNEL is not set +# CONFIG_INET6_TUNNEL is not set +CONFIG_INET6_XFRM_MODE_TRANSPORT=y +CONFIG_INET6_XFRM_MODE_TUNNEL=y +CONFIG_INET6_XFRM_MODE_BEET=y +# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set +# CONFIG_IPV6_VTI is not set +CONFIG_IPV6_SIT=y +# CONFIG_IPV6_SIT_6RD is not set +CONFIG_IPV6_NDISC_NODETYPE=y +# CONFIG_IPV6_TUNNEL is not set +# CONFIG_IPV6_FOU is not set +# CONFIG_IPV6_FOU_TUNNEL is not set +# CONFIG_IPV6_MULTIPLE_TABLES is not set +# CONFIG_IPV6_MROUTE is not set +# CONFIG_IPV6_SEG6_LWTUNNEL is not set +# CONFIG_IPV6_SEG6_HMAC is not set +# CONFIG_NETWORK_SECMARK is not set +# CONFIG_NET_PTP_CLASSIFY is not set +# CONFIG_NETWORK_PHY_TIMESTAMPING is not set +CONFIG_NETFILTER=y +CONFIG_NETFILTER_ADVANCED=y +CONFIG_BRIDGE_NETFILTER=m + +# +# Core Netfilter Configuration +# +CONFIG_NETFILTER_INGRESS=y +CONFIG_NETFILTER_FAMILY_BRIDGE=y +# CONFIG_NETFILTER_NETLINK_ACCT is not set +# CONFIG_NETFILTER_NETLINK_QUEUE is not set +# CONFIG_NETFILTER_NETLINK_LOG is not set +# CONFIG_NF_CONNTRACK is not set +# CONFIG_NF_LOG_NETDEV is not set +# CONFIG_NF_TABLES is not set +# CONFIG_NETFILTER_XTABLES is not set +# CONFIG_IP_SET is not set +# CONFIG_IP_VS is not set + +# +# IP: Netfilter Configuration +# +# CONFIG_NF_DEFRAG_IPV4 is not set +# CONFIG_NF_SOCKET_IPV4 is not set +# CONFIG_NF_DUP_IPV4 is not set +# CONFIG_NF_LOG_ARP is not set +# CONFIG_NF_LOG_IPV4 is not set +# CONFIG_NF_REJECT_IPV4 is not set +# CONFIG_IP_NF_IPTABLES is not set +# CONFIG_IP_NF_ARPTABLES is not set + +# +# IPv6: Netfilter Configuration +# +# CONFIG_NF_DEFRAG_IPV6 is not set +# CONFIG_NF_SOCKET_IPV6 is not set +# CONFIG_NF_DUP_IPV6 is not set +# CONFIG_NF_REJECT_IPV6 is not set +# CONFIG_NF_LOG_IPV6 is not set +# CONFIG_IP6_NF_IPTABLES is not set +# CONFIG_IP_DCCP is not set +# CONFIG_IP_SCTP is not set +# CONFIG_RDS is not set +# CONFIG_TIPC is not set +# CONFIG_ATM is not set +# CONFIG_L2TP is not set +CONFIG_STP=m +CONFIG_GARP=m +CONFIG_MRP=m +CONFIG_BRIDGE=m +CONFIG_BRIDGE_IGMP_SNOOPING=y +CONFIG_BRIDGE_VLAN_FILTERING=y +CONFIG_HAVE_NET_DSA=y +# CONFIG_NET_DSA is not set +CONFIG_VLAN_8021Q=m +CONFIG_VLAN_8021Q_GVRP=y +CONFIG_VLAN_8021Q_MVRP=y +# CONFIG_DECNET is not set +CONFIG_LLC=m +# CONFIG_LLC2 is not set +# CONFIG_ATALK is not set +# CONFIG_X25 is not set +# CONFIG_LAPB is not set +# CONFIG_PHONET is not set +# CONFIG_6LOWPAN is not set +# CONFIG_IEEE802154 is not set +CONFIG_NET_SCHED=y + +# +# Queueing/Scheduling +# +# CONFIG_NET_SCH_CBQ is not set +# CONFIG_NET_SCH_HTB is not set +# CONFIG_NET_SCH_HFSC is not set +# CONFIG_NET_SCH_PRIO is not set +# CONFIG_NET_SCH_MULTIQ is not set +# CONFIG_NET_SCH_RED is not set +# CONFIG_NET_SCH_SFB is not set +# CONFIG_NET_SCH_SFQ is not set +# CONFIG_NET_SCH_TEQL is not set +# CONFIG_NET_SCH_TBF is not set +# CONFIG_NET_SCH_CBS is not set +# CONFIG_NET_SCH_GRED is not set +# CONFIG_NET_SCH_DSMARK is not set +# CONFIG_NET_SCH_NETEM is not set +# CONFIG_NET_SCH_DRR is not set +# CONFIG_NET_SCH_MQPRIO is not set +# CONFIG_NET_SCH_CHOKE is not set +# CONFIG_NET_SCH_QFQ is not set +# CONFIG_NET_SCH_CODEL is not set +# CONFIG_NET_SCH_FQ_CODEL is not set +# CONFIG_NET_SCH_FQ is not set +# CONFIG_NET_SCH_HHF is not set +# CONFIG_NET_SCH_PIE is not set +# CONFIG_NET_SCH_PLUG is not set +# CONFIG_NET_SCH_DEFAULT is not set + +# +# Classification +# +# CONFIG_NET_CLS_BASIC is not set +# CONFIG_NET_CLS_TCINDEX is not set +# CONFIG_NET_CLS_ROUTE4 is not set +# CONFIG_NET_CLS_FW is not set +# CONFIG_NET_CLS_U32 is not set +# CONFIG_NET_CLS_RSVP is not set +# CONFIG_NET_CLS_RSVP6 is not set +# CONFIG_NET_CLS_FLOW is not set +# CONFIG_NET_CLS_CGROUP is not set +# CONFIG_NET_CLS_BPF is not set +# CONFIG_NET_CLS_FLOWER is not set +# CONFIG_NET_CLS_MATCHALL is not set +# CONFIG_NET_EMATCH is not set +# CONFIG_NET_CLS_ACT is not set +CONFIG_NET_SCH_FIFO=y +# CONFIG_DCB is not set +# CONFIG_BATMAN_ADV is not set +# CONFIG_OPENVSWITCH is not set +# CONFIG_VSOCKETS is not set +# CONFIG_NETLINK_DIAG is not set +# CONFIG_MPLS is not set +# CONFIG_NET_NSH is not set +# CONFIG_HSR is not set +# CONFIG_NET_SWITCHDEV is not set +# CONFIG_NET_L3_MASTER_DEV is not set +# CONFIG_NET_NCSI is not set +CONFIG_RPS=y +CONFIG_RFS_ACCEL=y +CONFIG_XPS=y +# CONFIG_CGROUP_NET_PRIO is not set +# CONFIG_CGROUP_NET_CLASSID is not set +CONFIG_BQL=y +CONFIG_NET_FLOW_LIMIT=y + +# +# Network testing +# +# CONFIG_NET_PKTGEN is not set +# CONFIG_HAMRADIO is not set +# CONFIG_CAN is not set +# CONFIG_BT is not set +# CONFIG_AF_RXRPC is not set +# CONFIG_AF_KCM is not set +# CONFIG_STREAM_PARSER is not set +CONFIG_WIRELESS=y +# CONFIG_CFG80211 is not set +# CONFIG_LIB80211 is not set + +# +# CFG80211 needs to be enabled for MAC80211 +# +CONFIG_MAC80211_STA_HASH_MAX_SIZE=0 +# CONFIG_WIMAX is not set +# CONFIG_RFKILL is not set +# CONFIG_NET_9P is not set +# CONFIG_CAIF is not set +# CONFIG_CEPH_LIB is not set +# CONFIG_NFC is not set +# CONFIG_PSAMPLE is not set +# CONFIG_NET_IFE is not set +# CONFIG_LWTUNNEL is not set +CONFIG_DST_CACHE=y +CONFIG_GRO_CELLS=y +CONFIG_NET_DEVLINK=y +CONFIG_MAY_USE_DEVLINK=y + +# +# Device Drivers +# + +# +# Generic Driver Options +# +CONFIG_UEVENT_HELPER=y +CONFIG_UEVENT_HELPER_PATH="" +CONFIG_DEVTMPFS=y +CONFIG_DEVTMPFS_MOUNT=y +# CONFIG_STANDALONE is not set +CONFIG_PREVENT_FIRMWARE_BUILD=y +CONFIG_FW_LOADER=y +CONFIG_EXTRA_FIRMWARE="" +# CONFIG_FW_LOADER_USER_HELPER_FALLBACK is not set +CONFIG_ALLOW_DEV_COREDUMP=y +# CONFIG_TEST_ASYNC_DRIVER_PROBE is not set +# CONFIG_SYS_HYPERVISOR is not set +# CONFIG_GENERIC_CPU_DEVICES is not set +CONFIG_GENERIC_CPU_AUTOPROBE=y +CONFIG_GENERIC_CPU_VULNERABILITIES=y +CONFIG_REGMAP=y +CONFIG_REGMAP_I2C=y +CONFIG_REGMAP_SPI=y +CONFIG_REGMAP_MMIO=y +CONFIG_DMA_SHARED_BUFFER=y +# CONFIG_DMA_FENCE_TRACE is not set + +# +# Bus devices +# +# CONFIG_SIMPLE_PM_BUS is not set +# CONFIG_CONNECTOR is not set +CONFIG_MTD=y +# CONFIG_MTD_TESTS is not set +# CONFIG_MTD_REDBOOT_PARTS is not set +CONFIG_MTD_CMDLINE_PARTS=y +CONFIG_MTD_OF_PARTS=y +# CONFIG_MTD_AR7_PARTS is not set + +# +# Partition parsers +# + +# +# User Modules And Translation Layers +# +CONFIG_MTD_BLKDEVS=y +CONFIG_MTD_BLOCK=y +# CONFIG_FTL is not set +# CONFIG_NFTL is not set +# CONFIG_INFTL is not set +# CONFIG_RFD_FTL is not set +# CONFIG_SSFDC is not set +# CONFIG_SM_FTL is not set +# CONFIG_MTD_OOPS is not set +# CONFIG_MTD_SWAP is not set +# CONFIG_MTD_PARTITIONED_MASTER is not set + +# +# RAM/ROM/Flash chip drivers +# +# CONFIG_MTD_CFI is not set +# CONFIG_MTD_JEDECPROBE is not set +CONFIG_MTD_MAP_BANK_WIDTH_1=y +CONFIG_MTD_MAP_BANK_WIDTH_2=y +CONFIG_MTD_MAP_BANK_WIDTH_4=y +# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set +# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set +# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set +CONFIG_MTD_CFI_I1=y +CONFIG_MTD_CFI_I2=y +# CONFIG_MTD_CFI_I4 is not set +# CONFIG_MTD_CFI_I8 is not set +# CONFIG_MTD_RAM is not set +# CONFIG_MTD_ROM is not set +# CONFIG_MTD_ABSENT is not set + +# +# Mapping drivers for chip access +# +# CONFIG_MTD_COMPLEX_MAPPINGS is not set +# CONFIG_MTD_INTEL_VR_NOR is not set +# CONFIG_MTD_PLATRAM is not set + +# +# Self-contained MTD device drivers +# +# CONFIG_MTD_PMC551 is not set +# CONFIG_MTD_DATAFLASH is not set +# CONFIG_MTD_MCHP23K256 is not set +# CONFIG_MTD_SST25L is not set +# CONFIG_MTD_SLRAM is not set +# CONFIG_MTD_PHRAM is not set +# CONFIG_MTD_MTDRAM is not set +# CONFIG_MTD_BLOCK2MTD is not set + +# +# Disk-On-Chip Device Drivers +# +# CONFIG_MTD_DOCG3 is not set +CONFIG_MTD_NAND_ECC=y +# CONFIG_MTD_NAND_ECC_SMC is not set +CONFIG_MTD_NAND=y +# CONFIG_MTD_NAND_ECC_BCH is not set +# CONFIG_MTD_SM_COMMON is not set +# CONFIG_MTD_NAND_DENALI_PCI is not set +# CONFIG_MTD_NAND_DENALI_DT is not set +# CONFIG_MTD_NAND_GPIO is not set +# CONFIG_MTD_NAND_OMAP_BCH_BUILD is not set +# CONFIG_MTD_NAND_RICOH is not set +# CONFIG_MTD_NAND_DISKONCHIP is not set +# CONFIG_MTD_NAND_DOCG4 is not set +# CONFIG_MTD_NAND_CAFE is not set +# CONFIG_MTD_NAND_CS553X is not set +# CONFIG_MTD_NAND_NANDSIM is not set +# CONFIG_MTD_NAND_PLATFORM is not set +# CONFIG_MTD_ONENAND is not set + +# +# LPDDR & LPDDR2 PCM memory drivers +# +# CONFIG_MTD_LPDDR is not set +# CONFIG_MTD_SPI_NOR is not set +# CONFIG_MTD_UBI is not set +CONFIG_OF=y +# CONFIG_OF_UNITTEST is not set +CONFIG_OF_KOBJ=y +CONFIG_OF_ADDRESS=y +CONFIG_OF_IRQ=y +CONFIG_OF_NET=y +# CONFIG_OF_OVERLAY is not set +CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y +CONFIG_PARPORT=y +# CONFIG_PARPORT_PC is not set +# CONFIG_PARPORT_GSC is not set +# CONFIG_PARPORT_AX88796 is not set +# CONFIG_PARPORT_1284 is not set +CONFIG_PNP=y +CONFIG_PNP_DEBUG_MESSAGES=y + +# +# Protocols +# +CONFIG_PNPACPI=y +CONFIG_BLK_DEV=y +# CONFIG_BLK_DEV_NULL_BLK is not set +CONFIG_BLK_DEV_FD=y +CONFIG_CDROM=y +CONFIG_BLK_DEV_PCIESSD_MTIP32XX=y +CONFIG_BLK_DEV_DAC960=y +CONFIG_BLK_DEV_UMEM=y +# CONFIG_BLK_DEV_COW_COMMON is not set +CONFIG_BLK_DEV_LOOP=y +CONFIG_BLK_DEV_LOOP_MIN_COUNT=8 +# CONFIG_BLK_DEV_CRYPTOLOOP is not set +# CONFIG_BLK_DEV_DRBD is not set +CONFIG_BLK_DEV_NBD=y +CONFIG_BLK_DEV_SX8=y +CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_COUNT=16 +CONFIG_BLK_DEV_RAM_SIZE=4096 +CONFIG_CDROM_PKTCDVD=y +CONFIG_CDROM_PKTCDVD_BUFFERS=8 +# CONFIG_CDROM_PKTCDVD_WCACHE is not set +# CONFIG_ATA_OVER_ETH is not set +# CONFIG_VIRTIO_BLK is not set +# CONFIG_BLK_DEV_RBD is not set +CONFIG_BLK_DEV_RSXX=y + +# +# NVME Support +# +# CONFIG_BLK_DEV_NVME is not set +# CONFIG_NVME_FC is not set +# CONFIG_NVME_TARGET is not set + +# +# Misc devices +# +# CONFIG_SENSORS_LIS3LV02D is not set +# CONFIG_AD525X_DPOT is not set +CONFIG_DUMMY_IRQ=y +# CONFIG_IBM_ASM is not set +CONFIG_PHANTOM=y +CONFIG_SGI_IOC4=y +CONFIG_TIFM_CORE=y +CONFIG_TIFM_7XX1=y +# CONFIG_ICS932S401 is not set +CONFIG_ENCLOSURE_SERVICES=y +CONFIG_HP_ILO=y +# CONFIG_APDS9802ALS is not set +# CONFIG_ISL29003 is not set +# CONFIG_ISL29020 is not set +# CONFIG_SENSORS_TSL2550 is not set +# CONFIG_SENSORS_BH1770 is not set +# CONFIG_SENSORS_APDS990X is not set +# CONFIG_HMC6352 is not set +# CONFIG_DS1682 is not set +# CONFIG_PCH_PHUB is not set +# CONFIG_USB_SWITCH_FSA9480 is not set +# CONFIG_LATTICE_ECP3_CONFIG is not set +CONFIG_SRAM=y +# CONFIG_PCI_ENDPOINT_TEST is not set +CONFIG_MISC_RTSX=y +CONFIG_C2PORT=y +# CONFIG_C2PORT_DURAMAR_2150 is not set + +# +# EEPROM support +# +# CONFIG_EEPROM_AT24 is not set +# CONFIG_EEPROM_AT25 is not set +# CONFIG_EEPROM_LEGACY is not set +# CONFIG_EEPROM_MAX6875 is not set +CONFIG_EEPROM_93CX6=y +# CONFIG_EEPROM_93XX46 is not set +# CONFIG_EEPROM_IDT_89HPESX is not set +CONFIG_CB710_CORE=y +# CONFIG_CB710_DEBUG is not set +CONFIG_CB710_DEBUG_ASSUMPTIONS=y + +# +# Texas Instruments shared transport line discipline +# +# CONFIG_TI_ST is not set +# CONFIG_SENSORS_LIS3_I2C is not set +# CONFIG_ALTERA_STAPL is not set +# CONFIG_INTEL_MEI is not set +# CONFIG_INTEL_MEI_ME is not set +# CONFIG_INTEL_MEI_TXE is not set +CONFIG_VMWARE_VMCI=y + +# +# Intel MIC & related support +# + +# +# Intel MIC Bus Driver +# + +# +# SCIF Bus Driver +# + +# +# VOP Bus Driver +# + +# +# Intel MIC Host Driver +# + +# +# Intel MIC Card Driver +# + +# +# SCIF Driver +# + +# +# Intel MIC Coprocessor State Management (COSM) Drivers +# + +# +# VOP Driver +# +CONFIG_ECHO=y +# CONFIG_CXL_BASE is not set +# CONFIG_CXL_AFU_DRIVER_OPS is not set +# CONFIG_CXL_LIB is not set +# CONFIG_OCXL_BASE is not set +CONFIG_MISC_RTSX_PCI=y +CONFIG_HAVE_IDE=y +CONFIG_IDE=y + +# +# Please see Documentation/ide/ide.txt for help/info on IDE drives +# +CONFIG_IDE_XFER_MODE=y +CONFIG_IDE_TIMINGS=y +CONFIG_IDE_ATAPI=y +CONFIG_BLK_DEV_IDE_SATA=y +CONFIG_IDE_GD=y +CONFIG_IDE_GD_ATA=y +CONFIG_IDE_GD_ATAPI=y +CONFIG_BLK_DEV_IDECS=y +# CONFIG_BLK_DEV_DELKIN is not set +CONFIG_BLK_DEV_IDECD=y +CONFIG_BLK_DEV_IDECD_VERBOSE_ERRORS=y +# CONFIG_BLK_DEV_IDETAPE is not set +CONFIG_BLK_DEV_IDEACPI=y +# CONFIG_IDE_TASK_IOCTL is not set +CONFIG_IDE_PROC_FS=y + +# +# IDE chipset support/bugfixes +# +CONFIG_IDE_GENERIC=y +CONFIG_BLK_DEV_PLATFORM=y +# CONFIG_BLK_DEV_CMD640 is not set +# CONFIG_BLK_DEV_IDEPNP is not set +CONFIG_BLK_DEV_IDEDMA_SFF=y + +# +# PCI IDE chipsets support +# +CONFIG_BLK_DEV_IDEPCI=y +CONFIG_IDEPCI_PCIBUS_ORDER=y +# CONFIG_BLK_DEV_OFFBOARD is not set +CONFIG_BLK_DEV_GENERIC=y +# CONFIG_BLK_DEV_OPTI621 is not set +# CONFIG_BLK_DEV_RZ1000 is not set +CONFIG_BLK_DEV_IDEDMA_PCI=y +# CONFIG_BLK_DEV_AEC62XX is not set +# CONFIG_BLK_DEV_ALI15X3 is not set +# CONFIG_BLK_DEV_AMD74XX is not set +CONFIG_BLK_DEV_ATIIXP=y +# CONFIG_BLK_DEV_CMD64X is not set +# CONFIG_BLK_DEV_TRIFLEX is not set +# CONFIG_BLK_DEV_CS5520 is not set +# CONFIG_BLK_DEV_CS5530 is not set +# CONFIG_BLK_DEV_CS5535 is not set +# CONFIG_BLK_DEV_CS5536 is not set +# CONFIG_BLK_DEV_HPT366 is not set +# CONFIG_BLK_DEV_JMICRON is not set +# CONFIG_BLK_DEV_SC1200 is not set +CONFIG_BLK_DEV_PIIX=y +# CONFIG_BLK_DEV_IT8172 is not set +# CONFIG_BLK_DEV_IT8213 is not set +# CONFIG_BLK_DEV_IT821X is not set +# CONFIG_BLK_DEV_NS87415 is not set +# CONFIG_BLK_DEV_PDC202XX_OLD is not set +# CONFIG_BLK_DEV_PDC202XX_NEW is not set +# CONFIG_BLK_DEV_SVWKS is not set +# CONFIG_BLK_DEV_SIIMAGE is not set +# CONFIG_BLK_DEV_SIS5513 is not set +# CONFIG_BLK_DEV_SLC90E66 is not set +# CONFIG_BLK_DEV_TRM290 is not set +CONFIG_BLK_DEV_VIA82CXXX=y +# CONFIG_BLK_DEV_TC86C001 is not set +CONFIG_BLK_DEV_IDEDMA=y + +# +# SCSI device support +# +CONFIG_SCSI_MOD=y +# CONFIG_RAID_ATTRS is not set +CONFIG_SCSI=y +CONFIG_SCSI_DMA=y +# CONFIG_SCSI_NETLINK is not set +# CONFIG_SCSI_MQ_DEFAULT is not set +CONFIG_SCSI_PROC_FS=y + +# +# SCSI support type (disk, tape, CD-ROM) +# +CONFIG_BLK_DEV_SD=y +# CONFIG_CHR_DEV_ST is not set +# CONFIG_CHR_DEV_OSST is not set +CONFIG_BLK_DEV_SR=y +CONFIG_BLK_DEV_SR_VENDOR=y +CONFIG_CHR_DEV_SG=y +# CONFIG_CHR_DEV_SCH is not set +# CONFIG_SCSI_ENCLOSURE is not set +# CONFIG_SCSI_CONSTANTS is not set +# CONFIG_SCSI_LOGGING is not set +# CONFIG_SCSI_SCAN_ASYNC is not set + +# +# SCSI Transports +# +CONFIG_SCSI_SPI_ATTRS=y +# CONFIG_SCSI_FC_ATTRS is not set +# CONFIG_SCSI_ISCSI_ATTRS is not set +CONFIG_SCSI_SAS_ATTRS=y +CONFIG_SCSI_SAS_LIBSAS=y +# CONFIG_SCSI_SAS_ATA is not set +CONFIG_SCSI_SAS_HOST_SMP=y +CONFIG_SCSI_SRP_ATTRS=y +CONFIG_SCSI_LOWLEVEL=y +# CONFIG_ISCSI_TCP is not set +# CONFIG_ISCSI_BOOT_SYSFS is not set +# CONFIG_SCSI_CXGB3_ISCSI is not set +# CONFIG_SCSI_CXGB4_ISCSI is not set +# CONFIG_SCSI_BNX2_ISCSI is not set +# CONFIG_BE2ISCSI is not set +CONFIG_BLK_DEV_3W_XXXX_RAID=y +CONFIG_SCSI_HPSA=y +CONFIG_SCSI_3W_9XXX=y +CONFIG_SCSI_3W_SAS=y +CONFIG_SCSI_ACARD=y +CONFIG_SCSI_AACRAID=y +CONFIG_SCSI_AIC7XXX=y +CONFIG_AIC7XXX_CMDS_PER_DEVICE=32 +CONFIG_AIC7XXX_RESET_DELAY_MS=5000 +CONFIG_AIC7XXX_DEBUG_ENABLE=y +CONFIG_AIC7XXX_DEBUG_MASK=0 +CONFIG_AIC7XXX_REG_PRETTY_PRINT=y +CONFIG_SCSI_AIC79XX=y +CONFIG_AIC79XX_CMDS_PER_DEVICE=32 +CONFIG_AIC79XX_RESET_DELAY_MS=5000 +CONFIG_AIC79XX_DEBUG_ENABLE=y +CONFIG_AIC79XX_DEBUG_MASK=0 +CONFIG_AIC79XX_REG_PRETTY_PRINT=y +CONFIG_SCSI_AIC94XX=y +CONFIG_AIC94XX_DEBUG=y +CONFIG_SCSI_MVSAS=y +CONFIG_SCSI_MVSAS_DEBUG=y +# CONFIG_SCSI_MVSAS_TASKLET is not set +CONFIG_SCSI_MVUMI=y +CONFIG_SCSI_DPT_I2O=y +CONFIG_SCSI_ADVANSYS=y +CONFIG_SCSI_ARCMSR=y +CONFIG_SCSI_ESAS2R=y +CONFIG_MEGARAID_NEWGEN=y +# CONFIG_MEGARAID_MM is not set +CONFIG_MEGARAID_LEGACY=y +CONFIG_MEGARAID_SAS=y +# CONFIG_SCSI_MPT3SAS is not set +# CONFIG_SCSI_MPT2SAS is not set +# CONFIG_SCSI_SMARTPQI is not set +CONFIG_SCSI_UFSHCD=y +# CONFIG_SCSI_UFSHCD_PCI is not set +# CONFIG_SCSI_UFSHCD_PLATFORM is not set +CONFIG_SCSI_HPTIOP=y +# CONFIG_SCSI_BUSLOGIC is not set +# CONFIG_VMWARE_PVSCSI is not set +CONFIG_SCSI_SNIC=y +CONFIG_SCSI_DMX3191D=y +# CONFIG_SCSI_EATA is not set +CONFIG_SCSI_FUTURE_DOMAIN=y +# CONFIG_SCSI_GDTH is not set +# CONFIG_SCSI_ISCI is not set +CONFIG_SCSI_IPS=y +CONFIG_SCSI_INITIO=y +CONFIG_SCSI_INIA100=y +CONFIG_SCSI_STEX=y +CONFIG_SCSI_SYM53C8XX_2=y +CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=1 +CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16 +CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64 +CONFIG_SCSI_SYM53C8XX_MMIO=y +# CONFIG_SCSI_IPR is not set +CONFIG_SCSI_QLOGIC_1280=y +# CONFIG_SCSI_QLA_ISCSI is not set +CONFIG_SCSI_DC395x=y +CONFIG_SCSI_AM53C974=y +# CONFIG_SCSI_NSP32 is not set +CONFIG_SCSI_WD719X=y +# CONFIG_SCSI_DEBUG is not set +# CONFIG_SCSI_PMCRAID is not set +CONFIG_SCSI_PM8001=y +# CONFIG_SCSI_VIRTIO is not set +# CONFIG_SCSI_LOWLEVEL_PCMCIA is not set +CONFIG_SCSI_DH=y +# CONFIG_SCSI_DH_RDAC is not set +# CONFIG_SCSI_DH_HP_SW is not set +# CONFIG_SCSI_DH_EMC is not set +# CONFIG_SCSI_DH_ALUA is not set +# CONFIG_SCSI_OSD_INITIATOR is not set +CONFIG_ATA=y +# CONFIG_ATA_NONSTANDARD is not set +CONFIG_ATA_VERBOSE_ERROR=y +CONFIG_ATA_ACPI=y +# CONFIG_SATA_ZPODD is not set +CONFIG_SATA_PMP=y + +# +# Controllers with non-SFF native interface +# +CONFIG_SATA_AHCI=y +CONFIG_SATA_MOBILE_LPM_POLICY=0 +CONFIG_SATA_AHCI_PLATFORM=y +# CONFIG_AHCI_CEVA is not set +# CONFIG_AHCI_QORIQ is not set +# CONFIG_SATA_INIC162X is not set +# CONFIG_SATA_ACARD_AHCI is not set +# CONFIG_SATA_SIL24 is not set +CONFIG_ATA_SFF=y + +# +# SFF controllers with custom DMA interface +# +# CONFIG_PDC_ADMA is not set +# CONFIG_SATA_QSTOR is not set +# CONFIG_SATA_SX4 is not set +CONFIG_ATA_BMDMA=y + +# +# SATA SFF controllers with BMDMA +# +CONFIG_ATA_PIIX=y +# CONFIG_SATA_DWC is not set +# CONFIG_SATA_MV is not set +# CONFIG_SATA_NV is not set +# CONFIG_SATA_PROMISE is not set +# CONFIG_SATA_SIL is not set +# CONFIG_SATA_SIS is not set +# CONFIG_SATA_SVW is not set +# CONFIG_SATA_ULI is not set +# CONFIG_SATA_VIA is not set +# CONFIG_SATA_VITESSE is not set + +# +# PATA SFF controllers with BMDMA +# +# CONFIG_PATA_ALI is not set +# CONFIG_PATA_AMD is not set +# CONFIG_PATA_ARTOP is not set +# CONFIG_PATA_ATIIXP is not set +# CONFIG_PATA_ATP867X is not set +# CONFIG_PATA_CMD64X is not set +# CONFIG_PATA_CS5520 is not set +# CONFIG_PATA_CS5530 is not set +# CONFIG_PATA_CS5535 is not set +# CONFIG_PATA_CS5536 is not set +# CONFIG_PATA_CYPRESS is not set +# CONFIG_PATA_EFAR is not set +# CONFIG_PATA_HPT366 is not set +# CONFIG_PATA_HPT37X is not set +# CONFIG_PATA_HPT3X2N is not set +# CONFIG_PATA_HPT3X3 is not set +# CONFIG_PATA_IT8213 is not set +# CONFIG_PATA_IT821X is not set +# CONFIG_PATA_JMICRON is not set +# CONFIG_PATA_MARVELL is not set +# CONFIG_PATA_NETCELL is not set +# CONFIG_PATA_NINJA32 is not set +# CONFIG_PATA_NS87415 is not set +# CONFIG_PATA_OLDPIIX is not set +# CONFIG_PATA_OPTIDMA is not set +# CONFIG_PATA_PDC2027X is not set +# CONFIG_PATA_PDC_OLD is not set +# CONFIG_PATA_RADISYS is not set +# CONFIG_PATA_RDC is not set +# CONFIG_PATA_SC1200 is not set +# CONFIG_PATA_SCH is not set +# CONFIG_PATA_SERVERWORKS is not set +# CONFIG_PATA_SIL680 is not set +CONFIG_PATA_SIS=y +# CONFIG_PATA_TOSHIBA is not set +# CONFIG_PATA_TRIFLEX is not set +# CONFIG_PATA_VIA is not set +# CONFIG_PATA_WINBOND is not set + +# +# PIO-only SFF controllers +# +# CONFIG_PATA_CMD640_PCI is not set +CONFIG_PATA_MPIIX=y +# CONFIG_PATA_NS87410 is not set +# CONFIG_PATA_OPTI is not set +# CONFIG_PATA_PCMCIA is not set +# CONFIG_PATA_RZ1000 is not set + +# +# Generic fallback / legacy drivers +# +CONFIG_PATA_ACPI=y +CONFIG_ATA_GENERIC=y +# CONFIG_PATA_LEGACY is not set +CONFIG_MD=y +# CONFIG_BLK_DEV_MD is not set +# CONFIG_BLK_DEV_DM is not set +CONFIG_TARGET_CORE=y +# CONFIG_TCM_IBLOCK is not set +# CONFIG_TCM_FILEIO is not set +# CONFIG_TCM_PSCSI is not set +# CONFIG_LOOPBACK_TARGET is not set +# CONFIG_ISCSI_TARGET is not set +# CONFIG_SBP_TARGET is not set +CONFIG_FUSION=y +# CONFIG_FUSION_SPI is not set +# CONFIG_FUSION_SAS is not set +CONFIG_FUSION_MAX_SGE=128 +# CONFIG_FUSION_LOGGING is not set + +# +# IEEE 1394 (FireWire) support +# +CONFIG_FIREWIRE=y +# CONFIG_FIREWIRE_OHCI is not set +# CONFIG_FIREWIRE_SBP2 is not set +# CONFIG_FIREWIRE_NET is not set +CONFIG_FIREWIRE_NOSY=y +# CONFIG_MACINTOSH_DRIVERS is not set +CONFIG_NETDEVICES=y +CONFIG_MII=y +CONFIG_NET_CORE=y +CONFIG_BONDING=y +CONFIG_DUMMY=y +# CONFIG_EQUALIZER is not set +# CONFIG_NET_FC is not set +# CONFIG_NET_TEAM is not set +# CONFIG_MACVLAN is not set +# CONFIG_VXLAN is not set +# CONFIG_MACSEC is not set +# CONFIG_NETCONSOLE is not set +# CONFIG_NETPOLL is not set +# CONFIG_NET_POLL_CONTROLLER is not set +# CONFIG_TUN is not set +# CONFIG_TUN_VNET_CROSS_LE is not set +# CONFIG_VETH is not set +# CONFIG_VIRTIO_NET is not set +# CONFIG_NLMON is not set +# CONFIG_ARCNET is not set + +# +# CAIF transport drivers +# + +# +# Distributed Switch Architecture drivers +# +CONFIG_ETHERNET=y +CONFIG_MDIO=y +CONFIG_NET_VENDOR_3COM=y +# CONFIG_PCMCIA_3C574 is not set +# CONFIG_PCMCIA_3C589 is not set +# CONFIG_VORTEX is not set +# CONFIG_TYPHOON is not set +CONFIG_NET_VENDOR_ADAPTEC=y +# CONFIG_ADAPTEC_STARFIRE is not set +CONFIG_NET_VENDOR_AGERE=y +# CONFIG_ET131X is not set +CONFIG_NET_VENDOR_ALACRITECH=y +# CONFIG_SLICOSS is not set +CONFIG_NET_VENDOR_ALTEON=y +# CONFIG_ACENIC is not set +# CONFIG_ALTERA_TSE is not set +CONFIG_NET_VENDOR_AMAZON=y +CONFIG_NET_VENDOR_AMD=y +# CONFIG_AMD8111_ETH is not set +# CONFIG_PCNET32 is not set +# CONFIG_PCMCIA_NMCLAN is not set +# CONFIG_AMD_XGBE is not set +# CONFIG_AMD_XGBE_HAVE_ECC is not set +CONFIG_NET_VENDOR_AQUANTIA=y +CONFIG_NET_VENDOR_ARC=y +CONFIG_NET_VENDOR_ATHEROS=y +# CONFIG_ATL2 is not set +# CONFIG_ATL1 is not set +# CONFIG_ATL1E is not set +# CONFIG_ATL1C is not set +# CONFIG_ALX is not set +# CONFIG_NET_VENDOR_AURORA is not set +CONFIG_NET_CADENCE=y +# CONFIG_MACB is not set +CONFIG_NET_VENDOR_BROADCOM=y +# CONFIG_B44 is not set +# CONFIG_BCMGENET is not set +# CONFIG_BNX2 is not set +# CONFIG_CNIC is not set +# CONFIG_TIGON3 is not set +# CONFIG_BNX2X is not set +# CONFIG_SYSTEMPORT is not set +# CONFIG_BNXT is not set +CONFIG_NET_VENDOR_BROCADE=y +# CONFIG_BNA is not set +CONFIG_NET_VENDOR_CAVIUM=y +CONFIG_NET_VENDOR_CHELSIO=y +# CONFIG_CHELSIO_T1 is not set +# CONFIG_CHELSIO_T3 is not set +# CONFIG_CHELSIO_T4 is not set +# CONFIG_CHELSIO_T4VF is not set +CONFIG_NET_VENDOR_CISCO=y +# CONFIG_ENIC is not set +CONFIG_NET_VENDOR_CORTINA=y +# CONFIG_GEMINI_ETHERNET is not set +# CONFIG_CX_ECAT is not set +# CONFIG_DNET is not set +CONFIG_NET_VENDOR_DEC=y +# CONFIG_NET_TULIP is not set +CONFIG_NET_VENDOR_DLINK=y +# CONFIG_DL2K is not set +# CONFIG_SUNDANCE is not set +CONFIG_NET_VENDOR_EMULEX=y +# CONFIG_BE2NET is not set +CONFIG_NET_VENDOR_EZCHIP=y +# CONFIG_EZCHIP_NPS_MANAGEMENT_ENET is not set +CONFIG_NET_VENDOR_EXAR=y +# CONFIG_S2IO is not set +# CONFIG_VXGE is not set +CONFIG_NET_VENDOR_FUJITSU=y +# CONFIG_PCMCIA_FMVJ18X is not set +CONFIG_NET_VENDOR_HP=y +# CONFIG_HP100 is not set +CONFIG_NET_VENDOR_HUAWEI=y +CONFIG_NET_VENDOR_INTEL=y +CONFIG_E100=y +CONFIG_E1000=y +CONFIG_E1000E=y +CONFIG_E1000E_HWTS=y +CONFIG_IGB=y +CONFIG_IGB_HWMON=y +CONFIG_IGBVF=y +CONFIG_IXGB=y +CONFIG_IXGBE=y +CONFIG_IXGBE_HWMON=y +CONFIG_I40E=y +CONFIG_NET_VENDOR_I825XX=y +# CONFIG_JME is not set +CONFIG_NET_VENDOR_MARVELL=y +# CONFIG_MVMDIO is not set +# CONFIG_MVNETA_BM is not set +# CONFIG_SKGE is not set +# CONFIG_SKY2 is not set +CONFIG_NET_VENDOR_MELLANOX=y +# CONFIG_MLX4_EN is not set +# CONFIG_MLX4_CORE is not set +# CONFIG_MLX5_CORE is not set +# CONFIG_MLXSW_CORE is not set +# CONFIG_MLXFW is not set +CONFIG_NET_VENDOR_MICREL=y +# CONFIG_KS8842 is not set +# CONFIG_KS8851 is not set +# CONFIG_KS8851_MLL is not set +# CONFIG_KSZ884X_PCI is not set +CONFIG_NET_VENDOR_MICROCHIP=y +# CONFIG_ENC28J60 is not set +# CONFIG_ENCX24J600 is not set +CONFIG_NET_VENDOR_MYRI=y +# CONFIG_MYRI10GE is not set +# CONFIG_FEALNX is not set +CONFIG_NET_VENDOR_NATSEMI=y +# CONFIG_NATSEMI is not set +# CONFIG_NS83820 is not set +CONFIG_NET_VENDOR_NETRONOME=y +CONFIG_NET_VENDOR_8390=y +# CONFIG_PCMCIA_AXNET is not set +# CONFIG_NE2K_PCI is not set +# CONFIG_PCMCIA_PCNET is not set +CONFIG_NET_VENDOR_NVIDIA=y +# CONFIG_FORCEDETH is not set +CONFIG_NET_VENDOR_OKI=y +# CONFIG_PCH_GBE is not set +# CONFIG_ETHOC is not set +CONFIG_NET_PACKET_ENGINE=y +# CONFIG_HAMACHI is not set +# CONFIG_YELLOWFIN is not set +CONFIG_NET_VENDOR_QLOGIC=y +# CONFIG_QLA3XXX is not set +# CONFIG_QLCNIC is not set +# CONFIG_QLGE is not set +# CONFIG_NETXEN_NIC is not set +# CONFIG_QED is not set +CONFIG_NET_VENDOR_QUALCOMM=y +# CONFIG_QCA7000_SPI is not set +# CONFIG_QCA7000_UART is not set +# CONFIG_QCOM_EMAC is not set +# CONFIG_RMNET is not set +CONFIG_NET_VENDOR_REALTEK=y +# CONFIG_ATP is not set +# CONFIG_8139CP is not set +# CONFIG_8139TOO is not set +# CONFIG_R8169 is not set +CONFIG_NET_VENDOR_RENESAS=y +CONFIG_NET_VENDOR_RDC=y +# CONFIG_R6040 is not set +CONFIG_NET_VENDOR_ROCKER=y +CONFIG_NET_VENDOR_SAMSUNG=y +# CONFIG_SXGBE_ETH is not set +CONFIG_NET_VENDOR_SEEQ=y +CONFIG_NET_VENDOR_SILAN=y +# CONFIG_SC92031 is not set +CONFIG_NET_VENDOR_SIS=y +# CONFIG_SIS900 is not set +# CONFIG_SIS190 is not set +CONFIG_NET_VENDOR_SOLARFLARE=y +# CONFIG_SFC is not set +# CONFIG_SFC_FALCON is not set +CONFIG_NET_VENDOR_SMSC=y +# CONFIG_PCMCIA_SMC91C92 is not set +# CONFIG_EPIC100 is not set +# CONFIG_SMSC911X is not set +# CONFIG_SMSC9420 is not set +CONFIG_NET_VENDOR_SOCIONEXT=y +CONFIG_NET_VENDOR_STMICRO=y +# CONFIG_STMMAC_ETH is not set +CONFIG_NET_VENDOR_SUN=y +# CONFIG_HAPPYMEAL is not set +# CONFIG_SUNGEM is not set +# CONFIG_CASSINI is not set +# CONFIG_NIU is not set +CONFIG_NET_VENDOR_TEHUTI=y +# CONFIG_TEHUTI is not set +CONFIG_NET_VENDOR_TI=y +# CONFIG_TI_CPSW_ALE is not set +# CONFIG_TLAN is not set +CONFIG_NET_VENDOR_VIA=y +# CONFIG_VIA_RHINE is not set +# CONFIG_VIA_VELOCITY is not set +CONFIG_NET_VENDOR_WIZNET=y +# CONFIG_WIZNET_W5100 is not set +# CONFIG_WIZNET_W5300 is not set +CONFIG_NET_VENDOR_XIRCOM=y +# CONFIG_PCMCIA_XIRC2PS is not set +CONFIG_NET_VENDOR_SYNOPSYS=y +# CONFIG_DWC_XLGMAC is not set +# CONFIG_FDDI is not set +# CONFIG_HIPPI is not set +# CONFIG_NET_SB1000 is not set +# CONFIG_MDIO_DEVICE is not set +# CONFIG_MDIO_BUS is not set +# CONFIG_PHYLIB is not set +# CONFIG_MICREL_KS8995MA is not set +# CONFIG_PLIP is not set +# CONFIG_PPP is not set +# CONFIG_SLIP is not set + +# +# Host-side USB support is needed for USB Network Adapter support +# +CONFIG_WLAN=y +CONFIG_WLAN_VENDOR_ADMTEK=y +CONFIG_WLAN_VENDOR_ATH=y +# CONFIG_ATH_DEBUG is not set +# CONFIG_ATH5K_PCI is not set +CONFIG_WLAN_VENDOR_ATMEL=y +CONFIG_WLAN_VENDOR_BROADCOM=y +CONFIG_WLAN_VENDOR_CISCO=y +CONFIG_WLAN_VENDOR_INTEL=y +CONFIG_WLAN_VENDOR_INTERSIL=y +# CONFIG_HOSTAP is not set +# CONFIG_PRISM54 is not set +CONFIG_WLAN_VENDOR_MARVELL=y +CONFIG_WLAN_VENDOR_MEDIATEK=y +CONFIG_WLAN_VENDOR_RALINK=y +CONFIG_WLAN_VENDOR_REALTEK=y +CONFIG_WLAN_VENDOR_RSI=y +CONFIG_WLAN_VENDOR_ST=y +CONFIG_WLAN_VENDOR_TI=y +CONFIG_WLAN_VENDOR_ZYDAS=y +CONFIG_WLAN_VENDOR_QUANTENNA=y +# CONFIG_PCMCIA_RAYCS is not set + +# +# Enable WiMAX (Networking options) to see the WiMAX drivers +# +# CONFIG_WAN is not set +# CONFIG_VMXNET3 is not set +# CONFIG_FUJITSU_ES is not set +# CONFIG_ISDN is not set +# CONFIG_NVM is not set + +# +# Input device support +# +CONFIG_INPUT=y +# CONFIG_INPUT_FF_MEMLESS is not set +# CONFIG_INPUT_POLLDEV is not set +# CONFIG_INPUT_SPARSEKMAP is not set +# CONFIG_INPUT_MATRIXKMAP is not set + +# +# Userland interfaces +# +CONFIG_INPUT_MOUSEDEV=y +# CONFIG_INPUT_MOUSEDEV_PSAUX is not set +CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 +CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 +# CONFIG_INPUT_JOYDEV is not set +# CONFIG_INPUT_EVDEV is not set +# CONFIG_INPUT_EVBUG is not set + +# +# Input Device Drivers +# +CONFIG_INPUT_KEYBOARD=y +# CONFIG_KEYBOARD_ADC is not set +# CONFIG_KEYBOARD_ADP5588 is not set +# CONFIG_KEYBOARD_ADP5589 is not set +CONFIG_KEYBOARD_ATKBD=y +# CONFIG_KEYBOARD_QT1070 is not set +# CONFIG_KEYBOARD_QT2160 is not set +# CONFIG_KEYBOARD_DLINK_DIR685 is not set +# CONFIG_KEYBOARD_LKKBD is not set +# CONFIG_KEYBOARD_GPIO is not set +# CONFIG_KEYBOARD_GPIO_POLLED is not set +# CONFIG_KEYBOARD_TCA6416 is not set +# CONFIG_KEYBOARD_TCA8418 is not set +# CONFIG_KEYBOARD_MATRIX is not set +# CONFIG_KEYBOARD_LM8333 is not set +# CONFIG_KEYBOARD_MAX7359 is not set +# CONFIG_KEYBOARD_MCS is not set +# CONFIG_KEYBOARD_MPR121 is not set +# CONFIG_KEYBOARD_NEWTON is not set +# CONFIG_KEYBOARD_OPENCORES is not set +# CONFIG_KEYBOARD_SAMSUNG is not set +# CONFIG_KEYBOARD_STOWAWAY is not set +# CONFIG_KEYBOARD_SUNKBD is not set +# CONFIG_KEYBOARD_OMAP4 is not set +# CONFIG_KEYBOARD_XTKBD is not set +# CONFIG_KEYBOARD_CAP11XX is not set +# CONFIG_KEYBOARD_BCM is not set +CONFIG_INPUT_MOUSE=y +CONFIG_MOUSE_PS2=y +CONFIG_MOUSE_PS2_ALPS=y +CONFIG_MOUSE_PS2_BYD=y +CONFIG_MOUSE_PS2_LOGIPS2PP=y +CONFIG_MOUSE_PS2_SYNAPTICS=y +CONFIG_MOUSE_PS2_SYNAPTICS_SMBUS=y +CONFIG_MOUSE_PS2_CYPRESS=y +CONFIG_MOUSE_PS2_LIFEBOOK=y +CONFIG_MOUSE_PS2_TRACKPOINT=y +# CONFIG_MOUSE_PS2_ELANTECH is not set +# CONFIG_MOUSE_PS2_SENTELIC is not set +# CONFIG_MOUSE_PS2_TOUCHKIT is not set +CONFIG_MOUSE_PS2_FOCALTECH=y +CONFIG_MOUSE_PS2_SMBUS=y +# CONFIG_MOUSE_SERIAL is not set +# CONFIG_MOUSE_APPLETOUCH is not set +# CONFIG_MOUSE_BCM5974 is not set +# CONFIG_MOUSE_CYAPA is not set +# CONFIG_MOUSE_ELAN_I2C is not set +# CONFIG_MOUSE_VSXXXAA is not set +# CONFIG_MOUSE_GPIO is not set +# CONFIG_MOUSE_SYNAPTICS_I2C is not set +# CONFIG_MOUSE_SYNAPTICS_USB is not set +# CONFIG_INPUT_JOYSTICK is not set +# CONFIG_INPUT_TABLET is not set +# CONFIG_INPUT_TOUCHSCREEN is not set +# CONFIG_INPUT_MISC is not set +# CONFIG_RMI4_CORE is not set + +# +# Hardware I/O ports +# +CONFIG_SERIO=y +CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y +CONFIG_SERIO_I8042=y +CONFIG_SERIO_SERPORT=y +# CONFIG_SERIO_CT82C710 is not set +# CONFIG_SERIO_PARKBD is not set +# CONFIG_SERIO_PCIPS2 is not set +CONFIG_SERIO_LIBPS2=y +# CONFIG_SERIO_RAW is not set +# CONFIG_SERIO_ALTERA_PS2 is not set +# CONFIG_SERIO_PS2MULT is not set +# CONFIG_SERIO_ARC_PS2 is not set +# CONFIG_SERIO_APBPS2 is not set +# CONFIG_SERIO_GPIO_PS2 is not set +# CONFIG_USERIO is not set +CONFIG_GAMEPORT=y +# CONFIG_GAMEPORT_NS558 is not set +# CONFIG_GAMEPORT_L4 is not set +# CONFIG_GAMEPORT_EMU10K1 is not set +# CONFIG_GAMEPORT_FM801 is not set + +# +# Character devices +# +CONFIG_TTY=y +CONFIG_VT=y +CONFIG_CONSOLE_TRANSLATIONS=y +CONFIG_VT_CONSOLE=y +CONFIG_VT_CONSOLE_SLEEP=y +CONFIG_HW_CONSOLE=y +CONFIG_VT_HW_CONSOLE_BINDING=y +CONFIG_UNIX98_PTYS=y +CONFIG_LEGACY_PTYS=y +CONFIG_LEGACY_PTY_COUNT=256 +CONFIG_SERIAL_NONSTANDARD=y +# CONFIG_ROCKETPORT is not set +# CONFIG_CYCLADES is not set +# CONFIG_MOXA_INTELLIO is not set +# CONFIG_MOXA_SMARTIO is not set +# CONFIG_SYNCLINK is not set +# CONFIG_SYNCLINKMP is not set +# CONFIG_SYNCLINK_GT is not set +CONFIG_NOZOMI=y +# CONFIG_ISI is not set +# CONFIG_N_HDLC is not set +# CONFIG_N_GSM is not set +# CONFIG_TRACE_ROUTER is not set +CONFIG_TRACE_SINK=y +CONFIG_DEVMEM=y +# CONFIG_DEVKMEM is not set + +# +# Serial drivers +# +CONFIG_SERIAL_8250=y +CONFIG_SERIAL_8250_DEPRECATED_OPTIONS=y +CONFIG_SERIAL_8250_PNP=y +CONFIG_SERIAL_8250_FINTEK=y +# CONFIG_SERIAL_8250_CONSOLE is not set +CONFIG_SERIAL_8250_DMA=y +CONFIG_SERIAL_8250_PCI=y +CONFIG_SERIAL_8250_EXAR=y +# CONFIG_SERIAL_8250_CS is not set +# CONFIG_SERIAL_8250_MEN_MCB is not set +CONFIG_SERIAL_8250_NR_UARTS=4 +CONFIG_SERIAL_8250_RUNTIME_UARTS=4 +# CONFIG_SERIAL_8250_EXTENDED is not set +# CONFIG_SERIAL_8250_ASPEED_VUART is not set +CONFIG_SERIAL_8250_DW=y +# CONFIG_SERIAL_8250_RT288X is not set +CONFIG_SERIAL_8250_LPSS=y +CONFIG_SERIAL_8250_MID=y +# CONFIG_SERIAL_8250_MOXA is not set +# CONFIG_SERIAL_OF_PLATFORM is not set + +# +# Non-8250 serial port support +# +# CONFIG_SERIAL_MAX3100 is not set +# CONFIG_SERIAL_MAX310X is not set +# CONFIG_SERIAL_UARTLITE is not set +CONFIG_SERIAL_CORE=y +CONFIG_SERIAL_JSM=y +CONFIG_SERIAL_SCCNXP=y +# CONFIG_SERIAL_SCCNXP_CONSOLE is not set +# CONFIG_SERIAL_SC16IS7XX is not set +# CONFIG_SERIAL_TIMBERDALE is not set +CONFIG_SERIAL_ALTERA_JTAGUART=y +# CONFIG_SERIAL_ALTERA_JTAGUART_CONSOLE is not set +CONFIG_SERIAL_ALTERA_UART=y +CONFIG_SERIAL_ALTERA_UART_MAXPORTS=4 +CONFIG_SERIAL_ALTERA_UART_BAUDRATE=115200 +# CONFIG_SERIAL_ALTERA_UART_CONSOLE is not set +# CONFIG_SERIAL_IFX6X60 is not set +# CONFIG_SERIAL_PCH_UART is not set +# CONFIG_SERIAL_XILINX_PS_UART is not set +CONFIG_SERIAL_ARC=y +# CONFIG_SERIAL_ARC_CONSOLE is not set +CONFIG_SERIAL_ARC_NR_PORTS=1 +CONFIG_SERIAL_RP2=y +CONFIG_SERIAL_RP2_NR_UARTS=32 +CONFIG_SERIAL_FSL_LPUART=y +# CONFIG_SERIAL_FSL_LPUART_CONSOLE is not set +# CONFIG_SERIAL_CONEXANT_DIGICOLOR is not set +# CONFIG_SERIAL_MEN_Z135 is not set +CONFIG_SERIAL_DEV_BUS=y +CONFIG_SERIAL_DEV_CTRL_TTYPORT=y +# CONFIG_PRINTER is not set +# CONFIG_PPDEV is not set +# CONFIG_VIRTIO_CONSOLE is not set +CONFIG_IPMI_HANDLER=y +CONFIG_IPMI_DMI_DECODE=y +CONFIG_IPMI_PROC_INTERFACE=y +# CONFIG_IPMI_PANIC_EVENT is not set +# CONFIG_IPMI_DEVICE_INTERFACE is not set +# CONFIG_IPMI_SI is not set +# CONFIG_IPMI_SSIF is not set +# CONFIG_IPMI_WATCHDOG is not set +# CONFIG_IPMI_POWEROFF is not set +CONFIG_HW_RANDOM=y +CONFIG_HW_RANDOM_TIMERIOMEM=y +CONFIG_HW_RANDOM_INTEL=y +CONFIG_HW_RANDOM_AMD=y +CONFIG_HW_RANDOM_GEODE=y +CONFIG_HW_RANDOM_VIA=y +# CONFIG_HW_RANDOM_VIRTIO is not set +# CONFIG_NVRAM is not set +# CONFIG_R3964 is not set +CONFIG_APPLICOM=y +# CONFIG_SONYPI is not set + +# +# PCMCIA character devices +# +# CONFIG_SYNCLINK_CS is not set +# CONFIG_CARDMAN_4000 is not set +# CONFIG_CARDMAN_4040 is not set +# CONFIG_SCR24X is not set +# CONFIG_IPWIRELESS is not set +# CONFIG_MWAVE is not set +# CONFIG_PC8736x_GPIO is not set +# CONFIG_NSC_GPIO is not set +CONFIG_RAW_DRIVER=y +CONFIG_MAX_RAW_DEVS=256 +CONFIG_HPET=y +CONFIG_HPET_MMAP=y +CONFIG_HPET_MMAP_DEFAULT=y +# CONFIG_HANGCHECK_TIMER is not set +# CONFIG_TCG_TPM is not set +# CONFIG_TELCLOCK is not set +CONFIG_DEVPORT=y +CONFIG_XILLYBUS=y +# CONFIG_XILLYBUS_OF is not set + +# +# I2C support +# +CONFIG_I2C=y +CONFIG_ACPI_I2C_OPREGION=y +CONFIG_I2C_BOARDINFO=y +CONFIG_I2C_COMPAT=y +# CONFIG_I2C_CHARDEV is not set +# CONFIG_I2C_MUX is not set +CONFIG_I2C_HELPER_AUTO=y +CONFIG_I2C_ALGOBIT=y + +# +# I2C Hardware Bus support +# + +# +# PC SMBus host controller drivers +# +# CONFIG_I2C_ALI1535 is not set +# CONFIG_I2C_ALI1563 is not set +# CONFIG_I2C_ALI15X3 is not set +# CONFIG_I2C_AMD756 is not set +# CONFIG_I2C_AMD8111 is not set +# CONFIG_I2C_I801 is not set +# CONFIG_I2C_ISCH is not set +# CONFIG_I2C_ISMT is not set +# CONFIG_I2C_PIIX4 is not set +# CONFIG_I2C_NFORCE2 is not set +# CONFIG_I2C_SIS5595 is not set +# CONFIG_I2C_SIS630 is not set +# CONFIG_I2C_SIS96X is not set +# CONFIG_I2C_VIA is not set +# CONFIG_I2C_VIAPRO is not set + +# +# ACPI drivers +# +# CONFIG_I2C_SCMI is not set + +# +# I2C system bus drivers (mostly embedded / system-on-chip) +# +# CONFIG_I2C_CBUS_GPIO is not set +# CONFIG_I2C_DESIGNWARE_PLATFORM is not set +# CONFIG_I2C_DESIGNWARE_PCI is not set +# CONFIG_I2C_EG20T is not set +# CONFIG_I2C_EMEV2 is not set +# CONFIG_I2C_GPIO is not set +# CONFIG_I2C_KEMPLD is not set +# CONFIG_I2C_OCORES is not set +# CONFIG_I2C_PCA_PLATFORM is not set +# CONFIG_I2C_PXA is not set +# CONFIG_I2C_PXA_PCI is not set +# CONFIG_I2C_RK3X is not set +# CONFIG_I2C_SIMTEC is not set +# CONFIG_I2C_XILINX is not set + +# +# External I2C/SMBus adapter drivers +# +# CONFIG_I2C_PARPORT is not set +# CONFIG_I2C_PARPORT_LIGHT is not set +# CONFIG_I2C_TAOS_EVM is not set + +# +# Other I2C/SMBus bus drivers +# +# CONFIG_SCx200_ACB is not set +# CONFIG_I2C_STUB is not set +# CONFIG_I2C_SLAVE is not set +# CONFIG_I2C_DEBUG_CORE is not set +# CONFIG_I2C_DEBUG_ALGO is not set +# CONFIG_I2C_DEBUG_BUS is not set +CONFIG_SPI=y +CONFIG_SPI_MASTER=y + +# +# SPI Master Controller Drivers +# +# CONFIG_SPI_ALTERA is not set +# CONFIG_SPI_AXI_SPI_ENGINE is not set +# CONFIG_SPI_BITBANG is not set +# CONFIG_SPI_BUTTERFLY is not set +# CONFIG_SPI_CADENCE is not set +# CONFIG_SPI_DESIGNWARE is not set +# CONFIG_SPI_GPIO is not set +# CONFIG_SPI_LM70_LLP is not set +# CONFIG_SPI_FSL_SPI is not set +# CONFIG_SPI_OC_TINY is not set +# CONFIG_SPI_PXA2XX is not set +# CONFIG_SPI_PXA2XX_PCI is not set +# CONFIG_SPI_ROCKCHIP is not set +# CONFIG_SPI_SC18IS602 is not set +# CONFIG_SPI_TOPCLIFF_PCH is not set +# CONFIG_SPI_XCOMM is not set +# CONFIG_SPI_XILINX is not set +# CONFIG_SPI_ZYNQMP_GQSPI is not set + +# +# SPI Protocol Masters +# +# CONFIG_SPI_SPIDEV is not set +# CONFIG_SPI_LOOPBACK_TEST is not set +# CONFIG_SPI_TLE62X0 is not set +# CONFIG_SPI_SLAVE is not set +CONFIG_SPMI=y +CONFIG_HSI=y +CONFIG_HSI_BOARDINFO=y + +# +# HSI controllers +# + +# +# HSI clients +# +# CONFIG_HSI_CHAR is not set +CONFIG_PPS=y +# CONFIG_PPS_DEBUG is not set +# CONFIG_NTP_PPS is not set + +# +# PPS clients support +# +# CONFIG_PPS_CLIENT_KTIMER is not set +CONFIG_PPS_CLIENT_LDISC=y +# CONFIG_PPS_CLIENT_PARPORT is not set +CONFIG_PPS_CLIENT_GPIO=y + +# +# PPS generators support +# + +# +# PTP clock support +# +# CONFIG_PTP_1588_CLOCK is not set + +# +# Enable PHYLIB and NETWORK_PHY_TIMESTAMPING to see the additional clocks. +# +# CONFIG_PTP_1588_CLOCK_PCH is not set +CONFIG_PINCTRL=y +CONFIG_PINMUX=y +CONFIG_PINCONF=y +CONFIG_GENERIC_PINCONF=y +# CONFIG_PINCTRL_AMD is not set +# CONFIG_PINCTRL_MCP23S08 is not set +# CONFIG_PINCTRL_SINGLE is not set +# CONFIG_PINCTRL_SX150X is not set +# CONFIG_PINCTRL_BAYTRAIL is not set +CONFIG_PINCTRL_CHERRYVIEW=y +# CONFIG_PINCTRL_BROXTON is not set +# CONFIG_PINCTRL_CANNONLAKE is not set +# CONFIG_PINCTRL_CEDARFORK is not set +# CONFIG_PINCTRL_DENVERTON is not set +# CONFIG_PINCTRL_GEMINILAKE is not set +# CONFIG_PINCTRL_LEWISBURG is not set +# CONFIG_PINCTRL_SUNRISEPOINT is not set +CONFIG_GPIOLIB=y +CONFIG_OF_GPIO=y +CONFIG_GPIO_ACPI=y +CONFIG_GPIOLIB_IRQCHIP=y +# CONFIG_GPIO_SYSFS is not set +CONFIG_GPIO_GENERIC=y + +# +# Memory mapped GPIO drivers +# +# CONFIG_GPIO_74XX_MMIO is not set +# CONFIG_GPIO_ALTERA is not set +# CONFIG_GPIO_AMDPT is not set +# CONFIG_GPIO_DWAPB is not set +# CONFIG_GPIO_EXAR is not set +# CONFIG_GPIO_FTGPIO010 is not set +CONFIG_GPIO_GENERIC_PLATFORM=y +# CONFIG_GPIO_GRGPIO is not set +# CONFIG_GPIO_ICH is not set +# CONFIG_GPIO_LYNXPOINT is not set +CONFIG_GPIO_MB86S7X=y +# CONFIG_GPIO_MENZ127 is not set +# CONFIG_GPIO_MOCKUP is not set +# CONFIG_GPIO_SYSCON is not set +# CONFIG_GPIO_VX855 is not set +# CONFIG_GPIO_XILINX is not set + +# +# Port-mapped I/O GPIO drivers +# +# CONFIG_GPIO_F7188X is not set +# CONFIG_GPIO_IT87 is not set +# CONFIG_GPIO_SCH is not set +# CONFIG_GPIO_SCH311X is not set + +# +# I2C GPIO expanders +# +# CONFIG_GPIO_ADP5588 is not set +# CONFIG_GPIO_ADNP is not set +# CONFIG_GPIO_MAX7300 is not set +# CONFIG_GPIO_MAX732X is not set +# CONFIG_GPIO_PCA953X is not set +# CONFIG_GPIO_PCF857X is not set +# CONFIG_GPIO_TPIC2810 is not set + +# +# MFD GPIO expanders +# +# CONFIG_GPIO_JANZ_TTL is not set +# CONFIG_GPIO_KEMPLD is not set + +# +# PCI GPIO expanders +# +# CONFIG_GPIO_AMD8111 is not set +# CONFIG_GPIO_BT8XX is not set +# CONFIG_GPIO_ML_IOH is not set +# CONFIG_GPIO_PCH is not set +# CONFIG_GPIO_PCI_IDIO_16 is not set +# CONFIG_GPIO_PCIE_IDIO_24 is not set +# CONFIG_GPIO_RDC321X is not set +# CONFIG_GPIO_SODAVILLE is not set + +# +# SPI GPIO expanders +# +# CONFIG_GPIO_74X164 is not set +# CONFIG_GPIO_MAX3191X is not set +# CONFIG_GPIO_MAX7301 is not set +# CONFIG_GPIO_MC33880 is not set +# CONFIG_GPIO_PISOSR is not set +# CONFIG_GPIO_XRA1403 is not set +CONFIG_W1=y + +# +# 1-wire Bus Masters +# +# CONFIG_W1_MASTER_MATROX is not set +# CONFIG_W1_MASTER_DS2482 is not set +# CONFIG_W1_MASTER_DS1WM is not set +# CONFIG_W1_MASTER_GPIO is not set + +# +# 1-wire Slaves +# +# CONFIG_W1_SLAVE_THERM is not set +# CONFIG_W1_SLAVE_SMEM is not set +# CONFIG_W1_SLAVE_DS2405 is not set +# CONFIG_W1_SLAVE_DS2408 is not set +# CONFIG_W1_SLAVE_DS2413 is not set +# CONFIG_W1_SLAVE_DS2406 is not set +# CONFIG_W1_SLAVE_DS2423 is not set +# CONFIG_W1_SLAVE_DS2805 is not set +# CONFIG_W1_SLAVE_DS2431 is not set +# CONFIG_W1_SLAVE_DS2433 is not set +# CONFIG_W1_SLAVE_DS2438 is not set +# CONFIG_W1_SLAVE_DS2760 is not set +# CONFIG_W1_SLAVE_DS2780 is not set +# CONFIG_W1_SLAVE_DS2781 is not set +# CONFIG_W1_SLAVE_DS28E04 is not set +# CONFIG_W1_SLAVE_DS28E17 is not set +CONFIG_POWER_AVS=y +# CONFIG_POWER_RESET is not set +CONFIG_POWER_SUPPLY=y +# CONFIG_POWER_SUPPLY_DEBUG is not set +# CONFIG_PDA_POWER is not set +# CONFIG_GENERIC_ADC_BATTERY is not set +# CONFIG_TEST_POWER is not set +# CONFIG_BATTERY_DS2780 is not set +# CONFIG_BATTERY_DS2781 is not set +# CONFIG_BATTERY_DS2782 is not set +# CONFIG_BATTERY_LEGO_EV3 is not set +# CONFIG_BATTERY_SBS is not set +# CONFIG_CHARGER_SBS is not set +# CONFIG_BATTERY_BQ27XXX is not set +# CONFIG_BATTERY_MAX17040 is not set +# CONFIG_BATTERY_MAX17042 is not set +# CONFIG_BATTERY_MAX1721X is not set +# CONFIG_CHARGER_ISP1704 is not set +# CONFIG_CHARGER_MAX8903 is not set +# CONFIG_CHARGER_LP8727 is not set +# CONFIG_CHARGER_GPIO is not set +# CONFIG_CHARGER_MANAGER is not set +# CONFIG_CHARGER_LTC3651 is not set +# CONFIG_CHARGER_DETECTOR_MAX14656 is not set +# CONFIG_CHARGER_BQ2415X is not set +# CONFIG_CHARGER_BQ24190 is not set +# CONFIG_CHARGER_BQ24257 is not set +# CONFIG_CHARGER_BQ24735 is not set +# CONFIG_CHARGER_BQ25890 is not set +# CONFIG_CHARGER_SMB347 is not set +# CONFIG_BATTERY_GAUGE_LTC2941 is not set +# CONFIG_CHARGER_RT9455 is not set +CONFIG_HWMON=y +# CONFIG_HWMON_DEBUG_CHIP is not set + +# +# Native drivers +# +# CONFIG_SENSORS_ABITUGURU is not set +# CONFIG_SENSORS_ABITUGURU3 is not set +# CONFIG_SENSORS_AD7314 is not set +# CONFIG_SENSORS_AD7414 is not set +# CONFIG_SENSORS_AD7418 is not set +# CONFIG_SENSORS_ADM1021 is not set +# CONFIG_SENSORS_ADM1025 is not set +# CONFIG_SENSORS_ADM1026 is not set +# CONFIG_SENSORS_ADM1029 is not set +# CONFIG_SENSORS_ADM1031 is not set +# CONFIG_SENSORS_ADM9240 is not set +# CONFIG_SENSORS_ADT7310 is not set +# CONFIG_SENSORS_ADT7410 is not set +# CONFIG_SENSORS_ADT7411 is not set +# CONFIG_SENSORS_ADT7462 is not set +# CONFIG_SENSORS_ADT7470 is not set +# CONFIG_SENSORS_ADT7475 is not set +# CONFIG_SENSORS_ASC7621 is not set +# CONFIG_SENSORS_K8TEMP is not set +# CONFIG_SENSORS_K10TEMP is not set +# CONFIG_SENSORS_FAM15H_POWER is not set +# CONFIG_SENSORS_APPLESMC is not set +# CONFIG_SENSORS_ASB100 is not set +# CONFIG_SENSORS_ASPEED is not set +# CONFIG_SENSORS_ATXP1 is not set +# CONFIG_SENSORS_DS620 is not set +# CONFIG_SENSORS_DS1621 is not set +# CONFIG_SENSORS_DELL_SMM is not set +# CONFIG_SENSORS_I5K_AMB is not set +# CONFIG_SENSORS_F71805F is not set +# CONFIG_SENSORS_F71882FG is not set +# CONFIG_SENSORS_F75375S is not set +# CONFIG_SENSORS_FSCHMD is not set +# CONFIG_SENSORS_GL518SM is not set +# CONFIG_SENSORS_GL520SM is not set +# CONFIG_SENSORS_G760A is not set +# CONFIG_SENSORS_G762 is not set +# CONFIG_SENSORS_GPIO_FAN is not set +# CONFIG_SENSORS_HIH6130 is not set +# CONFIG_SENSORS_IBMAEM is not set +# CONFIG_SENSORS_IBMPEX is not set +# CONFIG_SENSORS_IIO_HWMON is not set +# CONFIG_SENSORS_I5500 is not set +# CONFIG_SENSORS_CORETEMP is not set +# CONFIG_SENSORS_IT87 is not set +# CONFIG_SENSORS_JC42 is not set +# CONFIG_SENSORS_POWR1220 is not set +# CONFIG_SENSORS_LINEAGE is not set +# CONFIG_SENSORS_LTC2945 is not set +# CONFIG_SENSORS_LTC2990 is not set +# CONFIG_SENSORS_LTC4151 is not set +# CONFIG_SENSORS_LTC4215 is not set +# CONFIG_SENSORS_LTC4222 is not set +# CONFIG_SENSORS_LTC4245 is not set +# CONFIG_SENSORS_LTC4260 is not set +# CONFIG_SENSORS_LTC4261 is not set +# CONFIG_SENSORS_MAX1111 is not set +# CONFIG_SENSORS_MAX16065 is not set +# CONFIG_SENSORS_MAX1619 is not set +# CONFIG_SENSORS_MAX1668 is not set +# CONFIG_SENSORS_MAX197 is not set +# CONFIG_SENSORS_MAX31722 is not set +# CONFIG_SENSORS_MAX6621 is not set +# CONFIG_SENSORS_MAX6639 is not set +# CONFIG_SENSORS_MAX6642 is not set +# CONFIG_SENSORS_MAX6650 is not set +# CONFIG_SENSORS_MAX6697 is not set +# CONFIG_SENSORS_MAX31790 is not set +# CONFIG_SENSORS_MCP3021 is not set +# CONFIG_SENSORS_TC654 is not set +# CONFIG_SENSORS_ADCXX is not set +# CONFIG_SENSORS_LM63 is not set +# CONFIG_SENSORS_LM70 is not set +# CONFIG_SENSORS_LM73 is not set +# CONFIG_SENSORS_LM75 is not set +# CONFIG_SENSORS_LM77 is not set +# CONFIG_SENSORS_LM78 is not set +# CONFIG_SENSORS_LM80 is not set +# CONFIG_SENSORS_LM83 is not set +# CONFIG_SENSORS_LM85 is not set +# CONFIG_SENSORS_LM87 is not set +# CONFIG_SENSORS_LM90 is not set +# CONFIG_SENSORS_LM92 is not set +# CONFIG_SENSORS_LM93 is not set +# CONFIG_SENSORS_LM95234 is not set +# CONFIG_SENSORS_LM95241 is not set +# CONFIG_SENSORS_LM95245 is not set +# CONFIG_SENSORS_PC87360 is not set +# CONFIG_SENSORS_PC87427 is not set +# CONFIG_SENSORS_NTC_THERMISTOR is not set +# CONFIG_SENSORS_NCT6683 is not set +# CONFIG_SENSORS_NCT6775 is not set +# CONFIG_SENSORS_NCT7802 is not set +# CONFIG_SENSORS_NCT7904 is not set +# CONFIG_SENSORS_PCF8591 is not set +# CONFIG_PMBUS is not set +# CONFIG_SENSORS_PWM_FAN is not set +# CONFIG_SENSORS_SHT15 is not set +# CONFIG_SENSORS_SHT21 is not set +# CONFIG_SENSORS_SHT3x is not set +# CONFIG_SENSORS_SHTC1 is not set +# CONFIG_SENSORS_SIS5595 is not set +# CONFIG_SENSORS_DME1737 is not set +# CONFIG_SENSORS_EMC1403 is not set +# CONFIG_SENSORS_EMC2103 is not set +# CONFIG_SENSORS_EMC6W201 is not set +# CONFIG_SENSORS_SMSC47M1 is not set +# CONFIG_SENSORS_SMSC47M192 is not set +# CONFIG_SENSORS_SMSC47B397 is not set +# CONFIG_SENSORS_STTS751 is not set +# CONFIG_SENSORS_SMM665 is not set +# CONFIG_SENSORS_ADC128D818 is not set +# CONFIG_SENSORS_ADS1015 is not set +# CONFIG_SENSORS_ADS7828 is not set +# CONFIG_SENSORS_ADS7871 is not set +# CONFIG_SENSORS_AMC6821 is not set +# CONFIG_SENSORS_INA209 is not set +# CONFIG_SENSORS_INA2XX is not set +# CONFIG_SENSORS_INA3221 is not set +# CONFIG_SENSORS_TC74 is not set +# CONFIG_SENSORS_THMC50 is not set +# CONFIG_SENSORS_TMP102 is not set +# CONFIG_SENSORS_TMP103 is not set +# CONFIG_SENSORS_TMP108 is not set +# CONFIG_SENSORS_TMP401 is not set +# CONFIG_SENSORS_TMP421 is not set +# CONFIG_SENSORS_VIA_CPUTEMP is not set +# CONFIG_SENSORS_VIA686A is not set +# CONFIG_SENSORS_VT1211 is not set +# CONFIG_SENSORS_VT8231 is not set +# CONFIG_SENSORS_W83773G is not set +# CONFIG_SENSORS_W83781D is not set +# CONFIG_SENSORS_W83791D is not set +# CONFIG_SENSORS_W83792D is not set +# CONFIG_SENSORS_W83793 is not set +# CONFIG_SENSORS_W83795 is not set +# CONFIG_SENSORS_W83L785TS is not set +# CONFIG_SENSORS_W83L786NG is not set +# CONFIG_SENSORS_W83627HF is not set +# CONFIG_SENSORS_W83627EHF is not set +# CONFIG_SENSORS_XGENE is not set + +# +# ACPI drivers +# +# CONFIG_SENSORS_ACPI_POWER is not set +# CONFIG_SENSORS_ATK0110 is not set +CONFIG_THERMAL=y +CONFIG_THERMAL_EMERGENCY_POWEROFF_DELAY_MS=0 +CONFIG_THERMAL_HWMON=y +CONFIG_THERMAL_OF=y +CONFIG_THERMAL_WRITABLE_TRIPS=y +CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y +# CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE is not set +# CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE is not set +# CONFIG_THERMAL_DEFAULT_GOV_POWER_ALLOCATOR is not set +# CONFIG_THERMAL_GOV_FAIR_SHARE is not set +CONFIG_THERMAL_GOV_STEP_WISE=y +# CONFIG_THERMAL_GOV_BANG_BANG is not set +CONFIG_THERMAL_GOV_USER_SPACE=y +# CONFIG_THERMAL_GOV_POWER_ALLOCATOR is not set +# CONFIG_CPU_THERMAL is not set +# CONFIG_CLOCK_THERMAL is not set +# CONFIG_DEVFREQ_THERMAL is not set +# CONFIG_THERMAL_EMULATION is not set +# CONFIG_QORIQ_THERMAL is not set +# CONFIG_INTEL_POWERCLAMP is not set +CONFIG_X86_PKG_TEMP_THERMAL=y +# CONFIG_INTEL_SOC_DTS_THERMAL is not set + +# +# ACPI INT340X thermal drivers +# +# CONFIG_INT340X_THERMAL is not set +# CONFIG_INTEL_PCH_THERMAL is not set +# CONFIG_QCOM_SPMI_TEMP_ALARM is not set +# CONFIG_GENERIC_ADC_THERMAL is not set +# CONFIG_WATCHDOG is not set +CONFIG_SSB_POSSIBLE=y +CONFIG_SSB=y +CONFIG_SSB_SPROM=y +CONFIG_SSB_PCIHOST_POSSIBLE=y +CONFIG_SSB_PCIHOST=y +# CONFIG_SSB_B43_PCI_BRIDGE is not set +CONFIG_SSB_PCMCIAHOST_POSSIBLE=y +# CONFIG_SSB_PCMCIAHOST is not set +CONFIG_SSB_SDIOHOST_POSSIBLE=y +# CONFIG_SSB_SDIOHOST is not set +# CONFIG_SSB_DEBUG is not set +CONFIG_SSB_DRIVER_PCICORE_POSSIBLE=y +# CONFIG_SSB_DRIVER_PCICORE is not set +# CONFIG_SSB_DRIVER_GPIO is not set +CONFIG_BCMA_POSSIBLE=y +CONFIG_BCMA=y +CONFIG_BCMA_HOST_PCI_POSSIBLE=y +CONFIG_BCMA_HOST_PCI=y +# CONFIG_BCMA_HOST_SOC is not set +CONFIG_BCMA_DRIVER_PCI=y +# CONFIG_BCMA_DRIVER_GMAC_CMN is not set +# CONFIG_BCMA_DRIVER_GPIO is not set +# CONFIG_BCMA_DEBUG is not set + +# +# Multifunction device drivers +# +CONFIG_MFD_CORE=y +# CONFIG_MFD_CS5535 is not set +# CONFIG_MFD_ACT8945A is not set +# CONFIG_MFD_AS3711 is not set +# CONFIG_MFD_AS3722 is not set +# CONFIG_PMIC_ADP5520 is not set +# CONFIG_MFD_AAT2870_CORE is not set +# CONFIG_MFD_ATMEL_FLEXCOM is not set +# CONFIG_MFD_ATMEL_HLCDC is not set +# CONFIG_MFD_BCM590XX is not set +# CONFIG_MFD_BD9571MWV is not set +# CONFIG_MFD_AXP20X_I2C is not set +# CONFIG_MFD_CROS_EC is not set +# CONFIG_PMIC_DA903X is not set +# CONFIG_MFD_DA9052_SPI is not set +# CONFIG_MFD_DA9052_I2C is not set +# CONFIG_MFD_DA9055 is not set +# CONFIG_MFD_DA9062 is not set +# CONFIG_MFD_DA9063 is not set +# CONFIG_MFD_DA9150 is not set +# CONFIG_MFD_MC13XXX_SPI is not set +# CONFIG_MFD_MC13XXX_I2C is not set +# CONFIG_MFD_HI6421_PMIC is not set +CONFIG_HTC_PASIC3=y +# CONFIG_HTC_I2CPLD is not set +# CONFIG_MFD_INTEL_QUARK_I2C_GPIO is not set +CONFIG_LPC_ICH=y +CONFIG_LPC_SCH=y +# CONFIG_INTEL_SOC_PMIC is not set +# CONFIG_INTEL_SOC_PMIC_CHTWC is not set +# CONFIG_INTEL_SOC_PMIC_CHTDC_TI is not set +# CONFIG_MFD_INTEL_LPSS_ACPI is not set +# CONFIG_MFD_INTEL_LPSS_PCI is not set +CONFIG_MFD_JANZ_CMODIO=y +CONFIG_MFD_KEMPLD=y +# CONFIG_MFD_88PM800 is not set +# CONFIG_MFD_88PM805 is not set +# CONFIG_MFD_88PM860X is not set +# CONFIG_MFD_MAX14577 is not set +# CONFIG_MFD_MAX77620 is not set +# CONFIG_MFD_MAX77686 is not set +# CONFIG_MFD_MAX77693 is not set +# CONFIG_MFD_MAX77843 is not set +# CONFIG_MFD_MAX8907 is not set +# CONFIG_MFD_MAX8925 is not set +# CONFIG_MFD_MAX8997 is not set +# CONFIG_MFD_MAX8998 is not set +CONFIG_MFD_MT6397=y +# CONFIG_MFD_MENF21BMC is not set +# CONFIG_EZX_PCAP is not set +# CONFIG_MFD_CPCAP is not set +# CONFIG_MFD_RETU is not set +# CONFIG_MFD_PCF50633 is not set +# CONFIG_MFD_RDC321X is not set +# CONFIG_MFD_RT5033 is not set +# CONFIG_MFD_RC5T583 is not set +# CONFIG_MFD_RK808 is not set +# CONFIG_MFD_RN5T618 is not set +# CONFIG_MFD_SEC_CORE is not set +# CONFIG_MFD_SI476X_CORE is not set +CONFIG_MFD_SM501=y +# CONFIG_MFD_SM501_GPIO is not set +# CONFIG_MFD_SKY81452 is not set +# CONFIG_MFD_SMSC is not set +CONFIG_ABX500_CORE=y +# CONFIG_AB3100_CORE is not set +# CONFIG_MFD_STMPE is not set +CONFIG_MFD_SYSCON=y +CONFIG_MFD_TI_AM335X_TSCADC=y +# CONFIG_MFD_LP3943 is not set +# CONFIG_MFD_LP8788 is not set +# CONFIG_MFD_TI_LMU is not set +# CONFIG_MFD_PALMAS is not set +# CONFIG_TPS6105X is not set +# CONFIG_TPS65010 is not set +# CONFIG_TPS6507X is not set +# CONFIG_MFD_TPS65086 is not set +# CONFIG_MFD_TPS65090 is not set +# CONFIG_MFD_TPS65217 is not set +# CONFIG_MFD_TPS68470 is not set +# CONFIG_MFD_TI_LP873X is not set +# CONFIG_MFD_TI_LP87565 is not set +# CONFIG_MFD_TPS65218 is not set +# CONFIG_MFD_TPS6586X is not set +# CONFIG_MFD_TPS65910 is not set +# CONFIG_MFD_TPS65912_I2C is not set +# CONFIG_MFD_TPS65912_SPI is not set +# CONFIG_MFD_TPS80031 is not set +# CONFIG_TWL4030_CORE is not set +# CONFIG_TWL6040_CORE is not set +# CONFIG_MFD_WL1273_CORE is not set +# CONFIG_MFD_LM3533 is not set +# CONFIG_MFD_TIMBERDALE is not set +# CONFIG_MFD_TC3589X is not set +# CONFIG_MFD_TMIO is not set +# CONFIG_MFD_VX855 is not set +# CONFIG_MFD_ARIZONA_I2C is not set +# CONFIG_MFD_ARIZONA_SPI is not set +# CONFIG_MFD_WM8400 is not set +# CONFIG_MFD_WM831X_I2C is not set +# CONFIG_MFD_WM831X_SPI is not set +# CONFIG_MFD_WM8350_I2C is not set +# CONFIG_MFD_WM8994 is not set +# CONFIG_RAVE_SP_CORE is not set +CONFIG_REGULATOR=y +# CONFIG_REGULATOR_DEBUG is not set +CONFIG_REGULATOR_FIXED_VOLTAGE=y +# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set +# CONFIG_REGULATOR_USERSPACE_CONSUMER is not set +# CONFIG_REGULATOR_ACT8865 is not set +# CONFIG_REGULATOR_AD5398 is not set +# CONFIG_REGULATOR_ANATOP is not set +# CONFIG_REGULATOR_DA9210 is not set +# CONFIG_REGULATOR_DA9211 is not set +# CONFIG_REGULATOR_FAN53555 is not set +# CONFIG_REGULATOR_GPIO is not set +# CONFIG_REGULATOR_ISL9305 is not set +# CONFIG_REGULATOR_ISL6271A is not set +# CONFIG_REGULATOR_LP3971 is not set +# CONFIG_REGULATOR_LP3972 is not set +# CONFIG_REGULATOR_LP872X is not set +# CONFIG_REGULATOR_LP8755 is not set +# CONFIG_REGULATOR_LTC3589 is not set +# CONFIG_REGULATOR_LTC3676 is not set +# CONFIG_REGULATOR_MAX1586 is not set +# CONFIG_REGULATOR_MAX8649 is not set +# CONFIG_REGULATOR_MAX8660 is not set +# CONFIG_REGULATOR_MAX8952 is not set +# CONFIG_REGULATOR_MAX8973 is not set +# CONFIG_REGULATOR_MT6311 is not set +# CONFIG_REGULATOR_MT6323 is not set +# CONFIG_REGULATOR_MT6397 is not set +# CONFIG_REGULATOR_PFUZE100 is not set +# CONFIG_REGULATOR_PV88060 is not set +# CONFIG_REGULATOR_PV88080 is not set +# CONFIG_REGULATOR_PV88090 is not set +# CONFIG_REGULATOR_PWM is not set +# CONFIG_REGULATOR_QCOM_SPMI is not set +# CONFIG_REGULATOR_TPS51632 is not set +# CONFIG_REGULATOR_TPS62360 is not set +# CONFIG_REGULATOR_TPS65023 is not set +# CONFIG_REGULATOR_TPS6507X is not set +# CONFIG_REGULATOR_TPS65132 is not set +# CONFIG_REGULATOR_TPS6524X is not set +# CONFIG_REGULATOR_VCTRL is not set +# CONFIG_RC_CORE is not set +CONFIG_MEDIA_SUPPORT=y + +# +# Multimedia core support +# +# CONFIG_MEDIA_CAMERA_SUPPORT is not set +# CONFIG_MEDIA_ANALOG_TV_SUPPORT is not set +# CONFIG_MEDIA_DIGITAL_TV_SUPPORT is not set +# CONFIG_MEDIA_RADIO_SUPPORT is not set +# CONFIG_MEDIA_SDR_SUPPORT is not set +# CONFIG_MEDIA_CEC_SUPPORT is not set +# CONFIG_VIDEO_ADV_DEBUG is not set +# CONFIG_VIDEO_FIXED_MINOR_RANGES is not set +# CONFIG_TTPCI_EEPROM is not set + +# +# Media drivers +# +# CONFIG_MEDIA_PCI_SUPPORT is not set + +# +# Supported MMC/SDIO adapters +# + +# +# Media ancillary drivers (tuners, sensors, i2c, spi, frontends) +# + +# +# Customise DVB Frontends +# + +# +# Tools to develop new frontends +# + +# +# Graphics support +# +# CONFIG_AGP is not set +CONFIG_VGA_ARB=y +CONFIG_VGA_ARB_MAX_GPUS=16 +# CONFIG_VGA_SWITCHEROO is not set +CONFIG_DRM=y +# CONFIG_DRM_DP_AUX_CHARDEV is not set +# CONFIG_DRM_DEBUG_MM is not set +CONFIG_DRM_KMS_HELPER=y +CONFIG_DRM_KMS_FB_HELPER=y +CONFIG_DRM_FBDEV_EMULATION=y +CONFIG_DRM_FBDEV_OVERALLOC=100 +# CONFIG_DRM_LOAD_EDID_FIRMWARE is not set + +# +# I2C encoder or helper chips +# +# CONFIG_DRM_I2C_CH7006 is not set +# CONFIG_DRM_I2C_SIL164 is not set +# CONFIG_DRM_I2C_NXP_TDA998X is not set +# CONFIG_DRM_RADEON is not set +# CONFIG_DRM_AMDGPU is not set + +# +# ACP (Audio CoProcessor) Configuration +# + +# +# AMD Library routines +# +# CONFIG_CHASH is not set +# CONFIG_DRM_NOUVEAU is not set +# CONFIG_DRM_I915 is not set +# CONFIG_DRM_VGEM is not set +# CONFIG_DRM_VMWGFX is not set +# CONFIG_DRM_GMA500 is not set +# CONFIG_DRM_UDL is not set +# CONFIG_DRM_AST is not set +# CONFIG_DRM_MGAG200 is not set +# CONFIG_DRM_CIRRUS_QEMU is not set +# CONFIG_DRM_RCAR_DW_HDMI is not set +# CONFIG_DRM_QXL is not set +# CONFIG_DRM_BOCHS is not set +# CONFIG_DRM_VIRTIO_GPU is not set +CONFIG_DRM_PANEL=y + +# +# Display Panels +# +# CONFIG_DRM_PANEL_LVDS is not set +# CONFIG_DRM_PANEL_SIMPLE is not set +# CONFIG_DRM_PANEL_ILITEK_IL9322 is not set +# CONFIG_DRM_PANEL_SAMSUNG_LD9040 is not set +# CONFIG_DRM_PANEL_LG_LG4573 is not set +# CONFIG_DRM_PANEL_SAMSUNG_S6E8AA0 is not set +# CONFIG_DRM_PANEL_SEIKO_43WVF1G is not set +# CONFIG_DRM_PANEL_SITRONIX_ST7789V is not set +CONFIG_DRM_BRIDGE=y +CONFIG_DRM_PANEL_BRIDGE=y + +# +# Display Interface Bridges +# +# CONFIG_DRM_ANALOGIX_ANX78XX is not set +# CONFIG_DRM_DUMB_VGA_DAC is not set +# CONFIG_DRM_LVDS_ENCODER is not set +# CONFIG_DRM_MEGACHIPS_STDPXXXX_GE_B850V3_FW is not set +# CONFIG_DRM_NXP_PTN3460 is not set +# CONFIG_DRM_PARADE_PS8622 is not set +# CONFIG_DRM_SII902X is not set +# CONFIG_DRM_SII9234 is not set +# CONFIG_DRM_TOSHIBA_TC358767 is not set +# CONFIG_DRM_TI_TFP410 is not set +# CONFIG_DRM_I2C_ADV7511 is not set +# CONFIG_DRM_ARCPGU is not set +# CONFIG_DRM_HISI_HIBMC is not set +# CONFIG_DRM_MXSFB is not set +# CONFIG_DRM_TINYDRM is not set +# CONFIG_DRM_LEGACY is not set +CONFIG_DRM_PANEL_ORIENTATION_QUIRKS=y +# CONFIG_DRM_LIB_RANDOM is not set + +# +# Frame buffer Devices +# +CONFIG_FB=y +# CONFIG_FIRMWARE_EDID is not set +CONFIG_FB_CMDLINE=y +CONFIG_FB_NOTIFY=y +# CONFIG_FB_DDC is not set +# CONFIG_FB_BOOT_VESA_SUPPORT is not set +CONFIG_FB_CFB_FILLRECT=y +CONFIG_FB_CFB_COPYAREA=y +CONFIG_FB_CFB_IMAGEBLIT=y +# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set +CONFIG_FB_SYS_FILLRECT=y +CONFIG_FB_SYS_COPYAREA=y +CONFIG_FB_SYS_IMAGEBLIT=y +# CONFIG_FB_PROVIDE_GET_FB_UNMAPPED_AREA is not set +# CONFIG_FB_FOREIGN_ENDIAN is not set +CONFIG_FB_SYS_FOPS=y +CONFIG_FB_DEFERRED_IO=y +# CONFIG_FB_SVGALIB is not set +# CONFIG_FB_MACMODES is not set +# CONFIG_FB_BACKLIGHT is not set +# CONFIG_FB_MODE_HELPERS is not set +# CONFIG_FB_TILEBLITTING is not set + +# +# Frame buffer hardware drivers +# +# CONFIG_FB_CIRRUS is not set +# CONFIG_FB_PM2 is not set +# CONFIG_FB_CYBER2000 is not set +# CONFIG_FB_ARC is not set +# CONFIG_FB_ASILIANT is not set +# CONFIG_FB_IMSTT is not set +# CONFIG_FB_VGA16 is not set +# CONFIG_FB_VESA is not set +# CONFIG_FB_N411 is not set +# CONFIG_FB_HGA is not set +# CONFIG_FB_OPENCORES is not set +# CONFIG_FB_S1D13XXX is not set +# CONFIG_FB_NVIDIA is not set +# CONFIG_FB_RIVA is not set +# CONFIG_FB_I740 is not set +# CONFIG_FB_LE80578 is not set +# CONFIG_FB_MATROX is not set +# CONFIG_FB_RADEON is not set +# CONFIG_FB_ATY128 is not set +# CONFIG_FB_ATY is not set +# CONFIG_FB_S3 is not set +# CONFIG_FB_SAVAGE is not set +# CONFIG_FB_SIS is not set +# CONFIG_FB_VIA is not set +# CONFIG_FB_NEOMAGIC is not set +# CONFIG_FB_KYRO is not set +# CONFIG_FB_3DFX is not set +# CONFIG_FB_VOODOO1 is not set +# CONFIG_FB_VT8623 is not set +# CONFIG_FB_TRIDENT is not set +# CONFIG_FB_ARK is not set +# CONFIG_FB_PM3 is not set +# CONFIG_FB_CARMINE is not set +# CONFIG_FB_GEODE is not set +# CONFIG_FB_SM501 is not set +# CONFIG_FB_IBM_GXT4500 is not set +# CONFIG_FB_VIRTUAL is not set +# CONFIG_FB_METRONOME is not set +# CONFIG_FB_MB862XX is not set +# CONFIG_FB_BROADSHEET is not set +# CONFIG_FB_AUO_K190X is not set +# CONFIG_FB_SIMPLE is not set +# CONFIG_FB_SSD1307 is not set +# CONFIG_FB_SM712 is not set +CONFIG_BACKLIGHT_LCD_SUPPORT=y +CONFIG_LCD_CLASS_DEVICE=y +# CONFIG_LCD_L4F00242T03 is not set +# CONFIG_LCD_LMS283GF05 is not set +# CONFIG_LCD_LTV350QV is not set +# CONFIG_LCD_ILI922X is not set +# CONFIG_LCD_ILI9320 is not set +# CONFIG_LCD_TDO24M is not set +# CONFIG_LCD_VGG2432A4 is not set +# CONFIG_LCD_PLATFORM is not set +# CONFIG_LCD_S6E63M0 is not set +# CONFIG_LCD_LD9040 is not set +# CONFIG_LCD_AMS369FG06 is not set +# CONFIG_LCD_LMS501KF03 is not set +# CONFIG_LCD_HX8357 is not set +CONFIG_BACKLIGHT_CLASS_DEVICE=y +CONFIG_BACKLIGHT_GENERIC=y +# CONFIG_BACKLIGHT_PWM is not set +# CONFIG_BACKLIGHT_APPLE is not set +# CONFIG_BACKLIGHT_PM8941_WLED is not set +# CONFIG_BACKLIGHT_SAHARA is not set +# CONFIG_BACKLIGHT_ADP8860 is not set +# CONFIG_BACKLIGHT_ADP8870 is not set +# CONFIG_BACKLIGHT_LM3630A is not set +# CONFIG_BACKLIGHT_LM3639 is not set +# CONFIG_BACKLIGHT_LP855X is not set +# CONFIG_BACKLIGHT_GPIO is not set +# CONFIG_BACKLIGHT_LV5207LP is not set +# CONFIG_BACKLIGHT_BD6107 is not set +# CONFIG_BACKLIGHT_ARCXCNN is not set +# CONFIG_VGASTATE is not set +CONFIG_HDMI=y + +# +# Console display driver support +# +CONFIG_VGA_CONSOLE=y +# CONFIG_VGACON_SOFT_SCROLLBACK is not set +CONFIG_DUMMY_CONSOLE=y +CONFIG_DUMMY_CONSOLE_COLUMNS=80 +CONFIG_DUMMY_CONSOLE_ROWS=25 +CONFIG_FRAMEBUFFER_CONSOLE=y +CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y +# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set +# CONFIG_LOGO is not set +CONFIG_SOUND=y +# CONFIG_SOUND_OSS_CORE is not set +CONFIG_SND=y +CONFIG_SND_TIMER=y +CONFIG_SND_PCM=y +CONFIG_SND_COMPRESS_OFFLOAD=y +CONFIG_SND_JACK=y +CONFIG_SND_JACK_INPUT_DEV=y +# CONFIG_SND_OSSEMUL is not set +CONFIG_SND_PCM_TIMER=y +# CONFIG_SND_HRTIMER is not set +# CONFIG_SND_DYNAMIC_MINORS is not set +CONFIG_SND_SUPPORT_OLD_API=y +CONFIG_SND_PROC_FS=y +CONFIG_SND_VERBOSE_PROCFS=y +# CONFIG_SND_VERBOSE_PRINTK is not set +# CONFIG_SND_DEBUG is not set +CONFIG_SND_DMA_SGBUF=y +# CONFIG_SND_SEQUENCER is not set +# CONFIG_SND_OPL3_LIB_SEQ is not set +# CONFIG_SND_OPL4_LIB_SEQ is not set +CONFIG_SND_DRIVERS=y +# CONFIG_SND_PCSP is not set +# CONFIG_SND_DUMMY is not set +# CONFIG_SND_ALOOP is not set +# CONFIG_SND_MTPAV is not set +# CONFIG_SND_MTS64 is not set +# CONFIG_SND_SERIAL_U16550 is not set +# CONFIG_SND_MPU401 is not set +# CONFIG_SND_PORTMAN2X4 is not set +CONFIG_SND_PCI=y +# CONFIG_SND_AD1889 is not set +# CONFIG_SND_ALS300 is not set +# CONFIG_SND_ALS4000 is not set +# CONFIG_SND_ALI5451 is not set +# CONFIG_SND_ASIHPI is not set +# CONFIG_SND_ATIIXP is not set +# CONFIG_SND_ATIIXP_MODEM is not set +# CONFIG_SND_AU8810 is not set +# CONFIG_SND_AU8820 is not set +# CONFIG_SND_AU8830 is not set +# CONFIG_SND_AW2 is not set +# CONFIG_SND_AZT3328 is not set +# CONFIG_SND_BT87X is not set +# CONFIG_SND_CA0106 is not set +# CONFIG_SND_CMIPCI is not set +# CONFIG_SND_OXYGEN is not set +# CONFIG_SND_CS4281 is not set +# CONFIG_SND_CS46XX is not set +# CONFIG_SND_CS5530 is not set +# CONFIG_SND_CS5535AUDIO is not set +# CONFIG_SND_CTXFI is not set +# CONFIG_SND_DARLA20 is not set +# CONFIG_SND_GINA20 is not set +# CONFIG_SND_LAYLA20 is not set +# CONFIG_SND_DARLA24 is not set +# CONFIG_SND_GINA24 is not set +# CONFIG_SND_LAYLA24 is not set +# CONFIG_SND_MONA is not set +# CONFIG_SND_MIA is not set +# CONFIG_SND_ECHO3G is not set +# CONFIG_SND_INDIGO is not set +# CONFIG_SND_INDIGOIO is not set +# CONFIG_SND_INDIGODJ is not set +# CONFIG_SND_INDIGOIOX is not set +# CONFIG_SND_INDIGODJX is not set +# CONFIG_SND_EMU10K1 is not set +# CONFIG_SND_EMU10K1_SEQ is not set +# CONFIG_SND_EMU10K1X is not set +# CONFIG_SND_ENS1370 is not set +# CONFIG_SND_ENS1371 is not set +# CONFIG_SND_ES1938 is not set +# CONFIG_SND_ES1968 is not set +# CONFIG_SND_FM801 is not set +# CONFIG_SND_HDSP is not set +# CONFIG_SND_HDSPM is not set +# CONFIG_SND_ICE1712 is not set +# CONFIG_SND_ICE1724 is not set +# CONFIG_SND_INTEL8X0 is not set +# CONFIG_SND_INTEL8X0M is not set +# CONFIG_SND_KORG1212 is not set +# CONFIG_SND_LOLA is not set +# CONFIG_SND_LX6464ES is not set +# CONFIG_SND_MAESTRO3 is not set +# CONFIG_SND_MIXART is not set +# CONFIG_SND_NM256 is not set +# CONFIG_SND_PCXHR is not set +# CONFIG_SND_RIPTIDE is not set +# CONFIG_SND_RME32 is not set +# CONFIG_SND_RME96 is not set +# CONFIG_SND_RME9652 is not set +# CONFIG_SND_SE6X is not set +# CONFIG_SND_SIS7019 is not set +# CONFIG_SND_SONICVIBES is not set +# CONFIG_SND_TRIDENT is not set +# CONFIG_SND_VIA82XX is not set +# CONFIG_SND_VIA82XX_MODEM is not set +# CONFIG_SND_VIRTUOSO is not set +# CONFIG_SND_VX222 is not set +# CONFIG_SND_YMFPCI is not set + +# +# HD-Audio +# +# CONFIG_SND_HDA_INTEL is not set +CONFIG_SND_HDA_PREALLOC_SIZE=64 +CONFIG_SND_SPI=y +CONFIG_SND_FIREWIRE=y +# CONFIG_SND_DICE is not set +# CONFIG_SND_OXFW is not set +# CONFIG_SND_ISIGHT is not set +# CONFIG_SND_FIREWORKS is not set +# CONFIG_SND_BEBOB is not set +# CONFIG_SND_FIREWIRE_DIGI00X is not set +# CONFIG_SND_FIREWIRE_TASCAM is not set +# CONFIG_SND_FIREWIRE_MOTU is not set +# CONFIG_SND_FIREFACE is not set +CONFIG_SND_PCMCIA=y +# CONFIG_SND_VXPOCKET is not set +# CONFIG_SND_PDAUDIOCF is not set +CONFIG_SND_SOC=y +CONFIG_SND_SOC_COMPRESS=y +CONFIG_SND_SOC_ACPI=y +# CONFIG_SND_SOC_AMD_ACP is not set +# CONFIG_SND_ATMEL_SOC is not set +# CONFIG_SND_DESIGNWARE_I2S is not set + +# +# SoC Audio for Freescale CPUs +# + +# +# Common SoC Audio options for Freescale CPUs: +# +# CONFIG_SND_SOC_FSL_ASRC is not set +# CONFIG_SND_SOC_FSL_SAI is not set +CONFIG_SND_SOC_FSL_SSI=y +# CONFIG_SND_SOC_FSL_SPDIF is not set +# CONFIG_SND_SOC_FSL_ESAI is not set +CONFIG_SND_SOC_IMX_AUDMUX=y +# CONFIG_SND_I2S_HI6210_I2S is not set +# CONFIG_SND_SOC_IMG is not set +CONFIG_SND_SOC_INTEL_SST_TOPLEVEL=y +CONFIG_SND_SST_IPC=y +CONFIG_SND_SST_IPC_ACPI=y +# CONFIG_SND_SOC_INTEL_HASWELL is not set +# CONFIG_SND_SOC_INTEL_BAYTRAIL is not set +CONFIG_SND_SST_ATOM_HIFI2_PLATFORM=y +# CONFIG_SND_SST_ATOM_HIFI2_PLATFORM_PCI is not set +CONFIG_SND_SST_ATOM_HIFI2_PLATFORM_ACPI=y +# CONFIG_SND_SOC_INTEL_SKYLAKE is not set +CONFIG_SND_SOC_ACPI_INTEL_MATCH=y +CONFIG_SND_SOC_INTEL_MACH=y + +# +# STMicroelectronics STM32 SOC audio support +# +# CONFIG_SND_SOC_XTFPGA_I2S is not set +# CONFIG_ZX_TDM is not set +CONFIG_SND_SOC_I2C_AND_SPI=y + +# +# CODEC drivers +# +# CONFIG_SND_SOC_AC97_CODEC is not set +# CONFIG_SND_SOC_ADAU1701 is not set +# CONFIG_SND_SOC_ADAU1761_I2C is not set +# CONFIG_SND_SOC_ADAU1761_SPI is not set +# CONFIG_SND_SOC_ADAU7002 is not set +# CONFIG_SND_SOC_AK4104 is not set +# CONFIG_SND_SOC_AK4554 is not set +# CONFIG_SND_SOC_AK4613 is not set +# CONFIG_SND_SOC_AK4642 is not set +# CONFIG_SND_SOC_AK5386 is not set +# CONFIG_SND_SOC_ALC5623 is not set +# CONFIG_SND_SOC_BT_SCO is not set +# CONFIG_SND_SOC_CS35L32 is not set +# CONFIG_SND_SOC_CS35L33 is not set +# CONFIG_SND_SOC_CS35L34 is not set +# CONFIG_SND_SOC_CS35L35 is not set +# CONFIG_SND_SOC_CS42L42 is not set +# CONFIG_SND_SOC_CS42L51_I2C is not set +# CONFIG_SND_SOC_CS42L52 is not set +# CONFIG_SND_SOC_CS42L56 is not set +# CONFIG_SND_SOC_CS42L73 is not set +# CONFIG_SND_SOC_CS4265 is not set +# CONFIG_SND_SOC_CS4270 is not set +# CONFIG_SND_SOC_CS4271_I2C is not set +# CONFIG_SND_SOC_CS4271_SPI is not set +# CONFIG_SND_SOC_CS42XX8_I2C is not set +# CONFIG_SND_SOC_CS43130 is not set +# CONFIG_SND_SOC_CS4349 is not set +# CONFIG_SND_SOC_CS53L30 is not set +# CONFIG_SND_SOC_DIO2125 is not set +# CONFIG_SND_SOC_ES7134 is not set +# CONFIG_SND_SOC_ES8316 is not set +# CONFIG_SND_SOC_ES8328_I2C is not set +# CONFIG_SND_SOC_ES8328_SPI is not set +# CONFIG_SND_SOC_GTM601 is not set +# CONFIG_SND_SOC_INNO_RK3036 is not set +# CONFIG_SND_SOC_MAX98504 is not set +# CONFIG_SND_SOC_MAX98927 is not set +# CONFIG_SND_SOC_MAX98373 is not set +# CONFIG_SND_SOC_MAX9860 is not set +# CONFIG_SND_SOC_MSM8916_WCD_ANALOG is not set +# CONFIG_SND_SOC_MSM8916_WCD_DIGITAL is not set +# CONFIG_SND_SOC_PCM1681 is not set +# CONFIG_SND_SOC_PCM179X_I2C is not set +# CONFIG_SND_SOC_PCM179X_SPI is not set +# CONFIG_SND_SOC_PCM186X_I2C is not set +# CONFIG_SND_SOC_PCM186X_SPI is not set +# CONFIG_SND_SOC_PCM3168A_I2C is not set +# CONFIG_SND_SOC_PCM3168A_SPI is not set +# CONFIG_SND_SOC_PCM512x_I2C is not set +# CONFIG_SND_SOC_PCM512x_SPI is not set +# CONFIG_SND_SOC_RT5514_SPI_BUILTIN is not set +# CONFIG_SND_SOC_RT5616 is not set +# CONFIG_SND_SOC_RT5631 is not set +# CONFIG_SND_SOC_RT5677_SPI is not set +CONFIG_SND_SOC_SGTL5000=y +# CONFIG_SND_SOC_SIRF_AUDIO_CODEC is not set +# CONFIG_SND_SOC_SPDIF is not set +# CONFIG_SND_SOC_SSM2602_SPI is not set +# CONFIG_SND_SOC_SSM2602_I2C is not set +# CONFIG_SND_SOC_SSM4567 is not set +# CONFIG_SND_SOC_STA32X is not set +# CONFIG_SND_SOC_STA350 is not set +# CONFIG_SND_SOC_STI_SAS is not set +# CONFIG_SND_SOC_TAS2552 is not set +# CONFIG_SND_SOC_TAS5086 is not set +# CONFIG_SND_SOC_TAS571X is not set +# CONFIG_SND_SOC_TAS5720 is not set +# CONFIG_SND_SOC_TAS6424 is not set +# CONFIG_SND_SOC_TFA9879 is not set +# CONFIG_SND_SOC_TLV320AIC23_I2C is not set +# CONFIG_SND_SOC_TLV320AIC23_SPI is not set +# CONFIG_SND_SOC_TLV320AIC31XX is not set +# CONFIG_SND_SOC_TLV320AIC32X4_I2C is not set +# CONFIG_SND_SOC_TLV320AIC32X4_SPI is not set +# CONFIG_SND_SOC_TLV320AIC3X is not set +# CONFIG_SND_SOC_TS3A227E is not set +# CONFIG_SND_SOC_TSCS42XX is not set +# CONFIG_SND_SOC_WM8510 is not set +# CONFIG_SND_SOC_WM8523 is not set +# CONFIG_SND_SOC_WM8524 is not set +# CONFIG_SND_SOC_WM8580 is not set +# CONFIG_SND_SOC_WM8711 is not set +# CONFIG_SND_SOC_WM8728 is not set +# CONFIG_SND_SOC_WM8731 is not set +# CONFIG_SND_SOC_WM8737 is not set +# CONFIG_SND_SOC_WM8741 is not set +# CONFIG_SND_SOC_WM8750 is not set +# CONFIG_SND_SOC_WM8753 is not set +# CONFIG_SND_SOC_WM8770 is not set +# CONFIG_SND_SOC_WM8776 is not set +# CONFIG_SND_SOC_WM8804_I2C is not set +# CONFIG_SND_SOC_WM8804_SPI is not set +# CONFIG_SND_SOC_WM8903 is not set +# CONFIG_SND_SOC_WM8960 is not set +# CONFIG_SND_SOC_WM8962 is not set +# CONFIG_SND_SOC_WM8974 is not set +# CONFIG_SND_SOC_WM8978 is not set +# CONFIG_SND_SOC_WM8985 is not set +# CONFIG_SND_SOC_ZX_AUD96P22 is not set +# CONFIG_SND_SOC_NAU8540 is not set +# CONFIG_SND_SOC_NAU8810 is not set +# CONFIG_SND_SOC_NAU8824 is not set +# CONFIG_SND_SOC_TPA6130A2 is not set +# CONFIG_SND_SIMPLE_CARD is not set +# CONFIG_SND_SIMPLE_SCU_CARD is not set +# CONFIG_SND_AUDIO_GRAPH_CARD is not set +# CONFIG_SND_AUDIO_GRAPH_SCU_CARD is not set +CONFIG_SND_X86=y + +# +# HID support +# +CONFIG_HID=y +# CONFIG_HID_BATTERY_STRENGTH is not set +# CONFIG_HIDRAW is not set +# CONFIG_UHID is not set +CONFIG_HID_GENERIC=y + +# +# Special HID drivers +# +CONFIG_HID_A4TECH=y +# CONFIG_HID_ACRUX is not set +CONFIG_HID_APPLE=y +# CONFIG_HID_AUREAL is not set +CONFIG_HID_BELKIN=y +CONFIG_HID_CHERRY=y +CONFIG_HID_CHICONY=y +# CONFIG_HID_PRODIKEYS is not set +# CONFIG_HID_CMEDIA is not set +CONFIG_HID_CYPRESS=y +# CONFIG_HID_DRAGONRISE is not set +# CONFIG_HID_EMS_FF is not set +# CONFIG_HID_ELECOM is not set +CONFIG_HID_EZKEY=y +# CONFIG_HID_GEMBIRD is not set +# CONFIG_HID_GFRM is not set +# CONFIG_HID_KEYTOUCH is not set +# CONFIG_HID_KYE is not set +# CONFIG_HID_WALTOP is not set +# CONFIG_HID_GYRATION is not set +# CONFIG_HID_ICADE is not set +CONFIG_HID_ITE=y +# CONFIG_HID_JABRA is not set +# CONFIG_HID_TWINHAN is not set +CONFIG_HID_KENSINGTON=y +# CONFIG_HID_LCPOWER is not set +# CONFIG_HID_LENOVO is not set +CONFIG_HID_LOGITECH=y +# CONFIG_HID_LOGITECH_HIDPP is not set +# CONFIG_LOGITECH_FF is not set +# CONFIG_LOGIRUMBLEPAD2_FF is not set +# CONFIG_LOGIG940_FF is not set +# CONFIG_LOGIWHEELS_FF is not set +# CONFIG_HID_MAGICMOUSE is not set +# CONFIG_HID_MAYFLASH is not set +CONFIG_HID_MICROSOFT=y +CONFIG_HID_MONTEREY=y +# CONFIG_HID_MULTITOUCH is not set +# CONFIG_HID_NTI is not set +# CONFIG_HID_ORTEK is not set +# CONFIG_HID_PANTHERLORD is not set +# CONFIG_HID_PETALYNX is not set +# CONFIG_HID_PICOLCD is not set +# CONFIG_HID_PLANTRONICS is not set +# CONFIG_HID_PRIMAX is not set +# CONFIG_HID_SAITEK is not set +# CONFIG_HID_SAMSUNG is not set +# CONFIG_HID_SPEEDLINK is not set +# CONFIG_HID_STEELSERIES is not set +# CONFIG_HID_SUNPLUS is not set +# CONFIG_HID_RMI is not set +# CONFIG_HID_GREENASIA is not set +# CONFIG_HID_SMARTJOYPLUS is not set +# CONFIG_HID_TIVO is not set +# CONFIG_HID_TOPSEED is not set +# CONFIG_HID_THRUSTMASTER is not set +# CONFIG_HID_UDRAW_PS3 is not set +# CONFIG_HID_XINMO is not set +# CONFIG_HID_ZEROPLUS is not set +# CONFIG_HID_ZYDACRON is not set +# CONFIG_HID_SENSOR_HUB is not set +# CONFIG_HID_ALPS is not set + +# +# I2C HID support +# +# CONFIG_I2C_HID is not set +CONFIG_USB_OHCI_LITTLE_ENDIAN=y +CONFIG_USB_SUPPORT=y +CONFIG_USB_COMMON=y +CONFIG_USB_ARCH_HAS_HCD=y +# CONFIG_USB is not set +CONFIG_USB_PCI=y +CONFIG_USB_MUSB_HDRC=y +CONFIG_USB_MUSB_GADGET=y + +# +# Platform Glue Layer +# + +# +# MUSB DMA mode +# +# CONFIG_MUSB_PIO_ONLY is not set +# CONFIG_USB_DWC3 is not set +# CONFIG_USB_DWC2 is not set +# CONFIG_USB_CHIPIDEA is not set +# CONFIG_USB_ISP1760 is not set + +# +# USB port drivers +# + +# +# USB Physical Layer drivers +# +CONFIG_USB_PHY=y +CONFIG_NOP_USB_XCEIV=y +# CONFIG_USB_GPIO_VBUS is not set +# CONFIG_USB_ISP1301 is not set +CONFIG_USB_GADGET=y +# CONFIG_USB_GADGET_DEBUG_FILES is not set +CONFIG_USB_GADGET_VBUS_DRAW=2 +CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=2 + +# +# USB Peripheral Controller +# +# CONFIG_USB_FUSB300 is not set +# CONFIG_USB_FOTG210_UDC is not set +# CONFIG_USB_GR_UDC is not set +# CONFIG_USB_R8A66597 is not set +# CONFIG_USB_PXA27X is not set +# CONFIG_USB_MV_UDC is not set +# CONFIG_USB_MV_U3D is not set +# CONFIG_USB_SNP_UDC_PLAT is not set +# CONFIG_USB_M66592 is not set +# CONFIG_USB_BDC_UDC is not set +# CONFIG_USB_AMD5536UDC is not set +# CONFIG_USB_NET2272 is not set +# CONFIG_USB_NET2280 is not set +# CONFIG_USB_GOKU is not set +# CONFIG_USB_EG20T is not set +# CONFIG_USB_GADGET_XILINX is not set +# CONFIG_USB_CONFIGFS is not set +# CONFIG_TYPEC is not set +# CONFIG_USB_ULPI_BUS is not set +CONFIG_UWB=y +# CONFIG_UWB_WHCI is not set +CONFIG_MMC=y +CONFIG_PWRSEQ_EMMC=y +CONFIG_PWRSEQ_SIMPLE=y +CONFIG_MMC_BLOCK=y +CONFIG_MMC_BLOCK_MINORS=8 +# CONFIG_SDIO_UART is not set +# CONFIG_MMC_TEST is not set + +# +# MMC/SD/SDIO Host Controller Drivers +# +# CONFIG_MMC_DEBUG is not set +CONFIG_MMC_SDHCI=y +# CONFIG_MMC_SDHCI_PCI is not set +# CONFIG_MMC_SDHCI_ACPI is not set +CONFIG_MMC_SDHCI_PLTFM=y +# CONFIG_MMC_SDHCI_OF_ARASAN is not set +# CONFIG_MMC_SDHCI_OF_AT91 is not set +# CONFIG_MMC_SDHCI_CADENCE is not set +# CONFIG_MMC_SDHCI_F_SDH30 is not set +# CONFIG_MMC_WBSD is not set +# CONFIG_MMC_TIFM_SD is not set +# CONFIG_MMC_SPI is not set +# CONFIG_MMC_SDRICOH_CS is not set +# CONFIG_MMC_CB710 is not set +# CONFIG_MMC_VIA_SDMMC is not set +# CONFIG_MMC_USDHI6ROL0 is not set +# CONFIG_MMC_REALTEK_PCI is not set +# CONFIG_MMC_CQHCI is not set +# CONFIG_MMC_TOSHIBA_PCI is not set +# CONFIG_MMC_MTK is not set +# CONFIG_MMC_SDHCI_XENON is not set +# CONFIG_MMC_SDHCI_OMAP is not set +CONFIG_MEMSTICK=y +# CONFIG_MEMSTICK_DEBUG is not set + +# +# MemoryStick drivers +# +# CONFIG_MEMSTICK_UNSAFE_RESUME is not set +# CONFIG_MSPRO_BLOCK is not set +# CONFIG_MS_BLOCK is not set + +# +# MemoryStick Host Controller Drivers +# +# CONFIG_MEMSTICK_TIFM_MS is not set +# CONFIG_MEMSTICK_JMICRON_38X is not set +# CONFIG_MEMSTICK_R592 is not set +# CONFIG_MEMSTICK_REALTEK_PCI is not set +CONFIG_NEW_LEDS=y +# CONFIG_LEDS_CLASS is not set + +# +# LED drivers +# + +# +# LED driver for blink(1) USB RGB LED is under Special HID drivers (HID_THINGM) +# + +# +# LED Triggers +# +# CONFIG_ACCESSIBILITY is not set +# CONFIG_INFINIBAND is not set +CONFIG_EDAC_ATOMIC_SCRUB=y +CONFIG_EDAC_SUPPORT=y +# CONFIG_EDAC is not set +CONFIG_RTC_LIB=y +CONFIG_RTC_MC146818_LIB=y +CONFIG_RTC_CLASS=y +CONFIG_RTC_HCTOSYS=y +CONFIG_RTC_HCTOSYS_DEVICE="rtc0" +CONFIG_RTC_SYSTOHC=y +CONFIG_RTC_SYSTOHC_DEVICE="rtc0" +# CONFIG_RTC_DEBUG is not set +CONFIG_RTC_NVMEM=y + +# +# RTC interfaces +# +CONFIG_RTC_INTF_SYSFS=y +CONFIG_RTC_INTF_PROC=y +CONFIG_RTC_INTF_DEV=y +# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set +# CONFIG_RTC_DRV_TEST is not set + +# +# I2C RTC drivers +# +# CONFIG_RTC_DRV_ABB5ZES3 is not set +# CONFIG_RTC_DRV_ABX80X is not set +# CONFIG_RTC_DRV_DS1307 is not set +# CONFIG_RTC_DRV_DS1374 is not set +# CONFIG_RTC_DRV_DS1672 is not set +# CONFIG_RTC_DRV_HYM8563 is not set +# CONFIG_RTC_DRV_MAX6900 is not set +# CONFIG_RTC_DRV_RS5C372 is not set +# CONFIG_RTC_DRV_ISL1208 is not set +# CONFIG_RTC_DRV_ISL12022 is not set +# CONFIG_RTC_DRV_X1205 is not set +# CONFIG_RTC_DRV_PCF8523 is not set +# CONFIG_RTC_DRV_PCF85063 is not set +# CONFIG_RTC_DRV_PCF85363 is not set +# CONFIG_RTC_DRV_PCF8563 is not set +# CONFIG_RTC_DRV_PCF8583 is not set +# CONFIG_RTC_DRV_M41T80 is not set +# CONFIG_RTC_DRV_BQ32K is not set +# CONFIG_RTC_DRV_S35390A is not set +# CONFIG_RTC_DRV_FM3130 is not set +# CONFIG_RTC_DRV_RX8010 is not set +# CONFIG_RTC_DRV_RX8581 is not set +# CONFIG_RTC_DRV_RX8025 is not set +# CONFIG_RTC_DRV_EM3027 is not set +# CONFIG_RTC_DRV_RV8803 is not set + +# +# SPI RTC drivers +# +# CONFIG_RTC_DRV_M41T93 is not set +# CONFIG_RTC_DRV_M41T94 is not set +# CONFIG_RTC_DRV_DS1302 is not set +# CONFIG_RTC_DRV_DS1305 is not set +# CONFIG_RTC_DRV_DS1343 is not set +# CONFIG_RTC_DRV_DS1347 is not set +# CONFIG_RTC_DRV_DS1390 is not set +# CONFIG_RTC_DRV_MAX6916 is not set +# CONFIG_RTC_DRV_R9701 is not set +# CONFIG_RTC_DRV_RX4581 is not set +# CONFIG_RTC_DRV_RX6110 is not set +# CONFIG_RTC_DRV_RS5C348 is not set +# CONFIG_RTC_DRV_MAX6902 is not set +# CONFIG_RTC_DRV_PCF2123 is not set +# CONFIG_RTC_DRV_MCP795 is not set +CONFIG_RTC_I2C_AND_SPI=y + +# +# SPI and I2C RTC drivers +# +# CONFIG_RTC_DRV_DS3232 is not set +# CONFIG_RTC_DRV_PCF2127 is not set +# CONFIG_RTC_DRV_RV3029C2 is not set + +# +# Platform RTC drivers +# +CONFIG_RTC_DRV_CMOS=y +# CONFIG_RTC_DRV_DS1286 is not set +# CONFIG_RTC_DRV_DS1511 is not set +# CONFIG_RTC_DRV_DS1553 is not set +# CONFIG_RTC_DRV_DS1685_FAMILY is not set +# CONFIG_RTC_DRV_DS1742 is not set +# CONFIG_RTC_DRV_DS2404 is not set +# CONFIG_RTC_DRV_STK17TA8 is not set +# CONFIG_RTC_DRV_M48T86 is not set +# CONFIG_RTC_DRV_M48T35 is not set +# CONFIG_RTC_DRV_M48T59 is not set +# CONFIG_RTC_DRV_MSM6242 is not set +# CONFIG_RTC_DRV_BQ4802 is not set +# CONFIG_RTC_DRV_RP5C01 is not set +# CONFIG_RTC_DRV_V3020 is not set +# CONFIG_RTC_DRV_ZYNQMP is not set + +# +# on-CPU RTC drivers +# +# CONFIG_RTC_DRV_FTRTC010 is not set +# CONFIG_RTC_DRV_SNVS is not set +# CONFIG_RTC_DRV_MT6397 is not set +# CONFIG_RTC_DRV_R7301 is not set + +# +# HID Sensor RTC drivers +# +CONFIG_DMADEVICES=y +# CONFIG_DMADEVICES_DEBUG is not set + +# +# DMA Devices +# +CONFIG_DMA_ENGINE=y +CONFIG_DMA_VIRTUAL_CHANNELS=y +CONFIG_DMA_ACPI=y +CONFIG_DMA_OF=y +# CONFIG_ALTERA_MSGDMA is not set +# CONFIG_FSL_EDMA is not set +# CONFIG_INTEL_IDMA64 is not set +# CONFIG_PCH_DMA is not set +# CONFIG_QCOM_HIDMA_MGMT is not set +# CONFIG_QCOM_HIDMA is not set +CONFIG_DW_DMAC_CORE=y +# CONFIG_DW_DMAC is not set +# CONFIG_DW_DMAC_PCI is not set +CONFIG_HSU_DMA=y + +# +# DMA Clients +# +# CONFIG_ASYNC_TX_DMA is not set +# CONFIG_DMATEST is not set + +# +# DMABUF options +# +CONFIG_SYNC_FILE=y +CONFIG_AUXDISPLAY=y +# CONFIG_HD44780 is not set +# CONFIG_IMG_ASCII_LCD is not set +# CONFIG_HT16K33 is not set +# CONFIG_PANEL is not set +# CONFIG_UIO is not set +# CONFIG_VIRT_DRIVERS is not set +CONFIG_VIRTIO=y +CONFIG_VIRTIO_MENU=y +# CONFIG_VIRTIO_PCI is not set +# CONFIG_VIRTIO_BALLOON is not set +# CONFIG_VIRTIO_INPUT is not set +CONFIG_VIRTIO_MMIO=y +# CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES is not set + +# +# Microsoft Hyper-V guest support +# +# CONFIG_HYPERV_TSCPAGE is not set +CONFIG_STAGING=y +# CONFIG_IRDA is not set +# CONFIG_IPX is not set +# CONFIG_NCP_FS is not set +# CONFIG_COMEDI is not set +# CONFIG_RTLLIB is not set +# CONFIG_RTS5208 is not set + +# +# IIO staging drivers +# + +# +# Accelerometers +# +# CONFIG_ADIS16201 is not set +# CONFIG_ADIS16203 is not set +# CONFIG_ADIS16209 is not set +# CONFIG_ADIS16240 is not set + +# +# Analog to digital converters +# +# CONFIG_AD7606 is not set +# CONFIG_AD7780 is not set +# CONFIG_AD7816 is not set +# CONFIG_AD7192 is not set +# CONFIG_AD7280 is not set + +# +# Analog digital bi-direction converters +# +# CONFIG_ADT7316 is not set + +# +# Capacitance to digital converters +# +# CONFIG_AD7150 is not set +# CONFIG_AD7152 is not set +# CONFIG_AD7746 is not set + +# +# Direct Digital Synthesis +# +# CONFIG_AD9832 is not set +# CONFIG_AD9834 is not set + +# +# Digital gyroscope sensors +# +# CONFIG_ADIS16060 is not set + +# +# Network Analyzer, Impedance Converters +# +# CONFIG_AD5933 is not set + +# +# Light sensors +# +# CONFIG_TSL2x7x is not set + +# +# Active energy metering IC +# +# CONFIG_ADE7753 is not set +# CONFIG_ADE7754 is not set +# CONFIG_ADE7758 is not set +# CONFIG_ADE7759 is not set +# CONFIG_ADE7854 is not set + +# +# Resolver to digital converters +# +# CONFIG_AD2S90 is not set +# CONFIG_AD2S1200 is not set +# CONFIG_AD2S1210 is not set + +# +# Triggers - standalone +# +# CONFIG_FB_SM750 is not set +# CONFIG_FB_XGI is not set + +# +# Speakup console speech +# +# CONFIG_SPEAKUP is not set +# CONFIG_STAGING_MEDIA is not set + +# +# Android +# +# CONFIG_STAGING_BOARD is not set +# CONFIG_FIREWIRE_SERIAL is not set +# CONFIG_MTD_SPINAND_MT29F is not set +# CONFIG_LNET is not set +# CONFIG_DGNC is not set +# CONFIG_GS_FPGABOOT is not set +# CONFIG_UNISYSSPAR is not set +# CONFIG_COMMON_CLK_XLNX_CLKWZRD is not set +# CONFIG_FB_TFT is not set +# CONFIG_MOST is not set +# CONFIG_KS7010 is not set +# CONFIG_GREYBUS is not set +# CONFIG_CRYPTO_DEV_CCREE is not set + +# +# USB Power Delivery and Type-C drivers +# +# CONFIG_DRM_VBOXVIDEO is not set +# CONFIG_PI433 is not set +CONFIG_X86_PLATFORM_DEVICES=y +# CONFIG_ACER_WIRELESS is not set +# CONFIG_ACERHDF is not set +# CONFIG_ASUS_LAPTOP is not set +# CONFIG_DELL_SMBIOS is not set +# CONFIG_DELL_SMO8800 is not set +# CONFIG_FUJITSU_LAPTOP is not set +# CONFIG_FUJITSU_TABLET is not set +# CONFIG_GPD_POCKET_FAN is not set +# CONFIG_HP_ACCEL is not set +# CONFIG_HP_WIRELESS is not set +# CONFIG_PANASONIC_LAPTOP is not set +# CONFIG_THINKPAD_ACPI is not set +# CONFIG_SENSORS_HDAPS is not set +# CONFIG_INTEL_MENLOW is not set +# CONFIG_EEEPC_LAPTOP is not set +# CONFIG_ASUS_WIRELESS is not set +# CONFIG_ACPI_WMI is not set +# CONFIG_TOPSTAR_LAPTOP is not set +# CONFIG_TOSHIBA_BT_RFKILL is not set +# CONFIG_TOSHIBA_HAPS is not set +# CONFIG_ACPI_CMPC is not set +# CONFIG_INTEL_CHT_INT33FE is not set +# CONFIG_INTEL_INT0002_VGPIO is not set +# CONFIG_INTEL_HID_EVENT is not set +# CONFIG_INTEL_VBTN is not set +# CONFIG_INTEL_IPS is not set +# CONFIG_INTEL_PMC_CORE is not set +# CONFIG_IBM_RTL is not set +# CONFIG_SAMSUNG_LAPTOP is not set +# CONFIG_SAMSUNG_Q10 is not set +# CONFIG_APPLE_GMUX is not set +# CONFIG_INTEL_RST is not set +# CONFIG_INTEL_SMARTCONNECT is not set +# CONFIG_PVPANIC is not set +# CONFIG_INTEL_PMC_IPC is not set +# CONFIG_SURFACE_PRO3_BUTTON is not set +# CONFIG_INTEL_PUNIT_IPC is not set +# CONFIG_MLX_PLATFORM is not set +CONFIG_PMC_ATOM=y +# CONFIG_CHROME_PLATFORMS is not set +# CONFIG_MELLANOX_PLATFORM is not set +CONFIG_CLKDEV_LOOKUP=y +CONFIG_HAVE_CLK_PREPARE=y +CONFIG_COMMON_CLK=y + +# +# Common Clock Framework +# +# CONFIG_CLK_HSDK is not set +# CONFIG_COMMON_CLK_SI5351 is not set +# CONFIG_COMMON_CLK_SI514 is not set +# CONFIG_COMMON_CLK_SI570 is not set +# CONFIG_COMMON_CLK_CDCE706 is not set +# CONFIG_COMMON_CLK_CDCE925 is not set +# CONFIG_COMMON_CLK_CS2000_CP is not set +# CONFIG_COMMON_CLK_NXP is not set +# CONFIG_COMMON_CLK_PWM is not set +# CONFIG_COMMON_CLK_PXA is not set +# CONFIG_COMMON_CLK_PIC32 is not set +# CONFIG_COMMON_CLK_VC5 is not set +CONFIG_HWSPINLOCK=y + +# +# Clock Source drivers +# +CONFIG_CLKSRC_I8253=y +CONFIG_CLKEVT_I8253=y +CONFIG_I8253_LOCK=y +CONFIG_CLKBLD_I8253=y +# CONFIG_SH_TIMER_CMT is not set +# CONFIG_SH_TIMER_MTU2 is not set +# CONFIG_SH_TIMER_TMU is not set +# CONFIG_EM_TIMER_STI is not set +CONFIG_MAILBOX=y +# CONFIG_PLATFORM_MHU is not set +CONFIG_PCC=y +# CONFIG_ALTERA_MBOX is not set +# CONFIG_MAILBOX_TEST is not set +CONFIG_IOMMU_SUPPORT=y + +# +# Generic IOMMU Pagetable Support +# + +# +# Remoteproc drivers +# +# CONFIG_REMOTEPROC is not set + +# +# Rpmsg drivers +# +CONFIG_RPMSG=y +# CONFIG_RPMSG_CHAR is not set +# CONFIG_RPMSG_QCOM_GLINK_RPM is not set +CONFIG_RPMSG_VIRTIO=y +# CONFIG_SOUNDWIRE is not set + +# +# SOC (System On Chip) specific Drivers +# + +# +# Amlogic SoC drivers +# + +# +# Broadcom SoC drivers +# + +# +# i.MX SoC drivers +# + +# +# Qualcomm SoC drivers +# +# CONFIG_SUNXI_SRAM is not set +CONFIG_SOC_TI=y + +# +# Xilinx SoC drivers +# +# CONFIG_XILINX_VCU is not set +CONFIG_PM_DEVFREQ=y + +# +# DEVFREQ Governors +# +CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND=y +# CONFIG_DEVFREQ_GOV_PERFORMANCE is not set +# CONFIG_DEVFREQ_GOV_POWERSAVE is not set +# CONFIG_DEVFREQ_GOV_USERSPACE is not set +# CONFIG_DEVFREQ_GOV_PASSIVE is not set + +# +# DEVFREQ Drivers +# +# CONFIG_PM_DEVFREQ_EVENT is not set +CONFIG_EXTCON=y + +# +# Extcon Device Drivers +# +# CONFIG_EXTCON_ADC_JACK is not set +# CONFIG_EXTCON_GPIO is not set +# CONFIG_EXTCON_INTEL_INT3496 is not set +# CONFIG_EXTCON_MAX3355 is not set +# CONFIG_EXTCON_RT8973A is not set +# CONFIG_EXTCON_SM5502 is not set +# CONFIG_EXTCON_USB_GPIO is not set +CONFIG_MEMORY=y +CONFIG_IIO=y +# CONFIG_IIO_BUFFER is not set +# CONFIG_IIO_CONFIGFS is not set +# CONFIG_IIO_TRIGGER is not set +# CONFIG_IIO_SW_DEVICE is not set +# CONFIG_IIO_SW_TRIGGER is not set + +# +# Accelerometers +# +# CONFIG_ADXL345_I2C is not set +# CONFIG_ADXL345_SPI is not set +# CONFIG_BMA180 is not set +# CONFIG_BMA220 is not set +# CONFIG_BMC150_ACCEL is not set +# CONFIG_DA280 is not set +# CONFIG_DA311 is not set +# CONFIG_DMARD06 is not set +# CONFIG_DMARD09 is not set +# CONFIG_DMARD10 is not set +# CONFIG_IIO_CROS_EC_ACCEL_LEGACY is not set +# CONFIG_IIO_ST_ACCEL_3AXIS is not set +# CONFIG_KXSD9 is not set +# CONFIG_KXCJK1013 is not set +# CONFIG_MC3230 is not set +# CONFIG_MMA7455_I2C is not set +# CONFIG_MMA7455_SPI is not set +# CONFIG_MMA7660 is not set +# CONFIG_MMA8452 is not set +# CONFIG_MMA9551 is not set +# CONFIG_MMA9553 is not set +# CONFIG_MXC4005 is not set +# CONFIG_MXC6255 is not set +# CONFIG_SCA3000 is not set +# CONFIG_STK8312 is not set +# CONFIG_STK8BA50 is not set + +# +# Analog to digital converters +# +# CONFIG_AD7266 is not set +# CONFIG_AD7291 is not set +# CONFIG_AD7298 is not set +# CONFIG_AD7476 is not set +# CONFIG_AD7766 is not set +# CONFIG_AD7791 is not set +# CONFIG_AD7793 is not set +# CONFIG_AD7887 is not set +# CONFIG_AD7923 is not set +# CONFIG_AD799X is not set +# CONFIG_CC10001_ADC is not set +# CONFIG_ENVELOPE_DETECTOR is not set +# CONFIG_HI8435 is not set +# CONFIG_HX711 is not set +# CONFIG_INA2XX_ADC is not set +# CONFIG_LTC2471 is not set +# CONFIG_LTC2485 is not set +# CONFIG_LTC2497 is not set +# CONFIG_MAX1027 is not set +# CONFIG_MAX11100 is not set +# CONFIG_MAX1118 is not set +# CONFIG_MAX1363 is not set +# CONFIG_MAX9611 is not set +# CONFIG_MCP320X is not set +# CONFIG_MCP3422 is not set +# CONFIG_MEN_Z188_ADC is not set +# CONFIG_NAU7802 is not set +# CONFIG_QCOM_SPMI_IADC is not set +# CONFIG_QCOM_SPMI_VADC is not set +# CONFIG_SD_ADC_MODULATOR is not set +# CONFIG_TI_ADC081C is not set +# CONFIG_TI_ADC0832 is not set +# CONFIG_TI_ADC084S021 is not set +# CONFIG_TI_ADC12138 is not set +# CONFIG_TI_ADC108S102 is not set +# CONFIG_TI_ADC128S052 is not set +# CONFIG_TI_ADC161S626 is not set +# CONFIG_TI_ADS1015 is not set +# CONFIG_TI_ADS7950 is not set +# CONFIG_TI_ADS8688 is not set +# CONFIG_TI_AM335X_ADC is not set +# CONFIG_TI_TLC4541 is not set +# CONFIG_VF610_ADC is not set + +# +# Amplifiers +# +# CONFIG_AD8366 is not set + +# +# Chemical Sensors +# +# CONFIG_ATLAS_PH_SENSOR is not set +# CONFIG_CCS811 is not set +# CONFIG_IAQCORE is not set +# CONFIG_VZ89X is not set + +# +# Hid Sensor IIO Common +# + +# +# SSP Sensor Common +# +# CONFIG_IIO_SSP_SENSORHUB is not set + +# +# Counters +# + +# +# Digital to analog converters +# +# CONFIG_AD5064 is not set +# CONFIG_AD5360 is not set +# CONFIG_AD5380 is not set +# CONFIG_AD5421 is not set +# CONFIG_AD5446 is not set +# CONFIG_AD5449 is not set +# CONFIG_AD5592R is not set +# CONFIG_AD5593R is not set +# CONFIG_AD5504 is not set +# CONFIG_AD5624R_SPI is not set +# CONFIG_LTC2632 is not set +# CONFIG_AD5686 is not set +# CONFIG_AD5755 is not set +# CONFIG_AD5761 is not set +# CONFIG_AD5764 is not set +# CONFIG_AD5791 is not set +# CONFIG_AD7303 is not set +# CONFIG_AD8801 is not set +# CONFIG_DPOT_DAC is not set +# CONFIG_DS4424 is not set +# CONFIG_M62332 is not set +# CONFIG_MAX517 is not set +# CONFIG_MAX5821 is not set +# CONFIG_MCP4725 is not set +# CONFIG_MCP4922 is not set +# CONFIG_TI_DAC082S085 is not set +# CONFIG_VF610_DAC is not set + +# +# IIO dummy driver +# + +# +# Frequency Synthesizers DDS/PLL +# + +# +# Clock Generator/Distribution +# +# CONFIG_AD9523 is not set + +# +# Phase-Locked Loop (PLL) frequency synthesizers +# +# CONFIG_ADF4350 is not set + +# +# Digital gyroscope sensors +# +# CONFIG_ADIS16080 is not set +# CONFIG_ADIS16130 is not set +# CONFIG_ADIS16136 is not set +# CONFIG_ADIS16260 is not set +# CONFIG_ADXRS450 is not set +# CONFIG_BMG160 is not set +# CONFIG_MPU3050_I2C is not set +# CONFIG_IIO_ST_GYRO_3AXIS is not set +# CONFIG_ITG3200 is not set + +# +# Health Sensors +# + +# +# Heart Rate Monitors +# +# CONFIG_AFE4403 is not set +# CONFIG_AFE4404 is not set +# CONFIG_MAX30100 is not set +# CONFIG_MAX30102 is not set + +# +# Humidity sensors +# +# CONFIG_AM2315 is not set +# CONFIG_DHT11 is not set +# CONFIG_HDC100X is not set +# CONFIG_HTS221 is not set +# CONFIG_HTU21 is not set +# CONFIG_SI7005 is not set +# CONFIG_SI7020 is not set + +# +# Inertial measurement units +# +# CONFIG_ADIS16400 is not set +# CONFIG_ADIS16480 is not set +# CONFIG_BMI160_I2C is not set +# CONFIG_BMI160_SPI is not set +# CONFIG_KMX61 is not set +# CONFIG_INV_MPU6050_SPI is not set +# CONFIG_IIO_ST_LSM6DSX is not set + +# +# Light sensors +# +# CONFIG_ACPI_ALS is not set +# CONFIG_ADJD_S311 is not set +# CONFIG_AL3320A is not set +# CONFIG_APDS9300 is not set +# CONFIG_APDS9960 is not set +# CONFIG_BH1750 is not set +# CONFIG_BH1780 is not set +# CONFIG_CM32181 is not set +# CONFIG_CM3232 is not set +# CONFIG_CM3323 is not set +# CONFIG_CM3605 is not set +# CONFIG_CM36651 is not set +# CONFIG_GP2AP020A00F is not set +# CONFIG_SENSORS_ISL29018 is not set +# CONFIG_SENSORS_ISL29028 is not set +# CONFIG_ISL29125 is not set +# CONFIG_JSA1212 is not set +# CONFIG_RPR0521 is not set +# CONFIG_LTR501 is not set +# CONFIG_MAX44000 is not set +# CONFIG_OPT3001 is not set +# CONFIG_PA12203001 is not set +# CONFIG_SI1145 is not set +# CONFIG_STK3310 is not set +# CONFIG_ST_UVIS25 is not set +# CONFIG_TCS3414 is not set +# CONFIG_TCS3472 is not set +# CONFIG_SENSORS_TSL2563 is not set +# CONFIG_TSL2583 is not set +# CONFIG_TSL4531 is not set +# CONFIG_US5182D is not set +# CONFIG_VCNL4000 is not set +# CONFIG_VEML6070 is not set +# CONFIG_VL6180 is not set +# CONFIG_ZOPT2201 is not set + +# +# Magnetometer sensors +# +# CONFIG_AK8974 is not set +# CONFIG_AK8975 is not set +# CONFIG_AK09911 is not set +# CONFIG_BMC150_MAGN_I2C is not set +# CONFIG_BMC150_MAGN_SPI is not set +# CONFIG_MAG3110 is not set +# CONFIG_MMC35240 is not set +# CONFIG_IIO_ST_MAGN_3AXIS is not set +# CONFIG_SENSORS_HMC5843_I2C is not set +# CONFIG_SENSORS_HMC5843_SPI is not set + +# +# Multiplexers +# +# CONFIG_IIO_MUX is not set + +# +# Inclinometer sensors +# + +# +# Digital potentiometers +# +# CONFIG_DS1803 is not set +# CONFIG_MAX5481 is not set +# CONFIG_MAX5487 is not set +# CONFIG_MCP4131 is not set +# CONFIG_MCP4531 is not set +# CONFIG_TPL0102 is not set + +# +# Digital potentiostats +# +# CONFIG_LMP91000 is not set + +# +# Pressure sensors +# +# CONFIG_ABP060MG is not set +# CONFIG_BMP280 is not set +# CONFIG_HP03 is not set +# CONFIG_MPL115_I2C is not set +# CONFIG_MPL115_SPI is not set +# CONFIG_MPL3115 is not set +# CONFIG_MS5611 is not set +# CONFIG_MS5637 is not set +# CONFIG_IIO_ST_PRESS is not set +# CONFIG_T5403 is not set +# CONFIG_HP206C is not set +# CONFIG_ZPA2326 is not set + +# +# Lightning sensors +# +# CONFIG_AS3935 is not set + +# +# Proximity and distance sensors +# +# CONFIG_LIDAR_LITE_V2 is not set +# CONFIG_RFD77402 is not set +# CONFIG_SRF04 is not set +# CONFIG_SX9500 is not set +# CONFIG_SRF08 is not set + +# +# Temperature sensors +# +# CONFIG_MAXIM_THERMOCOUPLE is not set +# CONFIG_MLX90614 is not set +# CONFIG_TMP006 is not set +# CONFIG_TMP007 is not set +# CONFIG_TSYS01 is not set +# CONFIG_TSYS02D is not set +CONFIG_NTB=y +# CONFIG_NTB_IDT is not set +# CONFIG_NTB_SWITCHTEC is not set +# CONFIG_NTB_PINGPONG is not set +# CONFIG_NTB_TOOL is not set +# CONFIG_NTB_PERF is not set +# CONFIG_NTB_TRANSPORT is not set +CONFIG_VME_BUS=y + +# +# VME Bridge Drivers +# +# CONFIG_VME_CA91CX42 is not set +# CONFIG_VME_TSI148 is not set +# CONFIG_VME_FAKE is not set + +# +# VME Board Drivers +# +# CONFIG_VMIVME_7805 is not set + +# +# VME Device Drivers +# +# CONFIG_VME_USER is not set +CONFIG_PWM=y +CONFIG_PWM_SYSFS=y +# CONFIG_PWM_FSL_FTM is not set +# CONFIG_PWM_LPSS_PCI is not set +# CONFIG_PWM_LPSS_PLATFORM is not set +# CONFIG_PWM_PCA9685 is not set + +# +# IRQ chip support +# +CONFIG_IRQCHIP=y +CONFIG_ARM_GIC_MAX_NR=1 +# CONFIG_ARM_GIC_V3_ITS is not set +CONFIG_IPACK_BUS=y +# CONFIG_BOARD_TPCI200 is not set +# CONFIG_SERIAL_IPOCTAL is not set +CONFIG_RESET_CONTROLLER=y +# CONFIG_RESET_ATH79 is not set +# CONFIG_RESET_AXS10X is not set +# CONFIG_RESET_BERLIN is not set +# CONFIG_RESET_IMX7 is not set +# CONFIG_RESET_LANTIQ is not set +# CONFIG_RESET_LPC18XX is not set +# CONFIG_RESET_MESON is not set +# CONFIG_RESET_PISTACHIO is not set +# CONFIG_RESET_SIMPLE is not set +# CONFIG_RESET_SUNXI is not set +# CONFIG_RESET_TI_SYSCON is not set +# CONFIG_RESET_ZYNQ is not set +# CONFIG_RESET_TEGRA_BPMP is not set +CONFIG_FMC=y +# CONFIG_FMC_FAKEDEV is not set +# CONFIG_FMC_TRIVIAL is not set +# CONFIG_FMC_WRITE_EEPROM is not set +# CONFIG_FMC_CHARDEV is not set + +# +# PHY Subsystem +# +CONFIG_GENERIC_PHY=y +CONFIG_BCM_KONA_USB2_PHY=y +CONFIG_PHY_PXA_28NM_HSIC=y +CONFIG_PHY_PXA_28NM_USB2=y +# CONFIG_PHY_CPCAP_USB is not set +CONFIG_POWERCAP=y +# CONFIG_INTEL_RAPL is not set +CONFIG_MCB=y +# CONFIG_MCB_PCI is not set +# CONFIG_MCB_LPC is not set + +# +# Performance monitor support +# +CONFIG_RAS=y +# CONFIG_THUNDERBOLT is not set + +# +# Android +# +# CONFIG_ANDROID is not set +CONFIG_DAX=y +CONFIG_NVMEM=y +# CONFIG_STM is not set +# CONFIG_INTEL_TH is not set +# CONFIG_FPGA is not set +# CONFIG_FSI is not set +CONFIG_PM_OPP=y +# CONFIG_SIOX is not set +# CONFIG_SLIMBUS is not set + +# +# Firmware Drivers +# +# CONFIG_EDD is not set +CONFIG_FIRMWARE_MEMMAP=y +# CONFIG_DELL_RBU is not set +# CONFIG_DCDBAS is not set +CONFIG_DMIID=y +# CONFIG_DMI_SYSFS is not set +CONFIG_DMI_SCAN_MACHINE_NON_EFI_FALLBACK=y +# CONFIG_ISCSI_IBFT_FIND is not set +# CONFIG_FW_CFG_SYSFS is not set +# CONFIG_GOOGLE_FIRMWARE is not set +# CONFIG_EFI_DEV_PATH_PARSER is not set + +# +# Tegra firmware driver +# + +# +# File systems +# +CONFIG_DCACHE_WORD_ACCESS=y +CONFIG_FS_IOMAP=y +CONFIG_EXT2_FS=m +CONFIG_EXT2_FS_XATTR=y +CONFIG_EXT2_FS_POSIX_ACL=y +CONFIG_EXT2_FS_SECURITY=y +CONFIG_EXT3_FS=y +CONFIG_EXT3_FS_POSIX_ACL=y +CONFIG_EXT3_FS_SECURITY=y +CONFIG_EXT4_FS=y +CONFIG_EXT4_FS_POSIX_ACL=y +CONFIG_EXT4_FS_SECURITY=y +# CONFIG_EXT4_ENCRYPTION is not set +# CONFIG_EXT4_DEBUG is not set +CONFIG_JBD2=y +# CONFIG_JBD2_DEBUG is not set +CONFIG_FS_MBCACHE=y +CONFIG_REISERFS_FS=y +# CONFIG_REISERFS_CHECK is not set +# CONFIG_REISERFS_PROC_INFO is not set +# CONFIG_REISERFS_FS_XATTR is not set +CONFIG_JFS_FS=y +# CONFIG_JFS_POSIX_ACL is not set +# CONFIG_JFS_SECURITY is not set +# CONFIG_JFS_DEBUG is not set +# CONFIG_JFS_STATISTICS is not set +# CONFIG_XFS_FS is not set +# CONFIG_GFS2_FS is not set +# CONFIG_OCFS2_FS is not set +# CONFIG_BTRFS_FS is not set +# CONFIG_NILFS2_FS is not set +CONFIG_F2FS_FS=y +CONFIG_F2FS_FS_XATTR=y +CONFIG_F2FS_FS_POSIX_ACL=y +# CONFIG_F2FS_FS_SECURITY is not set +# CONFIG_F2FS_CHECK_FS is not set +# CONFIG_F2FS_FS_ENCRYPTION is not set +# CONFIG_F2FS_FAULT_INJECTION is not set +# CONFIG_FS_DAX is not set +CONFIG_FS_POSIX_ACL=y +CONFIG_EXPORTFS=y +CONFIG_EXPORTFS_BLOCK_OPS=y +CONFIG_FILE_LOCKING=y +CONFIG_MANDATORY_FILE_LOCKING=y +# CONFIG_FS_ENCRYPTION is not set +CONFIG_FSNOTIFY=y +CONFIG_DNOTIFY=y +CONFIG_INOTIFY_USER=y +CONFIG_FANOTIFY=y +# CONFIG_QUOTA is not set +# CONFIG_QUOTACTL is not set +CONFIG_AUTOFS4_FS=y +# CONFIG_FUSE_FS is not set +CONFIG_OVERLAY_FS=m +# CONFIG_OVERLAY_FS_REDIRECT_DIR is not set +CONFIG_OVERLAY_FS_REDIRECT_ALWAYS_FOLLOW=y +# CONFIG_OVERLAY_FS_INDEX is not set + +# +# Caches +# +# CONFIG_FSCACHE is not set + +# +# CD-ROM/DVD Filesystems +# +CONFIG_ISO9660_FS=m +# CONFIG_JOLIET is not set +# CONFIG_ZISOFS is not set +CONFIG_UDF_FS=m +CONFIG_UDF_NLS=y + +# +# DOS/FAT/NT Filesystems +# +# CONFIG_MSDOS_FS is not set +# CONFIG_VFAT_FS is not set +# CONFIG_NTFS_FS is not set + +# +# Pseudo filesystems +# +CONFIG_PROC_FS=y +CONFIG_PROC_KCORE=y +CONFIG_PROC_SYSCTL=y +CONFIG_PROC_PAGE_MONITOR=y +CONFIG_PROC_CHILDREN=y +CONFIG_KERNFS=y +CONFIG_SYSFS=y +CONFIG_TMPFS=y +# CONFIG_TMPFS_POSIX_ACL is not set +CONFIG_TMPFS_XATTR=y +# CONFIG_HUGETLBFS is not set +# CONFIG_HUGETLB_PAGE is not set +CONFIG_CONFIGFS_FS=y +CONFIG_MISC_FILESYSTEMS=y +# CONFIG_ORANGEFS_FS is not set +CONFIG_ADFS_FS=y +# CONFIG_ADFS_FS_RW is not set +CONFIG_AFFS_FS=y +CONFIG_HFS_FS=y +CONFIG_HFSPLUS_FS=y +# CONFIG_HFSPLUS_FS_POSIX_ACL is not set +CONFIG_BEFS_FS=y +# CONFIG_BEFS_DEBUG is not set +CONFIG_BFS_FS=y +CONFIG_EFS_FS=y +# CONFIG_JFFS2_FS is not set +CONFIG_CRAMFS=y +CONFIG_CRAMFS_BLOCKDEV=y +# CONFIG_CRAMFS_MTD is not set +CONFIG_SQUASHFS=y +CONFIG_SQUASHFS_FILE_CACHE=y +# CONFIG_SQUASHFS_FILE_DIRECT is not set +CONFIG_SQUASHFS_DECOMP_SINGLE=y +# CONFIG_SQUASHFS_DECOMP_MULTI is not set +# CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU is not set +# CONFIG_SQUASHFS_XATTR is not set +CONFIG_SQUASHFS_ZLIB=y +# CONFIG_SQUASHFS_LZ4 is not set +# CONFIG_SQUASHFS_LZO is not set +# CONFIG_SQUASHFS_XZ is not set +# CONFIG_SQUASHFS_ZSTD is not set +# CONFIG_SQUASHFS_4K_DEVBLK_SIZE is not set +# CONFIG_SQUASHFS_EMBEDDED is not set +CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3 +CONFIG_VXFS_FS=y +CONFIG_MINIX_FS=y +CONFIG_OMFS_FS=y +CONFIG_HPFS_FS=y +CONFIG_QNX4FS_FS=y +CONFIG_QNX6FS_FS=y +# CONFIG_QNX6FS_DEBUG is not set +CONFIG_ROMFS_FS=y +CONFIG_ROMFS_BACKED_BY_BLOCK=y +# CONFIG_ROMFS_BACKED_BY_MTD is not set +# CONFIG_ROMFS_BACKED_BY_BOTH is not set +CONFIG_ROMFS_ON_BLOCK=y +CONFIG_PSTORE=y +CONFIG_PSTORE_ZLIB_COMPRESS=y +# CONFIG_PSTORE_LZO_COMPRESS is not set +# CONFIG_PSTORE_LZ4_COMPRESS is not set +# CONFIG_PSTORE_CONSOLE is not set +# CONFIG_PSTORE_PMSG is not set +CONFIG_PSTORE_RAM=y +CONFIG_SYSV_FS=y +CONFIG_UFS_FS=y +# CONFIG_UFS_FS_WRITE is not set +# CONFIG_UFS_DEBUG is not set +CONFIG_NETWORK_FILESYSTEMS=y +# CONFIG_NFS_FS is not set +# CONFIG_NFSD is not set +# CONFIG_CEPH_FS is not set +# CONFIG_CIFS is not set +# CONFIG_CODA_FS is not set +# CONFIG_AFS_FS is not set +CONFIG_NLS=y +CONFIG_NLS_DEFAULT="iso8859-1" +# CONFIG_NLS_CODEPAGE_437 is not set +# CONFIG_NLS_CODEPAGE_737 is not set +# CONFIG_NLS_CODEPAGE_775 is not set +# CONFIG_NLS_CODEPAGE_850 is not set +# CONFIG_NLS_CODEPAGE_852 is not set +# CONFIG_NLS_CODEPAGE_855 is not set +# CONFIG_NLS_CODEPAGE_857 is not set +# CONFIG_NLS_CODEPAGE_860 is not set +# CONFIG_NLS_CODEPAGE_861 is not set +# CONFIG_NLS_CODEPAGE_862 is not set +# CONFIG_NLS_CODEPAGE_863 is not set +# CONFIG_NLS_CODEPAGE_864 is not set +# CONFIG_NLS_CODEPAGE_865 is not set +# CONFIG_NLS_CODEPAGE_866 is not set +# CONFIG_NLS_CODEPAGE_869 is not set +# CONFIG_NLS_CODEPAGE_936 is not set +# CONFIG_NLS_CODEPAGE_950 is not set +# CONFIG_NLS_CODEPAGE_932 is not set +# CONFIG_NLS_CODEPAGE_949 is not set +# CONFIG_NLS_CODEPAGE_874 is not set +# CONFIG_NLS_ISO8859_8 is not set +# CONFIG_NLS_CODEPAGE_1250 is not set +# CONFIG_NLS_CODEPAGE_1251 is not set +# CONFIG_NLS_ASCII is not set +# CONFIG_NLS_ISO8859_1 is not set +# CONFIG_NLS_ISO8859_2 is not set +# CONFIG_NLS_ISO8859_3 is not set +# CONFIG_NLS_ISO8859_4 is not set +# CONFIG_NLS_ISO8859_5 is not set +# CONFIG_NLS_ISO8859_6 is not set +# CONFIG_NLS_ISO8859_7 is not set +# CONFIG_NLS_ISO8859_9 is not set +# CONFIG_NLS_ISO8859_13 is not set +# CONFIG_NLS_ISO8859_14 is not set +# CONFIG_NLS_ISO8859_15 is not set +# CONFIG_NLS_KOI8_R is not set +# CONFIG_NLS_KOI8_U is not set +# CONFIG_NLS_MAC_ROMAN is not set +# CONFIG_NLS_MAC_CELTIC is not set +# CONFIG_NLS_MAC_CENTEURO is not set +# CONFIG_NLS_MAC_CROATIAN is not set +# CONFIG_NLS_MAC_CYRILLIC is not set +# CONFIG_NLS_MAC_GAELIC is not set +# CONFIG_NLS_MAC_GREEK is not set +# CONFIG_NLS_MAC_ICELAND is not set +# CONFIG_NLS_MAC_INUIT is not set +# CONFIG_NLS_MAC_ROMANIAN is not set +# CONFIG_NLS_MAC_TURKISH is not set +CONFIG_NLS_UTF8=y +# CONFIG_DLM is not set + +# +# Kernel hacking +# +CONFIG_TRACE_IRQFLAGS_SUPPORT=y + +# +# printk and dmesg options +# +# CONFIG_PRINTK_TIME is not set +CONFIG_CONSOLE_LOGLEVEL_DEFAULT=7 +CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4 + +# +# Compile-time checks and compiler options +# +CONFIG_ENABLE_WARN_DEPRECATED=y +CONFIG_ENABLE_MUST_CHECK=y +CONFIG_FRAME_WARN=1024 +# CONFIG_STRIP_ASM_SYMS is not set +CONFIG_UNUSED_SYMBOLS=y +# CONFIG_DEBUG_FS is not set +# CONFIG_HEADERS_CHECK is not set +# CONFIG_DEBUG_SECTION_MISMATCH is not set +CONFIG_SECTION_MISMATCH_WARN_ONLY=y +CONFIG_FRAME_POINTER=y +# CONFIG_MAGIC_SYSRQ is not set +# CONFIG_DEBUG_KERNEL is not set + +# +# Memory Debugging +# +# CONFIG_PAGE_EXTENSION is not set +# CONFIG_PAGE_POISONING is not set +# CONFIG_DEBUG_RODATA_TEST is not set +# CONFIG_SLUB_DEBUG_ON is not set +# CONFIG_SLUB_STATS is not set +CONFIG_HAVE_DEBUG_KMEMLEAK=y +CONFIG_ARCH_HAS_DEBUG_VIRTUAL=y +CONFIG_DEBUG_MEMORY_INIT=y +CONFIG_HAVE_DEBUG_STACKOVERFLOW=y + +# +# Debug Lockups and Hangs +# +# CONFIG_PANIC_ON_OOPS is not set +CONFIG_PANIC_ON_OOPS_VALUE=0 +CONFIG_PANIC_TIMEOUT=0 +# CONFIG_SCHED_INFO is not set +# CONFIG_DEBUG_TIMEKEEPING is not set + +# +# Lock Debugging (spinlocks, mutexes, etc...) +# +# CONFIG_WW_MUTEX_SELFTEST is not set +# CONFIG_STACKTRACE is not set +# CONFIG_WARN_ALL_UNSEEDED_RANDOM is not set +CONFIG_DEBUG_BUGVERBOSE=y + +# +# RCU Debugging +# +# CONFIG_PROVE_RCU is not set +# CONFIG_TORTURE_TEST is not set +CONFIG_RCU_CPU_STALL_TIMEOUT=21 +CONFIG_USER_STACKTRACE_SUPPORT=y +CONFIG_HAVE_FUNCTION_TRACER=y +CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y +CONFIG_HAVE_DYNAMIC_FTRACE=y +CONFIG_HAVE_DYNAMIC_FTRACE_WITH_REGS=y +CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y +CONFIG_HAVE_SYSCALL_TRACEPOINTS=y +CONFIG_HAVE_C_RECORDMCOUNT=y +CONFIG_TRACING_SUPPORT=y +# CONFIG_FTRACE is not set +# CONFIG_PROVIDE_OHCI1394_DMA_INIT is not set +# CONFIG_DMA_API_DEBUG is not set +CONFIG_RUNTIME_TESTING_MENU=y +# CONFIG_TEST_LIST_SORT is not set +# CONFIG_TEST_SORT is not set +# CONFIG_ATOMIC64_SELFTEST is not set +# CONFIG_TEST_HEXDUMP is not set +# CONFIG_TEST_STRING_HELPERS is not set +# CONFIG_TEST_KSTRTOX is not set +# CONFIG_TEST_PRINTF is not set +# CONFIG_TEST_BITMAP is not set +# CONFIG_TEST_UUID is not set +# CONFIG_TEST_RHASHTABLE is not set +# CONFIG_TEST_HASH is not set +# CONFIG_TEST_LKM is not set +# CONFIG_TEST_USER_COPY is not set +# CONFIG_TEST_BPF is not set +# CONFIG_FIND_BIT_BENCHMARK is not set +# CONFIG_TEST_FIRMWARE is not set +# CONFIG_TEST_SYSCTL is not set +# CONFIG_TEST_UDELAY is not set +# CONFIG_TEST_STATIC_KEYS is not set +# CONFIG_TEST_KMOD is not set +# CONFIG_MEMTEST is not set +# CONFIG_BUG_ON_DATA_CORRUPTION is not set +# CONFIG_SAMPLES is not set +CONFIG_HAVE_ARCH_KGDB=y +CONFIG_ARCH_HAS_UBSAN_SANITIZE_ALL=y +# CONFIG_ARCH_WANTS_UBSAN_NO_NULL is not set +# CONFIG_UBSAN is not set +CONFIG_ARCH_HAS_DEVMEM_IS_ALLOWED=y +CONFIG_STRICT_DEVMEM=y +# CONFIG_IO_STRICT_DEVMEM is not set +CONFIG_X86_VERBOSE_BOOTUP=y +CONFIG_EARLY_PRINTK=y +# CONFIG_EARLY_PRINTK_DBGP is not set +# CONFIG_EARLY_PRINTK_USB_XDBC is not set +# CONFIG_X86_PTDUMP_CORE is not set +# CONFIG_DEBUG_WX is not set +CONFIG_DOUBLEFAULT=y +CONFIG_HAVE_MMIOTRACE_SUPPORT=y +CONFIG_IO_DELAY_TYPE_0X80=0 +CONFIG_IO_DELAY_TYPE_0XED=1 +CONFIG_IO_DELAY_TYPE_UDELAY=2 +CONFIG_IO_DELAY_TYPE_NONE=3 +CONFIG_IO_DELAY_0X80=y +# CONFIG_IO_DELAY_0XED is not set +# CONFIG_IO_DELAY_UDELAY is not set +# CONFIG_IO_DELAY_NONE is not set +CONFIG_DEFAULT_IO_DELAY_TYPE=0 +# CONFIG_OPTIMIZE_INLINING is not set +# CONFIG_PUNIT_ATOM_DEBUG is not set +CONFIG_UNWINDER_FRAME_POINTER=y + +# +# Security options +# +# CONFIG_KEYS is not set +# CONFIG_SECURITY_DMESG_RESTRICT is not set +# CONFIG_SECURITY is not set +# CONFIG_SECURITYFS is not set +CONFIG_HAVE_HARDENED_USERCOPY_ALLOCATOR=y +# CONFIG_HARDENED_USERCOPY is not set +# CONFIG_FORTIFY_SOURCE is not set +# CONFIG_STATIC_USERMODEHELPER is not set +CONFIG_DEFAULT_SECURITY_DAC=y +CONFIG_DEFAULT_SECURITY="" +CONFIG_CRYPTO=y + +# +# Crypto core or helper +# +CONFIG_CRYPTO_ALGAPI=y +CONFIG_CRYPTO_ALGAPI2=y +CONFIG_CRYPTO_AEAD=y +CONFIG_CRYPTO_AEAD2=y +CONFIG_CRYPTO_BLKCIPHER=y +CONFIG_CRYPTO_BLKCIPHER2=y +CONFIG_CRYPTO_HASH=y +CONFIG_CRYPTO_HASH2=y +CONFIG_CRYPTO_RNG=y +CONFIG_CRYPTO_RNG2=y +CONFIG_CRYPTO_RNG_DEFAULT=y +CONFIG_CRYPTO_AKCIPHER2=y +CONFIG_CRYPTO_KPP2=y +CONFIG_CRYPTO_ACOMP2=y +# CONFIG_CRYPTO_RSA is not set +# CONFIG_CRYPTO_DH is not set +# CONFIG_CRYPTO_ECDH is not set +CONFIG_CRYPTO_MANAGER=y +CONFIG_CRYPTO_MANAGER2=y +# CONFIG_CRYPTO_USER is not set +CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y +# CONFIG_CRYPTO_GF128MUL is not set +CONFIG_CRYPTO_NULL=y +CONFIG_CRYPTO_NULL2=y +# CONFIG_CRYPTO_PCRYPT is not set +CONFIG_CRYPTO_WORKQUEUE=y +# CONFIG_CRYPTO_CRYPTD is not set +# CONFIG_CRYPTO_MCRYPTD is not set +CONFIG_CRYPTO_AUTHENC=y +# CONFIG_CRYPTO_TEST is not set +CONFIG_CRYPTO_ENGINE=y + +# +# Authenticated Encryption with Associated Data +# +# CONFIG_CRYPTO_CCM is not set +# CONFIG_CRYPTO_GCM is not set +# CONFIG_CRYPTO_CHACHA20POLY1305 is not set +# CONFIG_CRYPTO_SEQIV is not set +CONFIG_CRYPTO_ECHAINIV=y + +# +# Block modes +# +# CONFIG_CRYPTO_CBC is not set +# CONFIG_CRYPTO_CTR is not set +# CONFIG_CRYPTO_CTS is not set +# CONFIG_CRYPTO_ECB is not set +# CONFIG_CRYPTO_LRW is not set +# CONFIG_CRYPTO_PCBC is not set +# CONFIG_CRYPTO_XTS is not set +# CONFIG_CRYPTO_KEYWRAP is not set + +# +# Hash modes +# +# CONFIG_CRYPTO_CMAC is not set +CONFIG_CRYPTO_HMAC=y +# CONFIG_CRYPTO_XCBC is not set +# CONFIG_CRYPTO_VMAC is not set + +# +# Digest +# +CONFIG_CRYPTO_CRC32C=y +# CONFIG_CRYPTO_CRC32C_INTEL is not set +CONFIG_CRYPTO_CRC32=y +# CONFIG_CRYPTO_CRC32_PCLMUL is not set +CONFIG_CRYPTO_CRCT10DIF=y +# CONFIG_CRYPTO_GHASH is not set +# CONFIG_CRYPTO_POLY1305 is not set +# CONFIG_CRYPTO_MD4 is not set +# CONFIG_CRYPTO_MD5 is not set +# CONFIG_CRYPTO_MICHAEL_MIC is not set +# CONFIG_CRYPTO_RMD128 is not set +# CONFIG_CRYPTO_RMD160 is not set +# CONFIG_CRYPTO_RMD256 is not set +# CONFIG_CRYPTO_RMD320 is not set +# CONFIG_CRYPTO_SHA1 is not set +CONFIG_CRYPTO_SHA256=y +# CONFIG_CRYPTO_SHA512 is not set +# CONFIG_CRYPTO_SHA3 is not set +# CONFIG_CRYPTO_SM3 is not set +# CONFIG_CRYPTO_TGR192 is not set +# CONFIG_CRYPTO_WP512 is not set + +# +# Ciphers +# +CONFIG_CRYPTO_AES=y +# CONFIG_CRYPTO_AES_TI is not set +# CONFIG_CRYPTO_AES_586 is not set +# CONFIG_CRYPTO_AES_NI_INTEL is not set +# CONFIG_CRYPTO_ANUBIS is not set +# CONFIG_CRYPTO_ARC4 is not set +# CONFIG_CRYPTO_BLOWFISH is not set +# CONFIG_CRYPTO_CAMELLIA is not set +# CONFIG_CRYPTO_CAST5 is not set +# CONFIG_CRYPTO_CAST6 is not set +# CONFIG_CRYPTO_DES is not set +# CONFIG_CRYPTO_FCRYPT is not set +# CONFIG_CRYPTO_KHAZAD is not set +# CONFIG_CRYPTO_SALSA20 is not set +# CONFIG_CRYPTO_SALSA20_586 is not set +# CONFIG_CRYPTO_CHACHA20 is not set +# CONFIG_CRYPTO_SEED is not set +# CONFIG_CRYPTO_SERPENT is not set +# CONFIG_CRYPTO_SERPENT_SSE2_586 is not set +# CONFIG_CRYPTO_TEA is not set +# CONFIG_CRYPTO_TWOFISH is not set +# CONFIG_CRYPTO_TWOFISH_586 is not set + +# +# Compression +# +# CONFIG_CRYPTO_DEFLATE is not set +# CONFIG_CRYPTO_LZO is not set +# CONFIG_CRYPTO_842 is not set +# CONFIG_CRYPTO_LZ4 is not set +# CONFIG_CRYPTO_LZ4HC is not set + +# +# Random Number Generation +# +# CONFIG_CRYPTO_ANSI_CPRNG is not set +CONFIG_CRYPTO_DRBG_MENU=y +CONFIG_CRYPTO_DRBG_HMAC=y +# CONFIG_CRYPTO_DRBG_HASH is not set +CONFIG_CRYPTO_DRBG=y +CONFIG_CRYPTO_JITTERENTROPY=y +# CONFIG_CRYPTO_USER_API_HASH is not set +# CONFIG_CRYPTO_USER_API_SKCIPHER is not set +# CONFIG_CRYPTO_USER_API_RNG is not set +# CONFIG_CRYPTO_USER_API_AEAD is not set +CONFIG_CRYPTO_HW=y +# CONFIG_CRYPTO_DEV_PADLOCK is not set +# CONFIG_CRYPTO_DEV_GEODE is not set +# CONFIG_CRYPTO_DEV_HIFN_795X is not set +# CONFIG_CRYPTO_DEV_FSL_CAAM_CRYPTO_API_DESC is not set +# CONFIG_CRYPTO_DEV_CCP is not set +# CONFIG_CRYPTO_DEV_QAT_DH895xCC is not set +# CONFIG_CRYPTO_DEV_QAT_C3XXX is not set +# CONFIG_CRYPTO_DEV_QAT_C62X is not set +# CONFIG_CRYPTO_DEV_QAT_DH895xCCVF is not set +# CONFIG_CRYPTO_DEV_QAT_C3XXXVF is not set +# CONFIG_CRYPTO_DEV_QAT_C62XVF is not set +CONFIG_CRYPTO_DEV_VIRTIO=y + +# +# Certificates for signature checking +# +CONFIG_HAVE_KVM=y +CONFIG_VIRTUALIZATION=y +# CONFIG_KVM is not set +# CONFIG_VHOST_NET is not set +# CONFIG_VHOST_SCSI is not set +# CONFIG_VHOST_CROSS_ENDIAN_LEGACY is not set +# CONFIG_BINARY_PRINTF is not set + +# +# Library routines +# +CONFIG_BITREVERSE=y +# CONFIG_HAVE_ARCH_BITREVERSE is not set +CONFIG_RATIONAL=y +CONFIG_GENERIC_STRNCPY_FROM_USER=y +CONFIG_GENERIC_STRNLEN_USER=y +CONFIG_GENERIC_NET_UTILS=y +CONFIG_GENERIC_FIND_FIRST_BIT=y +CONFIG_GENERIC_PCI_IOMAP=y +CONFIG_GENERIC_IOMAP=y +CONFIG_ARCH_HAS_FAST_MULTIPLIER=y +# CONFIG_CRC_CCITT is not set +CONFIG_CRC16=y +CONFIG_CRC_T10DIF=y +CONFIG_CRC_ITU_T=y +CONFIG_CRC32=y +# CONFIG_CRC32_SELFTEST is not set +CONFIG_CRC32_SLICEBY8=y +# CONFIG_CRC32_SLICEBY4 is not set +# CONFIG_CRC32_SARWATE is not set +# CONFIG_CRC32_BIT is not set +# CONFIG_CRC4 is not set +# CONFIG_CRC7 is not set +# CONFIG_LIBCRC32C is not set +# CONFIG_CRC8 is not set +# CONFIG_AUDIT_ARCH_COMPAT_GENERIC is not set +# CONFIG_RANDOM32_SELFTEST is not set +CONFIG_ZLIB_INFLATE=y +CONFIG_ZLIB_DEFLATE=y +CONFIG_LZO_COMPRESS=y +CONFIG_LZO_DECOMPRESS=y +CONFIG_LZ4_DECOMPRESS=y +CONFIG_XZ_DEC=y +CONFIG_XZ_DEC_X86=y +CONFIG_XZ_DEC_POWERPC=y +CONFIG_XZ_DEC_IA64=y +CONFIG_XZ_DEC_ARM=y +CONFIG_XZ_DEC_ARMTHUMB=y +CONFIG_XZ_DEC_SPARC=y +CONFIG_XZ_DEC_BCJ=y +# CONFIG_XZ_DEC_TEST is not set +CONFIG_DECOMPRESS_GZIP=y +CONFIG_DECOMPRESS_BZIP2=y +CONFIG_DECOMPRESS_LZMA=y +CONFIG_DECOMPRESS_XZ=y +CONFIG_DECOMPRESS_LZO=y +CONFIG_DECOMPRESS_LZ4=y +CONFIG_GENERIC_ALLOCATOR=y +CONFIG_REED_SOLOMON=y +CONFIG_REED_SOLOMON_ENC8=y +CONFIG_REED_SOLOMON_DEC8=y +CONFIG_HAS_IOMEM=y +CONFIG_HAS_IOPORT_MAP=y +CONFIG_HAS_DMA=y +CONFIG_SGL_ALLOC=y +# CONFIG_DMA_DIRECT_OPS is not set +# CONFIG_DMA_VIRT_OPS is not set +CONFIG_CHECK_SIGNATURE=y +CONFIG_CPU_RMAP=y +CONFIG_DQL=y +CONFIG_GLOB=y +# CONFIG_GLOB_SELFTEST is not set +CONFIG_NLATTR=y +# CONFIG_CORDIC is not set +# CONFIG_DDR is not set +# CONFIG_IRQ_POLL is not set +CONFIG_FONT_SUPPORT=y +# CONFIG_FONTS is not set +CONFIG_FONT_8x8=y +CONFIG_FONT_8x16=y +# CONFIG_SG_SPLIT is not set +CONFIG_SG_POOL=y +CONFIG_ARCH_HAS_SG_CHAIN=y +CONFIG_SBITMAP=y +# CONFIG_STRING_SELFTEST is not set From e8bdcbeebf6e4c750d5f65f7ebf9df8f26f3fe60 Mon Sep 17 00:00:00 2001 From: jeff murphy Date: Mon, 3 Jan 2022 16:11:34 -0500 Subject: [PATCH 06/39] concurrency cleanup. see note. realtime_thread.c line 379 realtimeRunner() the 2nd setting of rtSync may need to vary based on whether rtthreads command line flag is present or not. --- runtime/gc/debug.h | 4 +- runtime/gc/garbage-collection.c | 11 +-- runtime/gc/realtime_thread.c | 147 ++------------------------------ runtime/gc/ummark.c | 3 +- 4 files changed, 19 insertions(+), 146 deletions(-) diff --git a/runtime/gc/debug.h b/runtime/gc/debug.h index a7ea5ef3a..13d8a00fc 100755 --- a/runtime/gc/debug.h +++ b/runtime/gc/debug.h @@ -41,8 +41,8 @@ enum { FORCE_GENERATIONAL = FALSE, FORCE_MARK_COMPACT = FALSE, DEBUG_OLD = FALSE, - DEBUG_RTGC = TRUE, - DEBUG_RTGC_MARKING = TRUE, + DEBUG_RTGC = FALSE, + DEBUG_RTGC_MARKING = FALSE, DEBUG_WB = FALSE, DISPLAY_GC_STATS = FALSE }; diff --git a/runtime/gc/garbage-collection.c b/runtime/gc/garbage-collection.c index 09e6da963..41e3e0b1b 100755 --- a/runtime/gc/garbage-collection.c +++ b/runtime/gc/garbage-collection.c @@ -345,8 +345,8 @@ void *GCrunner(void *_s) { /* 2 less than MAXPRI because: * GC thread is never blocked - * RT thread is always blocked*/ - fprintf(stderr, "%d] threadsBlockedForGC %d MAXPRI-2=%d attempts=%d\n", PTHREAD_NUM, s->threadsBlockedForGC, MAXPRI-2, s->attempts); + * RT thread is always blocked + */ if (s->threadsBlockedForGC == (MAXPRI - 2)) { s->attempts++; @@ -729,14 +729,14 @@ void performUMGC(GC_state s, bool fullGC) { if (DEBUG_MEM) { - fprintf(stderr, "PerformUMGC\n"); + fprintf(stderr, "%d] PerformUMGC\n", PTHREAD_NUM); dumpUMHeap(s); } #ifdef PROFILE_UMGC long t_start = getCurrentTime(); - fprintf(stderr, "[GC] Free chunk: %d\n",s->fl_chunks); + fprintf(stderr, "%d] GC Free chunk: %d\n",PTHREAD_NUM, s->fl_chunks); #endif @@ -760,7 +760,8 @@ void performUMGC(GC_state s, #ifdef PROFILE_UMGC long t_end = getCurrentTime(); - fprintf(stderr, "[GC] Time: %ld, Free chunk: %d\n", + fprintf(stderr, "%d] GC Time: %ld, Free chunk: %d\n", + PTHREAD_NUM, t_end - t_start, s->fl_chunks); #endif diff --git a/runtime/gc/realtime_thread.c b/runtime/gc/realtime_thread.c index 9a6a93969..f9bdc64f4 100755 --- a/runtime/gc/realtime_thread.c +++ b/runtime/gc/realtime_thread.c @@ -329,7 +329,13 @@ void RT_init (GC_state state) } /* be careful when using this in SML code. remember that maxpri - * includes the main thread and the GC + * includes the main thread and the GC, and it is one more than the + * actual final thread-id. ie. if MAXPRI is 3, then we have + * + * TID Description + * 0 main thr + * 1 GC + * 2 another thread */ Int32 RTThread_maxpri (void) { @@ -345,12 +351,6 @@ Int32 RTThread_get_pthread_num(void) #define COPYIN2(s,EL) s->EL[2] = s->EL[0] void Parallel_run(void); -/* -void client_thread2 (void); -void client_thread3 (void); -void client_thread4 (void); -void client_thread5 (void); -*/ __attribute__((noreturn)) void * @@ -375,142 +375,13 @@ realtimeRunner (void *paramsPtr) } fprintf (stderr, "%d] calling parallel_run \n", tNum); - state->rtSync[PTHREAD_NUM] = false; - -/* - switch (tNum) { - case 2: - fprintf(stderr, "call client_thread2\n"); - client_thread2(); - break; - case 3: - client_thread3(); - case 4: - client_thread4(); - case 5: - client_thread5(); - } - sleep(300); -*/ + + state->rtSync[PTHREAD_NUM] = false; // this may need to be true if "@MLton rtthreads" is false Parallel_run (); fprintf (stderr, "%d] back from Parallel_run (shouldnt happen)\n", tNum); exit (-1); -#if 0 - /*Using same lock to BLOCK again. This time it wont be unblocked. - * TODO: Define what RT threads should do*/ - - - /* RT thread allocates on UM heap without stack*/ - if(state->numAllocedByRT <= 0) - { - if(DEBUG) - fprintf(stderr,"%d] Blocking RT-Thread.FOREVA.\n",tNum); - - LOCK_RT_THREADS; - - while(state->rtSync[PTHREAD_NUM]) - BLOCK_RT_THREADS; - - UNLOCK_RT_THREADS; - } - - if (DEBUG) - fprintf(stderr,"%d] RT thread ALLOCATING\n",tNum); - - while(1)//state->savedThread[PTHREAD_NUM] == BOGUS_OBJPTR) - { - pointer res; - state->rtSync[PTHREAD_NUM]= true; - if(DEBUG_THREADS) - fprintf(stderr,"%d] Spinning with no green thread. Free chunks = %d, RTSync = %d \n",PTHREAD_NUM,state->fl_chunks,state->rtSync[PTHREAD_NUM]?1:0); - - reserveAllocation(state,state->numAllocedByRT); - - res = UM_Object_alloc(state,state->numAllocedByRT,(GC_header)3,GC_NORMAL_HEADER_SIZE); - - state->allocedByRT+=state->numAllocedByRT; - - if(DEBUG_THREADS) - fprintf(stderr, "Empty chunk: "FMTPTR" \n", (uintptr_t) res); - - sched_yield(); - - } -#endif - -#ifdef THREADED -#pragma message "********* THREADED enabled **********" - die("wrong"); - while (!TC.booted) { - if (DEBUG_THREADS) fprintf (stderr, "%d] TC.booted is false: spin\n", PTHREAD_NUM); - ssleep (1, 0); - } - - /* set currentThread of new RT thread to that of main thread until copied thread is setup */ - state->currentThread[PTHREAD_NUM] = state->currentThread[0]; - setGCStateCurrentThreadAndStack (state); - - GC_thread curct = (GC_thread) (objptrToPointer (state->currentThread[0], - state->heap.start) + - offsetofThread (state)); - GC_stack curstk = - (GC_stack) objptrToPointer (curct->stack, state->heap.start); - - /* GC_thread copyThread (GC_state s, GC_thread from, size_t used) */ - /* copy the savedThread which is stored earlier on from the copied thread, when C Handler was set */ - - if (DEBUG) - fprintf (stderr, "%d] copy thread\n", PTHREAD_NUM); - pointer copiedTh = GC_copyThread (state, - objptrToPointer (state-> - savedThread[0], - state->heap.start)); - - GC_thread tc = (GC_thread) (copiedTh + offsetofThread (state)); - tc->exnStack = -1; - - //current thread on for RT thread is taken from tc which is copied from main thread in previous line - if (DEBUG) - fprintf (stderr, "%d] switch to copied thread\n", PTHREAD_NUM); - - GC_switchToThread (state, tc, 0); - - COPYIN2 (state, savedThread); - COPYIN2 (state, signalHandlerThread); - COPYIN2 (state, ffiOpArgsResPtr); - - state->isRealTimeThreadRunning = TRUE; - - while (1) { - if (DEBUG) { - fprintf (stderr, "%d] realtimeRunner running.\n", tNum); - fprintf (stderr, "%d] calling Parallel_run..\n", tNum); - } -// Copy_globalObjptrs (0, params->tNum); - - TC_LOCK; - TC.running_threads++; - TC_UNLOCK; - - Parallel_run (); - - fprintf (stderr, "%d] back from Parallel_run (shouldnt happen)\n", - tNum); - exit (-1); - } -#else -#pragma message "********* THREADED NOT enabled **********" -#endif - /*NOTREACHED*/ - /* since the above is wrapped in while(1) this code should never - * be reached and is only here to suppress gcc 'noreturn function - * returns' compiler warnings (since we use -Wall) - */ - while (1) - fprintf (stderr, "%d] Should not get here. Spinning.\n", - tNum); } pointer diff --git a/runtime/gc/ummark.c b/runtime/gc/ummark.c index 25a26f73d..ea4f59d5f 100755 --- a/runtime/gc/ummark.c +++ b/runtime/gc/ummark.c @@ -113,7 +113,8 @@ bool isObjectShaded(GC_state s, objptr *opp) { GC_objectTypeTag tag = ERROR_TAG; splitHeader(s, header, &tag, NULL, &bytesNonObjptrs, &numObjptrs); - printTag(__func__, tag, p); + if (DEBUG_RTGC_MARKING) + printTag(__func__, tag, p); bool verdict = true; From d8034a5de289d050d3593b259ecc5b9ea770c1d0 Mon Sep 17 00:00:00 2001 From: jeff murphy Date: Mon, 3 Jan 2022 16:13:33 -0500 Subject: [PATCH 07/39] some notes on rtlinux deadline scheduler --- ub/rtlinux/README.md | 10 +++ ub/rtlinux/deadlinesyscall.c | 138 +++++++++++++++++++++++++++++++++++ 2 files changed, 148 insertions(+) create mode 100644 ub/rtlinux/README.md create mode 100755 ub/rtlinux/deadlinesyscall.c diff --git a/ub/rtlinux/README.md b/ub/rtlinux/README.md new file mode 100644 index 000000000..5c7e45aef --- /dev/null +++ b/ub/rtlinux/README.md @@ -0,0 +1,10 @@ + +## Refs + +https://elinux.org/images/f/fe/Using_SCHED_DEADLINE.pdf + +https://stackoverflow.com/questions/21279649/getting-error-in-c-program-undefined-reference-to-gettid + +https://www.admin-magazine.com/Archive/2015/25/Optimizing-utilization-with-the-EDF-scheduler + + diff --git a/ub/rtlinux/deadlinesyscall.c b/ub/rtlinux/deadlinesyscall.c new file mode 100755 index 000000000..ae7f2eaae --- /dev/null +++ b/ub/rtlinux/deadlinesyscall.c @@ -0,0 +1,138 @@ +#define _GNU_SOURCE +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef SYS_gettid +#error "SYS_gettid unavailable on this system" +#endif + +#define gettid() ((pid_t)syscall(SYS_gettid)) + +#define SCHED_DEADLINE 6 + +/* __NR_sched_setattr number */ +#ifndef __NR_sched_setattr +#ifdef __x86_64__ +#define __NR_sched_setattr 314 +#endif + +#ifdef __i386__ +#define __NR_sched_setattr 351 +#endif + +#ifdef __arm__ +#define __NR_sched_setattr 380 +#endif + +#ifdef __aarch64__ +#define __NR_sched_setattr 274 +#endif +#endif + +/* __NR_sched_getattr number */ +#ifndef __NR_sched_getattr +#ifdef __x86_64__ +#define __NR_sched_getattr 315 +#endif + +#ifdef __i386__ +#define __NR_sched_getattr 352 +#endif + +#ifdef __arm__ +#define __NR_sched_getattr 381 +#endif + +#ifdef __aarch64__ +#define __NR_sched_getattr 275 +#endif +#endif + +static volatile int done; + + +struct sched_attr { + __u32 size; + + __u32 sched_policy; + __u64 sched_flags; + + /* SCHED_NORMAL, SCHED_BATCH */ + __s32 sched_nice; + + /* SCHED_FIFO, SCHED_RR */ + __u32 sched_priority; + + /* SCHED_DEADLINE */ + __u64 sched_runtime; + __u64 sched_deadline; + __u64 sched_period; +}; + +int sched_setattr(pid_t pid, + const struct sched_attr *attr, + unsigned int flags) +{ + return syscall(__NR_sched_setattr, pid, attr, flags); +} + +int sched_getattr(pid_t pid, + struct sched_attr *attr, + unsigned int size, + unsigned int flags) +{ + return syscall(__NR_sched_getattr, pid, attr, size, flags); +} + + +void *run_deadline(void *data) + { + struct sched_attr attr; + int x = 0, ret; + unsigned int flags = 0; + + printf("deadline thread start %ld\n", + gettid()); + + attr.size = sizeof(attr); + attr.sched_flags = 0; + attr.sched_nice = 0; + attr.sched_priority = 0; + + /* creates a 10ms/30ms reservation */ + attr.sched_policy = SCHED_DEADLINE; + attr.sched_runtime = 10 * 1000 * 1000; + attr.sched_period = 30 * 1000 * 1000; + attr.sched_deadline= 30 * 1000 * 1000; + + ret = sched_setattr(0, &attr, flags); + if (ret < 0) { + done = 0; + perror("sched_setattr"); + exit(-1); + } + + while (!done) { + x++; + } + return NULL; + } + + int main (int argc, char **argv) + { + pthread_t thread; + printf("main thread [%ld]\n", gettid()); + pthread_create(&thread, NULL, run_deadline, NULL); + sleep(10); + done = 1; + pthread_join(thread, NULL); + printf("main dies [%ld]\n", gettid()); + return 0; + } From 44fb9e3961d1d08c26c27c36b2547dd33a5ff8f1 Mon Sep 17 00:00:00 2001 From: jeff murphy Date: Tue, 4 Jan 2022 12:14:39 -0500 Subject: [PATCH 08/39] expose rtlinux deadline scheduler via ffi --- basis-library/mlton/primthread.sig | 3 + basis-library/mlton/primthread.sml | 18 ++-- compile.sh | 2 +- runtime/gc/realtime_thread.c | 56 +++++++++++- runtime/gc/realtime_thread.h | 2 + runtime/platform/linux.c | 17 ++++ runtime/platform/linux.h | 102 +++++++++++++++++++++ ub/rtlinux/Makefile | 6 ++ ub/rtlinux/deadlinesyscall.c | 142 ++++++++++++++++++++--------- ub/rtlinux/periodic.sml | 35 +++++++ 10 files changed, 328 insertions(+), 55 deletions(-) create mode 100755 ub/rtlinux/Makefile create mode 100755 ub/rtlinux/periodic.sml diff --git a/basis-library/mlton/primthread.sig b/basis-library/mlton/primthread.sig index abea7eae6..f26b534f7 100755 --- a/basis-library/mlton/primthread.sig +++ b/basis-library/mlton/primthread.sig @@ -43,5 +43,8 @@ signature PRIM_THREAD = val gcstate: Primitive.MLton.GCState.t val getMyPriority: unit -> int + val set_schedule: int * int * int -> unit + val schedule_yield: unit -> unit + val wait_for_next_period: unit -> unit end diff --git a/basis-library/mlton/primthread.sml b/basis-library/mlton/primthread.sml index d74fe5eb2..8255a4282 100755 --- a/basis-library/mlton/primthread.sml +++ b/basis-library/mlton/primthread.sml @@ -135,22 +135,26 @@ struct end local - val inst__ = _import "User_instrument" : int -> unit; - val dise__ = _import "Dump_instrument_stderr" : int -> unit; - val gtsb__ = _import "get_ticks_since_boot" : unit -> real; - val lock__ = _import "User_lock" : int -> unit; + val inst__ = _import "User_instrument" : int -> unit; + val dise__ = _import "Dump_instrument_stderr" : int -> unit; + val gtsb__ = _import "get_ticks_since_boot" : unit -> real; + val lock__ = _import "User_lock" : int -> unit; val unlock__ = _import "User_unlock" : int -> unit; + val setsch = _import "set_schedule" : int * int * int -> unit; + val schyld = _import "schedule_yield" : unit -> unit; in fun instrument a = inst__ a fun dump_instrument_stderr a = dise__ a fun get_ticks_since_boot () = gtsb__ () - fun rtlock a = if a <=9 then lock__ a else print "Invalid lock. Valid locks are [0-9]\n" - fun rtunlock a = if a<=9 then unlock__ a else print "Invalid lock. Valid locks are [0-9]\n" + fun rtlock a = if a <= 9 then lock__ a else print "Invalid lock. Valid locks are [0-9]\n" + fun rtunlock a = if a <= 9 then unlock__ a else print "Invalid lock. Valid locks are [0-9]\n" + fun set_schedule (rt, per, dl) = setsch (rt, per, dl) + fun schedule_yield () = schyld () + fun wait_for_next_period () = schyld () end val getMyPriority = _import "GC_myPriority": unit -> int; - structure WorkQueue: sig type 'a t diff --git a/compile.sh b/compile.sh index 38c6f1e9f..26cfd2d5b 100755 --- a/compile.sh +++ b/compile.sh @@ -3,7 +3,7 @@ find runtime -name \*.[ao] -ls -exec rm {} \; -export CFLAGS="-Wunused-but-set-variable -DSTACK_GC_SANITY -Wall" +export CFLAGS="-Wunused-but-set-variable -DSTACK_GC_SANITY -Wall -DRTLINUX" arch_flags="-j 8" make $arch_flags dirs && make $arch_flags runtime && diff --git a/runtime/gc/realtime_thread.c b/runtime/gc/realtime_thread.c index f9bdc64f4..7761a5401 100755 --- a/runtime/gc/realtime_thread.c +++ b/runtime/gc/realtime_thread.c @@ -107,16 +107,62 @@ void InitializeMutexes(void) { } double get_ticks_since_boot(void) { - rtems_status_code sc; - rtems_interval time_buffer; + return rtems_clock_get_ticks_since_boot(); // to be consistent with set_schedule below +// return rtems_clock_get_uptime_nanoseconds(); +} - sc = rtems_clock_get(RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, (void *)&time_buffer); - assert (rc == RTEMS_SUCCESSFUL); - return (double)time_buffer; +/* for RTEMS, these parameters are clock ticks. the params are rtems_interval type, + * which is Watchdog_interval which in turn is uint32_t but to keep the FFI prototype + * consist (with the posix one below) we use 64_t and downcast. + */ +void set_schedule(uint64_t runtime, uint64_t period, uint64_t deadline) { + return; +} + +int schedule_yield() { + // See "11.3.6. Examples" here: + // https://docs.rtems.org/releases/rtems-docs-4.11.3/c-user/rate_monotonic_manager.html#rtems-rate-monotonic-create + // wait for next period + return 0; } #else +/* for RT linux, these parameters are in nanoseconds */ +void set_schedule(uint64_t runtime, uint64_t period, uint64_t deadline) { + struct sched_attr attr; + unsigned int flags = 0; + + if(DEBUG_THREADS) + fprintf(stderr, "%d] "YELLOW("set_schedule")" runtime:%llu period:%llu deadline:%llu\n", + PTHREAD_NUM, runtime, period, deadline); + + attr.size = sizeof(attr); + attr.sched_flags = SCHED_FLAG_DL_OVERRUN; // supposed to make linux SIGXCPU on overrun + attr.sched_nice = 0; + attr.sched_priority = 0; + + /* times are in nanos for rtlinux */ + attr.sched_policy = SCHED_DEADLINE; + attr.sched_runtime = runtime; //eg 5 * 1000 * 1000; 5ms + attr.sched_period = period; + attr.sched_deadline = deadline; + + // '0' means 'current thread' + if (sched_setattr(0, &attr, flags) < 0) { + perror("sched_setattr"); + die("realtime_thread.c set_schedule(): sched_setattr"); + } +} + +int schedule_yield() { + if (sched_yield() < 0) { + perror("sched_yield"); + die("realtime_thread.c set_schedule(): sched_yield"); + } + return 0; +} + /* TID of holding thread or -1 if no one*/ volatile int32_t ML_mutex; volatile int32_t *User_mutexes; diff --git a/runtime/gc/realtime_thread.h b/runtime/gc/realtime_thread.h index bc3686ee6..6f998d59b 100755 --- a/runtime/gc/realtime_thread.h +++ b/runtime/gc/realtime_thread.h @@ -38,6 +38,8 @@ void User_unlock (Int32); void User_instrument (Int32 p); void Dump_instrument_stderr (Int32 p); double get_ticks_since_boot(void); +void set_schedule(uint64_t runtime, uint64_t period, uint64_t deadline); +int schedule_yield(void); #endif #endif /* _REALTIME_THREAD_H_ */ diff --git a/runtime/platform/linux.c b/runtime/platform/linux.c index 40bb1837e..1f50547bc 100644 --- a/runtime/platform/linux.c +++ b/runtime/platform/linux.c @@ -99,3 +99,20 @@ uintmax_t GC_physMem (void) { return (uintmax_t)si.totalram * (uintmax_t)si.mem_unit; } + +#ifdef RTLINUX +int sched_setattr(pid_t pid, + const struct sched_attr *attr, + unsigned int flags) +{ + return syscall(__NR_sched_setattr, pid, attr, flags); +} + +int sched_getattr(pid_t pid, + struct sched_attr *attr, + unsigned int size, + unsigned int flags) +{ + return syscall(__NR_sched_getattr, pid, attr, size, flags); +} +#endif /* RTLINUX */ diff --git a/runtime/platform/linux.h b/runtime/platform/linux.h index b3375dfec..8189dcaa9 100644 --- a/runtime/platform/linux.h +++ b/runtime/platform/linux.h @@ -31,6 +31,108 @@ #include #include +#ifdef RTLINUX +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +# define timespec_diff_macro(a, b, result) \ + do { \ + (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ + (result)->tv_nsec = (a)->tv_nsec - (b)->tv_nsec; \ + if ((result)->tv_nsec < 0) { \ + --(result)->tv_sec; \ + (result)->tv_nsec += 1000000000; \ + } \ + } while (0) + +#ifndef SYS_gettid +#error "SYS_gettid unavailable on this system" +#endif + +#define gettid() ((pid_t)syscall(SYS_gettid)) + +#define SCHED_DEADLINE 6 +#define SCHED_FLAG_DL_OVERRUN 0x04 + +/* __NR_sched_setattr number */ +#ifndef __NR_sched_setattr +#ifdef __x86_64__ +#define __NR_sched_setattr 314 +#endif + +#ifdef __i386__ +#define __NR_sched_setattr 351 +#endif + +#ifdef __arm__ +#define __NR_sched_setattr 380 +#endif + +#ifdef __aarch64__ +#define __NR_sched_setattr 274 +#endif +#endif + +/* __NR_sched_getattr number */ +#ifndef __NR_sched_getattr +#ifdef __x86_64__ +#define __NR_sched_getattr 315 +#endif + +#ifdef __i386__ +#define __NR_sched_getattr 352 +#endif + +#ifdef __arm__ +#define __NR_sched_getattr 381 +#endif + +#ifdef __aarch64__ +#define __NR_sched_getattr 275 +#endif +#endif + +struct sched_attr { + __u32 size; + + __u32 sched_policy; + __u64 sched_flags; + + /* SCHED_NORMAL, SCHED_BATCH */ + __s32 sched_nice; + + /* SCHED_FIFO, SCHED_RR */ + __u32 sched_priority; + + /* SCHED_DEADLINE */ + __u64 sched_runtime; + __u64 sched_deadline; + __u64 sched_period; +}; + +int sched_setattr(pid_t pid, + const struct sched_attr *attr, + unsigned int flags); +int sched_getattr(pid_t pid, + struct sched_attr *attr, + unsigned int size, + unsigned int flags); +#endif /* RTLINUX */ + #ifdef __UCLIBC__ #define HAS_FEROUND FALSE #else diff --git a/ub/rtlinux/Makefile b/ub/rtlinux/Makefile new file mode 100755 index 000000000..b000688a9 --- /dev/null +++ b/ub/rtlinux/Makefile @@ -0,0 +1,6 @@ +c: + gcc -o deadline deadlinesyscall.c -lpthread + +sml: + ../../build/bin/mlton periodic.sml + sudo ./periodic @RTMLton rtthreads true -- diff --git a/ub/rtlinux/deadlinesyscall.c b/ub/rtlinux/deadlinesyscall.c index ae7f2eaae..cfdb83ea5 100755 --- a/ub/rtlinux/deadlinesyscall.c +++ b/ub/rtlinux/deadlinesyscall.c @@ -1,13 +1,28 @@ #define _GNU_SOURCE #include -#include -#include -#include +#include #include +#include #include -#include -#include +#include #include +#include +#include +#include +#include +#include +#include +#include + +# define timespec_diff_macro(a, b, result) \ + do { \ + (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ + (result)->tv_nsec = (a)->tv_nsec - (b)->tv_nsec; \ + if ((result)->tv_nsec < 0) { \ + --(result)->tv_sec; \ + (result)->tv_nsec += 1000000000; \ + } \ + } while (0) #ifndef SYS_gettid #error "SYS_gettid unavailable on this system" @@ -16,6 +31,7 @@ #define gettid() ((pid_t)syscall(SYS_gettid)) #define SCHED_DEADLINE 6 +#define SCHED_FLAG_DL_OVERRUN 0x04 /* __NR_sched_setattr number */ #ifndef __NR_sched_setattr @@ -91,48 +107,90 @@ int sched_getattr(pid_t pid, return syscall(__NR_sched_getattr, pid, attr, size, flags); } +void sig_handler(int signo) +{ + printf("received signal %d\n", signo); +} + + +/* from "man sched" + + arrival/wakeup absolute deadline + | start time | + | | | + v v v + -----x--------xooooooooooooooooo--------x--------x--- + |<-- Runtime ------->| + |<----------- Deadline ----------->| + |<-------------- Period ------------------->| + + The kernel requires that: + + sched_runtime <= sched_deadline <= sched_period +*/ void *run_deadline(void *data) { - struct sched_attr attr; - int x = 0, ret; - unsigned int flags = 0; - - printf("deadline thread start %ld\n", - gettid()); - - attr.size = sizeof(attr); - attr.sched_flags = 0; - attr.sched_nice = 0; - attr.sched_priority = 0; - - /* creates a 10ms/30ms reservation */ - attr.sched_policy = SCHED_DEADLINE; - attr.sched_runtime = 10 * 1000 * 1000; - attr.sched_period = 30 * 1000 * 1000; - attr.sched_deadline= 30 * 1000 * 1000; - - ret = sched_setattr(0, &attr, flags); - if (ret < 0) { - done = 0; - perror("sched_setattr"); - exit(-1); - } - - while (!done) { - x++; - } - return NULL; + struct sched_attr attr; + int x = 0, ret; + unsigned int flags = 0; + struct timespec prev, cur, diff; + struct timespec runtime_stop, runtime; + + printf("deadline thread start %ld\n", (long int) gettid()); + + attr.size = sizeof(attr); + attr.sched_flags = SCHED_FLAG_DL_OVERRUN; + attr.sched_nice = 0; + attr.sched_priority = 0; + + attr.sched_policy = SCHED_DEADLINE; + attr.sched_runtime = 25000; //5 * 1000 * 1000; + attr.sched_period = 1000 * 1000 * 1000; + attr.sched_deadline = 250 * 1000 * 1000; + + printf("Setting schedule to (ns): runtime=%lld deadline=%lld period=%lld\n\n", + (long long int)attr.sched_runtime, (long long int)attr.sched_deadline, (long long int)attr.sched_period); + ret = sched_setattr(0, &attr, flags); + if (ret < 0) { + done = 0; + perror("sched_setattr"); + exit(-1); + } + + clock_gettime(CLOCK_MONOTONIC, &prev); + printf("time (s) -- actual period (s) -- actual runtime (ns)\n"); + while (!done) { + clock_gettime(CLOCK_MONOTONIC, &cur); + timespec_diff_macro(&cur, &prev, &diff); + memcpy(&prev, &cur, sizeof(struct timespec)); + + printf("%lld.%.9ld -- ", (long long)prev.tv_sec, prev.tv_nsec); + printf("%lld.%.9ld -- ", (long long)diff.tv_sec, diff.tv_nsec); + x++; + clock_gettime(CLOCK_MONOTONIC, &runtime_stop); + timespec_diff_macro(&runtime_stop, &cur, &runtime); + printf("%9ld\n", runtime.tv_nsec); + + sched_yield(); + } + return NULL; } int main (int argc, char **argv) { - pthread_t thread; - printf("main thread [%ld]\n", gettid()); - pthread_create(&thread, NULL, run_deadline, NULL); - sleep(10); - done = 1; - pthread_join(thread, NULL); - printf("main dies [%ld]\n", gettid()); - return 0; + pthread_t thread; + + /* this is supposed to be delivered if there is a runtime over-run */ + + if (signal(SIGXCPU, sig_handler) == SIG_ERR) + perror("can't catch SIGXCPU"); + + printf("main thread [%ld]\n", (long int) gettid()); + pthread_create(&thread, NULL, run_deadline, NULL); + sleep(10); + done = 1; + pthread_join(thread, NULL); + printf("main dies [%ld]\n", (long int)gettid()); + return 0; } diff --git a/ub/rtlinux/periodic.sml b/ub/rtlinux/periodic.sml new file mode 100755 index 000000000..f4bc4e4c5 --- /dev/null +++ b/ub/rtlinux/periodic.sml @@ -0,0 +1,35 @@ + + +open MLton.PrimThread + +fun printit s = print (Int.toString(getMyPriority ())^"] "^s^"\n") +fun gettime () = get_ticks_since_boot () + +fun thread0 () = +let + val onesec = 1000000000 + val _ = printit "In let for thread0. Setting period/deadline to 1 sec\n" + val _ = set_schedule (onesec, onesec, onesec) + val prev = ref (gettime ()) + val cur = ref (gettime ()) +in + while true do ( + instrument 0; + cur := gettime(); + printit (Real.toString(Real.-(!cur, !prev))); + prev := !cur; + instrument 0; + wait_for_next_period (); (* after computation finishes, this must be called *) +(* + dump_instrument_stderr 0; +*) + () + ) end + + +val _ = printit "Thread 0 : main" +val _ = thread0 () +val _ = printit "Thread 0 : exit (should not happen)" + + + From 6fce65f7bd5d10e4cbbce06034a40d2c7b850096 Mon Sep 17 00:00:00 2001 From: jeff murphy Date: Sat, 5 Feb 2022 22:00:14 -0500 Subject: [PATCH 09/39] rtems additions --- mlton/atoms/id.fun | 0 mlton/backend/live.fun | 6 +++ mlton/backend/machine.fun | 10 +++- mlton/control/control.sml | 1 + mlton/defunctorize/defunctorize.fun | 8 +-- mlton/main/compile.fun | 23 ++++++-- runtime/gc/init.c | 1 - runtime/gc/realtime_thread.c | 64 +++++++++++++++++++++- ub/rtems/justprint/hello.c | 8 ++- ub/rtems/justprint/justprint.0.c | 3 +- ub/rtems/ratemono/Makefile | 5 ++ ub/rtems/ratemono/hello.c | 84 +++++++++++++++++++++++++++++ ub/rtems/ratemono/init.c | 35 ++++++++++++ ub/rtems/ratemono/wscript | 50 +++++++++++++++++ ub/rtlinux/clock_gettime.c | 26 +++++++++ 15 files changed, 311 insertions(+), 13 deletions(-) mode change 100644 => 100755 mlton/atoms/id.fun mode change 100644 => 100755 mlton/backend/machine.fun create mode 100755 ub/rtems/ratemono/Makefile create mode 100755 ub/rtems/ratemono/hello.c create mode 100755 ub/rtems/ratemono/init.c create mode 100755 ub/rtems/ratemono/wscript create mode 100755 ub/rtlinux/clock_gettime.c diff --git a/mlton/atoms/id.fun b/mlton/atoms/id.fun old mode 100644 new mode 100755 diff --git a/mlton/backend/live.fun b/mlton/backend/live.fun index bf4c687aa..0b1af313b 100644 --- a/mlton/backend/live.fun +++ b/mlton/backend/live.fun @@ -72,6 +72,11 @@ structure LiveInfo = addEdge end +(* outputs a string to stderr instead of source files *) +fun jeffit x = TextIO.output (TextIO.stdErr, (x^"\n")) (* JEFF *) +(* prints a Pretty.t to stderr *) +fun prettyit x = Layout.outputl (x, Out.error) (* JEFF *) + val traceConsider = Trace.trace ("Live.consider", LiveInfo.layout, Bool.layout) @@ -81,6 +86,7 @@ fun live (function, {shouldConsider: Var.t -> bool}) = Trace.trace ("Live.shouldConsider", Var.layout, Bool.layout) shouldConsider val {args, blocks, ...} = Function.dest function + val _ = Layout.outputl (Func.layout(Function.name function), Out.error) (* JEFF *) val _ = Control.diagnostic (fn () => diff --git a/mlton/backend/machine.fun b/mlton/backend/machine.fun old mode 100644 new mode 100755 index 9b0340696..2ad1e2f78 --- a/mlton/backend/machine.fun +++ b/mlton/backend/machine.fun @@ -473,9 +473,17 @@ structure Statement = end - + (* ref from + backend.fun "fun genStatement" + which takes an RSSA.Statement and converts it to a Machine.Statement + + *) fun chunkedObject {dst, header, size, numChunks} = let + +val _ = TextIO.output (TextIO.stdErr, + ("chunkedObject: size:"^Int.toString(Bytes.toInt(size))^" numChunks:"^Int.toString(Word.toInt(numChunks))^"\n")) (* JEFF *) + datatype z = datatype Operand.t fun bytes (b: Bytes.t): Operand.t = Word (WordX.fromIntInf (Bytes.toIntInf b, WordSize.csize ())) diff --git a/mlton/control/control.sml b/mlton/control/control.sml index 6ebd08118..34793cfdf 100644 --- a/mlton/control/control.sml +++ b/mlton/control/control.sml @@ -354,6 +354,7 @@ fun pass {display: 'a display, style: style, thunk: unit -> 'a}: 'a = let +val _ = TextIO.output (TextIO.stdErr, ("pass name "^name^"\n")) (* JEFF *) val thunk = wrapDiagnosing {name = name, thunk = thunk} val thunk = wrapProfiling {name = name, thunk = thunk} val result = trace (Pass, name) thunk () diff --git a/mlton/defunctorize/defunctorize.fun b/mlton/defunctorize/defunctorize.fun index 962cce283..5acb5507b 100644 --- a/mlton/defunctorize/defunctorize.fun +++ b/mlton/defunctorize/defunctorize.fun @@ -543,8 +543,8 @@ fun defunctorize (CoreML.Program.T {decs}) = (* Process all the datatypes. *) fun loopDec (d: Cdec.t) = let -(* Use open Cdec instead of the following due to an SML/NJ bug *) -(* datatype z = datatype Cdec.t *) + (* Use open Cdec instead of the following due to an SML/NJ bug *) + (* datatype z = datatype Cdec.t *) open Cdec in case d of @@ -722,8 +722,8 @@ fun defunctorize (CoreML.Program.T {decs}) = ty = Xtype.arrow (argType, bodyType), var = var} end) -(* Use open Cdec instead of the following due to an SML/NJ bug *) -(* datatype z = datatype Cdec.t *) + (* Use open Cdec instead of the following due to an SML/NJ bug *) + (* datatype z = datatype Cdec.t *) open Cdec in case d of diff --git a/mlton/main/compile.fun b/mlton/main/compile.fun index d1160fddc..8549450db 100755 --- a/mlton/main/compile.fun +++ b/mlton/main/compile.fun @@ -500,8 +500,7 @@ fun elaborate {input: MLBString.t}: Xml.Program.t = Runtime.GCField.setOffsets { atomicState = get "atomicState_Offset", - (*cardMapAbsolute = get - * "generationalMaps.cardMapAbsolute_Offset",*) + (*cardMapAbsolute = get "generationalMaps.cardMapAbsolute_Offset",*) currentThread = get "currentThread_Offset", curSourceSeqsIndex = get "sourceMaps.curSourceSeqsIndex_Offset", exnStack = get "exnStack_Offset", @@ -531,7 +530,7 @@ fun elaborate {input: MLBString.t}: Xml.Program.t = maxFrameSize = get "maxFrameSize_Size", signalIsPending = get "signalsInfo.signalIsPending_Size", flChunks = get "fl_chunks_Size", - currentFrame = get "currentFrame_Size", + currentFrame = get "currentFrame_Size", rtSync = get "rtSync_Size", heuristicChunks = get "heuristicChunks_Size", flLock = get "fl_lock_Size", @@ -550,6 +549,24 @@ fun elaborate {input: MLBString.t}: Xml.Program.t = in Control.Target.setBigEndian (get "MLton_Platform_Arch_bigendian") end + + fun lookfortasks (CoreML.Program.T {decs}) = (* JEFF todo *) + let + fun loopDec (d: CoreML.Dec.t) = + let + open CoreML.Dec + in + case d of + Fun {decs, ...} => () + | _ => () + end + val _ = Vector.foreach (decs, loopDec) + in + () + end + + val j = lookfortasks coreML + val xml = Control.passTypeCheck {display = Control.Layouts Xml.Program.layouts, diff --git a/runtime/gc/init.c b/runtime/gc/init.c index dd8a9f2cf..c08f64864 100644 --- a/runtime/gc/init.c +++ b/runtime/gc/init.c @@ -102,7 +102,6 @@ int processAtMLton(GC_state s, int start, int argc, char **argv, and irtSync[PTHREAD_NUM] = false; // this may need to be true if "@MLton rtthreads" is false - Parallel_run (); +#if defined(__rtems__) + RTEMS_Parallel_run_wrapper(params->tNum); +#else + Parallel_run (); +#endif fprintf (stderr, "%d] back from Parallel_run (shouldnt happen)\n", tNum); exit (-1); /*NOTREACHED*/ diff --git a/ub/rtems/justprint/hello.c b/ub/rtems/justprint/hello.c index cab0642a4..f2d3a8c21 100755 --- a/ub/rtems/justprint/hello.c +++ b/ub/rtems/justprint/hello.c @@ -6,13 +6,17 @@ #include #include "/home/jcmurphy/quick-start/rtems/6/i386-rtems6/include/stdio.h" -int mainX(void); +int mainX(int, char **); rtems_task Init( rtems_task_argument ignored ) { + int argc = 1; + char* argv[1]; + argv[0] = "justprint"; + printf("in rtems task init\n"); - mainX(); + mainX(argc, argv); exit( 0 ); } diff --git a/ub/rtems/justprint/justprint.0.c b/ub/rtems/justprint/justprint.0.c index e63c207be..320d6bf9e 100755 --- a/ub/rtems/justprint/justprint.0.c +++ b/ub/rtems/justprint/justprint.0.c @@ -762,9 +762,10 @@ static char* sourceNames[] = { uint32_t sources_len = 0; static struct GC_source sources[] = { }; -uint32_t atMLtons_len = 2; +uint32_t atMLtons_len = 4; static char* atMLtons[] = { "@MLton", /* 0 */ + "rtthreads", "true", "--", /* 1 */ }; DeclareChunk (1); diff --git a/ub/rtems/ratemono/Makefile b/ub/rtems/ratemono/Makefile new file mode 100755 index 000000000..00b34d814 --- /dev/null +++ b/ub/rtems/ratemono/Makefile @@ -0,0 +1,5 @@ +all: + tar -xpf ../../../runtime/rtems_waf.tar + ./waf configure --rtems=/opt/rtems6 --rtems-bsp=i386/pc386 + ./waf + /opt/rtems6/bin/rtems-run --rtems-bsps=pc-qemu ./build/i386-rtems6-pc386/hello.exe diff --git a/ub/rtems/ratemono/hello.c b/ub/rtems/ratemono/hello.c new file mode 100755 index 000000000..567e7c117 --- /dev/null +++ b/ub/rtems/ratemono/hello.c @@ -0,0 +1,84 @@ +/* + * Hello world example + */ +#include +#include +#include +#include "/opt/rtems6/i386-rtems6/include/stdio.h" +#include + +rtems_task Periodic_task(rtems_task_argument argument); +rtems_task Init(rtems_task_argument argument); +volatile int partial_loop = 0; + +rtems_task Periodic_task(rtems_task_argument arg) +{ + rtems_name name; + rtems_id period; + + rtems_status_code status; + name = rtems_build_name( 'P', 'E', 'R', 'D' ); + status = rtems_rate_monotonic_create( name, &period ); + if ( status != RTEMS_SUCCESSFUL ) { + printf( "rtems_monotonic_create failed with status of %d.\n", status ); + exit( 1 ); + } + while ( 1 ) { + int x = rtems_clock_get_ticks_since_boot(); + printf("Calling rtems_rate_monotonic_period(period=250 ticks). clock=%d\n", x); + if ( rtems_rate_monotonic_period( period, 250 ) == RTEMS_TIMEOUT ) + break; + x = rtems_clock_get_ticks_since_boot(); + printf(" Task awake: periodic action. clock=%d\n", x); + /* Perform some periodic actions */ + } + /* missed period so delete period and SELF */ + status = rtems_rate_monotonic_delete( period ); + if ( status != RTEMS_SUCCESSFUL ) { + printf( "rtems_rate_monotonic_delete failed with status of %d.\n", status ); + exit( 1 ); + } + status = rtems_task_delete( RTEMS_SELF ); /* should not return */ + printf( "rtems_task_delete returned with status of %d.\n", status ); + exit( 1 ); +} + +#define directive_failed(COND,MSG) do{if(COND){puts(MSG);exit(-1);}}while(0) +rtems_task Init( + rtems_task_argument ignored +) +{ + rtems_id task_id; + rtems_status_code status; + + printf("in rtems task init\n"); + + puts( "INIT - rtems_task_create - creating task 1" ); + status = rtems_task_create( + rtems_build_name( 'T', 'A', '1', ' ' ), + 1, + RTEMS_MINIMUM_STACK_SIZE, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &task_id + ); + + directive_failed( status, "rtems_task_create of TA1" ); + puts( "INIT - rtems_task_start - TA1 " ); + status = rtems_task_start( task_id, Periodic_task, 0 ); + directive_failed( status, "rtems_task_start of TA1" ); + while ( !partial_loop ) { + status = rtems_task_wake_after( 2 ); + directive_failed( status, "rtems_task_wake_after" ); + } + + rtems_cpu_usage_reset(); + + status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() ); + directive_failed( status, "rtems_task_wake_after" ); + + + exit( 0 ); +} + + diff --git a/ub/rtems/ratemono/init.c b/ub/rtems/ratemono/init.c new file mode 100755 index 000000000..cd6ca6c3f --- /dev/null +++ b/ub/rtems/ratemono/init.c @@ -0,0 +1,35 @@ +/* + * Simple RTEMS configuration + */ + +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER + +#define CONFIGURE_UNLIMITED_OBJECTS +#define CONFIGURE_UNIFIED_WORK_AREAS + +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE + +#define CONFIGURE_RTEMS_POSIX_API + +//#define CONFIGURE_POSIX_INIT_THREAD_TABLE + +#define CONFIGURE_MAXIMUM_POSIX_THREADS 6 +#define CONFIGURE_MAXIMUM_TASKS 2 +#define CONFIGURE_MAXIMUM_PERIODS 1 +#define CONFIGURE_INIT_TASK_STACK_SIZE (RTEMS_MINIMUM_STACK_SIZE * 2) +#define CONFIGURE_INIT_TASK_PRIORITY 10 +#define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_DEFAULT_MODES + +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE + +#define CONFIGURE_EXTRA_TASK_STACKS (1 * RTEMS_MINIMUM_STACK_SIZE) + +#define CONFIGURE_MEMORY_OVERHEAD 1 + +#define CONFIGURE_INIT + +//#define CONFIGURE_SCHEDULER_EDF +//#define CONFIGURE_SCHEDULER_NAME rtems_build_name('U', 'E', 'D', 'F') + +#include diff --git a/ub/rtems/ratemono/wscript b/ub/rtems/ratemono/wscript new file mode 100755 index 000000000..7749bc748 --- /dev/null +++ b/ub/rtems/ratemono/wscript @@ -0,0 +1,50 @@ +# +# Hello world Waf script +# +from __future__ import print_function + +rtems_version = "6" + +try: + import rtems_waf.rtems as rtems +except: + print('error: no rtems_waf git submodule') + import sys + sys.exit(1) + +def init(ctx): + rtems.init(ctx, version = rtems_version, long_commands = True) + +def bsp_configure(conf, arch_bsp): + # Add BSP specific configuration checks + pass + +def options(opt): + rtems.options(opt) + +def configure(conf): + rtems.configure(conf, bsp_configure = bsp_configure) + +def build(bld): + rtems.build(bld) + + x = """ + -I/opt/rtems6/include + -I/opt/rtems6/i386-rtems6/include + -I/home/jcmurphy/RTMLton/build/lib/include -fno-common + -D_GNU_SOURCE -D__USE_GNU -fno-strict-aliasing -fomit-frame-pointer + -w -m32 -fno-strength-reduce -fschedule-insns -fschedule-insns2 + -falign-functions=5 -falign-jumps=2 -falign-loops=2 + -w +""" + + y = """ -L/opt/rtems6/i386-rtems6/pc386/lib/ + -L/opt/rtems6/lib/ + -lm """ + + bld(features = 'c cprogram', + target = 'hello.exe', + cflags = ' -g -O0 ' + x, + ldflags = y, + source = ['hello.c', + 'init.c']) diff --git a/ub/rtlinux/clock_gettime.c b/ub/rtlinux/clock_gettime.c new file mode 100755 index 000000000..67788d839 --- /dev/null +++ b/ub/rtlinux/clock_gettime.c @@ -0,0 +1,26 @@ +#define _POSIX_C_SOURCE 200809L + +#include +#include +#include +#include + +int main() +{ + long ms; // Milliseconds + time_t s; // Seconds + struct timespec spec; + + clock_gettime(CLOCK_MONOTONIC, &spec); + + s = spec.tv_sec; + ms = round(spec.tv_nsec / 1.0e6); // Convert nanoseconds to milliseconds + if (ms > 999) { + s++; + ms = 0; + } + + long t = (s*1000) + ms; + printf("Current time: %"PRIdMAX".%03ld seconds since the Epoch %ld\n", + (intmax_t)s, ms, t); +} From 09c31764b1610d40b0ab10a6638c0a119241b214 Mon Sep 17 00:00:00 2001 From: jeff murphy Date: Sat, 5 Feb 2022 22:03:41 -0500 Subject: [PATCH 10/39] add some doc to gc-check --- mlton/backend/gc-check.fun | 298 +++++++++++++++++++------------------ 1 file changed, 155 insertions(+), 143 deletions(-) diff --git a/mlton/backend/gc-check.fun b/mlton/backend/gc-check.fun index c476b4399..169267f6b 100755 --- a/mlton/backend/gc-check.fun +++ b/mlton/backend/gc-check.fun @@ -52,162 +52,162 @@ struct - fun insertCheck (b as Block.T {args, kind, label, statements, transfer}) = - let - val chunksNeeded = Block.objChunksAllocated b - val dontCollect = Label.newNoname () - val collect = Label.newNoname () - val func = CFunction.gc {maySwitchThreads = false} - - fun gcAndJumpToBlock (to) = - let - val collectReturn = Label.newNoname () - in - [ Block.T {args = Vector.new0 (), - kind = Kind.Jump, - label = collect, - statements = Vector.new0 (), - transfer = (Transfer.CCall - {args = Vector.new4 (Operand.GCState, - (Operand.word - (WordX.zero (WordSize.csize ()))), - Operand.bool false, - Operand.bool true), - func = func, - return = SOME collectReturn})} - , Block.T { args = Vector.new0 () - , kind = Kind.CReturn {func = func} - , label = collectReturn - , statements = Vector.new0 () - , transfer = Transfer.Goto { dst = to - , args = Vector.new0 () }} ] - end + fun insertCheck (b as Block.T {args, kind, label, statements, transfer}) = + let + val chunksNeeded = Block.objChunksAllocated b + val dontCollect = Label.newNoname () + val collect = Label.newNoname () + val func = CFunction.gc {maySwitchThreads = false} + + fun gcAndJumpToBlock (to) = + let + val collectReturn = Label.newNoname () + in + [ Block.T {args = Vector.new0 (), + kind = Kind.Jump, + label = collect, + statements = Vector.new0 (), + transfer = (Transfer.CCall + {args = Vector.new4 (Operand.GCState, + (Operand.word + (WordX.zero (WordSize.csize ()))), + Operand.bool false, + Operand.bool true), + func = func, + return = SOME collectReturn})} + , Block.T { args = Vector.new0 () + , kind = Kind.CReturn {func = func} + , label = collectReturn + , statements = Vector.new0 () + , transfer = Transfer.Goto { dst = to + , args = Vector.new0 () }} ] + end + + datatype z = datatype Runtime.GCField.t + + fun decFreeChunks n = + let + val flChunks = Operand.Runtime FLChunks + val res = Var.newNoname () + val resTy = Operand.ty flChunks + in + [Statement.PrimApp {args = (Vector.new2 + (flChunks, Operand.constWord n (WordSize.word32))), + dst = SOME (res, resTy), + prim = Prim.wordSub WordSize.word32}, + Statement.Move {dst = flChunks, + src = Operand.Var {ty = resTy, var = res}}] + end + + + fun incReserved n = + let + val reserved = Operand.Runtime Reserved + val res = Var.newNoname () + val resTy = Operand.ty reserved + in + [Statement.PrimApp {args = (Vector.new2 + (reserved, Operand.constWord n (WordSize.word32))), + dst = SOME (res, resTy), + prim = Prim.wordAdd WordSize.word32}, + Statement.Move {dst = reserved, + src = Operand.Var {ty = resTy, var = res}}] + end + + + fun primApp (prim, op1, op2, {ifTrue, ifFalse}) = + let + val res = Var.newNoname () + val s = + Statement.PrimApp {args = Vector.new2 (op1, op2), + dst = SOME (res, Type.bool), + prim = prim} + val transfer = + Transfer.ifBool + (Operand.Var {var = res, ty = Type.bool}, + {falsee = ifFalse, + truee = ifTrue}) + in + (s, transfer) + end + + + val lockstmt = Statement.PrimApp {args = Vector.new1 (Operand.Runtime FLLock), + dst = NONE, + prim = Prim.lockfl} - datatype z = datatype Runtime.GCField.t + val unlockstmt = Statement.PrimApp {args = Vector.new1 (Operand.Runtime FLLock), + dst = NONE, + prim = Prim.unlockfl} - fun decFreeChunks n = + fun blockingGC blLbl check = let - val flChunks = Operand.Runtime FLChunks - val res = Var.newNoname () - val resTy = Operand.ty flChunks + val return = Label.newNoname () + val (ss, ts) = primApp (Prim.wordLt (WordSize.csize (), {signed = false}), + Operand.Runtime FLChunks, + Operand.constWord chunksNeeded (WordSize.csize ()), + {ifTrue=blLbl, ifFalse=check}) in - [Statement.PrimApp {args = (Vector.new2 - (flChunks, Operand.constWord n (WordSize.word32))), - dst = SOME (res, resTy), - prim = Prim.wordSub WordSize.word32}, - Statement.Move {dst = flChunks, - src = Operand.Var {ty = resTy, var = res}}] - end + [ Block.T {args = Vector.new0 (), + kind = Kind.Jump, + label = blLbl, + statements = Vector.new1 (unlockstmt), + transfer = (Transfer.CCall + {args = Vector.new4 (Operand.GCState, + (Operand.word + (WordX.zero (WordSize.csize ()))), + Operand.bool true, + Operand.bool true), + func = func, + return = SOME return})} + , Block.T { args = Vector.new0 () + , kind = Kind.CReturn {func = func} + , label = return + , statements = Vector.new2 (lockstmt,ss) + , transfer = ts} ] - fun incReserved n = - let - val reserved = Operand.Runtime Reserved - val res = Var.newNoname () - val resTy = Operand.ty reserved - in - [Statement.PrimApp {args = (Vector.new2 - (reserved, Operand.constWord n (WordSize.word32))), - dst = SOME (res, resTy), - prim = Prim.wordAdd WordSize.word32}, - Statement.Move {dst = reserved, - src = Operand.Var {ty = resTy, var = res}}] end - fun primApp (prim, op1, op2, {ifTrue, ifFalse}) = + + val startBlock = let + val check = Label.newNoname () + val block = Label.newNoname () + val reserved = Operand.Runtime Reserved val res = Var.newNoname () - val s = - Statement.PrimApp {args = Vector.new2 (op1, op2), - dst = SOME (res, Type.bool), - prim = prim} - val transfer = - Transfer.ifBool - (Operand.Var {var = res, ty = Type.bool}, - {falsee = ifFalse, - truee = ifTrue}) - in - (s, transfer) - end - - - val lockstmt = Statement.PrimApp {args = Vector.new1 (Operand.Runtime FLLock), - dst = NONE, - prim = Prim.lockfl} - - val unlockstmt = Statement.PrimApp {args = Vector.new1 (Operand.Runtime FLLock), - dst = NONE, - prim = Prim.unlockfl} - - fun blockingGC blLbl check = - let - val return = Label.newNoname () - val (ss, ts) = primApp (Prim.wordLt (WordSize.csize (), {signed = false}), - Operand.Runtime FLChunks, - Operand.constWord chunksNeeded (WordSize.csize ()), - {ifTrue=blLbl, ifFalse=check}) - in - [ Block.T {args = Vector.new0 (), - kind = Kind.Jump, - label = blLbl, - statements = Vector.new1 (unlockstmt), - transfer = (Transfer.CCall - {args = Vector.new4 (Operand.GCState, - (Operand.word - (WordX.zero (WordSize.csize ()))), - Operand.bool true, - Operand.bool true), - func = func, - return = SOME return})} - , Block.T { args = Vector.new0 () - , kind = Kind.CReturn {func = func} - , label = return - , statements = Vector.new2 (lockstmt,ss) - , transfer = ts} ] - - - end - - - - val startBlock = - let - val check = Label.newNoname () - val block = Label.newNoname () - val reserved = Operand.Runtime Reserved - val res = Var.newNoname () - val resTy = Operand.ty reserved - val sAdd = Statement.PrimApp {args = (Vector.new2 - (reserved, Operand.constWord chunksNeeded (WordSize.word32))), - dst = SOME (res, resTy), - prim = Prim.wordAdd WordSize.word32} - - val (ss, ts) = primApp (Prim.wordLt (WordSize.csize (), {signed = false}), - Operand.Runtime FLChunks, - Operand.Var {var = res, ty = resTy}, - {ifTrue=block, ifFalse=check}) - - val (ss2, ts2) = primApp (Prim.wordLt (WordSize.csize (), {signed = false}), - Operand.Runtime FLChunks, - Operand.Runtime HeuristicChunks, - {ifTrue=collect, ifFalse=dontCollect}) + val resTy = Operand.ty reserved + val sAdd = Statement.PrimApp {args = (Vector.new2 + (reserved, Operand.constWord chunksNeeded (WordSize.word32))), + dst = SOME (res, resTy), + prim = Prim.wordAdd WordSize.word32} + + val (ss, ts) = primApp (Prim.wordLt (WordSize.csize (), {signed = false}), + Operand.Runtime FLChunks, + Operand.Var {var = res, ty = resTy}, + {ifTrue=block, ifFalse=check}) + + val (ss2, ts2) = primApp (Prim.wordLt (WordSize.csize (), {signed = false}), + Operand.Runtime FLChunks, + Operand.Runtime HeuristicChunks, + {ifTrue=collect, ifFalse=dontCollect}) in - [ Block.T { args = args - , kind = kind - , label = label - , statements = Vector.new3 (lockstmt,sAdd,ss) - , transfer = ts } - , - Block.T { args = Vector.new0 () - , kind = Kind.Jump - , label = check - , statements = Vector.fromList ([ss2] @ (incReserved - chunksNeeded) - @[ unlockstmt]) - , transfer = ts2 } - ] @ blockingGC block check + [ Block.T { args = args + , kind = kind + , label = label + , statements = Vector.new3 (lockstmt,sAdd,ss) + , transfer = ts } + , + Block.T { args = Vector.new0 () + , kind = Kind.Jump + , label = check + , statements = Vector.fromList ([ss2] @ (incReserved + chunksNeeded) + @[ unlockstmt]) + , transfer = ts2 } + ] @ blockingGC block check end in @@ -222,6 +222,14 @@ struct , transfer = transfer }] end + (* + This function is applied to each function in the program. + + "Function.dest f" is defined in mlton/backend/rssa.sig + it matches the pattern of rssa.Function and extracts the + fields. it 'destructs' f into its component fields. + + *) fun handleFunction (f: Function.t): Function.t = let val {args, blocks, name, raises, returns, start} = Function.dest f @@ -239,6 +247,10 @@ struct , start = start } end + (* + Create a new program, replacing the functions with a new list of functions + where each has been transformed using handleFunction + *) fun transform (program as Program.T {functions, handlesSignals, main, objectTypes}) = Program.T { functions = List.map (functions, handleFunction) , handlesSignals = handlesSignals From f4154afbe9886cac4b6ea2efe2a6505492ceb63a Mon Sep 17 00:00:00 2001 From: jeff murphy Date: Sat, 5 Feb 2022 23:27:51 -0500 Subject: [PATCH 11/39] add used field to chunk --- include/c-chunk.h | 3 +++ runtime/gc/umheap.c | 3 ++- runtime/gc/umheap.h | 6 ++++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/include/c-chunk.h b/include/c-chunk.h index aba712279..285260463 100755 --- a/include/c-chunk.h +++ b/include/c-chunk.h @@ -293,6 +293,8 @@ void um_dumpFrame (void *s, void *f); typedef uintptr_t GC_returnAddress; typedef uintptr_t pointer; +// must match umheap.h + typedef struct GC_UM_Chunk { unsigned char ml_object[UM_CHUNK_PAYLOAD_SIZE + UM_CHUNK_PAYLOAD_SAFE_REGION]; Word32_t chunk_header; @@ -300,6 +302,7 @@ typedef struct GC_UM_Chunk { GC_returnAddress ra; GC_returnAddress handler; GC_returnAddress link; + size_t used; struct GC_UM_Chunk* next_chunk; struct GC_UM_Chunk* prev_chunk; }; diff --git a/runtime/gc/umheap.c b/runtime/gc/umheap.c index 62da6c453..0331deb60 100755 --- a/runtime/gc/umheap.c +++ b/runtime/gc/umheap.c @@ -42,6 +42,7 @@ GC_UM_Chunk allocNextChunk(GC_state s, c->next_chunk = c->prev_chunk = NULL; c->sentinel = UM_CHUNK_SENTINEL; c->chunk_header = UM_CHUNK_HEADER_CLEAN; + c->used = 0; if (nc == NULL) { h->fl_head = NULL; @@ -155,7 +156,7 @@ GC_UM_Array_Chunk allocNextArrayChunk(GC_state s, h->fl_head = nc; } - memset(c, 0xAB, sizeof(struct GC_UM_Array_Chunk)); // jeff - remove + // memset(c, 0xAB, sizeof(struct GC_UM_Array_Chunk)); // debugging c->next_chunk = NULL; c->array_chunk_magic = UM_ARRAY_SENTINEL; c->array_chunk_header = UM_CHUNK_HEADER_CLEAN; diff --git a/runtime/gc/umheap.h b/runtime/gc/umheap.h index 490458808..7d6060d85 100644 --- a/runtime/gc/umheap.h +++ b/runtime/gc/umheap.h @@ -19,6 +19,7 @@ typedef struct UM_Mem_Chunk { struct UM_Mem_Chunk* next_chunk; } *UM_Mem_Chunk; +// a copy of this struct is also in c-chunk.h and must match exactly typedef struct GC_UM_Chunk { unsigned char ml_object[UM_CHUNK_PAYLOAD_SIZE + UM_CHUNK_PAYLOAD_SAFE_REGION]; /* 154 + 16 */ @@ -27,7 +28,8 @@ typedef struct GC_UM_Chunk { GC_returnAddress ra; /* +8 */ GC_returnAddress handler; /* +12 */ GC_returnAddress link; /* +16 */ - struct GC_UM_Chunk* next_chunk; /* +20 */ + size_t used; /* +20 */ + struct GC_UM_Chunk* next_chunk; /* +24 */ struct GC_UM_Chunk* prev_chunk; } *GC_UM_Chunk; @@ -46,7 +48,7 @@ struct GC_UM_Array_Chunk; typedef union GC_UM_Array_Payload { pointer um_array_pointers[UM_CHUNK_ARRAY_INTERNAL_POINTERS]; // 38 - um_constants.h - unsigned char ml_object[UM_CHUNK_ARRAY_PAYLOAD_SIZE]; // 152 - um_constants.h + unsigned char ml_object[UM_CHUNK_ARRAY_PAYLOAD_SIZE]; // 152 - um_constants.h } GC_UM_Array_Payload; /* The array chunk. It still has a portion of ml header... for object type From 80f4ffd9c40c4abee1a04db3d28b6de48fa98c87 Mon Sep 17 00:00:00 2001 From: jeff murphy Date: Sat, 5 Feb 2022 23:52:41 -0500 Subject: [PATCH 12/39] pass object size into um_object_alloc --- mlton/atoms/prim.fun | 2 +- mlton/backend/machine.fun | 5 +++-- runtime/gc/garbage-collection.c | 2 +- runtime/gc/new-object.c | 4 ++-- runtime/gc/um.c | 9 ++++++++- runtime/gc/um.h | 2 +- runtime/gc/weak.c | 4 ++-- 7 files changed, 18 insertions(+), 10 deletions(-) diff --git a/mlton/atoms/prim.fun b/mlton/atoms/prim.fun index 1bb3f81c2..53fa5ca57 100644 --- a/mlton/atoms/prim.fun +++ b/mlton/atoms/prim.fun @@ -1259,7 +1259,7 @@ fun 'a checkApp (prim: 'a t, | Array_update => oneTarg (fn t => (threeArgs (array t, seqIndex, t), unit)) | UM_Object_alloc => - noTargs (fn () => (nArgs (Vector.new4(cpointer, csize, word32, csize)), + noTargs (fn () => (nArgs (Vector.new5(cpointer, csize, word32, csize, csize)), cpointer)) | UM_CPointer_offset => noTargs (fn () => (nArgs (Vector.new4(cpointer, cpointer, diff --git a/mlton/backend/machine.fun b/mlton/backend/machine.fun index 2ad1e2f78..9db13c427 100755 --- a/mlton/backend/machine.fun +++ b/mlton/backend/machine.fun @@ -494,10 +494,11 @@ val _ = TextIO.output (TextIO.stdErr, Word (WordX.fromIntInf (Word.toIntInf w, WordSize.csize ())) in Vector.new2 - (PrimApp {args = Vector.new4 (GCState, + (PrimApp {args = Vector.new5 (GCState, wordOp numChunks, gcHeader, - bytes (Runtime.headerSize ())), + bytes (Runtime.headerSize ()), + bytes (size)), dst = SOME temp, prim = Prim.umObjectAlloc}, (* CHECK; if objptr <> cpointer, need non-trivial coercion here. *) diff --git a/runtime/gc/garbage-collection.c b/runtime/gc/garbage-collection.c index 41e3e0b1b..38d29bcd4 100755 --- a/runtime/gc/garbage-collection.c +++ b/runtime/gc/garbage-collection.c @@ -200,7 +200,7 @@ maybe_growstack(GC_state s, GC_thread thread, bool force_grow) { size_t need_chunks = max(thread->stackSizeInChunks * s->controls.ratios.stackCurrentGrow, 10); reserveAllocation(s, need_chunks); - pointer new_growth = UM_Object_alloc(s, need_chunks, GC_STACK_HEADER, GC_NORMAL_HEADER_SIZE); + pointer new_growth = UM_Object_alloc(s, need_chunks, GC_STACK_HEADER, GC_NORMAL_HEADER_SIZE, 0); GC_UM_Chunk new_growth_chunks = (GC_UM_Chunk)(new_growth - GC_HEADER_SIZE); GC_UM_Chunk c = (GC_UM_Chunk)(thread->firstFrame - GC_HEADER_SIZE); diff --git a/runtime/gc/new-object.c b/runtime/gc/new-object.c index f56e11cda..b4b4dc83d 100755 --- a/runtime/gc/new-object.c +++ b/runtime/gc/new-object.c @@ -70,7 +70,7 @@ objptr newStack_um(GC_state s, size_t stackSizeInBytes, size_t *stackSizeInChunk * Will block if not enough chunks available. */ reserveAllocation(s, need_chunks); - um_stack = UM_Object_alloc(s, need_chunks, GC_STACK_HEADER, GC_NORMAL_HEADER_SIZE); + um_stack = UM_Object_alloc(s, need_chunks, GC_STACK_HEADER, GC_NORMAL_HEADER_SIZE, 0); if (DEBUG_STACKS) { #ifdef STACK_GC_SANITY @@ -112,7 +112,7 @@ GC_thread newThread(GC_state s, size_t stackSize) { */ reserveAllocation(s, numchunks); - res = UM_Object_alloc(s, numchunks, GC_THREAD_HEADER, GC_NORMAL_HEADER_SIZE); + res = UM_Object_alloc(s, numchunks, GC_THREAD_HEADER, GC_NORMAL_HEADER_SIZE, sizeofThread(s)); // offsetofThread should be 0 thread = (GC_thread) (res + offsetofThread(s)); diff --git a/runtime/gc/um.c b/runtime/gc/um.c index d1cd03c96..bde6b965d 100755 --- a/runtime/gc/um.c +++ b/runtime/gc/um.c @@ -53,7 +53,14 @@ void reserveAllocation(GC_state s, size_t numChunksToRequest) { Pointer -UM_Object_alloc(GC_state gc_stat, C_Size_t num_chunks, uint32_t header, C_Size_t s) { +UM_Object_alloc(GC_state gc_stat, C_Size_t num_chunks, uint32_t header, C_Size_t s, C_Size_t sz) { + /* gc_stat: GC_State + num_chunks: number of chunks requested + header: the MLton object header + s: the size of the MLton object header + sz: the size of the object being placed into this chunk + this field only applies to 'normal' (not stacks) objects + */ GC_UM_Chunk chunk; assert (num_chunks > 0); diff --git a/runtime/gc/um.h b/runtime/gc/um.h index 2cd33d069..ca796c25c 100644 --- a/runtime/gc/um.h +++ b/runtime/gc/um.h @@ -4,7 +4,7 @@ Pointer UM_Chunk_Next_offset(GC_state gc_stat, Pointer p, C_Size_t o, C_Size_t s Pointer UM_Array_offset(GC_state gc_stat, Pointer base, C_Size_t index, C_Size_t elemSize, C_Size_t offset); Pointer UM_Object_alloc(GC_state gc_stat, C_Size_t num_chunks, uint32_t header, - C_Size_t s); + C_Size_t s, C_Size_t sz); void CompareAndSet(GC_state s, int lockOrUnlock); diff --git a/runtime/gc/weak.c b/runtime/gc/weak.c index 655192fcb..10df809a7 100644 --- a/runtime/gc/weak.c +++ b/runtime/gc/weak.c @@ -69,11 +69,11 @@ pointer GC_weakNew(GC_state s, GC_header header, pointer p) { /*Will block if there aren't enough chunks*/ reserveAllocation(s, 1); - res = UM_Object_alloc(s, 1 /* num chunks */, header, GC_NORMAL_HEADER_SIZE); + res = UM_Object_alloc(s, 1 /* num chunks */, header, GC_NORMAL_HEADER_SIZE, 0); // JEFF weak = (GC_weak)(res + offsetofWeak(s)); weak->objptr = pointerToObjptr(p, s->umheap.start); - if (DEBUG_WEAK) + if (DEBUG_WEAK || 1) fprintf(stderr, FMTPTR " = GC_weakNew (" FMTHDR From a541b681d53734d9a00c31e04c96dda83522a352 Mon Sep 17 00:00:00 2001 From: jeff murphy Date: Sun, 6 Feb 2022 19:58:31 -0500 Subject: [PATCH 13/39] add activeChunk gc field --- mlton/main/lookup-constant.fun | 3 ++- runtime/gc/debug.h | 1 + runtime/gc/gc_state.h | 1 + runtime/gc/init.c | 1 + runtime/gc/object.h | 9 +++++++++ runtime/gc/um.c | 6 ++++++ 6 files changed, 20 insertions(+), 1 deletion(-) diff --git a/mlton/main/lookup-constant.fun b/mlton/main/lookup-constant.fun index b4101fa31..aa0f79058 100755 --- a/mlton/main/lookup-constant.fun +++ b/mlton/main/lookup-constant.fun @@ -64,7 +64,8 @@ val gcFields = "heuristicChunks", "rtSync", "fl_lock", - "reserved" + "reserved", + "activeChunk" ] val gcFieldsOffsets = diff --git a/runtime/gc/debug.h b/runtime/gc/debug.h index 13d8a00fc..b40103bc8 100755 --- a/runtime/gc/debug.h +++ b/runtime/gc/debug.h @@ -13,6 +13,7 @@ //#define PROFILE_UMGC enum { + DEBUG_ALLOC = TRUE, DEBUG_ARRAY = FALSE, DEBUG_ARRAY_OFFSET = FALSE, DEBUG_CALL_STACK = FALSE, diff --git a/runtime/gc/gc_state.h b/runtime/gc/gc_state.h index 7589848f8..9fb605739 100755 --- a/runtime/gc/gc_state.h +++ b/runtime/gc/gc_state.h @@ -101,6 +101,7 @@ struct GC_state { /* added for rt-threading */ pthread_t *realtimeThreads[MAXPRI]; + objptr activeChunk[MAXPRI]; volatile bool mainBooted; /* Begin inter-thread GC communication data */ volatile bool GCrunnerRunning; diff --git a/runtime/gc/init.c b/runtime/gc/init.c index c08f64864..f881bdb83 100644 --- a/runtime/gc/init.c +++ b/runtime/gc/init.c @@ -426,6 +426,7 @@ int GC_init(GC_state s, int argc, char **argv) { s->savedThread[__i] = BOGUS_OBJPTR; s->signalHandlerThread[__i] = BOGUS_OBJPTR; s->gcCallSeq[__i] = -1; + s->activeChunk[__i] = BOGUS_OBJPTR; /*For now permanently set the rt threads to true*/ if (__i < 2) diff --git a/runtime/gc/object.h b/runtime/gc/object.h index b31629366..e3cf4216d 100644 --- a/runtime/gc/object.h +++ b/runtime/gc/object.h @@ -37,11 +37,20 @@ static const char* objectTypeTagToString (GC_objectTypeTag tag); * Each object has a header, which immediately precedes the object data. * A header has the following bit layout: * + * MLton: + * * 00 : 1 * 01 - 19 : type index bits, index into GC_state->objectTypes. * 20 - 30 : counter bits, used by mark compact GC (initially 0) * 31 : mark bit, used by mark compact GC (initially 0) * 32 - 63 : 0wx00000000 (only w/ 64-bit header) + * + * RTMLton: + * + * 00 : 1 + * 01 - 19 : type index bits, index into GC_state->objectTypes. + * 20 - 31 : offset of this field from start of region/chunk + * 32 - 63 : 0wx00000000 (only w/ 64-bit header) */ #define GC_HEADER_TYPE__(z) uint ## z ## _t diff --git a/runtime/gc/um.c b/runtime/gc/um.c index bde6b965d..b53812143 100755 --- a/runtime/gc/um.c +++ b/runtime/gc/um.c @@ -65,6 +65,12 @@ UM_Object_alloc(GC_state gc_stat, C_Size_t num_chunks, uint32_t header, C_Size_t assert (num_chunks > 0); + if (DEBUG_ALLOC) { + GC_objectTypeTag tagRet; + splitHeader(gc_stat, header, &tagRet, NULL, NULL, NULL); + fprintf(stderr, "%d] UM_Object_alloc hd:%x (%s) sz:%d\n", PTHREAD_NUM, header, objectTypeTagToString(tagRet), sz); + } + if (header == GC_STACK_HEADER) { chunk = allocateChunks(gc_stat, &(gc_stat->umheap), num_chunks, UM_STACK_CHUNK); } else { From a5f3abd6fc7dbc6e284078c7a81979255d3fd762 Mon Sep 17 00:00:00 2001 From: jeff murphy Date: Wed, 16 Feb 2022 16:49:26 -0500 Subject: [PATCH 14/39] packing stage 1, commit contains debugging output --- mlton/backend/machine.fun | 2 +- runtime/gc/gc_state.c | 2 +- runtime/gc/gc_state.h | 4 +- runtime/gc/init.c | 22 +++-- runtime/gc/new-object.c | 2 +- runtime/gc/object.c | 5 +- runtime/gc/object.h | 9 +++ runtime/gc/um.c | 166 +++++++++++++++++++++++++++++++++----- runtime/gc/um.h | 3 +- 9 files changed, 183 insertions(+), 32 deletions(-) diff --git a/mlton/backend/machine.fun b/mlton/backend/machine.fun index 9db13c427..4bb1fcf74 100755 --- a/mlton/backend/machine.fun +++ b/mlton/backend/machine.fun @@ -454,7 +454,7 @@ structure Statement = fun bytes (b: Bytes.t): Operand.t = Word (WordX.fromIntInf (Bytes.toIntInf b, WordSize.csize ())) val temp = Register (Register.new (Type.cpointer (), NONE)) - val _ = print "Hmm! fiddling frontier!" + val _ = TextIO.output (TextIO.stdErr, "Hmm! fiddling frontier! (machine.fun)\n") in Vector.new4 (Move {dst = Contents {oper = Frontier, diff --git a/runtime/gc/gc_state.c b/runtime/gc/gc_state.c index 25455a960..836529fff 100755 --- a/runtime/gc/gc_state.c +++ b/runtime/gc/gc_state.c @@ -210,7 +210,7 @@ pointer GC_getCallFromCHandlerThread(GC_state s) { void GC_setCallFromCHandlerThread(GC_state s, pointer p) { objptr op = pointerToObjptr(p, s->umheap.start); s->callFromCHandlerThread[PTHREAD_NUM] = op; - if (DEBUG_THREADS) + if (1||DEBUG_THREADS) fprintf(stderr, "%d] "PURPLE("call handler set")": "FMTPTR"\n", PTHREAD_NUM, (uintptr_t)op); GC_copyCurrentThread(s, false); //LOCK_RT_TH; diff --git a/runtime/gc/gc_state.h b/runtime/gc/gc_state.h index 9fb605739..1649dd8f4 100755 --- a/runtime/gc/gc_state.h +++ b/runtime/gc/gc_state.h @@ -101,7 +101,9 @@ struct GC_state { /* added for rt-threading */ pthread_t *realtimeThreads[MAXPRI]; - objptr activeChunk[MAXPRI]; + pointer activeChunk[MAXPRI]; + bool packingStage1Enabled, packingStage2Enabled; + volatile bool mainBooted; /* Begin inter-thread GC communication data */ volatile bool GCrunnerRunning; diff --git a/runtime/gc/init.c b/runtime/gc/init.c index f881bdb83..1cad5788e 100644 --- a/runtime/gc/init.c +++ b/runtime/gc/init.c @@ -297,12 +297,22 @@ int processAtMLton(GC_state s, int start, int argc, char **argv, if (i == argc) die("@MLton gc-onebyone missing argument."); s->oneByOne = stringToBool(argv[i++]); - }else if (0 == strcmp(arg, "rtthreads")) { + } else if (0 == strcmp(arg, "rtthreads")) { i++; if (i == argc) die("@MLton rtthreads missing argument."); s->useRTThreads = stringToBool(argv[i++]); - }else if (0 == strcmp(arg, "use-mmap")) { + } else if (0 == strcmp(arg, "packingstage1")) { + i++; + if (i == argc) + die("@MLton packingstage1 missing argument."); + s->packingStage1Enabled = stringToBool(argv[i++]); + } else if (0 == strcmp(arg, "packingstage2")) { + i++; + if (i == argc) + die("@MLton packingstage2 missing argument."); + s->packingStage2Enabled = stringToBool(argv[i++]); + } else if (0 == strcmp(arg, "use-mmap")) { i++; if (i == argc) die("@MLton use-mmap missing argument."); @@ -405,13 +415,15 @@ int GC_init(GC_state s, int argc, char **argv) { s->allocedByRT = 0; s->numAllocedByRT = 0; s->oneByOne = false; - s->useRTThreads = false; + s->useRTThreads = false; + s->packingStage1Enabled = false; + s->packingStage2Enabled = false; s->wl_size = 10000; s->wl_length = 0; pthread_mutex_init(&s->wl_lock, NULL); - s->worklist = malloc(s->wl_size * sizeof(objptr * )); + s->worklist = malloc(s->wl_size * sizeof(objptr *)); s->casLock = -1; @@ -426,7 +438,7 @@ int GC_init(GC_state s, int argc, char **argv) { s->savedThread[__i] = BOGUS_OBJPTR; s->signalHandlerThread[__i] = BOGUS_OBJPTR; s->gcCallSeq[__i] = -1; - s->activeChunk[__i] = BOGUS_OBJPTR; + s->activeChunk[__i] = BOGUS_POINTER; /*For now permanently set the rt threads to true*/ if (__i < 2) diff --git a/runtime/gc/new-object.c b/runtime/gc/new-object.c index b4b4dc83d..619020ac8 100755 --- a/runtime/gc/new-object.c +++ b/runtime/gc/new-object.c @@ -123,7 +123,7 @@ GC_thread newThread(GC_state s, size_t stackSize) { thread->stackDepth = 0; thread->markCycles = 0; - if (DEBUG_THREADS) + if (1||DEBUG_THREADS) fprintf(stderr, "%d] newThread(stackSize=%"PRIuMAX") = "FMTPTR"\n", PTHREAD_NUM, (uintmax_t)stackSize, (uintptr_t) thread); diff --git a/runtime/gc/object.c b/runtime/gc/object.c index 2833d635b..866ef107b 100755 --- a/runtime/gc/object.c +++ b/runtime/gc/object.c @@ -72,8 +72,7 @@ void splitHeader(GC_state s, GC_header header, hasIdentity = objectType->hasIdentity; bytesNonObjptrs = objectType->bytesNonObjptrs; numObjptrs = objectType->numObjptrs; -/* - if (DEBUG_DETAILED) + if (DEBUG_DETAILED) fprintf (stderr, "%d] splitHeader ("FMTHDR")" " objectTypeIndex = %u" @@ -87,7 +86,7 @@ void splitHeader(GC_state s, GC_header header, objectTypeTagToString(tag), boolToString(hasIdentity), bytesNonObjptrs, numObjptrs); -*/ + if (tagRet != NULL) *tagRet = tag; if (hasIdentityRet != NULL) diff --git a/runtime/gc/object.h b/runtime/gc/object.h index e3cf4216d..ffa6e6af2 100644 --- a/runtime/gc/object.h +++ b/runtime/gc/object.h @@ -70,9 +70,18 @@ COMPILE_TIME_ASSERT(sizeof_objptr__eq__sizeof_header, #define TYPE_INDEX_BITS 19 #define TYPE_INDEX_MASK ((GC_header)0x000FFFFE) #define TYPE_INDEX_SHIFT 1 +#if 0 +// these not used anymore #define COUNTER_BITS 10 #define COUNTER_MASK ((GC_header)0x7FF00000) #define COUNTER_SHIFT 20 +#endif +// and are replaced with these used by packing +#define CHUNKOFFSET_BITS 10 +#define CHUNKOFFSET_MASK ((GC_header)0x7FF00000) +#define CHUNKOFFSET_SHIFT 20 +#define CHUNKOFFSET(x) (((GC_header)x & CHUNKOFFSET_MASK)>>CHUNKOFFSET_BITS) + #define MARK_BITS 1 #define MARK_MASK ((GC_header)0x80000000) #define MARK_SHIFT 31 diff --git a/runtime/gc/um.c b/runtime/gc/um.c index b53812143..0efbb5ed7 100755 --- a/runtime/gc/um.c +++ b/runtime/gc/um.c @@ -51,34 +51,16 @@ void reserveAllocation(GC_state s, size_t numChunksToRequest) { } - Pointer -UM_Object_alloc(GC_state gc_stat, C_Size_t num_chunks, uint32_t header, C_Size_t s, C_Size_t sz) { - /* gc_stat: GC_State - num_chunks: number of chunks requested - header: the MLton object header - s: the size of the MLton object header - sz: the size of the object being placed into this chunk - this field only applies to 'normal' (not stacks) objects - */ +UM_Object_alloc_no_packing(GC_state gc_stat, C_Size_t num_chunks, uint32_t header, C_Size_t s) { GC_UM_Chunk chunk; - assert (num_chunks > 0); - - if (DEBUG_ALLOC) { - GC_objectTypeTag tagRet; - splitHeader(gc_stat, header, &tagRet, NULL, NULL, NULL); - fprintf(stderr, "%d] UM_Object_alloc hd:%x (%s) sz:%d\n", PTHREAD_NUM, header, objectTypeTagToString(tagRet), sz); - } - if (header == GC_STACK_HEADER) { chunk = allocateChunks(gc_stat, &(gc_stat->umheap), num_chunks, UM_STACK_CHUNK); } else { chunk = allocateChunks(gc_stat, &(gc_stat->umheap), num_chunks, UM_NORMAL_CHUNK); } - assert(header != 0); - // apply object header to all chunks in the chain GC_UM_Chunk current = chunk; for (int i = 0; i < num_chunks; i++) { @@ -97,6 +79,152 @@ UM_Object_alloc(GC_state gc_stat, C_Size_t num_chunks, uint32_t header, C_Size_t return (Pointer) (chunk->ml_object + s); } +Pointer +UM_Object_alloc_packing_stage1(GC_state gc_stat, C_Size_t num_chunks, uint32_t header, C_Size_t s, C_Size_t sz) { + GC_UM_Chunk chunk = NULL; + + // packing stage 1 (same thread can pack with its own regions) + + /* array allocs do not occur in this function. stack, thread, weak allocs are never packed. */ + + assert (header != GC_THREAD_HEADER); + assert (header != GC_STACK_HEADER); + assert (header != GC_WEAK_GONE_HEADER); + + /* not a stack alloc. if we have an active chunk, pack into it. + * if we do not have room, we will alloc a new chunk + */ + assert (num_chunks == 1); + + if (gc_stat->activeChunk[PTHREAD_NUM] != BOGUS_POINTER) { + chunk = (GC_UM_Chunk)gc_stat->activeChunk[PTHREAD_NUM]; + fprintf(stderr, "%d] there's an activeChunk. used %d\n", PTHREAD_NUM, chunk->used); + + /* if cur chunk has no room left, then alloc a new one */ + + if (chunk->used + sz + s > UM_CHUNK_PAYLOAD_SIZE) { + fprintf(stderr, "%d] no space in active chunk, allocating a new one\n", PTHREAD_NUM); + chunk = allocateChunks(gc_stat, &(gc_stat->umheap), num_chunks, UM_NORMAL_CHUNK); + gc_stat->activeChunk[PTHREAD_NUM] = (Pointer)chunk; + } + else { + fprintf(stderr, "%d] there is space in this chunk (%u) to fit our object (%d)\n", + PTHREAD_NUM, + UM_CHUNK_PAYLOAD_SIZE-(chunk->used), sz+s + ); + } + } + else { + fprintf(stderr, "%d] no activeChunk, allocating one.\n", PTHREAD_NUM); + chunk = allocateChunks(gc_stat, &(gc_stat->umheap), num_chunks, UM_NORMAL_CHUNK); + gc_stat->activeChunk[PTHREAD_NUM] = (Pointer)chunk; + } + + /* + the first object is at the start of the chunk, but is offset by + 's'. we want the header offset field to contain 0. so we do + + header = *(objptr - s); + offset = extract from header; + start of chunk = objptr - offset; (note offset includes s) + + if another object is appended, we want the header offset to contain + N, where N is the accumulation of previous (s+sz) objects as well + as the current s, but not the current sz + + so if we use the chunk->used field to indicate how much of the + chunk is in use, it should contain the sum of all of the previous + (sz+s) values, but not the current s or sz. we will add the current + s to used, and store that into the header offset. we then add our + (s+sz) to chunk->used, and then return chunk->used-sz so we mimic the + behavior of returning the memory address just after the object + header field. + */ + int used = chunk->used; + header |= ((used+s)<used += (sz + s); + + // the following line violates C aliasing rules (undefined behavior): + // *((uint32_t*) chunk->ml_object) = header; + + uint32_t *alias = (uint32_t *)(chunk->ml_object + used); + *alias = header; + return (Pointer) (chunk->ml_object + s + used); + +} + + +Pointer +UM_Object_alloc(GC_state gc_stat, C_Size_t num_chunks, uint32_t header, C_Size_t s, C_Size_t sz) { + /* gc_stat: GC_State + num_chunks: number of chunks requested + header: the MLton object header + s: the size of the MLton object header + sz: the size of the object being placed into this chunk + this field only applies to 'normal' (not stacks) objects + + This does: + + no-packing if gcstate.packingStage1Enabled is false. In this mode, + each mlton object is mapped to an individual chunk. This is how RTMLton behaved + in our papers upto 2021. this is also the default behavior if these runtime + options are not specified. + + per-thread packing if gcstate.packingStage1Enabled is true and packingStage1Enabled is false. + In this case, once a chunk is allocated, we save a ref to it (gcstate.activechunk[tnum]) + and keep track of how much of it is used. we continue to write new object headers into it + until it is out of space, at which point we allocate a new chunk. since objptrs will be + stashed on the stack, and stack walking will populate the worklist, we need to save which + chunk we are in so the stack walking worklist can contain only chunks and not individual + object pointers. we do this by saving the offset to the chunk header in the object header + fields. see object.h for details. + + cross-thread packing if gcstate.packingStage1Enabled is true and packingStage1Enabled is true. + In this case, each thread passes in a period counter (id) which is calculated from the + current clock div the hyperperiod of the tasks. threads are allowed to place objects into + other threads' chunks (activechunk) before allocated a new chunk for themselves. + */ + Pointer p; + GC_objectTypeTag tagRet; + unsigned int objectTypeIndex = (header & TYPE_INDEX_MASK) >> TYPE_INDEX_SHIFT; + splitHeader(gc_stat, header, &tagRet, NULL, NULL, NULL); + + assert (num_chunks > 0); + assert (header != 0); + + if (DEBUG_ALLOC) { + fprintf(stderr, "%d] UM_Object_alloc %s numchk:%u hd:%d (%s [%d] index:%u) sz:%d\n", + PTHREAD_NUM, + (header == GC_THREAD_HEADER)?"*** thread ***":"", + num_chunks, + header, objectTypeTagToString(tagRet), tagRet, objectTypeIndex, sz); + } + + // no-packing. in order for stage2 to occur, stage1 must be enabled + if (header < 40 || header > 98) { + if (header != GC_WORD8_VECTOR_HEADER || header == GC_THREAD_HEADER + || header == GC_STACK_HEADER + || header == GC_WEAK_GONE_HEADER + || gc_stat->packingStage1Enabled == false) { + fprintf(stderr, "** me=%d THR %d WEAK %d STACK %d\n", header, + GC_THREAD_HEADER, GC_WEAK_GONE_HEADER, GC_STACK_HEADER + ); + fprintf(stderr, RED("** no packing for this type\n")); + p = UM_Object_alloc_no_packing(gc_stat, num_chunks, header, s); + fprintf(stderr, " p = %x\n", (unsigned int)p); + return p; + } + } + fprintf(stderr, YELLOW("** going to pack %d\n"), header); + + // stage2 packing (if enabled) occurs as a part of stage1. + + p = UM_Object_alloc_packing_stage1(gc_stat, num_chunks, header, s, sz); + fprintf(stderr, " p = %x\n", (unsigned int)p); + return p; + +} + Pointer UM_Chunk_Next_offset(GC_state gc_stat, Pointer p, C_Size_t o, C_Size_t s) { diff --git a/runtime/gc/um.h b/runtime/gc/um.h index ca796c25c..74e7b7a2d 100644 --- a/runtime/gc/um.h +++ b/runtime/gc/um.h @@ -5,7 +5,8 @@ Pointer UM_Array_offset(GC_state gc_stat, Pointer base, C_Size_t index, C_Size_t elemSize, C_Size_t offset); Pointer UM_Object_alloc(GC_state gc_stat, C_Size_t num_chunks, uint32_t header, C_Size_t s, C_Size_t sz); - +Pointer UM_Object_alloc_no_packing(GC_state gc_stat, C_Size_t num_chunks, uint32_t header, C_Size_t s); +Pointer UM_Object_alloc_packing_stage1(GC_state gc_stat, C_Size_t num_chunks, uint32_t header, C_Size_t s, C_Size_t sz); void CompareAndSet(GC_state s, int lockOrUnlock); bool CompareExchange(volatile int *ptr, int expected, int desired); From 46709f4c4563d4f2f4adc2dd7a867dea1ec3692f Mon Sep 17 00:00:00 2001 From: jeff murphy Date: Wed, 16 Feb 2022 18:41:05 -0500 Subject: [PATCH 15/39] add instrumentation to runtime --- runtime/gc/done.c | 2 +- runtime/gc/garbage-collection.c | 7 ++++++- runtime/gc/um.c | 20 +++++++++++++++++--- runtime/gc/umarray-allocate.c | 2 ++ ub/justprint.sml | 7 +++++++ 5 files changed, 33 insertions(+), 5 deletions(-) diff --git a/runtime/gc/done.c b/runtime/gc/done.c index 9fb00d0d3..b6f3a2bca 100755 --- a/runtime/gc/done.c +++ b/runtime/gc/done.c @@ -90,7 +90,7 @@ void RTGC_done(GC_state s) { free(s->worklist); - if (DISPLAY_GC_STATS) + if (DISPLAY_GC_STATS || s->controls.summary) displayChunkedGCStats(s, out); } __attribute__((noreturn)) diff --git a/runtime/gc/garbage-collection.c b/runtime/gc/garbage-collection.c index 38d29bcd4..6ec4c076c 100755 --- a/runtime/gc/garbage-collection.c +++ b/runtime/gc/garbage-collection.c @@ -331,6 +331,7 @@ void *GCrunner(void *_s) { assert(s->dirty); + User_instrument(30); /* JEFF */ if (DEBUG_RTGC) { fprintf(stderr, "%d] [RTGC: Starting cycle #%s]\n", PTHREAD_NUM, @@ -383,6 +384,8 @@ void *GCrunner(void *_s) { uintmaxToCommaString(s->cGCStats.numGCCycles)); } + User_instrument(30); /* JEFF */ + //not_dirty:; RTSYNC_UNLOCK; @@ -595,7 +598,7 @@ void sweep(GC_state s, size_t ensureObjectChunksAvailable, } else /*Unmarked Chunk*/ { assert(ISUNMARKED(header)); - +User_instrument(14); /* JEFF */ if (DEBUG_MEM or DEBUG_RTGC) { fprintf(stderr, "%d] Collecting: " FMTPTR @@ -669,6 +672,8 @@ void sweep(GC_state s, size_t ensureObjectChunksAvailable, } else { + User_instrument(15); /* JEFF */ + if (DEBUG_MEM or DEBUG_RTGC) { fprintf(stderr, "%d] Collecting array: " FMTPTR diff --git a/runtime/gc/um.c b/runtime/gc/um.c index 0efbb5ed7..9149b4e4f 100755 --- a/runtime/gc/um.c +++ b/runtime/gc/um.c @@ -82,6 +82,8 @@ UM_Object_alloc_no_packing(GC_state gc_stat, C_Size_t num_chunks, uint32_t heade Pointer UM_Object_alloc_packing_stage1(GC_state gc_stat, C_Size_t num_chunks, uint32_t header, C_Size_t s, C_Size_t sz) { GC_UM_Chunk chunk = NULL; + + User_instrument(13); /* JEFF */ // packing stage 1 (same thread can pack with its own regions) @@ -150,7 +152,6 @@ UM_Object_alloc_packing_stage1(GC_state gc_stat, C_Size_t num_chunks, uint32_t h uint32_t *alias = (uint32_t *)(chunk->ml_object + used); *alias = header; return (Pointer) (chunk->ml_object + s + used); - } @@ -201,20 +202,33 @@ UM_Object_alloc(GC_state gc_stat, C_Size_t num_chunks, uint32_t header, C_Size_t } // no-packing. in order for stage2 to occur, stage1 must be enabled + + if (gc_stat->packingStage1Enabled == false) { + if (header == GC_STACK_HEADER) User_instrument(10); /* JEFF */ + else User_instrument(12); /* JEFF */ + return UM_Object_alloc_no_packing(gc_stat, num_chunks, header, s); + } + + /* packing enabled, but we only pack some objects types */ + if (header < 40 || header > 98) { if (header != GC_WORD8_VECTOR_HEADER || header == GC_THREAD_HEADER || header == GC_STACK_HEADER - || header == GC_WEAK_GONE_HEADER - || gc_stat->packingStage1Enabled == false) { + || header == GC_WEAK_GONE_HEADER) { fprintf(stderr, "** me=%d THR %d WEAK %d STACK %d\n", header, GC_THREAD_HEADER, GC_WEAK_GONE_HEADER, GC_STACK_HEADER ); + + if (header == GC_STACK_HEADER) User_instrument(10); /* JEFF */ + else User_instrument(12); /* JEFF */ + fprintf(stderr, RED("** no packing for this type\n")); p = UM_Object_alloc_no_packing(gc_stat, num_chunks, header, s); fprintf(stderr, " p = %x\n", (unsigned int)p); return p; } } + fprintf(stderr, YELLOW("** going to pack %d\n"), header); // stage2 packing (if enabled) occurs as a part of stage1. diff --git a/runtime/gc/umarray-allocate.c b/runtime/gc/umarray-allocate.c index 6f8d14b64..a8f7da71d 100644 --- a/runtime/gc/umarray-allocate.c +++ b/runtime/gc/umarray-allocate.c @@ -204,6 +204,8 @@ pointer GC_arrayAllocate(GC_state s, /* calc number of leaves */ + User_instrument(11); /* JEFF */ + splitHeader(s, header, NULL, NULL, &bytesNonObjptrs, &numObjptrs); bytesPerElement = bytesNonObjptrs + (numObjptrs * OBJPTR_SIZE); diff --git a/ub/justprint.sml b/ub/justprint.sml index 117e55a7a..e10a1aaf3 100755 --- a/ub/justprint.sml +++ b/ub/justprint.sml @@ -1,2 +1,9 @@ val _ = print "something\n" val _ = print "more stuff\n" + +open MLton.PrimThread + +(* arg is thread number *) +val _ = ( dump_instrument_stderr 0; + dump_instrument_stderr 1) + From cae77d7aacff931756dffaf4b1c2b37147ca3a30 Mon Sep 17 00:00:00 2001 From: jeff murphy Date: Tue, 22 Feb 2022 16:32:19 -0500 Subject: [PATCH 16/39] packing --- runtime/gc/debug.h | 9 ++-- runtime/gc/foreach.c | 24 +++++----- runtime/gc/garbage-collection.c | 8 ++-- runtime/gc/object.c | 2 + runtime/gc/object.h | 2 +- runtime/gc/um.c | 78 ++++++++++++++++++++------------- runtime/gc/ummark.c | 46 ++++++++++++++++--- 7 files changed, 113 insertions(+), 56 deletions(-) diff --git a/runtime/gc/debug.h b/runtime/gc/debug.h index b40103bc8..755c23beb 100755 --- a/runtime/gc/debug.h +++ b/runtime/gc/debug.h @@ -13,14 +13,15 @@ //#define PROFILE_UMGC enum { - DEBUG_ALLOC = TRUE, + DEBUG_ALLOC = FALSE, + DEBUG_ALLOC_PACK = FALSE, DEBUG_ARRAY = FALSE, DEBUG_ARRAY_OFFSET = FALSE, DEBUG_CALL_STACK = FALSE, DEBUG_CARD_MARKING = FALSE, DEBUG_CHUNK_ARRAY = FALSE, DEBUG_DETAILED = FALSE, - DEBUG_DFS_MARK = FALSE, + DEBUG_DFS_MARK = TRUE, DEBUG_ENTER_LEAVE = FALSE, DEBUG_GENERATIONAL = FALSE, DEBUG_INT_INF = FALSE, @@ -42,8 +43,8 @@ enum { FORCE_GENERATIONAL = FALSE, FORCE_MARK_COMPACT = FALSE, DEBUG_OLD = FALSE, - DEBUG_RTGC = FALSE, - DEBUG_RTGC_MARKING = FALSE, + DEBUG_RTGC = TRUE, + DEBUG_RTGC_MARKING = TRUE, DEBUG_WB = FALSE, DISPLAY_GC_STATS = FALSE }; diff --git a/runtime/gc/foreach.c b/runtime/gc/foreach.c index 96aed501a..ab00157f7 100644 --- a/runtime/gc/foreach.c +++ b/runtime/gc/foreach.c @@ -90,20 +90,24 @@ pointer foreachObjptrInObject (GC_state s, pointer p, uint16_t bytesNonObjptrs = 0; uint16_t numObjptrs = 0; GC_objectTypeTag tag = ERROR_TAG; + int chunkOffset = 0; header = getHeader (p); + chunkOffset = CHUNKOFFSET(header); + splitHeader(s, header, &tag, NULL, &bytesNonObjptrs, &numObjptrs); - if (DEBUG_DETAILED) + if (1||DEBUG_DETAILED) fprintf (stderr, "%d] foreachObjptrInObject ("FMTPTR")" " header = "FMTHDR + " chunkOffset = %d " " tag = %s" " bytesNonObjptrs = %d" " numObjptrs = %d\n", PTHREAD_NUM, - (uintptr_t)p, header, objectTypeTagToString (tag), + (uintptr_t)p, header, chunkOffset, objectTypeTagToString (tag), bytesNonObjptrs, numObjptrs); if (NORMAL_TAG == tag) { - if (DEBUG_MEM) fprintf(stderr, "%d] "GREEN("marking normal\n"), PTHREAD_NUM); + if (DEBUG_MEM) fprintf(stderr, "%d] "GREEN("marking normal\n"), PTHREAD_NUM); if(!isObjectOnUMHeap(s,p)) { @@ -119,16 +123,16 @@ pointer foreachObjptrInObject (GC_state s, pointer p, pointer todo = UM_CPointer_offset(s, p, bytesNonObjptrs + i * OBJPTR_SIZE, OBJPTR_SIZE); - if (*(objptr*)todo == (objptr)NULL) { - fprintf(stderr, "%d] *TODO is null "FMTPTR"\n", - PTHREAD_NUM, (uintptr_t)todo); - } else { - callIfIsObjptr(s, f, (objptr *) todo); - } + if (*(objptr*)todo == (objptr)NULL) { + fprintf(stderr, "%d] *TODO is null "FMTPTR"\n", + PTHREAD_NUM, (uintptr_t)todo); + } else { + callIfIsObjptr(s, f, (objptr *) todo); + } } } else if (WEAK_TAG == tag) { - if (DEBUG_MEM) fprintf(stderr, "%d] "GREEN("marking weak\n"), PTHREAD_NUM); + if (DEBUG_MEM) fprintf(stderr, "%d] "GREEN("marking weak\n"), PTHREAD_NUM); p += bytesNonObjptrs; if (1 == numObjptrs) { diff --git a/runtime/gc/garbage-collection.c b/runtime/gc/garbage-collection.c index 6ec4c076c..2a93db669 100755 --- a/runtime/gc/garbage-collection.c +++ b/runtime/gc/garbage-collection.c @@ -602,8 +602,8 @@ User_instrument(14); /* JEFF */ if (DEBUG_MEM or DEBUG_RTGC) { fprintf(stderr, "%d] Collecting: " FMTPTR - ", %d, %d\n", PTHREAD_NUM, - (uintptr_t) pc, (int)pc->sentinel, (int)pc->chunk_header); + ", %d, %x\n", PTHREAD_NUM, + (uintptr_t) pc, (int)pc->sentinel, (unsigned int)pc->chunk_header); } //Set header of cleared object to magic number @@ -721,9 +721,9 @@ User_instrument(14); /* JEFF */ s->cGCStats.numSweeps++; if (DEBUG_RTGC) { - fprintf(stderr, "%d] Finished one sweep cycle and freed %d chunks\n", PTHREAD_NUM, freed); + fprintf(stderr, "%d] "GREEN("Finished one sweep cycle and freed %d chunks\n"), PTHREAD_NUM, freed); - fprintf(stderr, "%d] Chunks; Visited: %d, Marked: %d, Greys: %d Reds: %d\n", PTHREAD_NUM, visited, marked, grey, + fprintf(stderr, "%d] "GREEN("Chunks; Visited: %d, Marked: %d, Greys: %d Reds: %d\n"), PTHREAD_NUM, visited, marked, grey, red); } } diff --git a/runtime/gc/object.c b/runtime/gc/object.c index 866ef107b..8f14e97de 100755 --- a/runtime/gc/object.c +++ b/runtime/gc/object.c @@ -65,7 +65,9 @@ void splitHeader(GC_state s, GC_header header, assert (1 == (header & GC_VALID_HEADER_MASK)); + objectTypeIndex = (header & TYPE_INDEX_MASK) >> TYPE_INDEX_SHIFT; + assert (objectTypeIndex < s->objectTypesLength); objectType = &(s->objectTypes[objectTypeIndex]); tag = objectType->tag; diff --git a/runtime/gc/object.h b/runtime/gc/object.h index ffa6e6af2..a2ef87621 100644 --- a/runtime/gc/object.h +++ b/runtime/gc/object.h @@ -80,7 +80,7 @@ COMPILE_TIME_ASSERT(sizeof_objptr__eq__sizeof_header, #define CHUNKOFFSET_BITS 10 #define CHUNKOFFSET_MASK ((GC_header)0x7FF00000) #define CHUNKOFFSET_SHIFT 20 -#define CHUNKOFFSET(x) (((GC_header)x & CHUNKOFFSET_MASK)>>CHUNKOFFSET_BITS) +#define CHUNKOFFSET(x) (((GC_header)(x) & CHUNKOFFSET_MASK)>>CHUNKOFFSET_SHIFT) #define MARK_BITS 1 #define MARK_MASK ((GC_header)0x80000000) diff --git a/runtime/gc/um.c b/runtime/gc/um.c index 9149b4e4f..66851962f 100755 --- a/runtime/gc/um.c +++ b/runtime/gc/um.c @@ -80,10 +80,10 @@ UM_Object_alloc_no_packing(GC_state gc_stat, C_Size_t num_chunks, uint32_t heade } Pointer -UM_Object_alloc_packing_stage1(GC_state gc_stat, C_Size_t num_chunks, uint32_t header, C_Size_t s, C_Size_t sz) { +UM_Object_alloc_packing_stage1(GC_state s, C_Size_t num_chunks, uint32_t header, C_Size_t hdrsz, C_Size_t sz) { GC_UM_Chunk chunk = NULL; - User_instrument(13); /* JEFF */ + User_instrument(13); /* JEFF */ // packing stage 1 (same thread can pack with its own regions) @@ -98,28 +98,38 @@ UM_Object_alloc_packing_stage1(GC_state gc_stat, C_Size_t num_chunks, uint32_t h */ assert (num_chunks == 1); - if (gc_stat->activeChunk[PTHREAD_NUM] != BOGUS_POINTER) { - chunk = (GC_UM_Chunk)gc_stat->activeChunk[PTHREAD_NUM]; - fprintf(stderr, "%d] there's an activeChunk. used %d\n", PTHREAD_NUM, chunk->used); + if (s->activeChunk[PTHREAD_NUM] != BOGUS_POINTER) { + chunk = (GC_UM_Chunk)s->activeChunk[PTHREAD_NUM]; + + if (DEBUG_ALLOC_PACK) + fprintf(stderr, "%d] there's an activeChunk. used %d\n", PTHREAD_NUM, chunk->used); /* if cur chunk has no room left, then alloc a new one */ - if (chunk->used + sz + s > UM_CHUNK_PAYLOAD_SIZE) { - fprintf(stderr, "%d] no space in active chunk, allocating a new one\n", PTHREAD_NUM); - chunk = allocateChunks(gc_stat, &(gc_stat->umheap), num_chunks, UM_NORMAL_CHUNK); - gc_stat->activeChunk[PTHREAD_NUM] = (Pointer)chunk; + if (chunk->used + sz + hdrsz > UM_CHUNK_PAYLOAD_SIZE) { + if (DEBUG_ALLOC_PACK) + fprintf(stderr, "%d] no space in active chunk, allocating a new one\n", PTHREAD_NUM); + chunk = allocateChunks(s, &(s->umheap), num_chunks, UM_NORMAL_CHUNK); + s->activeChunk[PTHREAD_NUM] = (Pointer)chunk; } else { - fprintf(stderr, "%d] there is space in this chunk (%u) to fit our object (%d)\n", - PTHREAD_NUM, - UM_CHUNK_PAYLOAD_SIZE-(chunk->used), sz+s - ); + if (DEBUG_ALLOC_PACK) + fprintf(stderr, "%d] there is space in this chunk (%u) to fit our object (%d)\n", + PTHREAD_NUM, + UM_CHUNK_PAYLOAD_SIZE-(chunk->used), sz+hdrsz + ); + + LOCK_FL; + s->reserved -= 1; + UNLOCK_FL; + } } else { - fprintf(stderr, "%d] no activeChunk, allocating one.\n", PTHREAD_NUM); - chunk = allocateChunks(gc_stat, &(gc_stat->umheap), num_chunks, UM_NORMAL_CHUNK); - gc_stat->activeChunk[PTHREAD_NUM] = (Pointer)chunk; + if (DEBUG_ALLOC_PACK) + fprintf(stderr, "%d] no activeChunk, allocating one.\n", PTHREAD_NUM); + chunk = allocateChunks(s, &(s->umheap), num_chunks, UM_NORMAL_CHUNK); + s->activeChunk[PTHREAD_NUM] = (Pointer)chunk; } /* @@ -143,15 +153,19 @@ UM_Object_alloc_packing_stage1(GC_state gc_stat, C_Size_t num_chunks, uint32_t h header field. */ int used = chunk->used; - header |= ((used+s)<used += (sz + s); + header |= ((used+hdrsz)<used += (sz + hdrsz); + + if (DEBUG_ALLOC_PACK) + fprintf(stderr, "%d] writing header 0x%x(%d) with offset %d\n", + PTHREAD_NUM, header, header, used+hdrsz); // the following line violates C aliasing rules (undefined behavior): // *((uint32_t*) chunk->ml_object) = header; uint32_t *alias = (uint32_t *)(chunk->ml_object + used); *alias = header; - return (Pointer) (chunk->ml_object + s + used); + return (Pointer) (chunk->ml_object + hdrsz + used); } @@ -183,7 +197,7 @@ UM_Object_alloc(GC_state gc_stat, C_Size_t num_chunks, uint32_t header, C_Size_t cross-thread packing if gcstate.packingStage1Enabled is true and packingStage1Enabled is true. In this case, each thread passes in a period counter (id) which is calculated from the current clock div the hyperperiod of the tasks. threads are allowed to place objects into - other threads' chunks (activechunk) before allocated a new chunk for themselves. + other threads' chunks (activechunk) before allocating a new chunk for themselves. */ Pointer p; GC_objectTypeTag tagRet; @@ -194,10 +208,10 @@ UM_Object_alloc(GC_state gc_stat, C_Size_t num_chunks, uint32_t header, C_Size_t assert (header != 0); if (DEBUG_ALLOC) { - fprintf(stderr, "%d] UM_Object_alloc %s numchk:%u hd:%d (%s [%d] index:%u) sz:%d\n", + fprintf(stderr, "%d] UM_Object_alloc %s numchk:%u hd:0x%x(%d) (%s [%d] index:%u) sz:%d\n", PTHREAD_NUM, (header == GC_THREAD_HEADER)?"*** thread ***":"", - num_chunks, + num_chunks, header, header, objectTypeTagToString(tagRet), tagRet, objectTypeIndex, sz); } @@ -215,28 +229,32 @@ UM_Object_alloc(GC_state gc_stat, C_Size_t num_chunks, uint32_t header, C_Size_t if (header != GC_WORD8_VECTOR_HEADER || header == GC_THREAD_HEADER || header == GC_STACK_HEADER || header == GC_WEAK_GONE_HEADER) { - fprintf(stderr, "** me=%d THR %d WEAK %d STACK %d\n", header, - GC_THREAD_HEADER, GC_WEAK_GONE_HEADER, GC_STACK_HEADER - ); + if (DEBUG_ALLOC) + fprintf(stderr, "** me=%d THR %d WEAK %d STACK %d\n", header, + GC_THREAD_HEADER, GC_WEAK_GONE_HEADER, GC_STACK_HEADER + ); if (header == GC_STACK_HEADER) User_instrument(10); /* JEFF */ else User_instrument(12); /* JEFF */ - fprintf(stderr, RED("** no packing for this type\n")); + if (DEBUG_ALLOC) + fprintf(stderr, RED("** no packing for this type\n")); p = UM_Object_alloc_no_packing(gc_stat, num_chunks, header, s); - fprintf(stderr, " p = %x\n", (unsigned int)p); + if (DEBUG_ALLOC) + fprintf(stderr, " UM_Object_alloc returns: p = %x\n", (unsigned int)p); return p; } } - fprintf(stderr, YELLOW("** going to pack %d\n"), header); + if (DEBUG_ALLOC_PACK) + fprintf(stderr, YELLOW("** going to pack %d\n"), header); // stage2 packing (if enabled) occurs as a part of stage1. p = UM_Object_alloc_packing_stage1(gc_stat, num_chunks, header, s, sz); - fprintf(stderr, " p = %x\n", (unsigned int)p); + if (DEBUG_ALLOC_PACK) + fprintf(stderr, " UM_Object_alloc returns: p = %x\n", (unsigned int)p); return p; - } Pointer diff --git a/runtime/gc/ummark.c b/runtime/gc/ummark.c index ea4f59d5f..7efc1b91c 100755 --- a/runtime/gc/ummark.c +++ b/runtime/gc/ummark.c @@ -260,6 +260,23 @@ void markChunk(pointer p, GC_objectTypeTag tag, GC_markMode m, GC_state s, uint1 else pchunk = (GC_UM_Chunk)(p); + int coffset = CHUNKOFFSET(*(int*)(pchunk)); + + // normal (1), stack and weaks arent packed, so we adjust here + // if packing is not enabled, the chunkoffset field should always be + // zero. + + if (coffset > 0) coffset -= GC_NORMAL_HEADER_SIZE; + fprintf(stderr, "%d] %x header %x coffset %d\n", + PTHREAD_NUM, + (int)(pchunk), + *(int *)(pchunk), coffset + ); + + fprintf(stderr, "%x\n", (unsigned int)pchunk); + pchunk = (GC_UM_Chunk)((char*)pchunk-coffset); + fprintf(stderr, "%x\n", (unsigned int)pchunk); + if (tag == NORMAL_TAG || tag == WEAK_TAG) assert (pchunk->sentinel == UM_CHUNK_SENTINEL); else if (tag == STACK_TAG) @@ -433,21 +450,39 @@ static bool isChunkShaded(pointer p, GC_objectTypeTag tag) { static bool isContainerChunkMarkedByMode(pointer p, GC_markMode m, GC_objectTypeTag tag) { + // p is a pointer to an obj. we want to find the container it is in. + GC_header *headerp = getHeaderp(p); + GC_header header = *headerp; + int chunkOffset = CHUNKOFFSET(header); + + if (chunkOffset > 0) chunkOffset -= GC_NORMAL_HEADER_SIZE; + fprintf(stderr, "%d] isContainerChunkMarkedByMode %x header %x coffset %d\n", + PTHREAD_NUM, (unsigned int)p, + header, chunkOffset + ); + + GC_UM_Chunk pchunk = (GC_UM_Chunk)((char*)p-chunkOffset); + + if (DEBUG_DFS_MARK) { + fprintf(stderr, "%d] isContainerChunkMarkedByMode obj: "FMTPTR"\n", + PTHREAD_NUM, (uintptr_t) pchunk); + fprintf(stderr, " header %x chunkOffset %d\n", (unsigned int)header, chunkOffset); + } + switch (m) { case MARK_MODE: - return isChunkMarked(p, tag); + return isChunkMarked((pointer)pchunk, tag); case UNMARK_MODE: return not - isChunkMarked(p, tag); + isChunkMarked((pointer)pchunk, tag); case GREY_MODE: - return isChunkShaded(p, tag); + return isChunkShaded((pointer)pchunk, tag); default: die("bad mark mode %u", m); } } -//TODO: handle marking the mlton objects if packing more than one object in a chunk /* Tricolor abstraction at the chunk level. Binary marking for the MLton objects remain same. * Implementation: * 1. If function is in marking mode, mark current chunk grey. @@ -553,9 +588,6 @@ void markUMArrayChunks(GC_state s, GC_UM_Array_Chunk p, GC_markMode m) { void umDfsMarkObjectsToWorklist(GC_state s, objptr *opp, GC_markMode m) { pointer p = objptrToPointer(*opp, s->umheap.start); - if (DEBUG_DFS_MARK) - fprintf(stderr, "original obj: "FMTPTR", obj: "FMTPTR"\n", - (uintptr_t) * opp, (uintptr_t) p); GC_header *headerp = getHeaderp(p); GC_header header = *headerp; uint16_t bytesNonObjptrs = 0; From a832293a367eb71b655d2f4b7db5a6a3fb9f11ec Mon Sep 17 00:00:00 2001 From: jeff murphy Date: Tue, 22 Feb 2022 17:05:56 -0500 Subject: [PATCH 17/39] debug output --- runtime/gc/garbage-collection.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/gc/garbage-collection.c b/runtime/gc/garbage-collection.c index 2a93db669..12f62ff8d 100755 --- a/runtime/gc/garbage-collection.c +++ b/runtime/gc/garbage-collection.c @@ -677,9 +677,9 @@ User_instrument(14); /* JEFF */ if (DEBUG_MEM or DEBUG_RTGC) { fprintf(stderr, "%d] Collecting array: " FMTPTR - ", %d, %d\n", PTHREAD_NUM, + ", %d, %x\n", PTHREAD_NUM, (uintptr_t) pc, pc->array_chunk_magic, - pc->array_chunk_header); + (unsigned int)pc->array_chunk_header); } //Set header of cleared object to magic number From 86151eb4a90f0f1114c2b959a67cf55ca72f3858 Mon Sep 17 00:00:00 2001 From: jeff murphy Date: Sun, 27 Feb 2022 00:07:18 -0500 Subject: [PATCH 18/39] stage2 --- gdbmacros | 2 +- mlton/backend/merge-chunks.fun | 260 +++++++++++++++++++++++++++++++++ runtime/gc/array.c | 9 +- runtime/gc/debug.h | 6 +- runtime/gc/gc_state.h | 2 + runtime/gc/realtime_thread.c | 36 ++++- runtime/gc/realtime_thread.h | 2 +- runtime/gc/um.c | 123 +++++++++++++++- runtime/gc/um.h | 2 + ub/rtlinux/Makefile | 2 +- ub/rtlinux/periodic.sml | 6 +- 11 files changed, 424 insertions(+), 26 deletions(-) create mode 100644 mlton/backend/merge-chunks.fun diff --git a/gdbmacros b/gdbmacros index 0ec8f9b19..1476f1895 100644 --- a/gdbmacros +++ b/gdbmacros @@ -13,7 +13,7 @@ end def dumparraychunk set $caddr = $arg0 - print /x *((GC_UM_Array_Chunk) $caddr) + print /x *((GC_UM_Array_Chunk) ((char*)$caddr - 8)) end def dumpchunk diff --git a/mlton/backend/merge-chunks.fun b/mlton/backend/merge-chunks.fun new file mode 100644 index 000000000..2c09f379b --- /dev/null +++ b/mlton/backend/merge-chunks.fun @@ -0,0 +1,260 @@ +(* +* The goal of gc-check is to ensure that the GC is triggered at approproate +* points and also ensure that any block recieves the requested amount of chunks +* before it starts executing. +* +* It assumes that the runtime gives the operand FLChunks, which is a runtime +* count of number of chunks that the free list contains and TChunks which is the +* total number of chunks that are available to the program. It calculates the +* number of chunks allocated by block nc +* +* The Checks inserted by this pass are: +* +* 1. FLChunks > nc then +* decrement FLChunks by nc and continue if +* FLChunks > (0.3 * TChunks) else signal the GC to Run and continue +* +* 2. FLChunks < nc then +* Block and singal GC to run +* When woken up by GC, do check 1 again +* +* *) + + +functor MergeChunks (S: RSSA_TRANSFORM_STRUCTS): RSSA_TRANSFORM = +struct + open S + open Rssa + + structure CFunction = + struct + open CFunction Type.BuiltInCFunction + end + + structure Statement = + struct + open Statement + + fun objChunksAllocated (s: t): word = + case s of + ChunkedObject {numChunks, ...} => numChunks + | _ => Word.fromInt 0 + end + + structure Block = + struct + open Block + + fun objChunksAllocated (T {statements, ...}): word = + Vector.fold (statements, Word.fromInt 0, + fn (s, acc) => Word.+ (Statement.objChunksAllocated s, acc)) + end + + + + fun insertCheck (b as Block.T {args, kind, label, statements, transfer}) = + let + val chunksNeeded = Block.objChunksAllocated b + val dontCollect = Label.newNoname () + val collect = Label.newNoname () + val func = CFunction.gc {maySwitchThreads = false} + + fun gcAndJumpToBlock (to) = + let + val collectReturn = Label.newNoname () + in + [ Block.T {args = Vector.new0 (), + kind = Kind.Jump, + label = collect, + statements = Vector.new0 (), + transfer = (Transfer.CCall + {args = Vector.new4 (Operand.GCState, + (Operand.word + (WordX.zero (WordSize.csize ()))), + Operand.bool false, + Operand.bool true), + func = func, + return = SOME collectReturn})} + , Block.T { args = Vector.new0 () + , kind = Kind.CReturn {func = func} + , label = collectReturn + , statements = Vector.new0 () + , transfer = Transfer.Goto { dst = to + , args = Vector.new0 () }} ] + end + + datatype z = datatype Runtime.GCField.t + + fun decFreeChunks n = + let + val flChunks = Operand.Runtime FLChunks + val res = Var.newNoname () + val resTy = Operand.ty flChunks + in + [Statement.PrimApp {args = (Vector.new2 + (flChunks, Operand.constWord n (WordSize.word32))), + dst = SOME (res, resTy), + prim = Prim.wordSub WordSize.word32}, + Statement.Move {dst = flChunks, + src = Operand.Var {ty = resTy, var = res}}] + end + + + fun incReserved n = + let + val reserved = Operand.Runtime Reserved + val res = Var.newNoname () + val resTy = Operand.ty reserved + in + [Statement.PrimApp {args = (Vector.new2 + (reserved, Operand.constWord n (WordSize.word32))), + dst = SOME (res, resTy), + prim = Prim.wordAdd WordSize.word32}, + Statement.Move {dst = reserved, + src = Operand.Var {ty = resTy, var = res}}] + end + + + fun primApp (prim, op1, op2, {ifTrue, ifFalse}) = + let + val res = Var.newNoname () + val s = + Statement.PrimApp {args = Vector.new2 (op1, op2), + dst = SOME (res, Type.bool), + prim = prim} + val transfer = + Transfer.ifBool + (Operand.Var {var = res, ty = Type.bool}, + {falsee = ifFalse, + truee = ifTrue}) + in + (s, transfer) + end + + + val lockstmt = Statement.PrimApp {args = Vector.new1 (Operand.Runtime FLLock), + dst = NONE, + prim = Prim.lockfl} + + val unlockstmt = Statement.PrimApp {args = Vector.new1 (Operand.Runtime FLLock), + dst = NONE, + prim = Prim.unlockfl} + + fun blockingGC blLbl check = + let + val return = Label.newNoname () + val (ss, ts) = primApp (Prim.wordLt (WordSize.csize (), {signed = false}), + Operand.Runtime FLChunks, + Operand.constWord chunksNeeded (WordSize.csize ()), + {ifTrue=blLbl, ifFalse=check}) + in + [ Block.T {args = Vector.new0 (), + kind = Kind.Jump, + label = blLbl, + statements = Vector.new1 (unlockstmt), + transfer = (Transfer.CCall + {args = Vector.new4 (Operand.GCState, + (Operand.word + (WordX.zero (WordSize.csize ()))), + Operand.bool true, + Operand.bool true), + func = func, + return = SOME return})} + , Block.T { args = Vector.new0 () + , kind = Kind.CReturn {func = func} + , label = return + , statements = Vector.new2 (lockstmt,ss) + , transfer = ts} ] + + + end + + + + val startBlock = + let + val check = Label.newNoname () + val block = Label.newNoname () + val reserved = Operand.Runtime Reserved + val res = Var.newNoname () + val resTy = Operand.ty reserved + val sAdd = Statement.PrimApp {args = (Vector.new2 + (reserved, Operand.constWord chunksNeeded (WordSize.word32))), + dst = SOME (res, resTy), + prim = Prim.wordAdd WordSize.word32} + + val (ss, ts) = primApp (Prim.wordLt (WordSize.csize (), {signed = false}), + Operand.Runtime FLChunks, + Operand.Var {var = res, ty = resTy}, + {ifTrue=block, ifFalse=check}) + + val (ss2, ts2) = primApp (Prim.wordLt (WordSize.csize (), {signed = false}), + Operand.Runtime FLChunks, + Operand.Runtime HeuristicChunks, + {ifTrue=collect, ifFalse=dontCollect}) + + in + [ Block.T { args = args + , kind = kind + , label = label + , statements = Vector.new3 (lockstmt,sAdd,ss) + , transfer = ts } + , + Block.T { args = Vector.new0 () + , kind = Kind.Jump + , label = check + , statements = Vector.fromList ([ss2] @ (incReserved + chunksNeeded) + @[ unlockstmt]) + , transfer = ts2 } + ] @ blockingGC block check + + end + in + if chunksNeeded = Word.fromInt 0 + then [b] + else startBlock @ + gcAndJumpToBlock dontCollect @ + [Block.T { args = Vector.new0 () + , kind = Kind.Jump + , label = dontCollect + , statements = statements + , transfer = transfer }] + end + + (* + This function is applied to each function in the program. + + "Function.dest f" is defined in mlton/backend/rssa.sig + it matches the pattern of rssa.Function and extracts the + fields. it 'destructs' f into its component fields. + + *) + fun handleFunction (f: Function.t): Function.t = + let + val {args, blocks, name, raises, returns, start} = Function.dest f + val newBlocks = ref [] + val () = Vector.foreach + (blocks, + fn block => + List.push (newBlocks, insertCheck block)) + in + Function.new { args = args + , blocks = Vector.fromList (List.concat (!newBlocks)) + , name = name + , raises = raises + , returns = returns + , start = start } + end + + (* + Create a new program, replacing the functions with a new list of functions + where each has been transformed using handleFunction + *) + fun transform (program as Program.T {functions, handlesSignals, main, objectTypes}) = + Program.T { functions = List.map (functions, handleFunction) + , handlesSignals = handlesSignals + , main = handleFunction (main) + , objectTypes = objectTypes } + +end diff --git a/runtime/gc/array.c b/runtime/gc/array.c index 9845517eb..4aa614f16 100755 --- a/runtime/gc/array.c +++ b/runtime/gc/array.c @@ -22,9 +22,12 @@ GC_arrayLength* getArrayLengthp (pointer a) { * Returns the length for the array pointed to by p. */ GC_arrayLength getArrayLength (pointer a) { - GC_UM_Array_Chunk root = (GC_UM_Array_Chunk)(a - GC_HEADER_SIZE - sizeof(Word32_t)); - assert (root->array_chunk_magic == UM_ARRAY_SENTINEL); - return root->num_els; + GC_UM_Array_Chunk root0 = (GC_UM_Array_Chunk)(a - GC_HEADER_SIZE - sizeof(Word32_t)); + if (root0->array_chunk_magic != UM_ARRAY_SENTINEL) { + fprintf(stderr, "root0 %x\n", (int)root0); + } + assert (root0->array_chunk_magic == UM_ARRAY_SENTINEL); + return root0->num_els; } uintmax_t GC_getArrayLength (pointer a) { diff --git a/runtime/gc/debug.h b/runtime/gc/debug.h index 755c23beb..d3f6b92ac 100755 --- a/runtime/gc/debug.h +++ b/runtime/gc/debug.h @@ -14,7 +14,7 @@ enum { DEBUG_ALLOC = FALSE, - DEBUG_ALLOC_PACK = FALSE, + DEBUG_ALLOC_PACK = TRUE, DEBUG_ARRAY = FALSE, DEBUG_ARRAY_OFFSET = FALSE, DEBUG_CALL_STACK = FALSE, @@ -43,8 +43,8 @@ enum { FORCE_GENERATIONAL = FALSE, FORCE_MARK_COMPACT = FALSE, DEBUG_OLD = FALSE, - DEBUG_RTGC = TRUE, - DEBUG_RTGC_MARKING = TRUE, + DEBUG_RTGC = FALSE, + DEBUG_RTGC_MARKING = FALSE, DEBUG_WB = FALSE, DISPLAY_GC_STATS = FALSE }; diff --git a/runtime/gc/gc_state.h b/runtime/gc/gc_state.h index 1649dd8f4..f9e875918 100755 --- a/runtime/gc/gc_state.h +++ b/runtime/gc/gc_state.h @@ -102,6 +102,8 @@ struct GC_state { pthread_t *realtimeThreads[MAXPRI]; pointer activeChunk[MAXPRI]; + pthread_mutex_t activeChunkLock[MAXPRI]; + bool packingStage1Enabled, packingStage2Enabled; volatile bool mainBooted; diff --git a/runtime/gc/realtime_thread.c b/runtime/gc/realtime_thread.c index 4a6352d3f..23a80cd8d 100755 --- a/runtime/gc/realtime_thread.c +++ b/runtime/gc/realtime_thread.c @@ -161,7 +161,6 @@ void InitializeMutexes(void) { die("rtems_barrier_create failed"); } } - } double get_ticks_since_boot(void) { @@ -186,14 +185,34 @@ int schedule_yield() { #else -/* for RT linux, these parameters are in nanoseconds */ -void set_schedule(uint64_t runtime, uint64_t period, uint64_t deadline) { +/* for RT linux, these parameters are in milli-seconds + + + from "man sched" + + arrival/wakeup absolute deadline + | start time | + | | | + v v v + -----x--------xooooooooooooooooo--------x--------x--- + |<-- Runtime ------->| + |<----------- Deadline ----------->| + |<-------------- Period ------------------->| + + The kernel requires that: + + sched_runtime <= sched_deadline <= sched_period + */ + +#define NANOS_PER_MILLI 1000000 + +void set_schedule(int runtime, int period, int deadline) { struct sched_attr attr; unsigned int flags = 0; if(DEBUG_THREADS) fprintf(stderr, "%d] "YELLOW("set_schedule")" runtime:%llu period:%llu deadline:%llu\n", - PTHREAD_NUM, runtime, period, deadline); + PTHREAD_NUM, (uint64_t)runtime, (uint64_t)period, (uint64_t)deadline); attr.size = sizeof(attr); attr.sched_flags = SCHED_FLAG_DL_OVERRUN; // supposed to make linux SIGXCPU on overrun @@ -202,9 +221,12 @@ void set_schedule(uint64_t runtime, uint64_t period, uint64_t deadline) { /* times are in nanos for rtlinux */ attr.sched_policy = SCHED_DEADLINE; - attr.sched_runtime = runtime; //eg 5 * 1000 * 1000; 5ms - attr.sched_period = period; - attr.sched_deadline = deadline; + attr.sched_runtime = (uint64_t)runtime * NANOS_PER_MILLI; + attr.sched_period = (uint64_t)period * NANOS_PER_MILLI; + attr.sched_deadline = (uint64_t)deadline * NANOS_PER_MILLI; + + assert (runtime <= deadline); + assert (deadline <= period); // '0' means 'current thread' if (sched_setattr(0, &attr, flags) < 0) { diff --git a/runtime/gc/realtime_thread.h b/runtime/gc/realtime_thread.h index 6f998d59b..c0853c95d 100755 --- a/runtime/gc/realtime_thread.h +++ b/runtime/gc/realtime_thread.h @@ -38,7 +38,7 @@ void User_unlock (Int32); void User_instrument (Int32 p); void Dump_instrument_stderr (Int32 p); double get_ticks_since_boot(void); -void set_schedule(uint64_t runtime, uint64_t period, uint64_t deadline); +void set_schedule(int runtime, int period, int deadline); int schedule_yield(void); #endif diff --git a/runtime/gc/um.c b/runtime/gc/um.c index 66851962f..b21ed3905 100755 --- a/runtime/gc/um.c +++ b/runtime/gc/um.c @@ -7,6 +7,8 @@ # define POW pow #endif +#define LOCKIT(X) IFED(pthread_mutex_lock(&(X))) +#define UNLOCKIT(X) IFED(pthread_mutex_unlock(&(X))) #undef DBG @@ -79,6 +81,68 @@ UM_Object_alloc_no_packing(GC_state gc_stat, C_Size_t num_chunks, uint32_t heade return (Pointer) (chunk->ml_object + s); } +Pointer +UM_Object_alloc_packing_stage2(GC_state s, C_Size_t num_chunks, uint32_t header, C_Size_t hdrsz, C_Size_t sz, + int *piggybackedOnThreadNum) +{ + /* stage2 packing: pack across threads + * in this implementation, we allow threads in the same period to pack with each other. + * an RMS will schedule these threads one after the other, starting at the beginning + * of the period. the GC can run at the end of the period (but is not guaranteed to). + * + * we pack across threads by allowing the current thread that is requesting an alloc + * to look into other threads' activeChunks before allocating a new chunk of its own. + * + * stage1: + * if no activeChunk or no space in activeChunk: + * peak into other threads' activeChunks <--- stage2 + * alloc a new activeChunk + * + */ + GC_UM_Chunk chunk = NULL; + + User_instrument(16); /* JEFF */ + + /* unsuccessful, return to stage 1 and try to allocate a new chunk */ + + /* see if any other thread's chunks have room */ + for (int i = 0 ; i < MAXPRI ; i++) { + if (i == 1 || i == PTHREAD_NUM) + continue; + if (s->activeChunk[i] == BOGUS_POINTER) + continue; + + LOCKIT(s->activeChunkLock[i]); + + if (((GC_UM_Chunk)s->activeChunk[i])->used + sz + hdrsz <= UM_CHUNK_PAYLOAD_SIZE){ + chunk = (GC_UM_Chunk)s->activeChunk[i]; + int used = chunk->used; + header |= ((used+hdrsz)<used += (sz + hdrsz); + + UNLOCKIT(s->activeChunkLock[i]); + + LOCK_FL; + s->reserved -= 1; + UNLOCK_FL; + + if (DEBUG_ALLOC_PACK) + fprintf(stderr, "%d] writing header 0x%x(%d) with offset %d\n", + PTHREAD_NUM, header, header, used+hdrsz); + + *piggybackedOnThreadNum = i; + + uint32_t *alias = (uint32_t *)(chunk->ml_object + used); + *alias = header; + return (Pointer) (chunk->ml_object + hdrsz + used); + } + + UNLOCKIT(s->activeChunkLock[i]); + } + + return BOGUS_POINTER; +} + Pointer UM_Object_alloc_packing_stage1(GC_state s, C_Size_t num_chunks, uint32_t header, C_Size_t hdrsz, C_Size_t sz) { GC_UM_Chunk chunk = NULL; @@ -94,8 +158,8 @@ UM_Object_alloc_packing_stage1(GC_state s, C_Size_t num_chunks, uint32_t header, assert (header != GC_WEAK_GONE_HEADER); /* not a stack alloc. if we have an active chunk, pack into it. - * if we do not have room, we will alloc a new chunk - */ + * if we do not have room, we will alloc a new chunk + */ assert (num_chunks == 1); if (s->activeChunk[PTHREAD_NUM] != BOGUS_POINTER) { @@ -104,11 +168,33 @@ UM_Object_alloc_packing_stage1(GC_state s, C_Size_t num_chunks, uint32_t header, if (DEBUG_ALLOC_PACK) fprintf(stderr, "%d] there's an activeChunk. used %d\n", PTHREAD_NUM, chunk->used); - /* if cur chunk has no room left, then alloc a new one */ + /* if cur chunk has no room left, then alloc a new one: + * if stage2 is enabled, we will first attempt to piggy back on another + * thread's chunk. + */ if (chunk->used + sz + hdrsz > UM_CHUNK_PAYLOAD_SIZE) { + + if (s->packingStage2Enabled == true) { + if (DEBUG_ALLOC_PACK) + fprintf(stderr, "%d] no space in active chunk, cross-peak first\n", PTHREAD_NUM); + int piggybackthread = -1; + Pointer xp = UM_Object_alloc_packing_stage2(s, num_chunks, header, hdrsz, sz, &piggybackthread); + if (xp != BOGUS_POINTER) { + if (DEBUG_ALLOC_PACK) + fprintf(stderr, "%d] "PURPLE("successfully found space in another threads (%d) chunk\n"), + PTHREAD_NUM, + piggybackthread + ); + return xp; + } else { + if (DEBUG_ALLOC_PACK) + fprintf(stderr, "%d] unable to find space in another threads chunk, and:\n", PTHREAD_NUM); + } + } + if (DEBUG_ALLOC_PACK) - fprintf(stderr, "%d] no space in active chunk, allocating a new one\n", PTHREAD_NUM); + fprintf(stderr, "%d] no space in active chunk, so allocating a new one\n", PTHREAD_NUM); chunk = allocateChunks(s, &(s->umheap), num_chunks, UM_NORMAL_CHUNK); s->activeChunk[PTHREAD_NUM] = (Pointer)chunk; } @@ -122,12 +208,31 @@ UM_Object_alloc_packing_stage1(GC_state s, C_Size_t num_chunks, uint32_t header, LOCK_FL; s->reserved -= 1; UNLOCK_FL; - } } else { + /* if stage2 is enabled, we will first attempt to piggy back on + * another thread's chunk. + */ + if (s->packingStage2Enabled == true) { + if (DEBUG_ALLOC_PACK) + fprintf(stderr, "%d] no activeChunk, cross-peak first\n", PTHREAD_NUM); + int piggybackthread = -1; + Pointer xp = UM_Object_alloc_packing_stage2(s, num_chunks, header, hdrsz, sz, &piggybackthread); + if (xp != BOGUS_POINTER) { + if (DEBUG_ALLOC_PACK) + fprintf(stderr, "%d] "PURPLE("successfully found space in another threads (%d) chunk\n"), PTHREAD_NUM, + piggybackthread + ); + return xp; + } else { + if (DEBUG_ALLOC_PACK) + fprintf(stderr, "%d] unable to find space in another threads chunk, and:\n", PTHREAD_NUM); + } + } + if (DEBUG_ALLOC_PACK) - fprintf(stderr, "%d] no activeChunk, allocating one.\n", PTHREAD_NUM); + fprintf(stderr, "%d] no activeChunk, so allocating one.\n", PTHREAD_NUM); chunk = allocateChunks(s, &(s->umheap), num_chunks, UM_NORMAL_CHUNK); s->activeChunk[PTHREAD_NUM] = (Pointer)chunk; } @@ -208,11 +313,13 @@ UM_Object_alloc(GC_state gc_stat, C_Size_t num_chunks, uint32_t header, C_Size_t assert (header != 0); if (DEBUG_ALLOC) { - fprintf(stderr, "%d] UM_Object_alloc %s numchk:%u hd:0x%x(%d) (%s [%d] index:%u) sz:%d\n", + fprintf(stderr, "%d] UM_Object_alloc %s numchk:%u hd:0x%x(%d) (%s [%d] index:%u) sz:%d freelist:%d reserved:%d\n", PTHREAD_NUM, (header == GC_THREAD_HEADER)?"*** thread ***":"", num_chunks, header, - header, objectTypeTagToString(tagRet), tagRet, objectTypeIndex, sz); + header, objectTypeTagToString(tagRet), tagRet, objectTypeIndex, sz, + gc_stat->fl_chunks, + gc_stat->reserved); } // no-packing. in order for stage2 to occur, stage1 must be enabled diff --git a/runtime/gc/um.h b/runtime/gc/um.h index 74e7b7a2d..c628e6a6d 100644 --- a/runtime/gc/um.h +++ b/runtime/gc/um.h @@ -7,6 +7,8 @@ Pointer UM_Object_alloc(GC_state gc_stat, C_Size_t num_chunks, uint32_t header, C_Size_t s, C_Size_t sz); Pointer UM_Object_alloc_no_packing(GC_state gc_stat, C_Size_t num_chunks, uint32_t header, C_Size_t s); Pointer UM_Object_alloc_packing_stage1(GC_state gc_stat, C_Size_t num_chunks, uint32_t header, C_Size_t s, C_Size_t sz); +Pointer UM_Object_alloc_packing_stage2(GC_state gc_stat, C_Size_t num_chunks, uint32_t header, C_Size_t s, C_Size_t sz, + int *piggybackedOnThreadNum); void CompareAndSet(GC_state s, int lockOrUnlock); bool CompareExchange(volatile int *ptr, int expected, int desired); diff --git a/ub/rtlinux/Makefile b/ub/rtlinux/Makefile index b000688a9..3e0412668 100755 --- a/ub/rtlinux/Makefile +++ b/ub/rtlinux/Makefile @@ -2,5 +2,5 @@ c: gcc -o deadline deadlinesyscall.c -lpthread sml: - ../../build/bin/mlton periodic.sml + ../../build/bin/mlton -debug true periodic.sml sudo ./periodic @RTMLton rtthreads true -- diff --git a/ub/rtlinux/periodic.sml b/ub/rtlinux/periodic.sml index f4bc4e4c5..9a4356c62 100755 --- a/ub/rtlinux/periodic.sml +++ b/ub/rtlinux/periodic.sml @@ -7,9 +7,11 @@ fun gettime () = get_ticks_since_boot () fun thread0 () = let - val onesec = 1000000000 + val runtime = 2 (* ms *) + val deadline = 250 + val period = 1000 val _ = printit "In let for thread0. Setting period/deadline to 1 sec\n" - val _ = set_schedule (onesec, onesec, onesec) + val _ = set_schedule (runtime, period, deadline) val prev = ref (gettime ()) val cur = ref (gettime ()) in From 56ebd81bcd4573e9d3707235237cb1042c4a7811 Mon Sep 17 00:00:00 2001 From: jeff murphy Date: Sun, 27 Feb 2022 12:21:00 -0500 Subject: [PATCH 19/39] disable debug output --- runtime/gc/debug.h | 4 ++-- runtime/gc/foreach.c | 12 ++++++------ runtime/gc/garbage-collection.c | 6 +++--- runtime/gc/ummark.c | 20 +++++++++----------- 4 files changed, 20 insertions(+), 22 deletions(-) diff --git a/runtime/gc/debug.h b/runtime/gc/debug.h index d3f6b92ac..38fa8eea3 100755 --- a/runtime/gc/debug.h +++ b/runtime/gc/debug.h @@ -14,14 +14,14 @@ enum { DEBUG_ALLOC = FALSE, - DEBUG_ALLOC_PACK = TRUE, + DEBUG_ALLOC_PACK = FALSE, DEBUG_ARRAY = FALSE, DEBUG_ARRAY_OFFSET = FALSE, DEBUG_CALL_STACK = FALSE, DEBUG_CARD_MARKING = FALSE, DEBUG_CHUNK_ARRAY = FALSE, DEBUG_DETAILED = FALSE, - DEBUG_DFS_MARK = TRUE, + DEBUG_DFS_MARK = FALSE, DEBUG_ENTER_LEAVE = FALSE, DEBUG_GENERATIONAL = FALSE, DEBUG_INT_INF = FALSE, diff --git a/runtime/gc/foreach.c b/runtime/gc/foreach.c index ab00157f7..983c9ce87 100644 --- a/runtime/gc/foreach.c +++ b/runtime/gc/foreach.c @@ -96,7 +96,7 @@ pointer foreachObjptrInObject (GC_state s, pointer p, chunkOffset = CHUNKOFFSET(header); splitHeader(s, header, &tag, NULL, &bytesNonObjptrs, &numObjptrs); - if (1||DEBUG_DETAILED) + if (DEBUG_DETAILED) fprintf (stderr, "%d] foreachObjptrInObject ("FMTPTR")" " header = "FMTHDR @@ -197,12 +197,12 @@ pointer foreachObjptrInObject (GC_state s, pointer p, */ size_t bytesPerElement; - size_t dataBytes, curBytePosition; - pointer last; + size_t dataBytes, curBytePosition; + pointer last; GC_arrayLength numElements; - numElements = getArrayLength (p); - bytesPerElement = bytesNonObjptrs + (numObjptrs * OBJPTR_SIZE); - dataBytes = numElements * bytesPerElement; + numElements = getArrayLength (p); + bytesPerElement = bytesNonObjptrs + (numObjptrs * OBJPTR_SIZE); + dataBytes = numElements * bytesPerElement; if (DEBUG_MEM) fprintf(stderr, "%d] "GREEN("marking array (new heap)") " numObjptrs(%d) bytesNonObjptrs(%d) numElements(%d) bpe(%d)\n", diff --git a/runtime/gc/garbage-collection.c b/runtime/gc/garbage-collection.c index 12f62ff8d..b93802b38 100755 --- a/runtime/gc/garbage-collection.c +++ b/runtime/gc/garbage-collection.c @@ -720,7 +720,7 @@ User_instrument(14); /* JEFF */ s->cGCStats.numSweeps++; - if (DEBUG_RTGC) { + if (1||DEBUG_RTGC) { fprintf(stderr, "%d] "GREEN("Finished one sweep cycle and freed %d chunks\n"), PTHREAD_NUM, freed); fprintf(stderr, "%d] "GREEN("Chunks; Visited: %d, Marked: %d, Greys: %d Reds: %d\n"), PTHREAD_NUM, visited, marked, grey, @@ -965,14 +965,14 @@ void GC_collect(GC_state s, size_t bytesRequested, bool force, bool collectRed) if (i == MAXPRI) /*Last thread to sync before GC*/ { - s->dirty = true; RTSYNC_SIGNAL; if (DEBUG_RTGC) fprintf(stderr, "%d] Signal sent to wake GC\n", PTHREAD_NUM); } else { - fprintf(stderr, "%d] All Threads not synced\n", PTHREAD_NUM); + if (DEBUG_RTGC) + fprintf(stderr, "%d] All Threads not synced\n", PTHREAD_NUM); } diff --git a/runtime/gc/ummark.c b/runtime/gc/ummark.c index 7efc1b91c..50848a8d3 100755 --- a/runtime/gc/ummark.c +++ b/runtime/gc/ummark.c @@ -267,15 +267,11 @@ void markChunk(pointer p, GC_objectTypeTag tag, GC_markMode m, GC_state s, uint1 // zero. if (coffset > 0) coffset -= GC_NORMAL_HEADER_SIZE; - fprintf(stderr, "%d] %x header %x coffset %d\n", - PTHREAD_NUM, - (int)(pchunk), - *(int *)(pchunk), coffset - ); - fprintf(stderr, "%x\n", (unsigned int)pchunk); + //fprintf(stderr, "%d] %x header %x coffset %d\n", PTHREAD_NUM, (int)(pchunk), *(int *)(pchunk), coffset); + //fprintf(stderr, "%x\n", (unsigned int)pchunk); pchunk = (GC_UM_Chunk)((char*)pchunk-coffset); - fprintf(stderr, "%x\n", (unsigned int)pchunk); + //fprintf(stderr, "%x\n", (unsigned int)pchunk); if (tag == NORMAL_TAG || tag == WEAK_TAG) assert (pchunk->sentinel == UM_CHUNK_SENTINEL); @@ -456,10 +452,12 @@ bool isContainerChunkMarkedByMode(pointer p, GC_markMode m, GC_objectTypeTag tag int chunkOffset = CHUNKOFFSET(header); if (chunkOffset > 0) chunkOffset -= GC_NORMAL_HEADER_SIZE; - fprintf(stderr, "%d] isContainerChunkMarkedByMode %x header %x coffset %d\n", - PTHREAD_NUM, (unsigned int)p, - header, chunkOffset - ); + + if (DEBUG_DFS_MARK) + fprintf(stderr, "%d] isContainerChunkMarkedByMode %x header %x coffset %d\n", + PTHREAD_NUM, (unsigned int)p, + header, chunkOffset + ); GC_UM_Chunk pchunk = (GC_UM_Chunk)((char*)p-chunkOffset); From 03b3b1d58a383c11798953544fa9a51daa3c4aab Mon Sep 17 00:00:00 2001 From: jeff murphy Date: Wed, 2 Mar 2022 15:14:25 -0500 Subject: [PATCH 20/39] prevent packing unless in same sw-period --- basis-library/mlton/primthread.sig | 2 +- basis-library/mlton/primthread.sml | 4 ++-- runtime/gc/gc_state.h | 2 +- runtime/gc/init.c | 4 +++- runtime/gc/realtime_thread.c | 21 +++++++++++++++++---- runtime/gc/realtime_thread.h | 2 +- runtime/gc/um.c | 3 +-- ub/rtlinux/periodic.sml | 2 +- 8 files changed, 27 insertions(+), 13 deletions(-) diff --git a/basis-library/mlton/primthread.sig b/basis-library/mlton/primthread.sig index f26b534f7..cd8f6984f 100755 --- a/basis-library/mlton/primthread.sig +++ b/basis-library/mlton/primthread.sig @@ -43,7 +43,7 @@ signature PRIM_THREAD = val gcstate: Primitive.MLton.GCState.t val getMyPriority: unit -> int - val set_schedule: int * int * int -> unit + val set_schedule: int * int * int * int -> unit val schedule_yield: unit -> unit val wait_for_next_period: unit -> unit diff --git a/basis-library/mlton/primthread.sml b/basis-library/mlton/primthread.sml index 8255a4282..ac094b6a4 100755 --- a/basis-library/mlton/primthread.sml +++ b/basis-library/mlton/primthread.sml @@ -140,7 +140,7 @@ struct val gtsb__ = _import "get_ticks_since_boot" : unit -> real; val lock__ = _import "User_lock" : int -> unit; val unlock__ = _import "User_unlock" : int -> unit; - val setsch = _import "set_schedule" : int * int * int -> unit; + val setsch = _import "set_schedule" : int * int * int * int -> unit; val schyld = _import "schedule_yield" : unit -> unit; in fun instrument a = inst__ a @@ -148,7 +148,7 @@ struct fun get_ticks_since_boot () = gtsb__ () fun rtlock a = if a <= 9 then lock__ a else print "Invalid lock. Valid locks are [0-9]\n" fun rtunlock a = if a <= 9 then unlock__ a else print "Invalid lock. Valid locks are [0-9]\n" - fun set_schedule (rt, per, dl) = setsch (rt, per, dl) + fun set_schedule (rt, dl, per, packing) = setsch (rt, dl, per, packing) fun schedule_yield () = schyld () fun wait_for_next_period () = schyld () end diff --git a/runtime/gc/gc_state.h b/runtime/gc/gc_state.h index f9e875918..82462e9f5 100755 --- a/runtime/gc/gc_state.h +++ b/runtime/gc/gc_state.h @@ -103,7 +103,7 @@ struct GC_state { pthread_t *realtimeThreads[MAXPRI]; pointer activeChunk[MAXPRI]; pthread_mutex_t activeChunkLock[MAXPRI]; - + int packingStageForThread[MAXPRI]; bool packingStage1Enabled, packingStage2Enabled; volatile bool mainBooted; diff --git a/runtime/gc/init.c b/runtime/gc/init.c index 1cad5788e..edb12bdd3 100644 --- a/runtime/gc/init.c +++ b/runtime/gc/init.c @@ -432,7 +432,9 @@ int GC_init(GC_state s, int argc, char **argv) { } for (__i = 0; __i < MAXPRI; __i++) { - + + s->packingStageForThread[__i] = 0; + s->callFromCHandlerThread[__i] = BOGUS_OBJPTR; s->currentThread[__i] = BOGUS_OBJPTR; s->savedThread[__i] = BOGUS_OBJPTR; diff --git a/runtime/gc/realtime_thread.c b/runtime/gc/realtime_thread.c index 23a80cd8d..e12cfbf75 100755 --- a/runtime/gc/realtime_thread.c +++ b/runtime/gc/realtime_thread.c @@ -15,6 +15,7 @@ static volatile int initialized = 0; volatile bool rtinitfromML = FALSE; +int allowedToPack[MAXPRI]; extern void Copy_globalObjptrs (int f, int t); @@ -172,7 +173,12 @@ double get_ticks_since_boot(void) { * which is Watchdog_interval which in turn is uint32_t but to keep the FFI prototype * consist (with the posix one below) we use 64_t and downcast. */ -void set_schedule(uint64_t runtime, uint64_t period, uint64_t deadline) { +/* packing param is 0, 1, or 2. determines if this thread is allowed + * to pack during its releases. not all threads should/can pack + * safely. only rate mono / deadline scheduled threads should pack + * using "2" and only during their shared periods + */ +void set_schedule(uint64_t runtime, uint64_t deadline, uint64_t period, int packing) { return; } @@ -206,13 +212,20 @@ int schedule_yield() { #define NANOS_PER_MILLI 1000000 -void set_schedule(int runtime, int period, int deadline) { +/* packing param is 0, 1, or 2. determines if this thread is allowed + * to pack during its releases. not all threads should/can pack + * safely. only rate mono / deadline scheduled threads should pack + * using "2" and only during their shared periods + */ +void set_schedule(int runtime, int deadline, int period, int packing) { struct sched_attr attr; unsigned int flags = 0; if(DEBUG_THREADS) - fprintf(stderr, "%d] "YELLOW("set_schedule")" runtime:%llu period:%llu deadline:%llu\n", - PTHREAD_NUM, (uint64_t)runtime, (uint64_t)period, (uint64_t)deadline); + fprintf(stderr, "%d] "YELLOW("set_schedule")" runtime:%llu period:%llu deadline:%llu packing:%d\n", + PTHREAD_NUM, (uint64_t)runtime, (uint64_t)period, (uint64_t)deadline, packing); + + allowedToPack[PTHREAD_NUM] = packing; attr.size = sizeof(attr); attr.sched_flags = SCHED_FLAG_DL_OVERRUN; // supposed to make linux SIGXCPU on overrun diff --git a/runtime/gc/realtime_thread.h b/runtime/gc/realtime_thread.h index c0853c95d..3b0e7e03d 100755 --- a/runtime/gc/realtime_thread.h +++ b/runtime/gc/realtime_thread.h @@ -38,7 +38,7 @@ void User_unlock (Int32); void User_instrument (Int32 p); void Dump_instrument_stderr (Int32 p); double get_ticks_since_boot(void); -void set_schedule(int runtime, int period, int deadline); +void set_schedule(int runtime, int deadline, int period, int packing); int schedule_yield(void); #endif diff --git a/runtime/gc/um.c b/runtime/gc/um.c index b21ed3905..eb32a8eb9 100755 --- a/runtime/gc/um.c +++ b/runtime/gc/um.c @@ -19,7 +19,6 @@ * define the free list */ - void reserveAllocation(GC_state s, size_t numChunksToRequest) { assert (numChunksToRequest > 0); @@ -324,7 +323,7 @@ UM_Object_alloc(GC_state gc_stat, C_Size_t num_chunks, uint32_t header, C_Size_t // no-packing. in order for stage2 to occur, stage1 must be enabled - if (gc_stat->packingStage1Enabled == false) { + if (gc_stat->packingStage1Enabled == false || allowedToPack[PTHREAD_NUM] == 0) { if (header == GC_STACK_HEADER) User_instrument(10); /* JEFF */ else User_instrument(12); /* JEFF */ return UM_Object_alloc_no_packing(gc_stat, num_chunks, header, s); diff --git a/ub/rtlinux/periodic.sml b/ub/rtlinux/periodic.sml index 9a4356c62..40c79e3d0 100755 --- a/ub/rtlinux/periodic.sml +++ b/ub/rtlinux/periodic.sml @@ -11,7 +11,7 @@ let val deadline = 250 val period = 1000 val _ = printit "In let for thread0. Setting period/deadline to 1 sec\n" - val _ = set_schedule (runtime, period, deadline) + val _ = set_schedule (runtime, deadline, period, 0) val prev = ref (gettime ()) val cur = ref (gettime ()) in From ba74cfbdd0f66fa299212906753818582031f7e1 Mon Sep 17 00:00:00 2001 From: jeff murphy Date: Fri, 25 Mar 2022 21:58:34 -0400 Subject: [PATCH 21/39] ticks in micros --- basis-library/mlton/primthread.sig | 4 ++-- basis-library/mlton/primthread.sml | 6 +++--- runtime/gc/garbage-collection.c | 16 +++++++--------- runtime/gc/realtime_thread.c | 28 ++++++++++++++++++++-------- runtime/gc/realtime_thread.h | 2 +- ub/rtlinux/deadlinesyscall.c | 9 ++++++--- 6 files changed, 39 insertions(+), 26 deletions(-) diff --git a/basis-library/mlton/primthread.sig b/basis-library/mlton/primthread.sig index cd8f6984f..3cdae979e 100755 --- a/basis-library/mlton/primthread.sig +++ b/basis-library/mlton/primthread.sig @@ -44,7 +44,7 @@ signature PRIM_THREAD = val getMyPriority: unit -> int val set_schedule: int * int * int * int -> unit - val schedule_yield: unit -> unit - val wait_for_next_period: unit -> unit + val schedule_yield: bool -> unit + val wait_for_next_period: bool -> unit end diff --git a/basis-library/mlton/primthread.sml b/basis-library/mlton/primthread.sml index ac094b6a4..881f8e155 100755 --- a/basis-library/mlton/primthread.sml +++ b/basis-library/mlton/primthread.sml @@ -141,7 +141,7 @@ struct val lock__ = _import "User_lock" : int -> unit; val unlock__ = _import "User_unlock" : int -> unit; val setsch = _import "set_schedule" : int * int * int * int -> unit; - val schyld = _import "schedule_yield" : unit -> unit; + val schyld = _import "schedule_yield" : Primitive.MLton.GCState.t * bool -> unit; in fun instrument a = inst__ a fun dump_instrument_stderr a = dise__ a @@ -149,8 +149,8 @@ struct fun rtlock a = if a <= 9 then lock__ a else print "Invalid lock. Valid locks are [0-9]\n" fun rtunlock a = if a <= 9 then unlock__ a else print "Invalid lock. Valid locks are [0-9]\n" fun set_schedule (rt, dl, per, packing) = setsch (rt, dl, per, packing) - fun schedule_yield () = schyld () - fun wait_for_next_period () = schyld () + fun schedule_yield trigger_gc = schyld (Primitive.MLton.GCState.gcState, trigger_gc) + fun wait_for_next_period trigger_gc = schyld (Primitive.MLton.GCState.gcState, trigger_gc) end val getMyPriority = _import "GC_myPriority": unit -> int; diff --git a/runtime/gc/garbage-collection.c b/runtime/gc/garbage-collection.c index b93802b38..dbeabd468 100755 --- a/runtime/gc/garbage-collection.c +++ b/runtime/gc/garbage-collection.c @@ -333,8 +333,8 @@ void *GCrunner(void *_s) { User_instrument(30); /* JEFF */ - if (DEBUG_RTGC) { - fprintf(stderr, "%d] [RTGC: Starting cycle #%s]\n", PTHREAD_NUM, + if (1||DEBUG_RTGC) { + fprintf(stderr, "%d] "YELLOW("[RTGC: Starting cycle #%s]\n"), PTHREAD_NUM, uintmaxToCommaString(s->cGCStats.numGCCycles + 1)); fprintf(stderr, "%d] [RTGC: Number of Chunks; Free: %d Allocated: %s]\n", PTHREAD_NUM, s->fl_chunks, uintmaxToCommaString(s->cGCStats.numChunksAllocated)); @@ -357,7 +357,6 @@ void *GCrunner(void *_s) { if (s->attempts > 2) { die("Insuffient Memory\n"); - } performGC_helper(s, @@ -367,8 +366,8 @@ void *GCrunner(void *_s) { s->cGCStats.numGCCycles += 1; gettimeofday(&t1, NULL); - - s->cGCStats.totalGCTime += ((t1.tv_sec - t0.tv_sec) * 1000000 + t1.tv_usec - t0.tv_usec) / 1000; + unsigned int gc_runtime_microsecs = ((t1.tv_sec - t0.tv_sec) * 1000000 + t1.tv_usec - t0.tv_usec) / 1000; + s->cGCStats.totalGCTime += gc_runtime_microsecs; s->dirty = false; /*Change this to reset all rtSync values for all RT threads*/ @@ -379,9 +378,9 @@ void *GCrunner(void *_s) { s->isGCRunning = false; - if (DEBUG_RTGC) { - fprintf(stderr, "%d] [RTGC: GC cycle #%s completed]\n", PTHREAD_NUM, - uintmaxToCommaString(s->cGCStats.numGCCycles)); + if (1||DEBUG_RTGC) { + fprintf(stderr, "%d] "YELLOW("[RTGC: GC cycle #%s completed in %u us]\n"), PTHREAD_NUM, + uintmaxToCommaString(s->cGCStats.numGCCycles), gc_runtime_microsecs); } User_instrument(30); /* JEFF */ @@ -913,7 +912,6 @@ void GC_collect(GC_state s, size_t bytesRequested, bool force, bool collectRed) fprintf(stderr, "%d] Came to block until GC finishes. ChunksAllocated = %s, FC = %d\n", PTHREAD_NUM, uintmaxToCommaString(s->cGCStats.numChunksAllocated), s->fl_chunks); } - } /*If stack is not marked already */ diff --git a/runtime/gc/realtime_thread.c b/runtime/gc/realtime_thread.c index e12cfbf75..10cffc0ce 100755 --- a/runtime/gc/realtime_thread.c +++ b/runtime/gc/realtime_thread.c @@ -211,11 +211,16 @@ int schedule_yield() { */ #define NANOS_PER_MILLI 1000000 +#define NANOS_PER_MICRO 1000 /* packing param is 0, 1, or 2. determines if this thread is allowed * to pack during its releases. not all threads should/can pack * safely. only rate mono / deadline scheduled threads should pack * using "2" and only during their shared periods + * + * the parameters are in ms which is probably too coarse. you + * can change to NANOS_PER_MICRO. one issue is that on 32bit + * systems you can overflow if you go too fine. */ void set_schedule(int runtime, int deadline, int period, int packing) { struct sched_attr attr; @@ -234,9 +239,9 @@ void set_schedule(int runtime, int deadline, int period, int packing) { /* times are in nanos for rtlinux */ attr.sched_policy = SCHED_DEADLINE; - attr.sched_runtime = (uint64_t)runtime * NANOS_PER_MILLI; - attr.sched_period = (uint64_t)period * NANOS_PER_MILLI; - attr.sched_deadline = (uint64_t)deadline * NANOS_PER_MILLI; + attr.sched_runtime = (uint64_t)runtime * NANOS_PER_MICRO; + attr.sched_period = (uint64_t)period * NANOS_PER_MICRO; + attr.sched_deadline = (uint64_t)deadline * NANOS_PER_MICRO; assert (runtime <= deadline); assert (deadline <= period); @@ -248,11 +253,14 @@ void set_schedule(int runtime, int deadline, int period, int packing) { } } -int schedule_yield() { +int schedule_yield(GC_state s, bool trigger_gc) { if (sched_yield() < 0) { perror("sched_yield"); die("realtime_thread.c set_schedule(): sched_yield"); } + if (trigger_gc) { + GC_collect(s, 0, true, true); // TODO not safe here + } return 0; } @@ -332,15 +340,19 @@ double get_ticks_since_boot(void) { #endif // must be a multiple of 2*sizeof(int) -#define MAX_INSTRUMENT 1024 +#define MAX_INSTRUMENT 4096 unsigned int instrument_offset[MAXPRI+1]; double instrument_buffer[MAXPRI+1][MAX_INSTRUMENT]; void User_instrument (Int32 icode) { - instrument_buffer[PTHREAD_NUM][instrument_offset[MAXPRI]] = get_ticks_since_boot(); - instrument_buffer[PTHREAD_NUM][instrument_offset[MAXPRI]+1] = (double)icode; - instrument_offset[MAXPRI] = (instrument_offset[MAXPRI]+2) % MAX_INSTRUMENT; + if (instrument_offset[PTHREAD_NUM] > (MAX_INSTRUMENT-2)) { + fprintf(stderr, "%d] "RED("*** instrument buffer wrapped ***")"\n", + PTHREAD_NUM); + } + instrument_buffer[PTHREAD_NUM][instrument_offset[PTHREAD_NUM]] = get_ticks_since_boot(); + instrument_buffer[PTHREAD_NUM][instrument_offset[PTHREAD_NUM]+1] = (double)icode; + instrument_offset[PTHREAD_NUM] = (instrument_offset[PTHREAD_NUM]+2) % MAX_INSTRUMENT; } void Dump_instrument_stderr (Int32 thrnum) { diff --git a/runtime/gc/realtime_thread.h b/runtime/gc/realtime_thread.h index 3b0e7e03d..229b2d40f 100755 --- a/runtime/gc/realtime_thread.h +++ b/runtime/gc/realtime_thread.h @@ -39,7 +39,7 @@ void User_instrument (Int32 p); void Dump_instrument_stderr (Int32 p); double get_ticks_since_boot(void); void set_schedule(int runtime, int deadline, int period, int packing); -int schedule_yield(void); +int schedule_yield(GC_state s, bool trigger_gc); #endif #endif /* _REALTIME_THREAD_H_ */ diff --git a/ub/rtlinux/deadlinesyscall.c b/ub/rtlinux/deadlinesyscall.c index cfdb83ea5..8b2d69eba 100755 --- a/ub/rtlinux/deadlinesyscall.c +++ b/ub/rtlinux/deadlinesyscall.c @@ -144,10 +144,13 @@ void *run_deadline(void *data) attr.sched_nice = 0; attr.sched_priority = 0; +#define MILLISEC 1000000 +#define MICROSEC 1000 + attr.sched_policy = SCHED_DEADLINE; - attr.sched_runtime = 25000; //5 * 1000 * 1000; - attr.sched_period = 1000 * 1000 * 1000; - attr.sched_deadline = 250 * 1000 * 1000; + attr.sched_runtime = 5 * MILLISEC; + attr.sched_period = 1000 * MILLISEC; + attr.sched_deadline = 500 * MILLISEC; printf("Setting schedule to (ns): runtime=%lld deadline=%lld period=%lld\n\n", (long long int)attr.sched_runtime, (long long int)attr.sched_deadline, (long long int)attr.sched_period); From 37783dc1c7f88f04ef70f3059f19a41e9899fdb6 Mon Sep 17 00:00:00 2001 From: jeff murphy Date: Sun, 27 Mar 2022 16:40:13 -0400 Subject: [PATCH 22/39] rtems changes --- basis-library/mlton/primthread.sig | 1 + basis-library/mlton/primthread.sml | 6 ++ runtime/gc/realtime_thread.c | 127 ++++++++++++++++++++++++----- runtime/gc/um.c | 4 +- ub/rtems/ratemono/hello.c | 6 +- ub/rtems/ratemono/init.c | 3 + 6 files changed, 121 insertions(+), 26 deletions(-) diff --git a/basis-library/mlton/primthread.sig b/basis-library/mlton/primthread.sig index 3cdae979e..127748f32 100755 --- a/basis-library/mlton/primthread.sig +++ b/basis-library/mlton/primthread.sig @@ -40,6 +40,7 @@ signature PRIM_THREAD = val rtunlock : int -> unit val pspawn: (unit->unit) * int -> unit val thread_main: unit -> unit + val thread_main_rtems: unit -> unit val gcstate: Primitive.MLton.GCState.t val getMyPriority: unit -> int diff --git a/basis-library/mlton/primthread.sml b/basis-library/mlton/primthread.sml index 881f8e155..6e05905f4 100755 --- a/basis-library/mlton/primthread.sml +++ b/basis-library/mlton/primthread.sml @@ -212,16 +212,22 @@ struct NONE => loop p | SOME w => (dbg "Working .. \n"; w () ; loop p) + fun oneshot p = + case WorkQueue.getWork (workQ, p) of + NONE => () + | SOME w => (dbg "Working .. \n"; w ()) fun test () = print (Int.toString(getMyPriority ())^"] Parallel_run::thread_main running!\n"); fun pspawn (f: unit->unit, p: int) = WorkQueue.addWork(workQ, f, p) fun thread_main () = loop (pthreadNum ()) + fun thread_main_rtems () = oneshot (pthreadNum ()) val gcstate = Primitive.MLton.GCState.gcState val () = (_export "Parallel_run": (unit -> unit) -> unit;) thread_main + val () = (_export "Parallel_run_rtems": (unit -> unit) -> unit;) thread_main_rtems (* val rtinit = _import "RT_init": Primitive.MLton.GCState.t -> unit;*) diff --git a/runtime/gc/realtime_thread.c b/runtime/gc/realtime_thread.c index 10cffc0ce..e9224d880 100755 --- a/runtime/gc/realtime_thread.c +++ b/runtime/gc/realtime_thread.c @@ -52,23 +52,62 @@ GC_safePoint(int32_t thr_num) { return 0; } +void Parallel_run(void); +void Parallel_run_rtems(void); + #if defined(__rtems__) #define directive_failed(COND,MSG) do{if(COND){puts(MSG);exit(-1);}}while(0) rtems_id ML_mutex; rtems_id User_mutexes[NUM_USER_MUTEXES]; +int current_runtime[MAXPRI], current_deadline[MAXPRI], current_period[MAXPRI]; rtems_task Periodic_task(rtems_task_argument argument); void RTEMS_Parallel_run_wrapper(int tNum); +/* + From the RTEMS doc + + The first time the loop is executed, the rtems_rate_monotonic_period directive will + initiate the period for 100 ticks and return immediately. Subsequent invocations of + the rtems_rate_monotonic_period directive will result in the task blocking for the + remainder of the 100 tick period. If, for any reason, the body of the loop takes more + than 100 ticks to execute, the rtems_rate_monotonic_period directive will return the + RTEMS_TIMEOUT status. + + Regarding changing a period: + + https://docs.rtems.org/releases/rtems-docs-4.11.3/c-user/rate_monotonic_manager.html#manipulating-a-period + + This periodic task initially executes Parallel_run() every 10ms. + 10 * ticks_per_sec() / 1000 + + To hit 10ms, be sure to configure RTEMS so that the clock is sufficiently high resolution. + eg.: + + #define CONFIGURE_MICROSECONDS_PER_TICK 1000 // 1 millisecond + #define CONFIGURE_TICKS_PER_TIMESLICE 50 // 50 milliseconds + + + Eventually, the SML code will call set_schedule. We will then cancel the 10ms period + and reset it to what was given to set_schedule as the period parameter. If we overrun + our period, instead of dying (as shown in the RTEMS example), we simply note it and + continue. + */ + __attribute__((noreturn)) rtems_task Periodic_task(rtems_task_argument arg) { + /* rtems_task_argument is a 32bit ptr + * https://docs.rtems.org/doxygen/branches/master/group__ClassicTasks.html#gaf202f985ef5a3156f29eae99a0536842 + */ rtems_name name; rtems_id period; + char tnum = arg & 0xFF; + int prev_period = current_period[tnum]; rtems_status_code status; - name = rtems_build_name( 'P', 'E', 'R', 'D' ); + name = rtems_build_name( 'P', 'E', 'R', tnum ); status = rtems_rate_monotonic_create( name, &period ); if ( status != RTEMS_SUCCESSFUL ) { printf( "rtems_monotonic_create failed with status of %d.\n", status ); @@ -76,28 +115,46 @@ rtems_task Periodic_task(rtems_task_argument arg) { } while ( 1 ) { int x = rtems_clock_get_ticks_since_boot(); - printf("Calling rtems_rate_monotonic_period(period=250 ticks). clock=%d\n", x); - if ( rtems_rate_monotonic_period( period, 250 ) == RTEMS_TIMEOUT ) - break; - x = rtems_clock_get_ticks_since_boot(); - printf(" Task awake: periodic action. clock=%d\n", x); + + /* if our period has changed (via set_schedule) then we need to cancel + * and reset our period + */ + if (prev_period != current_period[tnum]) { + status = rtems_rate_monotonic_cancel(period); + if (status != RTEMS_SUCCESSFUL) { + fprintf(stderr, "%d] "RED("rtems failed to cancel current period. status=%d\n"), PTHREAD_NUM, status); + exit(1); + } + prev_period = current_period[tnum]; + } + + /* the following is an implicit yield if we are still in the same period */ + + if ( rtems_rate_monotonic_period( period, current_period[tnum] ) == RTEMS_TIMEOUT ) { + fprintf(stderr, "%d] "RED("missed deadline/period cur: %d, clock: %d\n"), + PTHREAD_NUM, current_period[tnum], x); + status = rtems_rate_monotonic_cancel(period); + if (status != RTEMS_SUCCESSFUL) { + fprintf(stderr, "%d] "RED("rtems failed to cancel current period. status=%d\n"), PTHREAD_NUM, status); + exit(1); + } + continue; + } + /* Perform some periodic actions */ + fprintf(stderr, "%d] calling into parallel_run_rtems\n", PTHREAD_NUM); + Parallel_run_rtems(); + fprintf(stderr, "%d] back from parallel_run_rtems\n", PTHREAD_NUM); } - /* missed period so delete period and SELF */ - status = rtems_rate_monotonic_delete( period ); - if ( status != RTEMS_SUCCESSFUL ) { - printf( "rtems_rate_monotonic_delete failed with status of %d.\n", status ); - exit( 1 ); - } - status = rtems_task_delete( RTEMS_SELF ); /* should not return */ - printf( "rtems_task_delete returned with status of %d.\n", status ); - exit( 1 ); + /* NOTREACHED */ } __attribute__((noreturn)) void RTEMS_Parallel_run_wrapper(int tNum) { rtems_id task_id; rtems_status_code status; + + /* create a new task, the identifier contains the thread number */ status = rtems_task_create( rtems_build_name( 'T', 'A', '1', (char)tNum ), 1, @@ -107,10 +164,18 @@ void RTEMS_Parallel_run_wrapper(int tNum) { &task_id ); directive_failed( status, "rtems_task_create of TA1" ); - status = rtems_task_start( task_id, Periodic_task, 0 ); + + // see note above about configuring the RTEMS clock + current_period[tNum] = (int)(10 * rtems_clock_get_ticks_per_second() / 1000.0); + + /* start the task. the task will call Parallel_run() to execute + * the SML code the way the linux code path does. + */ + status = rtems_task_start( task_id, Periodic_task, tNum ); directive_failed( status, "rtems_task_start of TA1" ); while ( 1 ) { - status = rtems_task_wake_after( 200*rtems_clock_get_ticks_per_second() ); + /* this loops forever, waking every 300 seconds, does not affect the period_task */ + status = rtems_task_wake_after( 300*rtems_clock_get_ticks_per_second() ); directive_failed( status, "rtems_task_wake_after" ); } } @@ -178,14 +243,34 @@ double get_ticks_since_boot(void) { * safely. only rate mono / deadline scheduled threads should pack * using "2" and only during their shared periods */ -void set_schedule(uint64_t runtime, uint64_t deadline, uint64_t period, int packing) { +void set_schedule(int runtime, int deadline, int period, int packing) { + if(DEBUG_THREADS) + fprintf(stderr, "%d] "YELLOW("set_schedule")" runtime:%llu period:%llu deadline:%llu packing:%d\n", + PTHREAD_NUM, (uint64_t)runtime, (uint64_t)period, (uint64_t)deadline, packing); + + assert (runtime <= deadline); + assert (deadline <= period); + allowedToPack[PTHREAD_NUM] = packing; + + /* these will cause a schedule update at the start of the task's next period */ + + current_runtime[PTHREAD_NUM] = runtime; + current_deadline[PTHREAD_NUM] = deadline; + current_period[PTHREAD_NUM] = period; + return; } -int schedule_yield() { +int schedule_yield(GC_state s, bool trigger_gc) { // See "11.3.6. Examples" here: // https://docs.rtems.org/releases/rtems-docs-4.11.3/c-user/rate_monotonic_manager.html#rtems-rate-monotonic-create // wait for next period + + /* yield/wfnp is implicit in RTEMS: when the computation returns, we go to the top + * of the loop and call rtems_rate_monotonic_period again. if we are still in + * the current period, we are suspended until a new period starts. therefore, this + * function is a NOP. + */ return 0; } @@ -233,7 +318,7 @@ void set_schedule(int runtime, int deadline, int period, int packing) { allowedToPack[PTHREAD_NUM] = packing; attr.size = sizeof(attr); - attr.sched_flags = SCHED_FLAG_DL_OVERRUN; // supposed to make linux SIGXCPU on overrun + attr.sched_flags = 0; // SCHED_FLAG_DL_OVERRUN; // supposed to make linux SIGXCPU on overrun attr.sched_nice = 0; attr.sched_priority = 0; @@ -501,8 +586,6 @@ Int32 RTThread_get_pthread_num(void) #define COPYIN2(s,EL) s->EL[2] = s->EL[0] -void Parallel_run(void); - __attribute__((noreturn)) void * realtimeRunner (void *paramsPtr) diff --git a/runtime/gc/um.c b/runtime/gc/um.c index eb32a8eb9..2ca46b1ac 100755 --- a/runtime/gc/um.c +++ b/runtime/gc/um.c @@ -165,7 +165,7 @@ UM_Object_alloc_packing_stage1(GC_state s, C_Size_t num_chunks, uint32_t header, chunk = (GC_UM_Chunk)s->activeChunk[PTHREAD_NUM]; if (DEBUG_ALLOC_PACK) - fprintf(stderr, "%d] there's an activeChunk. used %d\n", PTHREAD_NUM, chunk->used); + fprintf(stderr, "%d] there's an activeChunk. used %d\n", PTHREAD_NUM, (int) chunk->used); /* if cur chunk has no room left, then alloc a new one: * if stage2 is enabled, we will first attempt to piggy back on another @@ -201,7 +201,7 @@ UM_Object_alloc_packing_stage1(GC_state s, C_Size_t num_chunks, uint32_t header, if (DEBUG_ALLOC_PACK) fprintf(stderr, "%d] there is space in this chunk (%u) to fit our object (%d)\n", PTHREAD_NUM, - UM_CHUNK_PAYLOAD_SIZE-(chunk->used), sz+hdrsz + (unsigned int)(UM_CHUNK_PAYLOAD_SIZE-(chunk->used)), sz+hdrsz ); LOCK_FL; diff --git a/ub/rtems/ratemono/hello.c b/ub/rtems/ratemono/hello.c index 567e7c117..9e038eea0 100755 --- a/ub/rtems/ratemono/hello.c +++ b/ub/rtems/ratemono/hello.c @@ -25,7 +25,8 @@ rtems_task Periodic_task(rtems_task_argument arg) } while ( 1 ) { int x = rtems_clock_get_ticks_since_boot(); - printf("Calling rtems_rate_monotonic_period(period=250 ticks). clock=%d\n", x); + printf("Calling rtems_rate_monotonic_period(period=250 ticks). clock=%d ticks/sec=%d\n", x, rtems_clock_get_ticks_per_second()); + if ( rtems_rate_monotonic_period( period, 250 ) == RTEMS_TIMEOUT ) break; x = rtems_clock_get_ticks_since_boot(); @@ -68,7 +69,8 @@ rtems_task Init( status = rtems_task_start( task_id, Periodic_task, 0 ); directive_failed( status, "rtems_task_start of TA1" ); while ( !partial_loop ) { - status = rtems_task_wake_after( 2 ); + /* main sleeps for 200 secs before checking to see if partial_loop is set */ + status = rtems_task_wake_after( 200*rtems_clock_get_ticks_per_second() ); directive_failed( status, "rtems_task_wake_after" ); } diff --git a/ub/rtems/ratemono/init.c b/ub/rtems/ratemono/init.c index cd6ca6c3f..46dee37d0 100755 --- a/ub/rtems/ratemono/init.c +++ b/ub/rtems/ratemono/init.c @@ -14,6 +14,9 @@ //#define CONFIGURE_POSIX_INIT_THREAD_TABLE +#define CONFIGURE_MICROSECONDS_PER_TICK 1000 /* 1 millisecond */ +#define CONFIGURE_TICKS_PER_TIMESLICE 50 /* 50 milliseconds */ + #define CONFIGURE_MAXIMUM_POSIX_THREADS 6 #define CONFIGURE_MAXIMUM_TASKS 2 #define CONFIGURE_MAXIMUM_PERIODS 1 From 1f90392e265a77458a674f207f53536f6a7679d2 Mon Sep 17 00:00:00 2001 From: jeff murphy Date: Mon, 28 Mar 2022 16:49:07 -0400 Subject: [PATCH 23/39] rtems --- .gitignore | 12 + runtime/gc/debug.h | 669 +++++++++++++++++++++++++++ runtime/gc/realtime_thread.c | 7 +- ub/rtems/justprint/justprint.0.c | 7 + ub/rtems/two-threads/Makefile | 38 ++ ub/rtems/two-threads/init.c | 29 ++ ub/rtems/two-threads/rtems-main.c | 23 + ub/rtems/two-threads/two-threads.sml | 67 +++ ub/rtems/two-threads/wscript | 54 +++ 9 files changed, 903 insertions(+), 3 deletions(-) create mode 100755 ub/rtems/two-threads/Makefile create mode 100755 ub/rtems/two-threads/init.c create mode 100755 ub/rtems/two-threads/rtems-main.c create mode 100755 ub/rtems/two-threads/two-threads.sml create mode 100755 ub/rtems/two-threads/wscript diff --git a/.gitignore b/.gitignore index 7c1400cda..12b21549a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,17 @@ ub/rtems/thread-message/message runtime/constants-rtems/waf +ub/rtems/ratemono/.lock-waf_linux2_build +ub/rtems/ratemono/build/ +ub/rtems/ratemono/waf +ub/rtems/two-threads/two-threads +ub/rtems/two-threads/two-threads.0.c.orig +ub/rtems/two-threads/two-threads.3.c +ub/rtems/two-threads/two-threads.3.c.orig +ub/rtlinux/deadline +ub/rtlinux/periodic +ub/rtems/two-threads/.lock-waf_linux2_build +ub/rtems/two-threads/waf +ub/rtems/two-threads/build ub/rtems/justprint/.lock-waf_linux2_build ub/rtems/justprint/waf ub/rtems/justprint/build diff --git a/runtime/gc/debug.h b/runtime/gc/debug.h index 38fa8eea3..9602fa0e0 100755 --- a/runtime/gc/debug.h +++ b/runtime/gc/debug.h @@ -54,3 +54,672 @@ enum { #define GREEN(x) "\033[1;32m"x"\033[0m" #define BLUE(x) "\033[1;34m"x"\033[0m" #define PURPLE(x) "\033[1;35m"x"\033[0m" + + +#include +char const * errnoname(int errno_); + +char const * errnoname(int errno_) +{ + switch(errno_) + { +#ifdef E2BIG + case E2BIG: return "E2BIG"; +#endif +#ifdef EACCES + case EACCES: return "EACCES"; +#endif +#ifdef EADDRINUSE + case EADDRINUSE: return "EADDRINUSE"; +#endif +#ifdef EADDRNOTAVAIL + case EADDRNOTAVAIL: return "EADDRNOTAVAIL"; +#endif +#ifdef EADI + case EADI: return "EADI"; +#endif +#ifdef EADV + case EADV: return "EADV"; +#endif +#ifdef EAFNOSUPPORT + case EAFNOSUPPORT: return "EAFNOSUPPORT"; +#endif +#ifdef EAGAIN + case EAGAIN: return "EAGAIN"; +#endif +#ifdef EAIO + case EAIO: return "EAIO"; +#endif +#ifdef EALIGN + case EALIGN: return "EALIGN"; +#endif +#ifdef EALREADY + case EALREADY: return "EALREADY"; +#endif +#ifdef EASYNC + case EASYNC: return "EASYNC"; +#endif +#ifdef EAUTH + case EAUTH: return "EAUTH"; +#endif +#ifdef EBADARCH + case EBADARCH: return "EBADARCH"; +#endif +#ifdef EBADE + case EBADE: return "EBADE"; +#endif +#ifdef EBADEXEC + case EBADEXEC: return "EBADEXEC"; +#endif +#ifdef EBADF + case EBADF: return "EBADF"; +#endif +#ifdef EBADFD + case EBADFD: return "EBADFD"; +#endif +#ifdef EBADMACHO + case EBADMACHO: return "EBADMACHO"; +#endif +#ifdef EBADMSG + case EBADMSG: return "EBADMSG"; +#endif +#ifdef EBADR + case EBADR: return "EBADR"; +#endif +#ifdef EBADRPC + case EBADRPC: return "EBADRPC"; +#endif +#ifdef EBADRQC + case EBADRQC: return "EBADRQC"; +#endif +#ifdef EBADSLT + case EBADSLT: return "EBADSLT"; +#endif +#ifdef EBADVER + case EBADVER: return "EBADVER"; +#endif +#ifdef EBFONT + case EBFONT: return "EBFONT"; +#endif +#ifdef EBUSY + case EBUSY: return "EBUSY"; +#endif +#ifdef ECANCELED + case ECANCELED: return "ECANCELED"; +#endif +#if defined(ECANCELLED) && (!defined(ECANCELED) || ECANCELLED != ECANCELED) + case ECANCELLED: return "ECANCELLED"; +#endif +#ifdef ECAPMODE + case ECAPMODE: return "ECAPMODE"; +#endif +#ifdef ECHILD + case ECHILD: return "ECHILD"; +#endif +#ifdef ECHRNG + case ECHRNG: return "ECHRNG"; +#endif +#ifdef ECKPT + case ECKPT: return "ECKPT"; +#endif +#ifdef ECLONEME + case ECLONEME: return "ECLONEME"; +#endif +#ifdef ECOMM + case ECOMM: return "ECOMM"; +#endif +#ifdef ECONFIG + case ECONFIG: return "ECONFIG"; +#endif +#ifdef ECONNABORTED + case ECONNABORTED: return "ECONNABORTED"; +#endif +#ifdef ECONNREFUSED + case ECONNREFUSED: return "ECONNREFUSED"; +#endif +#ifdef ECONNRESET + case ECONNRESET: return "ECONNRESET"; +#endif +#ifdef ECORRUPT + case ECORRUPT: return "ECORRUPT"; +#endif +#ifdef ECVCERORR + case ECVCERORR: return "ECVCERORR"; +#endif +#ifdef ECVPERORR + case ECVPERORR: return "ECVPERORR"; +#endif +#ifdef EDEADLK + case EDEADLK: return "EDEADLK"; +#endif +#if defined(EDEADLOCK) && (!defined(EDEADLK) || EDEADLOCK != EDEADLK) + case EDEADLOCK: return "EDEADLOCK"; +#endif +#ifdef EDESTADDREQ + case EDESTADDREQ: return "EDESTADDREQ"; +#endif +#ifdef EDESTADDRREQ + case EDESTADDRREQ: return "EDESTADDRREQ"; +#endif +#ifdef EDEVERR + case EDEVERR: return "EDEVERR"; +#endif +#ifdef EDIRIOCTL + case EDIRIOCTL: return "EDIRIOCTL"; +#endif +#ifdef EDIRTY + case EDIRTY: return "EDIRTY"; +#endif +#ifdef EDIST + case EDIST: return "EDIST"; +#endif +#ifdef EDOM + case EDOM: return "EDOM"; +#endif +#ifdef EDOOFUS + case EDOOFUS: return "EDOOFUS"; +#endif +#ifdef EDOTDOT + case EDOTDOT: return "EDOTDOT"; +#endif +#ifdef EDQUOT + case EDQUOT: return "EDQUOT"; +#endif +#ifdef EDUPFD + case EDUPFD: return "EDUPFD"; +#endif +#ifdef EDUPPKG + case EDUPPKG: return "EDUPPKG"; +#endif +#ifdef EEXIST + case EEXIST: return "EEXIST"; +#endif +#ifdef EFAIL + case EFAIL: return "EFAIL"; +#endif +#ifdef EFAULT + case EFAULT: return "EFAULT"; +#endif +#ifdef EFBIG + case EFBIG: return "EFBIG"; +#endif +#ifdef EFORMAT + case EFORMAT: return "EFORMAT"; +#endif +#ifdef EFSCORRUPTED + case EFSCORRUPTED: return "EFSCORRUPTED"; +#endif +#ifdef EFTYPE + case EFTYPE: return "EFTYPE"; +#endif +#ifdef EHOSTDOWN + case EHOSTDOWN: return "EHOSTDOWN"; +#endif +#ifdef EHOSTUNREACH + case EHOSTUNREACH: return "EHOSTUNREACH"; +#endif +#ifdef EHWPOISON + case EHWPOISON: return "EHWPOISON"; +#endif +#ifdef EIDRM + case EIDRM: return "EIDRM"; +#endif +#ifdef EILSEQ + case EILSEQ: return "EILSEQ"; +#endif +#ifdef EINIT + case EINIT: return "EINIT"; +#endif +#ifdef EINPROG + case EINPROG: return "EINPROG"; +#endif +#ifdef EINPROGRESS + case EINPROGRESS: return "EINPROGRESS"; +#endif +#ifdef EINTEGRITY + case EINTEGRITY: return "EINTEGRITY"; +#endif +#ifdef EINTR + case EINTR: return "EINTR"; +#endif +#ifdef EINVAL + case EINVAL: return "EINVAL"; +#endif +#ifdef EIO + case EIO: return "EIO"; +#endif +#ifdef EIPSEC + case EIPSEC: return "EIPSEC"; +#endif +#ifdef EISCONN + case EISCONN: return "EISCONN"; +#endif +#ifdef EISDIR + case EISDIR: return "EISDIR"; +#endif +#ifdef EISNAM + case EISNAM: return "EISNAM"; +#endif +#ifdef EJUSTRETURN + case EJUSTRETURN: return "EJUSTRETURN"; +#endif +#ifdef EKEEPLOOKING + case EKEEPLOOKING: return "EKEEPLOOKING"; +#endif +#ifdef EKEYEXPIRED + case EKEYEXPIRED: return "EKEYEXPIRED"; +#endif +#ifdef EKEYREJECTED + case EKEYREJECTED: return "EKEYREJECTED"; +#endif +#ifdef EKEYREVOKED + case EKEYREVOKED: return "EKEYREVOKED"; +#endif +#ifdef EL2HLT + case EL2HLT: return "EL2HLT"; +#endif +#ifdef EL2NSYNC + case EL2NSYNC: return "EL2NSYNC"; +#endif +#ifdef EL3HLT + case EL3HLT: return "EL3HLT"; +#endif +#ifdef EL3RST + case EL3RST: return "EL3RST"; +#endif +#ifdef ELIBACC + case ELIBACC: return "ELIBACC"; +#endif +#ifdef ELIBBAD + case ELIBBAD: return "ELIBBAD"; +#endif +#ifdef ELIBEXEC + case ELIBEXEC: return "ELIBEXEC"; +#endif +#ifdef ELIBMAX + case ELIBMAX: return "ELIBMAX"; +#endif +#ifdef ELIBSCN + case ELIBSCN: return "ELIBSCN"; +#endif +#ifdef ELNRNG + case ELNRNG: return "ELNRNG"; +#endif +#ifdef ELOCKUNMAPPED + case ELOCKUNMAPPED: return "ELOCKUNMAPPED"; +#endif +#ifdef ELOOP + case ELOOP: return "ELOOP"; +#endif +#ifdef EMEDIA + case EMEDIA: return "EMEDIA"; +#endif +#ifdef EMEDIUMTYPE + case EMEDIUMTYPE: return "EMEDIUMTYPE"; +#endif +#ifdef EMFILE + case EMFILE: return "EMFILE"; +#endif +#ifdef EMLINK + case EMLINK: return "EMLINK"; +#endif +#ifdef EMOUNTEXIT + case EMOUNTEXIT: return "EMOUNTEXIT"; +#endif +#ifdef EMOVEFD + case EMOVEFD: return "EMOVEFD"; +#endif +#ifdef EMSGSIZE + case EMSGSIZE: return "EMSGSIZE"; +#endif +#ifdef EMTIMERS + case EMTIMERS: return "EMTIMERS"; +#endif +#ifdef EMULTIHOP + case EMULTIHOP: return "EMULTIHOP"; +#endif +#ifdef ENAMETOOLONG + case ENAMETOOLONG: return "ENAMETOOLONG"; +#endif +#ifdef ENAVAIL + case ENAVAIL: return "ENAVAIL"; +#endif +#ifdef ENEEDAUTH + case ENEEDAUTH: return "ENEEDAUTH"; +#endif +#ifdef ENETDOWN + case ENETDOWN: return "ENETDOWN"; +#endif +#ifdef ENETRESET + case ENETRESET: return "ENETRESET"; +#endif +#ifdef ENETUNREACH + case ENETUNREACH: return "ENETUNREACH"; +#endif +#ifdef ENFILE + case ENFILE: return "ENFILE"; +#endif +#ifdef ENFSREMOTE + case ENFSREMOTE: return "ENFSREMOTE"; +#endif +#ifdef ENOANO + case ENOANO: return "ENOANO"; +#endif +#ifdef ENOATTR + case ENOATTR: return "ENOATTR"; +#endif +#ifdef ENOBUFS + case ENOBUFS: return "ENOBUFS"; +#endif +#ifdef ENOCONNECT + case ENOCONNECT: return "ENOCONNECT"; +#endif +#ifdef ENOCSI + case ENOCSI: return "ENOCSI"; +#endif +#ifdef ENODATA + case ENODATA: return "ENODATA"; +#endif +#ifdef ENODEV + case ENODEV: return "ENODEV"; +#endif +#ifdef ENOENT + case ENOENT: return "ENOENT"; +#endif +#ifdef ENOEXEC + case ENOEXEC: return "ENOEXEC"; +#endif +#ifdef ENOIOCTL + case ENOIOCTL: return "ENOIOCTL"; +#endif +#ifdef ENOKEY + case ENOKEY: return "ENOKEY"; +#endif +#ifdef ENOLCK + case ENOLCK: return "ENOLCK"; +#endif +#ifdef ENOLINK + case ENOLINK: return "ENOLINK"; +#endif +#ifdef ENOLOAD + case ENOLOAD: return "ENOLOAD"; +#endif +#ifdef ENOMATCH + case ENOMATCH: return "ENOMATCH"; +#endif +#ifdef ENOMEDIUM + case ENOMEDIUM: return "ENOMEDIUM"; +#endif +#ifdef ENOMEM + case ENOMEM: return "ENOMEM"; +#endif +#ifdef ENOMSG + case ENOMSG: return "ENOMSG"; +#endif +#ifdef ENONET + case ENONET: return "ENONET"; +#endif +#ifdef ENOPKG + case ENOPKG: return "ENOPKG"; +#endif +#ifdef ENOPOLICY + case ENOPOLICY: return "ENOPOLICY"; +#endif +#ifdef ENOPROTOOPT + case ENOPROTOOPT: return "ENOPROTOOPT"; +#endif +#ifdef ENOREG + case ENOREG: return "ENOREG"; +#endif +#ifdef ENOSPC + case ENOSPC: return "ENOSPC"; +#endif +#ifdef ENOSR + case ENOSR: return "ENOSR"; +#endif +#ifdef ENOSTR + case ENOSTR: return "ENOSTR"; +#endif +#ifdef ENOSYM + case ENOSYM: return "ENOSYM"; +#endif +#ifdef ENOSYS + case ENOSYS: return "ENOSYS"; +#endif +#ifdef ENOTACTIVE + case ENOTACTIVE: return "ENOTACTIVE"; +#endif +#ifdef ENOTBLK + case ENOTBLK: return "ENOTBLK"; +#endif +#ifdef ENOTCAPABLE + case ENOTCAPABLE: return "ENOTCAPABLE"; +#endif +#ifdef ENOTCONN + case ENOTCONN: return "ENOTCONN"; +#endif +#ifdef ENOTDIR + case ENOTDIR: return "ENOTDIR"; +#endif +#ifdef ENOTEMPTY + case ENOTEMPTY: return "ENOTEMPTY"; +#endif +#ifdef ENOTNAM + case ENOTNAM: return "ENOTNAM"; +#endif +#ifdef ENOTREADY + case ENOTREADY: return "ENOTREADY"; +#endif +#ifdef ENOTRECOVERABLE + case ENOTRECOVERABLE: return "ENOTRECOVERABLE"; +#endif +#ifdef ENOTRUST + case ENOTRUST: return "ENOTRUST"; +#endif +#ifdef ENOTSOCK + case ENOTSOCK: return "ENOTSOCK"; +#endif +#ifdef ENOTSUP + case ENOTSUP: return "ENOTSUP"; +#endif +#ifdef ENOTTY + case ENOTTY: return "ENOTTY"; +#endif +#ifdef ENOTUNIQ + case ENOTUNIQ: return "ENOTUNIQ"; +#endif +#ifdef ENOUNLD + case ENOUNLD: return "ENOUNLD"; +#endif +#ifdef ENOUNREG + case ENOUNREG: return "ENOUNREG"; +#endif +#ifdef ENXIO + case ENXIO: return "ENXIO"; +#endif +#ifdef EOPCOMPLETE + case EOPCOMPLETE: return "EOPCOMPLETE"; +#endif +#if defined(EOPNOTSUPP) && (!defined(ENOTSUP) || EOPNOTSUPP != ENOTSUP) + case EOPNOTSUPP: return "EOPNOTSUPP"; +#endif +#ifdef EOVERFLOW + case EOVERFLOW: return "EOVERFLOW"; +#endif +#ifdef EOWNERDEAD + case EOWNERDEAD: return "EOWNERDEAD"; +#endif +#ifdef EPASSTHROUGH + case EPASSTHROUGH: return "EPASSTHROUGH"; +#endif +#ifdef EPATHREMOTE + case EPATHREMOTE: return "EPATHREMOTE"; +#endif +#ifdef EPERM + case EPERM: return "EPERM"; +#endif +#ifdef EPFNOSUPPORT + case EPFNOSUPPORT: return "EPFNOSUPPORT"; +#endif +#ifdef EPIPE + case EPIPE: return "EPIPE"; +#endif +#ifdef EPOWERF + case EPOWERF: return "EPOWERF"; +#endif +#ifdef EPROCLIM + case EPROCLIM: return "EPROCLIM"; +#endif +#ifdef EPROCUNAVAIL + case EPROCUNAVAIL: return "EPROCUNAVAIL"; +#endif +#ifdef EPROGMISMATCH + case EPROGMISMATCH: return "EPROGMISMATCH"; +#endif +#ifdef EPROGUNAVAIL + case EPROGUNAVAIL: return "EPROGUNAVAIL"; +#endif +#ifdef EPROTO + case EPROTO: return "EPROTO"; +#endif +#ifdef EPROTONOSUPPORT + case EPROTONOSUPPORT: return "EPROTONOSUPPORT"; +#endif +#ifdef EPROTOTYPE + case EPROTOTYPE: return "EPROTOTYPE"; +#endif +#ifdef EPWROFF + case EPWROFF: return "EPWROFF"; +#endif +#ifdef EQFULL + case EQFULL: return "EQFULL"; +#endif +#ifdef EQSUSPENDED + case EQSUSPENDED: return "EQSUSPENDED"; +#endif +#ifdef ERANGE + case ERANGE: return "ERANGE"; +#endif +#ifdef ERECYCLE + case ERECYCLE: return "ERECYCLE"; +#endif +#ifdef EREDRIVEOPEN + case EREDRIVEOPEN: return "EREDRIVEOPEN"; +#endif +#ifdef EREFUSED + case EREFUSED: return "EREFUSED"; +#endif +#ifdef ERELOC + case ERELOC: return "ERELOC"; +#endif +#ifdef ERELOCATED + case ERELOCATED: return "ERELOCATED"; +#endif +#ifdef ERELOOKUP + case ERELOOKUP: return "ERELOOKUP"; +#endif +#ifdef EREMCHG + case EREMCHG: return "EREMCHG"; +#endif +#ifdef EREMDEV + case EREMDEV: return "EREMDEV"; +#endif +#ifdef EREMOTE + case EREMOTE: return "EREMOTE"; +#endif +#ifdef EREMOTEIO + case EREMOTEIO: return "EREMOTEIO"; +#endif +#ifdef EREMOTERELEASE + case EREMOTERELEASE: return "EREMOTERELEASE"; +#endif +#ifdef ERESTART + case ERESTART: return "ERESTART"; +#endif +#ifdef ERFKILL + case ERFKILL: return "ERFKILL"; +#endif +#ifdef EROFS + case EROFS: return "EROFS"; +#endif +#ifdef ERPCMISMATCH + case ERPCMISMATCH: return "ERPCMISMATCH"; +#endif +#ifdef ESAD + case ESAD: return "ESAD"; +#endif +#ifdef ESHLIBVERS + case ESHLIBVERS: return "ESHLIBVERS"; +#endif +#ifdef ESHUTDOWN + case ESHUTDOWN: return "ESHUTDOWN"; +#endif +#ifdef ESOCKTNOSUPPORT + case ESOCKTNOSUPPORT: return "ESOCKTNOSUPPORT"; +#endif +#ifdef ESOFT + case ESOFT: return "ESOFT"; +#endif +#ifdef ESPIPE + case ESPIPE: return "ESPIPE"; +#endif +#ifdef ESRCH + case ESRCH: return "ESRCH"; +#endif +#ifdef ESRMNT + case ESRMNT: return "ESRMNT"; +#endif +#ifdef ESTALE + case ESTALE: return "ESTALE"; +#endif +#ifdef ESTART + case ESTART: return "ESTART"; +#endif +#ifdef ESTRPIPE + case ESTRPIPE: return "ESTRPIPE"; +#endif +#ifdef ESYSERROR + case ESYSERROR: return "ESYSERROR"; +#endif +#ifdef ETIME + case ETIME: return "ETIME"; +#endif +#ifdef ETIMEDOUT + case ETIMEDOUT: return "ETIMEDOUT"; +#endif +#ifdef ETOOMANYREFS + case ETOOMANYREFS: return "ETOOMANYREFS"; +#endif +#ifdef ETXTBSY + case ETXTBSY: return "ETXTBSY"; +#endif +#ifdef EUCLEAN + case EUCLEAN: return "EUCLEAN"; +#endif +#ifdef EUNATCH + case EUNATCH: return "EUNATCH"; +#endif +#ifdef EUSERS + case EUSERS: return "EUSERS"; +#endif +#ifdef EVERSION + case EVERSION: return "EVERSION"; +#endif +#if defined(EWOULDBLOCK) && (!defined(EAGAIN) || EWOULDBLOCK != EAGAIN) + case EWOULDBLOCK: return "EWOULDBLOCK"; +#endif +#ifdef EWRONGFS + case EWRONGFS: return "EWRONGFS"; +#endif +#ifdef EWRPROTECT + case EWRPROTECT: return "EWRPROTECT"; +#endif +#ifdef EXDEV + case EXDEV: return "EXDEV"; +#endif +#ifdef EXFULL + case EXFULL: return "EXFULL"; +#endif + } + return 0; +} diff --git a/runtime/gc/realtime_thread.c b/runtime/gc/realtime_thread.c index e9224d880..c35808de6 100755 --- a/runtime/gc/realtime_thread.c +++ b/runtime/gc/realtime_thread.c @@ -607,17 +607,18 @@ realtimeRunner (void *paramsPtr) BLOCK_RT_THREADS; UNLOCK_RT_THREADS; } - - fprintf (stderr, "%d] calling parallel_run \n", tNum); + state->rtSync[PTHREAD_NUM] = false; // this may need to be true if "@MLton rtthreads" is false #if defined(__rtems__) + fprintf (stderr, "%d] "PURPLE("calling RTEMS_Parallel_run_wrapper\n"), tNum); RTEMS_Parallel_run_wrapper(params->tNum); #else + fprintf (stderr, "%d] "PURPLE("calling parallel_run\n"), tNum); Parallel_run (); #endif - fprintf (stderr, "%d] back from Parallel_run (shouldnt happen)\n", tNum); + fprintf (stderr, "%d] "RED("back from Parallel_run (shouldnt happen)\n"), tNum); exit (-1); /*NOTREACHED*/ } diff --git a/ub/rtems/justprint/justprint.0.c b/ub/rtems/justprint/justprint.0.c index 320d6bf9e..b1e12d496 100755 --- a/ub/rtems/justprint/justprint.0.c +++ b/ub/rtems/justprint/justprint.0.c @@ -157,6 +157,13 @@ PRIVATE Word32 CReturnW32[PTHREAD_MAX]; PRIVATE Word64 globalWord64[0]; PRIVATE Word64 CReturnW64[PTHREAD_MAX]; PRIVATE Pointer globalObjptrNonRoot [1]; +PUBLIC void Parallel_run_rtems () { + Pointer localOpArgsRes[1]; + Int32 localOp = 1; + localOpArgsRes[0] = (Pointer)(&localOp); + MLton_callFromC ((Pointer)(localOpArgsRes)); +/*(Pointer)(localOpArgsRes));*/ +} PUBLIC void Parallel_run () { Pointer localOpArgsRes[1]; Int32 localOp = 0; diff --git a/ub/rtems/two-threads/Makefile b/ub/rtems/two-threads/Makefile new file mode 100755 index 000000000..67e8b1bdf --- /dev/null +++ b/ub/rtems/two-threads/Makefile @@ -0,0 +1,38 @@ +# steps +# 1. build the sml file, save the C intermediates +# 2. rename 'main' in the *.0.c file +# 3. unpack the waf code +# 4. configure and build using waf + +all: rtems + +rtems: fixmain fixprotos + rm -fr build + tar -xpf ../../../runtime/rtems_waf.tar + ./waf configure --rtems=/opt/rtems6 --rtems-bsp=i386/pc386 + ./waf + /opt/rtems6/bin/rtems-run --rtems-bsps=pc-qemu ./build/i386-rtems6-pc386/hello.exe + +buildsml: + [ -f /home/jcmurphy/RTMLton/build/lib/targets/self/constants.linux ] || cp /home/jcmurphy/RTMLton/build/lib/targets/self/constants /home/jcmurphy/RTMLton/build/lib/targets/self/constants.linux + cp /home/jcmurphy/RTMLton/build/lib/targets/i386-rtems6/constants /home/jcmurphy/RTMLton/build/lib/targets/self/constants + /home/jcmurphy/RTMLton/build/bin/mlton -codegen c -keep g -debug true two-threads.sml + +fixmain: buildsml + mv two-threads.0.c two-threads.0.c.orig + sed 's/^int main /int mainX /' two-threads.0.c.orig | \ + sed 's/uint32_t atMLtons_len = 2;/uint32_t atMLtons_len = 4;/' | \ + sed 's/static char\* atMLtons/static char* atMLtons[] = {"@MLton","rtthreads", "true","--",}; static char* atMLtonsOLD/' \ + > two-threads.0.c + +fixprotos: buildsml + mv two-threads.3.c two-threads.3.c.orig + cat two-threads.3.c.orig | \ + sed 's/PRIVATE Int32 Posix_FileSys_Stat_getCTime ();/PRIVATE C_Time_t Posix_FileSys_Stat_getCTime(void);/' | \ + sed 's/PRIVATE Int32 Posix_FileSys_Stat_getMTime ();/PRIVATE C_Time_t Posix_FileSys_Stat_getMTime(void);/' | \ + sed 's/PRIVATE Int32 Posix_FileSys_Stat_getATime ();/PRIVATE C_Time_t Posix_FileSys_Stat_getATime(void);/' | \ + sed 's/PRIVATE Word32 Posix_FileSys_Stat_getGId ();/PRIVATE C_GId_t Posix_FileSys_Stat_getGId(void);/' | \ + sed 's/PRIVATE Word32 Posix_FileSys_Stat_getUId ();/PRIVATE C_UId_t Posix_FileSys_Stat_getUId(void);/' | \ + sed 's/PRIVATE Word32 Posix_FileSys_Stat_getNLink ();/PRIVATE C_NLink_t Posix_FileSys_Stat_getNLink(void);/' \ + > two-threads.3.c + diff --git a/ub/rtems/two-threads/init.c b/ub/rtems/two-threads/init.c new file mode 100755 index 000000000..9e0703a7b --- /dev/null +++ b/ub/rtems/two-threads/init.c @@ -0,0 +1,29 @@ +/* + * Simple RTEMS configuration + */ + +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER + +#define CONFIGURE_UNLIMITED_OBJECTS +#define CONFIGURE_UNIFIED_WORK_AREAS + +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE + +#define CONFIGURE_RTEMS_POSIX_API + +//#define CONFIGURE_POSIX_INIT_THREAD_TABLE + +#define CONFIGURE_MICROSECONDS_PER_TICK 1000 /* 1 millisecond */ +#define CONFIGURE_TICKS_PER_TIMESLICE 50 /* 50 milliseconds */ + +#define CONFIGURE_MAXIMUM_POSIX_THREADS 6 + +#define CONFIGURE_MEMORY_OVERHEAD 1 + +#define CONFIGURE_INIT + +//#define CONFIGURE_SCHEDULER_EDF +//#define CONFIGURE_SCHEDULER_NAME rtems_build_name('U', 'E', 'D', 'F') + +#include diff --git a/ub/rtems/two-threads/rtems-main.c b/ub/rtems/two-threads/rtems-main.c new file mode 100755 index 000000000..5d86adc65 --- /dev/null +++ b/ub/rtems/two-threads/rtems-main.c @@ -0,0 +1,23 @@ +/* + * Hello world example + */ +#include +//#include +//#include +//#include "/home/jcmurphy/quick-start/rtems/6/i386-rtems6/include/stdio.h" + +int stderr = 0; +int mainX(int, char **); + +rtems_task Init( + rtems_task_argument ignored +) +{ + int argc = 1; + char* argv[1]; + argv[0] = "justprint"; + + printf("in rtems task init\n"); + mainX(argc, argv); + exit( 0 ); +} diff --git a/ub/rtems/two-threads/two-threads.sml b/ub/rtems/two-threads/two-threads.sml new file mode 100755 index 000000000..f65a64474 --- /dev/null +++ b/ub/rtems/two-threads/two-threads.sml @@ -0,0 +1,67 @@ +(* n-threads.sml + * + * create N rt threads using pspawn + * notes: N must be equal to the number of threads (MAXPRI) + * configured in the run time + *) +open MLton.PrimThread + +fun printit2 s = () +fun printit s = print (Int.toString(getMyPriority ())^"] "^s^"\n") +fun gettime () = get_ticks_since_boot () + +val runtime = 1000 (* 1 ms *) +val deadline = 4000 (* 4 ms *) +val period = 8000 (* 8 ms *) + +fun checkDeadline (cur : real, dl : int) = + let + val dl_in_secs = Real./(Real.fromInt(dl), 1000.0) + in + if (Real.>(cur, dl_in_secs)) then + printit "DEADLINE MISSED" + else () + end + + + +fun threadN n = +let + val threadname = "thread #"^Int.toString(n) + val prev = ref (gettime ()) + val cur = ref (gettime ()) + (* reminder: sched_runtime <= sched_deadline <= sched_period *) + val _ = set_schedule (runtime, deadline, period, 0) (* runtime, deadline, period, allowedtopacks *) +in + while true do ( + cur := gettime(); + printit (threadname^": runtime "^Real.toString(Real.-(!prev, !cur))); + checkDeadline (Real.-(!cur, !prev), deadline); + prev := !cur; + wait_for_next_period false (* after computation finishes, this must be called but on rtems does nothng*) + ) +end + +(* note: thread #1 is the GC *) + +val _ = printit "create thread 2"; + +val _ = pspawn (fn () => let in threadN 2 end, 2) + +val _ = printit "create thread 3"; + +val _ = pspawn (fn () => let in threadN 3 end, 3) + +val _ = printit "create thread 4"; + +val _ = pspawn (fn () => let in threadN 4 end, 4) + +val _ = printit "create thread 5"; + +val _ = pspawn (fn () => let in threadN 5 end, 5) + + +val _ = printit "thread 0: Main loop "; + +fun loop () = (printit "main loop"; Posix.Process.sleep (Time.fromSeconds 1) ; loop ()) +val _ = loop () diff --git a/ub/rtems/two-threads/wscript b/ub/rtems/two-threads/wscript new file mode 100755 index 000000000..596ddfda5 --- /dev/null +++ b/ub/rtems/two-threads/wscript @@ -0,0 +1,54 @@ +# +# Hello world Waf script +# +from __future__ import print_function +import glob + +rtems_version = "6" + +try: + import rtems_waf.rtems as rtems +except: + print('error: no rtems_waf git submodule') + import sys + sys.exit(1) + +def init(ctx): + rtems.init(ctx, version = rtems_version, long_commands = True) + +def bsp_configure(conf, arch_bsp): + # Add BSP specific configuration checks + pass + +def options(opt): + rtems.options(opt) + +def configure(conf): + rtems.configure(conf, bsp_configure = bsp_configure) + +def build(bld): + rtems.build(bld) + + x = """ + -I/opt/rtems6/include + -I/opt/rtems6/i386-rtems6/include + -I/home/jcmurphy/RTMLton/build/lib/targets/i386-rtems6/include + -I/home/jcmurphy/RTMLton/build/lib/include -fno-common + -D_GNU_SOURCE -D__USE_GNU -fno-strict-aliasing -fomit-frame-pointer + -w -m32 -fno-strength-reduce -fschedule-insns -fschedule-insns2 + -falign-functions=5 -falign-jumps=2 -falign-loops=2 + -w +""" + + y = """ -L/opt/rtems6/i386-rtems6/pc386/lib/ + -L/opt/rtems6/lib/ + -L/home/jcmurphy/RTMLton/build/lib/targets/i386-rtems6 -lmlton-gdb -lgdtoa-gdb -lm + -lgmp """ + + sources = glob.glob('*.?.c') + + bld(features = 'c cprogram', + target = 'hello.exe', + cflags = ' -g -O0 ' + x, + ldflags = y, + source = ['rtems-main.c', 'init.c'] + sources) From d169e710655d050f9632b233acc02de51ae564e7 Mon Sep 17 00:00:00 2001 From: jeff murphy Date: Mon, 28 Mar 2022 21:43:53 -0400 Subject: [PATCH 24/39] rtems --- runtime/gc/debug.h | 668 ---------------------------------- runtime/gc/errorname.c | 668 ++++++++++++++++++++++++++++++++++ runtime/gc/init.c | 2 - ub/rtems/two-threads/Makefile | 10 +- 4 files changed, 676 insertions(+), 672 deletions(-) create mode 100644 runtime/gc/errorname.c mode change 100644 => 100755 runtime/gc/init.c diff --git a/runtime/gc/debug.h b/runtime/gc/debug.h index 9602fa0e0..a72df7b88 100755 --- a/runtime/gc/debug.h +++ b/runtime/gc/debug.h @@ -55,671 +55,3 @@ enum { #define BLUE(x) "\033[1;34m"x"\033[0m" #define PURPLE(x) "\033[1;35m"x"\033[0m" - -#include -char const * errnoname(int errno_); - -char const * errnoname(int errno_) -{ - switch(errno_) - { -#ifdef E2BIG - case E2BIG: return "E2BIG"; -#endif -#ifdef EACCES - case EACCES: return "EACCES"; -#endif -#ifdef EADDRINUSE - case EADDRINUSE: return "EADDRINUSE"; -#endif -#ifdef EADDRNOTAVAIL - case EADDRNOTAVAIL: return "EADDRNOTAVAIL"; -#endif -#ifdef EADI - case EADI: return "EADI"; -#endif -#ifdef EADV - case EADV: return "EADV"; -#endif -#ifdef EAFNOSUPPORT - case EAFNOSUPPORT: return "EAFNOSUPPORT"; -#endif -#ifdef EAGAIN - case EAGAIN: return "EAGAIN"; -#endif -#ifdef EAIO - case EAIO: return "EAIO"; -#endif -#ifdef EALIGN - case EALIGN: return "EALIGN"; -#endif -#ifdef EALREADY - case EALREADY: return "EALREADY"; -#endif -#ifdef EASYNC - case EASYNC: return "EASYNC"; -#endif -#ifdef EAUTH - case EAUTH: return "EAUTH"; -#endif -#ifdef EBADARCH - case EBADARCH: return "EBADARCH"; -#endif -#ifdef EBADE - case EBADE: return "EBADE"; -#endif -#ifdef EBADEXEC - case EBADEXEC: return "EBADEXEC"; -#endif -#ifdef EBADF - case EBADF: return "EBADF"; -#endif -#ifdef EBADFD - case EBADFD: return "EBADFD"; -#endif -#ifdef EBADMACHO - case EBADMACHO: return "EBADMACHO"; -#endif -#ifdef EBADMSG - case EBADMSG: return "EBADMSG"; -#endif -#ifdef EBADR - case EBADR: return "EBADR"; -#endif -#ifdef EBADRPC - case EBADRPC: return "EBADRPC"; -#endif -#ifdef EBADRQC - case EBADRQC: return "EBADRQC"; -#endif -#ifdef EBADSLT - case EBADSLT: return "EBADSLT"; -#endif -#ifdef EBADVER - case EBADVER: return "EBADVER"; -#endif -#ifdef EBFONT - case EBFONT: return "EBFONT"; -#endif -#ifdef EBUSY - case EBUSY: return "EBUSY"; -#endif -#ifdef ECANCELED - case ECANCELED: return "ECANCELED"; -#endif -#if defined(ECANCELLED) && (!defined(ECANCELED) || ECANCELLED != ECANCELED) - case ECANCELLED: return "ECANCELLED"; -#endif -#ifdef ECAPMODE - case ECAPMODE: return "ECAPMODE"; -#endif -#ifdef ECHILD - case ECHILD: return "ECHILD"; -#endif -#ifdef ECHRNG - case ECHRNG: return "ECHRNG"; -#endif -#ifdef ECKPT - case ECKPT: return "ECKPT"; -#endif -#ifdef ECLONEME - case ECLONEME: return "ECLONEME"; -#endif -#ifdef ECOMM - case ECOMM: return "ECOMM"; -#endif -#ifdef ECONFIG - case ECONFIG: return "ECONFIG"; -#endif -#ifdef ECONNABORTED - case ECONNABORTED: return "ECONNABORTED"; -#endif -#ifdef ECONNREFUSED - case ECONNREFUSED: return "ECONNREFUSED"; -#endif -#ifdef ECONNRESET - case ECONNRESET: return "ECONNRESET"; -#endif -#ifdef ECORRUPT - case ECORRUPT: return "ECORRUPT"; -#endif -#ifdef ECVCERORR - case ECVCERORR: return "ECVCERORR"; -#endif -#ifdef ECVPERORR - case ECVPERORR: return "ECVPERORR"; -#endif -#ifdef EDEADLK - case EDEADLK: return "EDEADLK"; -#endif -#if defined(EDEADLOCK) && (!defined(EDEADLK) || EDEADLOCK != EDEADLK) - case EDEADLOCK: return "EDEADLOCK"; -#endif -#ifdef EDESTADDREQ - case EDESTADDREQ: return "EDESTADDREQ"; -#endif -#ifdef EDESTADDRREQ - case EDESTADDRREQ: return "EDESTADDRREQ"; -#endif -#ifdef EDEVERR - case EDEVERR: return "EDEVERR"; -#endif -#ifdef EDIRIOCTL - case EDIRIOCTL: return "EDIRIOCTL"; -#endif -#ifdef EDIRTY - case EDIRTY: return "EDIRTY"; -#endif -#ifdef EDIST - case EDIST: return "EDIST"; -#endif -#ifdef EDOM - case EDOM: return "EDOM"; -#endif -#ifdef EDOOFUS - case EDOOFUS: return "EDOOFUS"; -#endif -#ifdef EDOTDOT - case EDOTDOT: return "EDOTDOT"; -#endif -#ifdef EDQUOT - case EDQUOT: return "EDQUOT"; -#endif -#ifdef EDUPFD - case EDUPFD: return "EDUPFD"; -#endif -#ifdef EDUPPKG - case EDUPPKG: return "EDUPPKG"; -#endif -#ifdef EEXIST - case EEXIST: return "EEXIST"; -#endif -#ifdef EFAIL - case EFAIL: return "EFAIL"; -#endif -#ifdef EFAULT - case EFAULT: return "EFAULT"; -#endif -#ifdef EFBIG - case EFBIG: return "EFBIG"; -#endif -#ifdef EFORMAT - case EFORMAT: return "EFORMAT"; -#endif -#ifdef EFSCORRUPTED - case EFSCORRUPTED: return "EFSCORRUPTED"; -#endif -#ifdef EFTYPE - case EFTYPE: return "EFTYPE"; -#endif -#ifdef EHOSTDOWN - case EHOSTDOWN: return "EHOSTDOWN"; -#endif -#ifdef EHOSTUNREACH - case EHOSTUNREACH: return "EHOSTUNREACH"; -#endif -#ifdef EHWPOISON - case EHWPOISON: return "EHWPOISON"; -#endif -#ifdef EIDRM - case EIDRM: return "EIDRM"; -#endif -#ifdef EILSEQ - case EILSEQ: return "EILSEQ"; -#endif -#ifdef EINIT - case EINIT: return "EINIT"; -#endif -#ifdef EINPROG - case EINPROG: return "EINPROG"; -#endif -#ifdef EINPROGRESS - case EINPROGRESS: return "EINPROGRESS"; -#endif -#ifdef EINTEGRITY - case EINTEGRITY: return "EINTEGRITY"; -#endif -#ifdef EINTR - case EINTR: return "EINTR"; -#endif -#ifdef EINVAL - case EINVAL: return "EINVAL"; -#endif -#ifdef EIO - case EIO: return "EIO"; -#endif -#ifdef EIPSEC - case EIPSEC: return "EIPSEC"; -#endif -#ifdef EISCONN - case EISCONN: return "EISCONN"; -#endif -#ifdef EISDIR - case EISDIR: return "EISDIR"; -#endif -#ifdef EISNAM - case EISNAM: return "EISNAM"; -#endif -#ifdef EJUSTRETURN - case EJUSTRETURN: return "EJUSTRETURN"; -#endif -#ifdef EKEEPLOOKING - case EKEEPLOOKING: return "EKEEPLOOKING"; -#endif -#ifdef EKEYEXPIRED - case EKEYEXPIRED: return "EKEYEXPIRED"; -#endif -#ifdef EKEYREJECTED - case EKEYREJECTED: return "EKEYREJECTED"; -#endif -#ifdef EKEYREVOKED - case EKEYREVOKED: return "EKEYREVOKED"; -#endif -#ifdef EL2HLT - case EL2HLT: return "EL2HLT"; -#endif -#ifdef EL2NSYNC - case EL2NSYNC: return "EL2NSYNC"; -#endif -#ifdef EL3HLT - case EL3HLT: return "EL3HLT"; -#endif -#ifdef EL3RST - case EL3RST: return "EL3RST"; -#endif -#ifdef ELIBACC - case ELIBACC: return "ELIBACC"; -#endif -#ifdef ELIBBAD - case ELIBBAD: return "ELIBBAD"; -#endif -#ifdef ELIBEXEC - case ELIBEXEC: return "ELIBEXEC"; -#endif -#ifdef ELIBMAX - case ELIBMAX: return "ELIBMAX"; -#endif -#ifdef ELIBSCN - case ELIBSCN: return "ELIBSCN"; -#endif -#ifdef ELNRNG - case ELNRNG: return "ELNRNG"; -#endif -#ifdef ELOCKUNMAPPED - case ELOCKUNMAPPED: return "ELOCKUNMAPPED"; -#endif -#ifdef ELOOP - case ELOOP: return "ELOOP"; -#endif -#ifdef EMEDIA - case EMEDIA: return "EMEDIA"; -#endif -#ifdef EMEDIUMTYPE - case EMEDIUMTYPE: return "EMEDIUMTYPE"; -#endif -#ifdef EMFILE - case EMFILE: return "EMFILE"; -#endif -#ifdef EMLINK - case EMLINK: return "EMLINK"; -#endif -#ifdef EMOUNTEXIT - case EMOUNTEXIT: return "EMOUNTEXIT"; -#endif -#ifdef EMOVEFD - case EMOVEFD: return "EMOVEFD"; -#endif -#ifdef EMSGSIZE - case EMSGSIZE: return "EMSGSIZE"; -#endif -#ifdef EMTIMERS - case EMTIMERS: return "EMTIMERS"; -#endif -#ifdef EMULTIHOP - case EMULTIHOP: return "EMULTIHOP"; -#endif -#ifdef ENAMETOOLONG - case ENAMETOOLONG: return "ENAMETOOLONG"; -#endif -#ifdef ENAVAIL - case ENAVAIL: return "ENAVAIL"; -#endif -#ifdef ENEEDAUTH - case ENEEDAUTH: return "ENEEDAUTH"; -#endif -#ifdef ENETDOWN - case ENETDOWN: return "ENETDOWN"; -#endif -#ifdef ENETRESET - case ENETRESET: return "ENETRESET"; -#endif -#ifdef ENETUNREACH - case ENETUNREACH: return "ENETUNREACH"; -#endif -#ifdef ENFILE - case ENFILE: return "ENFILE"; -#endif -#ifdef ENFSREMOTE - case ENFSREMOTE: return "ENFSREMOTE"; -#endif -#ifdef ENOANO - case ENOANO: return "ENOANO"; -#endif -#ifdef ENOATTR - case ENOATTR: return "ENOATTR"; -#endif -#ifdef ENOBUFS - case ENOBUFS: return "ENOBUFS"; -#endif -#ifdef ENOCONNECT - case ENOCONNECT: return "ENOCONNECT"; -#endif -#ifdef ENOCSI - case ENOCSI: return "ENOCSI"; -#endif -#ifdef ENODATA - case ENODATA: return "ENODATA"; -#endif -#ifdef ENODEV - case ENODEV: return "ENODEV"; -#endif -#ifdef ENOENT - case ENOENT: return "ENOENT"; -#endif -#ifdef ENOEXEC - case ENOEXEC: return "ENOEXEC"; -#endif -#ifdef ENOIOCTL - case ENOIOCTL: return "ENOIOCTL"; -#endif -#ifdef ENOKEY - case ENOKEY: return "ENOKEY"; -#endif -#ifdef ENOLCK - case ENOLCK: return "ENOLCK"; -#endif -#ifdef ENOLINK - case ENOLINK: return "ENOLINK"; -#endif -#ifdef ENOLOAD - case ENOLOAD: return "ENOLOAD"; -#endif -#ifdef ENOMATCH - case ENOMATCH: return "ENOMATCH"; -#endif -#ifdef ENOMEDIUM - case ENOMEDIUM: return "ENOMEDIUM"; -#endif -#ifdef ENOMEM - case ENOMEM: return "ENOMEM"; -#endif -#ifdef ENOMSG - case ENOMSG: return "ENOMSG"; -#endif -#ifdef ENONET - case ENONET: return "ENONET"; -#endif -#ifdef ENOPKG - case ENOPKG: return "ENOPKG"; -#endif -#ifdef ENOPOLICY - case ENOPOLICY: return "ENOPOLICY"; -#endif -#ifdef ENOPROTOOPT - case ENOPROTOOPT: return "ENOPROTOOPT"; -#endif -#ifdef ENOREG - case ENOREG: return "ENOREG"; -#endif -#ifdef ENOSPC - case ENOSPC: return "ENOSPC"; -#endif -#ifdef ENOSR - case ENOSR: return "ENOSR"; -#endif -#ifdef ENOSTR - case ENOSTR: return "ENOSTR"; -#endif -#ifdef ENOSYM - case ENOSYM: return "ENOSYM"; -#endif -#ifdef ENOSYS - case ENOSYS: return "ENOSYS"; -#endif -#ifdef ENOTACTIVE - case ENOTACTIVE: return "ENOTACTIVE"; -#endif -#ifdef ENOTBLK - case ENOTBLK: return "ENOTBLK"; -#endif -#ifdef ENOTCAPABLE - case ENOTCAPABLE: return "ENOTCAPABLE"; -#endif -#ifdef ENOTCONN - case ENOTCONN: return "ENOTCONN"; -#endif -#ifdef ENOTDIR - case ENOTDIR: return "ENOTDIR"; -#endif -#ifdef ENOTEMPTY - case ENOTEMPTY: return "ENOTEMPTY"; -#endif -#ifdef ENOTNAM - case ENOTNAM: return "ENOTNAM"; -#endif -#ifdef ENOTREADY - case ENOTREADY: return "ENOTREADY"; -#endif -#ifdef ENOTRECOVERABLE - case ENOTRECOVERABLE: return "ENOTRECOVERABLE"; -#endif -#ifdef ENOTRUST - case ENOTRUST: return "ENOTRUST"; -#endif -#ifdef ENOTSOCK - case ENOTSOCK: return "ENOTSOCK"; -#endif -#ifdef ENOTSUP - case ENOTSUP: return "ENOTSUP"; -#endif -#ifdef ENOTTY - case ENOTTY: return "ENOTTY"; -#endif -#ifdef ENOTUNIQ - case ENOTUNIQ: return "ENOTUNIQ"; -#endif -#ifdef ENOUNLD - case ENOUNLD: return "ENOUNLD"; -#endif -#ifdef ENOUNREG - case ENOUNREG: return "ENOUNREG"; -#endif -#ifdef ENXIO - case ENXIO: return "ENXIO"; -#endif -#ifdef EOPCOMPLETE - case EOPCOMPLETE: return "EOPCOMPLETE"; -#endif -#if defined(EOPNOTSUPP) && (!defined(ENOTSUP) || EOPNOTSUPP != ENOTSUP) - case EOPNOTSUPP: return "EOPNOTSUPP"; -#endif -#ifdef EOVERFLOW - case EOVERFLOW: return "EOVERFLOW"; -#endif -#ifdef EOWNERDEAD - case EOWNERDEAD: return "EOWNERDEAD"; -#endif -#ifdef EPASSTHROUGH - case EPASSTHROUGH: return "EPASSTHROUGH"; -#endif -#ifdef EPATHREMOTE - case EPATHREMOTE: return "EPATHREMOTE"; -#endif -#ifdef EPERM - case EPERM: return "EPERM"; -#endif -#ifdef EPFNOSUPPORT - case EPFNOSUPPORT: return "EPFNOSUPPORT"; -#endif -#ifdef EPIPE - case EPIPE: return "EPIPE"; -#endif -#ifdef EPOWERF - case EPOWERF: return "EPOWERF"; -#endif -#ifdef EPROCLIM - case EPROCLIM: return "EPROCLIM"; -#endif -#ifdef EPROCUNAVAIL - case EPROCUNAVAIL: return "EPROCUNAVAIL"; -#endif -#ifdef EPROGMISMATCH - case EPROGMISMATCH: return "EPROGMISMATCH"; -#endif -#ifdef EPROGUNAVAIL - case EPROGUNAVAIL: return "EPROGUNAVAIL"; -#endif -#ifdef EPROTO - case EPROTO: return "EPROTO"; -#endif -#ifdef EPROTONOSUPPORT - case EPROTONOSUPPORT: return "EPROTONOSUPPORT"; -#endif -#ifdef EPROTOTYPE - case EPROTOTYPE: return "EPROTOTYPE"; -#endif -#ifdef EPWROFF - case EPWROFF: return "EPWROFF"; -#endif -#ifdef EQFULL - case EQFULL: return "EQFULL"; -#endif -#ifdef EQSUSPENDED - case EQSUSPENDED: return "EQSUSPENDED"; -#endif -#ifdef ERANGE - case ERANGE: return "ERANGE"; -#endif -#ifdef ERECYCLE - case ERECYCLE: return "ERECYCLE"; -#endif -#ifdef EREDRIVEOPEN - case EREDRIVEOPEN: return "EREDRIVEOPEN"; -#endif -#ifdef EREFUSED - case EREFUSED: return "EREFUSED"; -#endif -#ifdef ERELOC - case ERELOC: return "ERELOC"; -#endif -#ifdef ERELOCATED - case ERELOCATED: return "ERELOCATED"; -#endif -#ifdef ERELOOKUP - case ERELOOKUP: return "ERELOOKUP"; -#endif -#ifdef EREMCHG - case EREMCHG: return "EREMCHG"; -#endif -#ifdef EREMDEV - case EREMDEV: return "EREMDEV"; -#endif -#ifdef EREMOTE - case EREMOTE: return "EREMOTE"; -#endif -#ifdef EREMOTEIO - case EREMOTEIO: return "EREMOTEIO"; -#endif -#ifdef EREMOTERELEASE - case EREMOTERELEASE: return "EREMOTERELEASE"; -#endif -#ifdef ERESTART - case ERESTART: return "ERESTART"; -#endif -#ifdef ERFKILL - case ERFKILL: return "ERFKILL"; -#endif -#ifdef EROFS - case EROFS: return "EROFS"; -#endif -#ifdef ERPCMISMATCH - case ERPCMISMATCH: return "ERPCMISMATCH"; -#endif -#ifdef ESAD - case ESAD: return "ESAD"; -#endif -#ifdef ESHLIBVERS - case ESHLIBVERS: return "ESHLIBVERS"; -#endif -#ifdef ESHUTDOWN - case ESHUTDOWN: return "ESHUTDOWN"; -#endif -#ifdef ESOCKTNOSUPPORT - case ESOCKTNOSUPPORT: return "ESOCKTNOSUPPORT"; -#endif -#ifdef ESOFT - case ESOFT: return "ESOFT"; -#endif -#ifdef ESPIPE - case ESPIPE: return "ESPIPE"; -#endif -#ifdef ESRCH - case ESRCH: return "ESRCH"; -#endif -#ifdef ESRMNT - case ESRMNT: return "ESRMNT"; -#endif -#ifdef ESTALE - case ESTALE: return "ESTALE"; -#endif -#ifdef ESTART - case ESTART: return "ESTART"; -#endif -#ifdef ESTRPIPE - case ESTRPIPE: return "ESTRPIPE"; -#endif -#ifdef ESYSERROR - case ESYSERROR: return "ESYSERROR"; -#endif -#ifdef ETIME - case ETIME: return "ETIME"; -#endif -#ifdef ETIMEDOUT - case ETIMEDOUT: return "ETIMEDOUT"; -#endif -#ifdef ETOOMANYREFS - case ETOOMANYREFS: return "ETOOMANYREFS"; -#endif -#ifdef ETXTBSY - case ETXTBSY: return "ETXTBSY"; -#endif -#ifdef EUCLEAN - case EUCLEAN: return "EUCLEAN"; -#endif -#ifdef EUNATCH - case EUNATCH: return "EUNATCH"; -#endif -#ifdef EUSERS - case EUSERS: return "EUSERS"; -#endif -#ifdef EVERSION - case EVERSION: return "EVERSION"; -#endif -#if defined(EWOULDBLOCK) && (!defined(EAGAIN) || EWOULDBLOCK != EAGAIN) - case EWOULDBLOCK: return "EWOULDBLOCK"; -#endif -#ifdef EWRONGFS - case EWRONGFS: return "EWRONGFS"; -#endif -#ifdef EWRPROTECT - case EWRPROTECT: return "EWRPROTECT"; -#endif -#ifdef EXDEV - case EXDEV: return "EXDEV"; -#endif -#ifdef EXFULL - case EXFULL: return "EXFULL"; -#endif - } - return 0; -} diff --git a/runtime/gc/errorname.c b/runtime/gc/errorname.c new file mode 100644 index 000000000..2284ffbeb --- /dev/null +++ b/runtime/gc/errorname.c @@ -0,0 +1,668 @@ + +#include +char const * errnoname(int errno_); + +char const * errnoname(int errno_) +{ + switch(errno_) + { +#ifdef E2BIG + case E2BIG: return "E2BIG"; +#endif +#ifdef EACCES + case EACCES: return "EACCES"; +#endif +#ifdef EADDRINUSE + case EADDRINUSE: return "EADDRINUSE"; +#endif +#ifdef EADDRNOTAVAIL + case EADDRNOTAVAIL: return "EADDRNOTAVAIL"; +#endif +#ifdef EADI + case EADI: return "EADI"; +#endif +#ifdef EADV + case EADV: return "EADV"; +#endif +#ifdef EAFNOSUPPORT + case EAFNOSUPPORT: return "EAFNOSUPPORT"; +#endif +#ifdef EAGAIN + case EAGAIN: return "EAGAIN"; +#endif +#ifdef EAIO + case EAIO: return "EAIO"; +#endif +#ifdef EALIGN + case EALIGN: return "EALIGN"; +#endif +#ifdef EALREADY + case EALREADY: return "EALREADY"; +#endif +#ifdef EASYNC + case EASYNC: return "EASYNC"; +#endif +#ifdef EAUTH + case EAUTH: return "EAUTH"; +#endif +#ifdef EBADARCH + case EBADARCH: return "EBADARCH"; +#endif +#ifdef EBADE + case EBADE: return "EBADE"; +#endif +#ifdef EBADEXEC + case EBADEXEC: return "EBADEXEC"; +#endif +#ifdef EBADF + case EBADF: return "EBADF"; +#endif +#ifdef EBADFD + case EBADFD: return "EBADFD"; +#endif +#ifdef EBADMACHO + case EBADMACHO: return "EBADMACHO"; +#endif +#ifdef EBADMSG + case EBADMSG: return "EBADMSG"; +#endif +#ifdef EBADR + case EBADR: return "EBADR"; +#endif +#ifdef EBADRPC + case EBADRPC: return "EBADRPC"; +#endif +#ifdef EBADRQC + case EBADRQC: return "EBADRQC"; +#endif +#ifdef EBADSLT + case EBADSLT: return "EBADSLT"; +#endif +#ifdef EBADVER + case EBADVER: return "EBADVER"; +#endif +#ifdef EBFONT + case EBFONT: return "EBFONT"; +#endif +#ifdef EBUSY + case EBUSY: return "EBUSY"; +#endif +#ifdef ECANCELED + case ECANCELED: return "ECANCELED"; +#endif +#if defined(ECANCELLED) && (!defined(ECANCELED) || ECANCELLED != ECANCELED) + case ECANCELLED: return "ECANCELLED"; +#endif +#ifdef ECAPMODE + case ECAPMODE: return "ECAPMODE"; +#endif +#ifdef ECHILD + case ECHILD: return "ECHILD"; +#endif +#ifdef ECHRNG + case ECHRNG: return "ECHRNG"; +#endif +#ifdef ECKPT + case ECKPT: return "ECKPT"; +#endif +#ifdef ECLONEME + case ECLONEME: return "ECLONEME"; +#endif +#ifdef ECOMM + case ECOMM: return "ECOMM"; +#endif +#ifdef ECONFIG + case ECONFIG: return "ECONFIG"; +#endif +#ifdef ECONNABORTED + case ECONNABORTED: return "ECONNABORTED"; +#endif +#ifdef ECONNREFUSED + case ECONNREFUSED: return "ECONNREFUSED"; +#endif +#ifdef ECONNRESET + case ECONNRESET: return "ECONNRESET"; +#endif +#ifdef ECORRUPT + case ECORRUPT: return "ECORRUPT"; +#endif +#ifdef ECVCERORR + case ECVCERORR: return "ECVCERORR"; +#endif +#ifdef ECVPERORR + case ECVPERORR: return "ECVPERORR"; +#endif +#ifdef EDEADLK + case EDEADLK: return "EDEADLK"; +#endif +#if defined(EDEADLOCK) && (!defined(EDEADLK) || EDEADLOCK != EDEADLK) + case EDEADLOCK: return "EDEADLOCK"; +#endif +#ifdef EDESTADDREQ + case EDESTADDREQ: return "EDESTADDREQ"; +#endif +#ifdef EDESTADDRREQ + case EDESTADDRREQ: return "EDESTADDRREQ"; +#endif +#ifdef EDEVERR + case EDEVERR: return "EDEVERR"; +#endif +#ifdef EDIRIOCTL + case EDIRIOCTL: return "EDIRIOCTL"; +#endif +#ifdef EDIRTY + case EDIRTY: return "EDIRTY"; +#endif +#ifdef EDIST + case EDIST: return "EDIST"; +#endif +#ifdef EDOM + case EDOM: return "EDOM"; +#endif +#ifdef EDOOFUS + case EDOOFUS: return "EDOOFUS"; +#endif +#ifdef EDOTDOT + case EDOTDOT: return "EDOTDOT"; +#endif +#ifdef EDQUOT + case EDQUOT: return "EDQUOT"; +#endif +#ifdef EDUPFD + case EDUPFD: return "EDUPFD"; +#endif +#ifdef EDUPPKG + case EDUPPKG: return "EDUPPKG"; +#endif +#ifdef EEXIST + case EEXIST: return "EEXIST"; +#endif +#ifdef EFAIL + case EFAIL: return "EFAIL"; +#endif +#ifdef EFAULT + case EFAULT: return "EFAULT"; +#endif +#ifdef EFBIG + case EFBIG: return "EFBIG"; +#endif +#ifdef EFORMAT + case EFORMAT: return "EFORMAT"; +#endif +#ifdef EFSCORRUPTED + case EFSCORRUPTED: return "EFSCORRUPTED"; +#endif +#ifdef EFTYPE + case EFTYPE: return "EFTYPE"; +#endif +#ifdef EHOSTDOWN + case EHOSTDOWN: return "EHOSTDOWN"; +#endif +#ifdef EHOSTUNREACH + case EHOSTUNREACH: return "EHOSTUNREACH"; +#endif +#ifdef EHWPOISON + case EHWPOISON: return "EHWPOISON"; +#endif +#ifdef EIDRM + case EIDRM: return "EIDRM"; +#endif +#ifdef EILSEQ + case EILSEQ: return "EILSEQ"; +#endif +#ifdef EINIT + case EINIT: return "EINIT"; +#endif +#ifdef EINPROG + case EINPROG: return "EINPROG"; +#endif +#ifdef EINPROGRESS + case EINPROGRESS: return "EINPROGRESS"; +#endif +#ifdef EINTEGRITY + case EINTEGRITY: return "EINTEGRITY"; +#endif +#ifdef EINTR + case EINTR: return "EINTR"; +#endif +#ifdef EINVAL + case EINVAL: return "EINVAL"; +#endif +#ifdef EIO + case EIO: return "EIO"; +#endif +#ifdef EIPSEC + case EIPSEC: return "EIPSEC"; +#endif +#ifdef EISCONN + case EISCONN: return "EISCONN"; +#endif +#ifdef EISDIR + case EISDIR: return "EISDIR"; +#endif +#ifdef EISNAM + case EISNAM: return "EISNAM"; +#endif +#ifdef EJUSTRETURN + case EJUSTRETURN: return "EJUSTRETURN"; +#endif +#ifdef EKEEPLOOKING + case EKEEPLOOKING: return "EKEEPLOOKING"; +#endif +#ifdef EKEYEXPIRED + case EKEYEXPIRED: return "EKEYEXPIRED"; +#endif +#ifdef EKEYREJECTED + case EKEYREJECTED: return "EKEYREJECTED"; +#endif +#ifdef EKEYREVOKED + case EKEYREVOKED: return "EKEYREVOKED"; +#endif +#ifdef EL2HLT + case EL2HLT: return "EL2HLT"; +#endif +#ifdef EL2NSYNC + case EL2NSYNC: return "EL2NSYNC"; +#endif +#ifdef EL3HLT + case EL3HLT: return "EL3HLT"; +#endif +#ifdef EL3RST + case EL3RST: return "EL3RST"; +#endif +#ifdef ELIBACC + case ELIBACC: return "ELIBACC"; +#endif +#ifdef ELIBBAD + case ELIBBAD: return "ELIBBAD"; +#endif +#ifdef ELIBEXEC + case ELIBEXEC: return "ELIBEXEC"; +#endif +#ifdef ELIBMAX + case ELIBMAX: return "ELIBMAX"; +#endif +#ifdef ELIBSCN + case ELIBSCN: return "ELIBSCN"; +#endif +#ifdef ELNRNG + case ELNRNG: return "ELNRNG"; +#endif +#ifdef ELOCKUNMAPPED + case ELOCKUNMAPPED: return "ELOCKUNMAPPED"; +#endif +#ifdef ELOOP + case ELOOP: return "ELOOP"; +#endif +#ifdef EMEDIA + case EMEDIA: return "EMEDIA"; +#endif +#ifdef EMEDIUMTYPE + case EMEDIUMTYPE: return "EMEDIUMTYPE"; +#endif +#ifdef EMFILE + case EMFILE: return "EMFILE"; +#endif +#ifdef EMLINK + case EMLINK: return "EMLINK"; +#endif +#ifdef EMOUNTEXIT + case EMOUNTEXIT: return "EMOUNTEXIT"; +#endif +#ifdef EMOVEFD + case EMOVEFD: return "EMOVEFD"; +#endif +#ifdef EMSGSIZE + case EMSGSIZE: return "EMSGSIZE"; +#endif +#ifdef EMTIMERS + case EMTIMERS: return "EMTIMERS"; +#endif +#ifdef EMULTIHOP + case EMULTIHOP: return "EMULTIHOP"; +#endif +#ifdef ENAMETOOLONG + case ENAMETOOLONG: return "ENAMETOOLONG"; +#endif +#ifdef ENAVAIL + case ENAVAIL: return "ENAVAIL"; +#endif +#ifdef ENEEDAUTH + case ENEEDAUTH: return "ENEEDAUTH"; +#endif +#ifdef ENETDOWN + case ENETDOWN: return "ENETDOWN"; +#endif +#ifdef ENETRESET + case ENETRESET: return "ENETRESET"; +#endif +#ifdef ENETUNREACH + case ENETUNREACH: return "ENETUNREACH"; +#endif +#ifdef ENFILE + case ENFILE: return "ENFILE"; +#endif +#ifdef ENFSREMOTE + case ENFSREMOTE: return "ENFSREMOTE"; +#endif +#ifdef ENOANO + case ENOANO: return "ENOANO"; +#endif +#ifdef ENOATTR + case ENOATTR: return "ENOATTR"; +#endif +#ifdef ENOBUFS + case ENOBUFS: return "ENOBUFS"; +#endif +#ifdef ENOCONNECT + case ENOCONNECT: return "ENOCONNECT"; +#endif +#ifdef ENOCSI + case ENOCSI: return "ENOCSI"; +#endif +#ifdef ENODATA + case ENODATA: return "ENODATA"; +#endif +#ifdef ENODEV + case ENODEV: return "ENODEV"; +#endif +#ifdef ENOENT + case ENOENT: return "ENOENT"; +#endif +#ifdef ENOEXEC + case ENOEXEC: return "ENOEXEC"; +#endif +#ifdef ENOIOCTL + case ENOIOCTL: return "ENOIOCTL"; +#endif +#ifdef ENOKEY + case ENOKEY: return "ENOKEY"; +#endif +#ifdef ENOLCK + case ENOLCK: return "ENOLCK"; +#endif +#ifdef ENOLINK + case ENOLINK: return "ENOLINK"; +#endif +#ifdef ENOLOAD + case ENOLOAD: return "ENOLOAD"; +#endif +#ifdef ENOMATCH + case ENOMATCH: return "ENOMATCH"; +#endif +#ifdef ENOMEDIUM + case ENOMEDIUM: return "ENOMEDIUM"; +#endif +#ifdef ENOMEM + case ENOMEM: return "ENOMEM"; +#endif +#ifdef ENOMSG + case ENOMSG: return "ENOMSG"; +#endif +#ifdef ENONET + case ENONET: return "ENONET"; +#endif +#ifdef ENOPKG + case ENOPKG: return "ENOPKG"; +#endif +#ifdef ENOPOLICY + case ENOPOLICY: return "ENOPOLICY"; +#endif +#ifdef ENOPROTOOPT + case ENOPROTOOPT: return "ENOPROTOOPT"; +#endif +#ifdef ENOREG + case ENOREG: return "ENOREG"; +#endif +#ifdef ENOSPC + case ENOSPC: return "ENOSPC"; +#endif +#ifdef ENOSR + case ENOSR: return "ENOSR"; +#endif +#ifdef ENOSTR + case ENOSTR: return "ENOSTR"; +#endif +#ifdef ENOSYM + case ENOSYM: return "ENOSYM"; +#endif +#ifdef ENOSYS + case ENOSYS: return "ENOSYS"; +#endif +#ifdef ENOTACTIVE + case ENOTACTIVE: return "ENOTACTIVE"; +#endif +#ifdef ENOTBLK + case ENOTBLK: return "ENOTBLK"; +#endif +#ifdef ENOTCAPABLE + case ENOTCAPABLE: return "ENOTCAPABLE"; +#endif +#ifdef ENOTCONN + case ENOTCONN: return "ENOTCONN"; +#endif +#ifdef ENOTDIR + case ENOTDIR: return "ENOTDIR"; +#endif +#ifdef ENOTEMPTY + case ENOTEMPTY: return "ENOTEMPTY"; +#endif +#ifdef ENOTNAM + case ENOTNAM: return "ENOTNAM"; +#endif +#ifdef ENOTREADY + case ENOTREADY: return "ENOTREADY"; +#endif +#ifdef ENOTRECOVERABLE + case ENOTRECOVERABLE: return "ENOTRECOVERABLE"; +#endif +#ifdef ENOTRUST + case ENOTRUST: return "ENOTRUST"; +#endif +#ifdef ENOTSOCK + case ENOTSOCK: return "ENOTSOCK"; +#endif +#ifdef ENOTSUP + case ENOTSUP: return "ENOTSUP"; +#endif +#ifdef ENOTTY + case ENOTTY: return "ENOTTY"; +#endif +#ifdef ENOTUNIQ + case ENOTUNIQ: return "ENOTUNIQ"; +#endif +#ifdef ENOUNLD + case ENOUNLD: return "ENOUNLD"; +#endif +#ifdef ENOUNREG + case ENOUNREG: return "ENOUNREG"; +#endif +#ifdef ENXIO + case ENXIO: return "ENXIO"; +#endif +#ifdef EOPCOMPLETE + case EOPCOMPLETE: return "EOPCOMPLETE"; +#endif +#if defined(EOPNOTSUPP) && (!defined(ENOTSUP) || EOPNOTSUPP != ENOTSUP) + case EOPNOTSUPP: return "EOPNOTSUPP"; +#endif +#ifdef EOVERFLOW + case EOVERFLOW: return "EOVERFLOW"; +#endif +#ifdef EOWNERDEAD + case EOWNERDEAD: return "EOWNERDEAD"; +#endif +#ifdef EPASSTHROUGH + case EPASSTHROUGH: return "EPASSTHROUGH"; +#endif +#ifdef EPATHREMOTE + case EPATHREMOTE: return "EPATHREMOTE"; +#endif +#ifdef EPERM + case EPERM: return "EPERM"; +#endif +#ifdef EPFNOSUPPORT + case EPFNOSUPPORT: return "EPFNOSUPPORT"; +#endif +#ifdef EPIPE + case EPIPE: return "EPIPE"; +#endif +#ifdef EPOWERF + case EPOWERF: return "EPOWERF"; +#endif +#ifdef EPROCLIM + case EPROCLIM: return "EPROCLIM"; +#endif +#ifdef EPROCUNAVAIL + case EPROCUNAVAIL: return "EPROCUNAVAIL"; +#endif +#ifdef EPROGMISMATCH + case EPROGMISMATCH: return "EPROGMISMATCH"; +#endif +#ifdef EPROGUNAVAIL + case EPROGUNAVAIL: return "EPROGUNAVAIL"; +#endif +#ifdef EPROTO + case EPROTO: return "EPROTO"; +#endif +#ifdef EPROTONOSUPPORT + case EPROTONOSUPPORT: return "EPROTONOSUPPORT"; +#endif +#ifdef EPROTOTYPE + case EPROTOTYPE: return "EPROTOTYPE"; +#endif +#ifdef EPWROFF + case EPWROFF: return "EPWROFF"; +#endif +#ifdef EQFULL + case EQFULL: return "EQFULL"; +#endif +#ifdef EQSUSPENDED + case EQSUSPENDED: return "EQSUSPENDED"; +#endif +#ifdef ERANGE + case ERANGE: return "ERANGE"; +#endif +#ifdef ERECYCLE + case ERECYCLE: return "ERECYCLE"; +#endif +#ifdef EREDRIVEOPEN + case EREDRIVEOPEN: return "EREDRIVEOPEN"; +#endif +#ifdef EREFUSED + case EREFUSED: return "EREFUSED"; +#endif +#ifdef ERELOC + case ERELOC: return "ERELOC"; +#endif +#ifdef ERELOCATED + case ERELOCATED: return "ERELOCATED"; +#endif +#ifdef ERELOOKUP + case ERELOOKUP: return "ERELOOKUP"; +#endif +#ifdef EREMCHG + case EREMCHG: return "EREMCHG"; +#endif +#ifdef EREMDEV + case EREMDEV: return "EREMDEV"; +#endif +#ifdef EREMOTE + case EREMOTE: return "EREMOTE"; +#endif +#ifdef EREMOTEIO + case EREMOTEIO: return "EREMOTEIO"; +#endif +#ifdef EREMOTERELEASE + case EREMOTERELEASE: return "EREMOTERELEASE"; +#endif +#ifdef ERESTART + case ERESTART: return "ERESTART"; +#endif +#ifdef ERFKILL + case ERFKILL: return "ERFKILL"; +#endif +#ifdef EROFS + case EROFS: return "EROFS"; +#endif +#ifdef ERPCMISMATCH + case ERPCMISMATCH: return "ERPCMISMATCH"; +#endif +#ifdef ESAD + case ESAD: return "ESAD"; +#endif +#ifdef ESHLIBVERS + case ESHLIBVERS: return "ESHLIBVERS"; +#endif +#ifdef ESHUTDOWN + case ESHUTDOWN: return "ESHUTDOWN"; +#endif +#ifdef ESOCKTNOSUPPORT + case ESOCKTNOSUPPORT: return "ESOCKTNOSUPPORT"; +#endif +#ifdef ESOFT + case ESOFT: return "ESOFT"; +#endif +#ifdef ESPIPE + case ESPIPE: return "ESPIPE"; +#endif +#ifdef ESRCH + case ESRCH: return "ESRCH"; +#endif +#ifdef ESRMNT + case ESRMNT: return "ESRMNT"; +#endif +#ifdef ESTALE + case ESTALE: return "ESTALE"; +#endif +#ifdef ESTART + case ESTART: return "ESTART"; +#endif +#ifdef ESTRPIPE + case ESTRPIPE: return "ESTRPIPE"; +#endif +#ifdef ESYSERROR + case ESYSERROR: return "ESYSERROR"; +#endif +#ifdef ETIME + case ETIME: return "ETIME"; +#endif +#ifdef ETIMEDOUT + case ETIMEDOUT: return "ETIMEDOUT"; +#endif +#ifdef ETOOMANYREFS + case ETOOMANYREFS: return "ETOOMANYREFS"; +#endif +#ifdef ETXTBSY + case ETXTBSY: return "ETXTBSY"; +#endif +#ifdef EUCLEAN + case EUCLEAN: return "EUCLEAN"; +#endif +#ifdef EUNATCH + case EUNATCH: return "EUNATCH"; +#endif +#ifdef EUSERS + case EUSERS: return "EUSERS"; +#endif +#ifdef EVERSION + case EVERSION: return "EVERSION"; +#endif +#if defined(EWOULDBLOCK) && (!defined(EAGAIN) || EWOULDBLOCK != EAGAIN) + case EWOULDBLOCK: return "EWOULDBLOCK"; +#endif +#ifdef EWRONGFS + case EWRONGFS: return "EWRONGFS"; +#endif +#ifdef EWRPROTECT + case EWRPROTECT: return "EWRPROTECT"; +#endif +#ifdef EXDEV + case EXDEV: return "EXDEV"; +#endif +#ifdef EXFULL + case EXFULL: return "EXFULL"; +#endif + } + return 0; +} diff --git a/runtime/gc/init.c b/runtime/gc/init.c old mode 100644 new mode 100755 index edb12bdd3..c2cb3d896 --- a/runtime/gc/init.c +++ b/runtime/gc/init.c @@ -497,8 +497,6 @@ int GC_init(GC_state s, int argc, char **argv) { processAtMLton(s, 0, s->atMLtonsLength, s->atMLtons, &worldFile); res = processAtMLton(s, 1, argc, argv, &worldFile); - printf("argc %d\n", argc); -printf("processAtMLton %ld %ld\n", (long int)s->controls.fixedHeap, (long int)s->controls.maxHeap); if (s->controls.fixedHeap > 0 and s->controls.maxHeap > 0) die("Cannot use both fixed-heap and max-heap."); diff --git a/ub/rtems/two-threads/Makefile b/ub/rtems/two-threads/Makefile index 67e8b1bdf..a491f12d9 100755 --- a/ub/rtems/two-threads/Makefile +++ b/ub/rtems/two-threads/Makefile @@ -18,11 +18,17 @@ buildsml: cp /home/jcmurphy/RTMLton/build/lib/targets/i386-rtems6/constants /home/jcmurphy/RTMLton/build/lib/targets/self/constants /home/jcmurphy/RTMLton/build/bin/mlton -codegen c -keep g -debug true two-threads.sml +buildlinux: + /home/jcmurphy/RTMLton/build/bin/mlton -codegen c -keep g -debug true two-threads.sml + +undoconstants: + cp /home/jcmurphy/RTMLton/build/lib/targets/self/constants.linux /home/jcmurphy/RTMLton/build/lib/targets/self/constants + fixmain: buildsml mv two-threads.0.c two-threads.0.c.orig sed 's/^int main /int mainX /' two-threads.0.c.orig | \ - sed 's/uint32_t atMLtons_len = 2;/uint32_t atMLtons_len = 4;/' | \ - sed 's/static char\* atMLtons/static char* atMLtons[] = {"@MLton","rtthreads", "true","--",}; static char* atMLtonsOLD/' \ + sed 's/uint32_t atMLtons_len = 2;/uint32_t atMLtons_len = 6;/' | \ + sed 's/static char\* atMLtons/static char* atMLtons[] = {"@MLton","rtthreads", "true","max-heap", "4M", "--",}; static char* atMLtonsOLD/' \ > two-threads.0.c fixprotos: buildsml From 28eafb9b4799e8d0b9bc184132ebf4fc7b59d177 Mon Sep 17 00:00:00 2001 From: jeff murphy Date: Tue, 5 Apr 2022 00:57:49 -0400 Subject: [PATCH 25/39] lock debugging perf tracking instrumentation counters heuristic updating --- basis-library/mlton/primthread.sig | 2 + basis-library/mlton/primthread.sml | 5 +- mlton/backend/gc-check.fun | 5 +- runtime/gc/debug.h | 11 ++++ runtime/gc/done.c | 6 +- runtime/gc/garbage-collection.c | 82 ++++++++++++++------------ runtime/gc/init.c | 6 +- runtime/gc/realtime_thread.c | 95 ++++++++++++++++++++++-------- runtime/gc/realtime_thread.h | 3 + runtime/gc/um.c | 60 +++++++++++++------ runtime/gc/umheap.c | 6 +- runtime/gc/ummark.c | 40 ++++++++----- 12 files changed, 217 insertions(+), 104 deletions(-) diff --git a/basis-library/mlton/primthread.sig b/basis-library/mlton/primthread.sig index 127748f32..f615b7c0c 100755 --- a/basis-library/mlton/primthread.sig +++ b/basis-library/mlton/primthread.sig @@ -35,6 +35,8 @@ signature PRIM_THREAD = val get_ticks_since_boot : unit -> real val dump_instrument_stderr : int -> unit val instrument : int -> unit + val dump_instrument_counter_stderr : int -> unit + val instrument_counter : int * int -> unit val rtlock : int -> unit val rtunlock : int -> unit diff --git a/basis-library/mlton/primthread.sml b/basis-library/mlton/primthread.sml index 6e05905f4..b4502caec 100755 --- a/basis-library/mlton/primthread.sml +++ b/basis-library/mlton/primthread.sml @@ -137,12 +137,16 @@ struct local val inst__ = _import "User_instrument" : int -> unit; val dise__ = _import "Dump_instrument_stderr" : int -> unit; + val instc__ = _import "User_instrument_counter" : int * int -> unit; + val disec__ = _import "Dump_instrument_counter_stderr" : int -> unit; val gtsb__ = _import "get_ticks_since_boot" : unit -> real; val lock__ = _import "User_lock" : int -> unit; val unlock__ = _import "User_unlock" : int -> unit; val setsch = _import "set_schedule" : int * int * int * int -> unit; val schyld = _import "schedule_yield" : Primitive.MLton.GCState.t * bool -> unit; in + fun instrument_counter a = instc__ a + fun dump_instrument_counter_stderr a = disec__ a fun instrument a = inst__ a fun dump_instrument_stderr a = dise__ a fun get_ticks_since_boot () = gtsb__ () @@ -170,7 +174,6 @@ struct thread ID 0 and the GC is thread ID 1 (see realtime_thread.c realtimeThreadInit) *) fun new () = T ( - print ("make wq, size "^Int.toString(numberOfPThreads ())^"\n"); Array.tabulate(numberOfPThreads (), fn _ => []) ) (*fun mysleep () = (Posix.Process.sleep (Time.fromSeconds 1); ())*) diff --git a/mlton/backend/gc-check.fun b/mlton/backend/gc-check.fun index 169267f6b..53fd31461 100755 --- a/mlton/backend/gc-check.fun +++ b/mlton/backend/gc-check.fun @@ -197,14 +197,13 @@ struct [ Block.T { args = args , kind = kind , label = label - , statements = Vector.new3 (lockstmt,sAdd,ss) + , statements = Vector.new3 (lockstmt, sAdd, ss) , transfer = ts } , Block.T { args = Vector.new0 () , kind = Kind.Jump , label = check - , statements = Vector.fromList ([ss2] @ (incReserved - chunksNeeded) + , statements = Vector.fromList ([ss2] @ (incReserved chunksNeeded) @[ unlockstmt]) , transfer = ts2 } ] @ blockingGC block check diff --git a/runtime/gc/debug.h b/runtime/gc/debug.h index a72df7b88..04298c990 100755 --- a/runtime/gc/debug.h +++ b/runtime/gc/debug.h @@ -26,6 +26,7 @@ enum { DEBUG_GENERATIONAL = FALSE, DEBUG_INT_INF = FALSE, DEBUG_INT_INF_DETAILED = FALSE, + DEBUG_LOCKS = FALSE, DEBUG_MARK_COMPACT = FALSE, DEBUG_MEM = FALSE, DEBUG_OBJPTR = FALSE, @@ -45,6 +46,7 @@ enum { DEBUG_OLD = FALSE, DEBUG_RTGC = FALSE, DEBUG_RTGC_MARKING = FALSE, + DEBUG_RTGC_VERBOSE = FALSE, DEBUG_WB = FALSE, DISPLAY_GC_STATS = FALSE }; @@ -55,3 +57,12 @@ enum { #define BLUE(x) "\033[1;34m"x"\033[0m" #define PURPLE(x) "\033[1;35m"x"\033[0m" +#ifdef DO_PERF +# define START_PERF struct timeval t0, t1; gettimeofday(&t0, NULL) +# define STOP_PERF do { gettimeofday(&t1, NULL); unsigned int xxx = ((t1.tv_sec - t0.tv_sec) * 1000000 + t1.tv_usec - t0.tv_usec); fprintf(stderr, "%d] PERF %s %d us\n", PTHREAD_NUM, __FUNCTION__, xxx); } while(0) +#else +# define START_PERF do {} while(0) +# define STOP_PERF do {} while(0) +#endif + +#define LOCK_DEBUG(LN) if(getenv("DEBUG_LOCKS")) {fprintf(stderr, "%d] LOCKDBG %s %s\n", PTHREAD_NUM, __FUNCTION__, LN);} diff --git a/runtime/gc/done.c b/runtime/gc/done.c index b6f3a2bca..6f6705482 100755 --- a/runtime/gc/done.c +++ b/runtime/gc/done.c @@ -10,10 +10,10 @@ */ #define IFED(X) do { if (X) { printf(__FUNCTION__);perror("-perror " #X); exit(-1); } } while(0) -#define LOCK_FL IFED(pthread_mutex_lock(&s->fl_lock)) -#define UNLOCK_FL IFED(pthread_mutex_unlock(&s->fl_lock)) +#define LOCK_FL LOCK_DEBUG("LOCK_FL"); IFED(pthread_mutex_lock(&s->fl_lock)) +#define UNLOCK_FL LOCK_DEBUG("UNLOCK_FL"); IFED(pthread_mutex_unlock(&s->fl_lock)) -#define BLOCK IFED(pthread_cond_wait(&s->fl_empty_cond,&s->fl_lock)) +#define BLOCK LOCK_DEBUG("BLOCK"); IFED(pthread_cond_wait(&s->fl_empty_cond,&s->fl_lock)) #if 0 diff --git a/runtime/gc/garbage-collection.c b/runtime/gc/garbage-collection.c index dbeabd468..98fcda2ea 100755 --- a/runtime/gc/garbage-collection.c +++ b/runtime/gc/garbage-collection.c @@ -30,20 +30,20 @@ struct thrctrl { //#define IFED(X) do { if (X) { fprintf(stderr, "%s:%d ", __FUNCTION__, __LINE__); perror("perror " #X); exit(-1); } } while(0) -#define LOCK_FL_FROMGC IFED(pthread_mutex_lock(&s->fl_lock)) -#define UNLOCK_FL_FROMGC IFED(pthread_mutex_unlock(&s->fl_lock)) +#define LOCK_FL_FROMGC LOCK_DEBUG("LOCK_FL_FROMGC"); IFED(pthread_mutex_lock(&s->fl_lock)) +#define UNLOCK_FL_FROMGC LOCK_DEBUG("UNLOCK_FL_FROMGC"); IFED(pthread_mutex_unlock(&s->fl_lock)) -#define BROADCAST IFED(pthread_cond_broadcast(&s->fl_empty_cond)) +#define BROADCAST LOCK_DEBUG("BROADCAST"); IFED(pthread_cond_broadcast(&s->fl_empty_cond)) -#define BROADCAST_EMPTY IFED(pthread_cond_broadcast(&s->fl_empty_cond)) -#define BLOCK_EMPTY IFED(pthread_cond_wait(&s->fl_empty_cond,&s->fl_lock)) +#define BROADCAST_EMPTY LOCK_DEBUG("BROADCAST_EMPTY"); IFED(pthread_cond_broadcast(&s->fl_empty_cond)) +#define BLOCK_EMPTY LOCK_DEBUG("BLOCK_EMPTY"); IFED(pthread_cond_wait(&s->fl_empty_cond,&s->fl_lock)) -#define RTSYNC_LOCK IFED(pthread_mutex_lock(&s->rtSync_lock)) -#define RTSYNC_UNLOCK IFED(pthread_mutex_unlock(&s->rtSync_lock)) -#define RTSYNC_SIGNAL IFED(pthread_cond_signal(&s->rtSync_cond)) -#define RTSYNC_BLOCK IFED(pthread_cond_wait(&s->rtSync_cond,&s->rtSync_lock)) -#define RTSYNC_TRYLOCK pthread_mutex_trylock(&s->rtSync_lock) +#define RTSYNC_LOCK LOCK_DEBUG("RTSYNC_LOCK"); IFED(pthread_mutex_lock(&s->rtSync_lock)) +#define RTSYNC_UNLOCK LOCK_DEBUG("RTSYNC_UNLOCK"); IFED(pthread_mutex_unlock(&s->rtSync_lock)) +#define RTSYNC_SIGNAL LOCK_DEBUG("RTSYNC_SIGNAL"); IFED(pthread_cond_signal(&s->rtSync_cond)) +#define RTSYNC_BLOCK LOCK_DEBUG("RTSYNC_BLOCK"); IFED(pthread_cond_wait(&s->rtSync_cond,&s->rtSync_lock)) +#define RTSYNC_TRYLOCK LOCK_DEBUG("RTSYNC_TRYLOCK"); pthread_mutex_trylock(&s->rtSync_lock) #define TC_LOCK if (DEBUG or DEBUG_RTGC) fprintf(stderr, "%d] TC_LOCK thr:%d boot:%d\n", PTHREAD_NUM, TC.running_threads, TC.booted); IFED(pthread_mutex_lock(&TC.lock)) #define TC_UNLOCK if (DEBUG or DEBUG_RTGC) fprintf(stderr, "%d] TC_UNLOCK thr:%d boot:%d\n", PTHREAD_NUM, TC.running_threads, TC.booted); IFED(pthread_mutex_unlock(&TC.lock)) @@ -321,8 +321,10 @@ void *GCrunner(void *_s) { /* GC sweep is performed under RTSYNC_LOCK because this lock also prevents the mutators from marking their stacks*/ RTSYNC_LOCK; - while (!s->dirty) + while (!s->dirty) { + fprintf(stderr, "%d] not dirty\n", PTHREAD_NUM); RTSYNC_BLOCK; + } if (DEBUG_RTGC) fprintf(stderr, "%d] GC sweep starting: FC=%d \n", PTHREAD_NUM, s->fl_chunks); @@ -366,7 +368,7 @@ void *GCrunner(void *_s) { s->cGCStats.numGCCycles += 1; gettimeofday(&t1, NULL); - unsigned int gc_runtime_microsecs = ((t1.tv_sec - t0.tv_sec) * 1000000 + t1.tv_usec - t0.tv_usec) / 1000; + unsigned int gc_runtime_microsecs = ((t1.tv_sec - t0.tv_sec) * 1000000 + t1.tv_usec - t0.tv_usec); s->cGCStats.totalGCTime += gc_runtime_microsecs; s->dirty = false; @@ -460,6 +462,7 @@ performGC(GC_state s, void markStack(GC_state s, pointer thread_) { + START_PERF; GC_thread thread = (GC_thread) thread_; thread->markCycles++; @@ -492,7 +495,7 @@ void markStack(GC_state s, pointer thread_) { } while (stackFrame != (GC_UM_Chunk) (s->currentFrame[PTHREAD_NUM] - GC_HEADER_SIZE)); - // mark the rest of the chunks + // mark the rest of the chunks while (stackFrame) { markChunk((((pointer)stackFrame) + GC_HEADER_SIZE), STACK_TAG, MARK_MODE, s, 0); stackFrame = stackFrame->next_chunk; @@ -503,6 +506,7 @@ void markStack(GC_state s, pointer thread_) { PTHREAD_NUM); maybe_growstack(s, thread, FALSE); + STOP_PERF; } @@ -527,7 +531,9 @@ void startMarking(GC_state s) { void sweep(GC_state s, size_t ensureObjectChunksAvailable, size_t ensureArrayChunksAvailable, - bool fullGC) { + bool fullGC) +{ + START_PERF; pointer pchunk; size_t step = sizeof(struct GC_UM_Chunk) + sizeof(UM_header); /*account for size of chunktype header*/ //pointer end = s->umheap.start + s->umheap.size - step; @@ -541,9 +547,9 @@ void sweep(GC_state s, size_t ensureObjectChunksAvailable, assert(PTHREAD_NUM == 1); - if (DEBUG_RTGC_MARKING) - fprintf(stderr, "%d] GC sweep started. Worklist length: %d\n", PTHREAD_NUM, (int)s->wl_length); + fprintf(stderr, "%d] GC sweep started. Worklist length: %d, oneByOne %d\n", + PTHREAD_NUM, (int)s->wl_length, s->oneByOne); //dumpUMHeap(s); for (pchunk = s->umheap.start; @@ -551,7 +557,6 @@ void sweep(GC_state s, size_t ensureObjectChunksAvailable, pchunk += step) { if (((UM_Mem_Chunk) pchunk)->chunkType == UM_STACK_CHUNK){ - continue; } else if (((UM_Mem_Chunk) pchunk)->chunkType == UM_NORMAL_CHUNK) { @@ -597,11 +602,9 @@ void sweep(GC_state s, size_t ensureObjectChunksAvailable, } else /*Unmarked Chunk*/ { assert(ISUNMARKED(header)); -User_instrument(14); /* JEFF */ +User_instrument_counter(400, 1); /* JEFF normal collect */ if (DEBUG_MEM or DEBUG_RTGC) { - fprintf(stderr, "%d] Collecting: " - FMTPTR - ", %d, %x\n", PTHREAD_NUM, + fprintf(stderr, "%d] Collecting: "FMTPTR", %d, %x\n", PTHREAD_NUM, (uintptr_t) pc, (int)pc->sentinel, (unsigned int)pc->chunk_header); } @@ -617,10 +620,8 @@ User_instrument(14); /* JEFF */ else insertChunktoSubList(s, &(s->umheap), pchunk); - s->cGCStats.numChunksFreed++; freed++; - } } @@ -671,7 +672,7 @@ User_instrument(14); /* JEFF */ } else { - User_instrument(15); /* JEFF */ + User_instrument_counter(420, 1); /* JEFF array collect */ if (DEBUG_MEM or DEBUG_RTGC) { fprintf(stderr, "%d] Collecting array: " @@ -725,6 +726,8 @@ User_instrument(14); /* JEFF */ fprintf(stderr, "%d] "GREEN("Chunks; Visited: %d, Marked: %d, Greys: %d Reds: %d\n"), PTHREAD_NUM, visited, marked, grey, red); } + + STOP_PERF; } void performUMGC(GC_state s, @@ -865,15 +868,16 @@ void ensureInvariantForMutator(GC_state s, bool force) { */ bool ensureChunksAvailable(GC_state s) { - if (DEBUG_RTGC) + if (DEBUG_RTGC_VERBOSE) fprintf(stderr, "%d] ensureChunksAvailable: FC = %d, Max Chunks = %d\n", PTHREAD_NUM, (int)s->fl_chunks, (int)s->maxChunksAvailable); - if (s->fl_chunks > (size_t)((30 * s->maxChunksAvailable) / 100)) + // see also reserveAllocation in um.c + + if (s->fl_chunks > (size_t)(s->hPercent * s->maxChunksAvailable)) return true; else return false; - } @@ -947,21 +951,27 @@ void GC_collect(GC_state s, size_t bytesRequested, bool force, bool collectRed) GC_collect_real(s, bytesRequested, true); /*marks stack*/ s->rtSync[PTHREAD_NUM] = true; - /*Check if all other RT threads have set their values*/ + + /*Check if all other RT threads have set their values*/ + int i; + int ready_to_sync_count = 0; for (i = 0; i < MAXPRI; i++) { - if (i == 1 || i == PTHREAD_NUM) +fprintf(stderr, "%d] check rtsync[%d] = %d\n", PTHREAD_NUM, i, s->rtSync[i]); + if (i == 1 || i == PTHREAD_NUM) // GC thr and our thr are not counted continue; - - if (!s->rtSync[i]) - break; + if (s->rtSync[i]) + ready_to_sync_count ++; } /*Increment count when current thread will block. Must be done before signalling GC. */ if (force) s->threadsBlockedForGC++; - if (i == MAXPRI) /*Last thread to sync before GC*/ +fprintf(stderr, "%d] force %d threadsBlockedForGC %d i=%d MAXPRI=%d dirty=%d ready_to_sync_count=%d\n", PTHREAD_NUM, force, +s->threadsBlockedForGC, i,MAXPRI, s->dirty, ready_to_sync_count); + + if (ready_to_sync_count == MAXPRI-2) /* all threads are ready to sync and GC */ { s->dirty = true; RTSYNC_SIGNAL; @@ -998,10 +1008,6 @@ void GC_collect(GC_state s, size_t bytesRequested, bool force, bool collectRed) uintmax_t tmp = ((t1.tv_sec - t0.tv_sec) * 1000000 + t1.tv_usec - t0.tv_usec) / 1000; - if ((tmp > s->cGCStats.maxMutatorPauseTime) && - (PTHREAD_NUM == 0)) + if ((tmp > s->cGCStats.maxMutatorPauseTime) && (PTHREAD_NUM == 0)) s->cGCStats.maxMutatorPauseTime = tmp; - - } - diff --git a/runtime/gc/init.c b/runtime/gc/init.c index c2cb3d896..907c18a8c 100755 --- a/runtime/gc/init.c +++ b/runtime/gc/init.c @@ -281,13 +281,13 @@ int processAtMLton(GC_state s, int start, int argc, char **argv, } else if (0 == strcmp(arg, "hpercent")) { i++; if (i == argc) - die("@MLton hPercent missing argument."); + die("@MLton hpercent missing argument."); s->hPercent = stringToFloat(argv[i++]); unless(0.0 <= s->hPercent and s->hPercent <= 1.0) die("@MLton hpercent argument must be between 0.0 and 1.0."); - } else if (0 == strcmp(arg, "rtobj")) { + } else if (0 == strcmp(arg, "rtobj")) { // not used anywhere? i++; if (i == argc) die("@MLton rtobj missing argument."); @@ -333,6 +333,8 @@ int GC_init(GC_state s, int argc, char **argv) { char *worldFile; int res, __i, __j; + User_instrument_initialize(); + assert(s->alignment >= GC_MODEL_MINALIGN); assert(isAligned(sizeof(struct GC_stack), s->alignment)); // While the following asserts are manifestly true, diff --git a/runtime/gc/realtime_thread.c b/runtime/gc/realtime_thread.c index c35808de6..9ac505a93 100755 --- a/runtime/gc/realtime_thread.c +++ b/runtime/gc/realtime_thread.c @@ -4,14 +4,13 @@ #include "realtime_thread.h" -#define LOCK_RT_THREADS IFED(pthread_mutex_lock(&state->rtThreads_lock)) -#define UNLOCK_RT_THREADS IFED(pthread_mutex_unlock(&state->rtThreads_lock)) -#define SIGNAL_RT_THREADS IFED(pthread_cond_signal(&state->rtThreads_cond)) -#define BLOCK_RT_THREADS IFED(pthread_cond_wait(&state->rtThreads_cond,&state->rtThreads_lock)) +#define LOCK_RT_THREADS LOCK_DEBUG("LOCK_RT_THREADS"); IFED(pthread_mutex_lock(&state->rtThreads_lock)) +#define UNLOCK_RT_THREADS LOCK_DEBUG("UNLOCK_RT_THREADS"); IFED(pthread_mutex_unlock(&state->rtThreads_lock)) +#define SIGNAL_RT_THREADS LOCK_DEBUG("SIGNAL_RT_THREADS"); IFED(pthread_cond_signal(&state->rtThreads_cond)) +#define BLOCK_RT_THREADS LOCK_DEBUG("BLOCK_RT_THREADS"); IFED(pthread_cond_wait(&state->rtThreads_cond,&state->rtThreads_lock)) -#define BROADCAST_RT_THREADS IFED(pthread_cond_broadcast(&state->rtThreads_cond)) +#define BROADCAST_RT_THREADS LOCK_DEBUG("BROADCAST_RT_THREADS"); IFED(pthread_cond_broadcast(&state->rtThreads_cond)) #define CONCURRENT -//#define DEBUG true static volatile int initialized = 0; volatile bool rtinitfromML = FALSE; @@ -419,38 +418,82 @@ void InitializeMutexes(void) { double get_ticks_since_boot(void) { struct timespec spec; - clock_gettime(CLOCK_MONOTONIC, &spec); + clock_gettime(CLOCK_MONOTONIC_RAW, &spec); return spec.tv_sec + spec.tv_nsec / 1.0e9; } #endif -// must be a multiple of 2*sizeof(int) -#define MAX_INSTRUMENT 4096 +/* this is instrumentation code. + * the intent is to avoid locking, and memory allocations. so this + * is implemented as an array of ring buffers, one for each thread. + * the instrument_buffer tracks tuples of (timesecs, timenanos, codenum) + * which lets us track timing (start/stop) information for 'codes' for example + * thread #1 might be code #30, and so calling instrument(30) lets us record + * a start/stop time stamp for that thread. + * + * the instrument_counter is for recording non time based counters. for example + * code #40 maybe would be "number of calls to alloc_object" so each called to + * User_instrument_counter(40) would increment that counter, again per thread to + * avoid locking. + */ + + +#define INSTRUMENT_TUPLE_SIZE 3 +#define MAX_INSTRUMENT (4096*INSTRUMENT_TUPLE_SIZE) +#define MAX_INSTRUMENT_COUNTERS 4096 unsigned int instrument_offset[MAXPRI+1]; -double instrument_buffer[MAXPRI+1][MAX_INSTRUMENT]; +unsigned int instrument_buffer[MAXPRI+1][MAX_INSTRUMENT]; +unsigned int instrument_counters[MAXPRI+1][MAX_INSTRUMENT_COUNTERS]; + +void User_instrument_initialize() { + memset(instrument_offset , 0, (MAXPRI+1) * sizeof(unsigned int)); + memset(instrument_buffer , 0, (MAXPRI+1) * MAX_INSTRUMENT*sizeof(unsigned int)); + memset(instrument_counters, 0, (MAXPRI+1) * MAX_INSTRUMENT_COUNTERS); +} + +void User_instrument_counter (Int32 icode, Int32 inc) { + instrument_counters[PTHREAD_NUM][icode] += inc; +} + +void Dump_instrument_counter_stderr (Int32 thrnum) { + if (thrnum == -1) thrnum = PTHREAD_NUM; + fprintf(stderr, "instr-counter:thread-id, code-number, count\n"); + for(unsigned int i = 0 ; i < MAX_INSTRUMENT_COUNTERS ; i += 1) { + if (instrument_counters[thrnum][i]) + fprintf(stderr, "instr-counter:%d, %d, %u\n", thrnum, i, instrument_counters[thrnum][i]); + } +} void User_instrument (Int32 icode) { - if (instrument_offset[PTHREAD_NUM] > (MAX_INSTRUMENT-2)) { + struct timespec spec; + + if (instrument_offset[PTHREAD_NUM] > (MAX_INSTRUMENT-INSTRUMENT_TUPLE_SIZE)) { fprintf(stderr, "%d] "RED("*** instrument buffer wrapped ***")"\n", PTHREAD_NUM); } - instrument_buffer[PTHREAD_NUM][instrument_offset[PTHREAD_NUM]] = get_ticks_since_boot(); - instrument_buffer[PTHREAD_NUM][instrument_offset[PTHREAD_NUM]+1] = (double)icode; - instrument_offset[PTHREAD_NUM] = (instrument_offset[PTHREAD_NUM]+2) % MAX_INSTRUMENT; + clock_gettime(CLOCK_MONOTONIC_RAW, &spec); + + instrument_buffer[PTHREAD_NUM][instrument_offset[PTHREAD_NUM]] = spec.tv_sec; + instrument_buffer[PTHREAD_NUM][instrument_offset[PTHREAD_NUM]+1] = spec.tv_nsec; + + instrument_buffer[PTHREAD_NUM][instrument_offset[PTHREAD_NUM]+2] = icode; + instrument_offset[PTHREAD_NUM] = (instrument_offset[PTHREAD_NUM]+INSTRUMENT_TUPLE_SIZE) % MAX_INSTRUMENT; } void Dump_instrument_stderr (Int32 thrnum) { if (thrnum == -1) thrnum = PTHREAD_NUM; - fprintf(stderr, "thread-id, time-stamp, code-number\n"); + fprintf(stderr, "instr-timer:thread-id, secs, ns, code-number\n"); - for(unsigned int i = 0 ; i < MAX_INSTRUMENT ; i += 2) { - if (instrument_buffer[thrnum][i] > 0 || instrument_buffer[thrnum][i] < 0) { - fprintf(stderr, "%d, %f, %f\n", + for(unsigned int i = 0 ; i < MAX_INSTRUMENT ; i += INSTRUMENT_TUPLE_SIZE) { + // only dump non-zero codes + if (instrument_buffer[thrnum][i+2] > 0) { + fprintf(stderr, "instr-timer:%d, %u, %u, %d\n", thrnum, instrument_buffer[thrnum][i], - instrument_buffer[thrnum][i+1] + instrument_buffer[thrnum][i+1], + instrument_buffer[thrnum][i+2] ); } } @@ -555,10 +598,12 @@ void RT_init (GC_state state) } InitializeMutexes(); - + ssleep(5, 0); + fprintf(stderr, "%d] rtinitfromML set to true\n", PTHREAD_NUM); rtinitfromML = TRUE; - + + fprintf(stderr, "%d] broadcasting to release all waiting rt threads\n", PTHREAD_NUM); LOCK_RT_THREADS; BROADCAST_RT_THREADS; UNLOCK_RT_THREADS; @@ -594,6 +639,8 @@ realtimeRunner (void *paramsPtr) struct GC_state *state = params->state; int tNum = params->tNum; + fprintf (stderr, "%d] "PURPLE("realtimeRunner\n"), tNum); + set_pthread_num (params->tNum); state->rtSync[PTHREAD_NUM] = true; @@ -602,12 +649,14 @@ realtimeRunner (void *paramsPtr) while(!rtinitfromML) { /*This will be unblocked in rtInit */ - if(DEBUG) - fprintf(stderr,"%d] callFromCHandlerThread is not set, Blocking RT-Thread \n",tNum); + if(1||DEBUG) + fprintf(stderr, "%d] "RED("callFromCHandlerThread is not set, Blocking RT-Thread\n"),tNum); BLOCK_RT_THREADS; UNLOCK_RT_THREADS; } + fprintf (stderr, "%d] "PURPLE("realtimeRunner released %d\n"), tNum, rtinitfromML); + state->rtSync[PTHREAD_NUM] = false; // this may need to be true if "@MLton rtthreads" is false diff --git a/runtime/gc/realtime_thread.h b/runtime/gc/realtime_thread.h index 229b2d40f..529c12192 100755 --- a/runtime/gc/realtime_thread.h +++ b/runtime/gc/realtime_thread.h @@ -35,8 +35,11 @@ void ML_lock (void); void ML_unlock (void); void User_lock (Int32); void User_unlock (Int32); +void User_instrument_initialize (void); void User_instrument (Int32 p); void Dump_instrument_stderr (Int32 p); +void User_instrument_counter (Int32 p, Int32 i); +void Dump_instrument_counter_stderr (Int32 p); double get_ticks_since_boot(void); void set_schedule(int runtime, int deadline, int period, int packing); int schedule_yield(GC_state s, bool trigger_gc); diff --git a/runtime/gc/um.c b/runtime/gc/um.c index 2ca46b1ac..609ac010b 100755 --- a/runtime/gc/um.c +++ b/runtime/gc/um.c @@ -7,8 +7,8 @@ # define POW pow #endif -#define LOCKIT(X) IFED(pthread_mutex_lock(&(X))) -#define UNLOCKIT(X) IFED(pthread_mutex_unlock(&(X))) +#define LOCKIT(X) LOCK_DEBUG("LOCKIT"); IFED(pthread_mutex_lock(&(X))) +#define UNLOCKIT(X) LOCK_DEBUG("UNLOCKIT"); IFED(pthread_mutex_unlock(&(X))) #undef DBG @@ -39,14 +39,15 @@ void reserveAllocation(GC_state s, size_t numChunksToRequest) { } LOCK_FL; - while (s->fl_chunks < (s->reserved + numChunksToRequest)) + while ((s->fl_chunks < (s->reserved + numChunksToRequest)))// || (s->fl_chunks < (size_t)(s->hPercent * s->maxChunksAvailable))) { + fprintf(stderr, "%d] either fl (%d) is < reserved+req (%d) or fl (%d) < heuristic (%d)\n", + PTHREAD_NUM, s->fl_chunks, (s->reserved + numChunksToRequest), s->fl_chunks, (size_t)(s->hPercent * s->maxChunksAvailable) ); UNLOCK_FL; GC_collect(s, 0, true, true); LOCK_FL; } - s->reserved += (numChunksToRequest==0?1:numChunksToRequest); UNLOCK_FL; @@ -77,6 +78,8 @@ UM_Object_alloc_no_packing(GC_state gc_stat, C_Size_t num_chunks, uint32_t heade current = current->next_chunk; } + if (DEBUG_ALLOC_PACK) + fprintf(stderr, "%d] %s returns %x\n", PTHREAD_NUM, __FUNCTION__, (unsigned int) (chunk->ml_object + s)); return (Pointer) (chunk->ml_object + s); } @@ -100,9 +103,7 @@ UM_Object_alloc_packing_stage2(GC_state s, C_Size_t num_chunks, uint32_t header, */ GC_UM_Chunk chunk = NULL; - User_instrument(16); /* JEFF */ - - /* unsuccessful, return to stage 1 and try to allocate a new chunk */ + User_instrument_counter(320, num_chunks); /* JEFF packed2 total */ /* see if any other thread's chunks have room */ for (int i = 0 ; i < MAXPRI ; i++) { @@ -139,15 +140,16 @@ UM_Object_alloc_packing_stage2(GC_state s, C_Size_t num_chunks, uint32_t header, UNLOCKIT(s->activeChunkLock[i]); } + User_instrument_counter(340, num_chunks); /* JEFF packed2 cant fit, need new chunk */ + return BOGUS_POINTER; } Pointer -UM_Object_alloc_packing_stage1(GC_state s, C_Size_t num_chunks, uint32_t header, C_Size_t hdrsz, C_Size_t sz) { +UM_Object_alloc_packing_stage1(GC_state s, C_Size_t num_chunks, uint32_t header, C_Size_t hdrsz, C_Size_t sz) +{ GC_UM_Chunk chunk = NULL; - User_instrument(13); /* JEFF */ - // packing stage 1 (same thread can pack with its own regions) /* array allocs do not occur in this function. stack, thread, weak allocs are never packed. */ @@ -161,6 +163,10 @@ UM_Object_alloc_packing_stage1(GC_state s, C_Size_t num_chunks, uint32_t header, */ assert (num_chunks == 1); + if (s->packingStage2Enabled == false) { + User_instrument_counter(310, num_chunks); /* JEFF packed1 total */ + } + if (s->activeChunk[PTHREAD_NUM] != BOGUS_POINTER) { chunk = (GC_UM_Chunk)s->activeChunk[PTHREAD_NUM]; @@ -190,10 +196,13 @@ UM_Object_alloc_packing_stage1(GC_state s, C_Size_t num_chunks, uint32_t header, if (DEBUG_ALLOC_PACK) fprintf(stderr, "%d] unable to find space in another threads chunk, and:\n", PTHREAD_NUM); } + } else { + User_instrument_counter(330, num_chunks); /* JEFF packed1, new chunk required */ } if (DEBUG_ALLOC_PACK) fprintf(stderr, "%d] no space in active chunk, so allocating a new one\n", PTHREAD_NUM); + chunk = allocateChunks(s, &(s->umheap), num_chunks, UM_NORMAL_CHUNK); s->activeChunk[PTHREAD_NUM] = (Pointer)chunk; } @@ -228,10 +237,13 @@ UM_Object_alloc_packing_stage1(GC_state s, C_Size_t num_chunks, uint32_t header, if (DEBUG_ALLOC_PACK) fprintf(stderr, "%d] unable to find space in another threads chunk, and:\n", PTHREAD_NUM); } + } else { + User_instrument_counter(330, num_chunks); /* JEFF packed1, new chunk required */ } if (DEBUG_ALLOC_PACK) fprintf(stderr, "%d] no activeChunk, so allocating one.\n", PTHREAD_NUM); + chunk = allocateChunks(s, &(s->umheap), num_chunks, UM_NORMAL_CHUNK); s->activeChunk[PTHREAD_NUM] = (Pointer)chunk; } @@ -274,7 +286,8 @@ UM_Object_alloc_packing_stage1(GC_state s, C_Size_t num_chunks, uint32_t header, Pointer -UM_Object_alloc(GC_state gc_stat, C_Size_t num_chunks, uint32_t header, C_Size_t s, C_Size_t sz) { +UM_Object_alloc(GC_state gc_stat, C_Size_t num_chunks, uint32_t header, C_Size_t s, C_Size_t sz) +{ /* gc_stat: GC_State num_chunks: number of chunks requested header: the MLton object header @@ -308,10 +321,19 @@ UM_Object_alloc(GC_state gc_stat, C_Size_t num_chunks, uint32_t header, C_Size_t unsigned int objectTypeIndex = (header & TYPE_INDEX_MASK) >> TYPE_INDEX_SHIFT; splitHeader(gc_stat, header, &tagRet, NULL, NULL, NULL); +int lower_bound = 40; // JEFF +int upper_bound = 98; +char *lower_ev = getenv("LOWER"); +char *upper_ev = getenv("UPPER"); +if (lower_ev) lower_bound = atoi(lower_ev); +if (upper_ev) upper_bound = atoi(upper_ev); + assert (num_chunks > 0); assert (header != 0); - if (DEBUG_ALLOC) { + User_instrument_counter(50, num_chunks); /* JEFF um_obj_alloc calls, num chunks asked for */ + + if (1||DEBUG_ALLOC) { fprintf(stderr, "%d] UM_Object_alloc %s numchk:%u hd:0x%x(%d) (%s [%d] index:%u) sz:%d freelist:%d reserved:%d\n", PTHREAD_NUM, (header == GC_THREAD_HEADER)?"*** thread ***":"", @@ -324,14 +346,16 @@ UM_Object_alloc(GC_state gc_stat, C_Size_t num_chunks, uint32_t header, C_Size_t // no-packing. in order for stage2 to occur, stage1 must be enabled if (gc_stat->packingStage1Enabled == false || allowedToPack[PTHREAD_NUM] == 0) { - if (header == GC_STACK_HEADER) User_instrument(10); /* JEFF */ - else User_instrument(12); /* JEFF */ + if (header == GC_STACK_HEADER) + User_instrument_counter(100, num_chunks); /* JEFF Stack Allocs */ + else + User_instrument_counter(300, num_chunks); /* JEFF Normal allocs, unpacked */ return UM_Object_alloc_no_packing(gc_stat, num_chunks, header, s); } /* packing enabled, but we only pack some objects types */ - if (header < 40 || header > 98) { + if (header < lower_bound || header > upper_bound) { if (header != GC_WORD8_VECTOR_HEADER || header == GC_THREAD_HEADER || header == GC_STACK_HEADER || header == GC_WEAK_GONE_HEADER) { @@ -340,8 +364,10 @@ UM_Object_alloc(GC_state gc_stat, C_Size_t num_chunks, uint32_t header, C_Size_t GC_THREAD_HEADER, GC_WEAK_GONE_HEADER, GC_STACK_HEADER ); - if (header == GC_STACK_HEADER) User_instrument(10); /* JEFF */ - else User_instrument(12); /* JEFF */ + if (header == GC_STACK_HEADER) + User_instrument_counter(100, num_chunks); /* JEFF stack alloc */ + else + User_instrument_counter(300, num_chunks); /* JEFF normal alloc, unpacked */ if (DEBUG_ALLOC) fprintf(stderr, RED("** no packing for this type\n")); diff --git a/runtime/gc/umheap.c b/runtime/gc/umheap.c index 0331deb60..a06d1786a 100755 --- a/runtime/gc/umheap.c +++ b/runtime/gc/umheap.c @@ -2,10 +2,10 @@ //#define IFED(X) do { if (X) { fprintf(stderr, "%s:%d ", __FUNCTION__, __LINE__); perror("perror " #X); exit(-1); } } while(0) -#define LOCK_FL IFED(pthread_mutex_lock(&s->fl_lock)) -#define UNLOCK_FL IFED(pthread_mutex_unlock(&s->fl_lock)) +#define LOCK_FL LOCK_DEBUG("LOCK_FL"); IFED(pthread_mutex_lock(&s->fl_lock)) +#define UNLOCK_FL LOCK_DEBUG("UNLOCK_FL"); IFED(pthread_mutex_unlock(&s->fl_lock)) -#define BLOCK IFED(pthread_cond_wait(&s->fl_empty_cond,&s->fl_lock)) +#define BLOCK LOCK_DEBUG("BLOCK"); IFED(pthread_cond_wait(&s->fl_empty_cond,&s->fl_lock)) void initUMHeap(GC_state s, diff --git a/runtime/gc/ummark.c b/runtime/gc/ummark.c index 50848a8d3..64c086628 100755 --- a/runtime/gc/ummark.c +++ b/runtime/gc/ummark.c @@ -51,7 +51,6 @@ void printTag(const char *f, GC_objectTypeTag tag, pointer _p) { void addToWorklist(GC_state s, objptr *opp) { LOCK_WL; - assert(isObjptr(*opp)); /*Objptr on Worklist is not shaded when : @@ -73,16 +72,9 @@ void addToWorklist(GC_state s, objptr *opp) { s->wl_size *= 2; if (DEBUG_RTGC_MARKING) { - fprintf(stderr, "old: " - FMTPTR - " \n", (uintptr_t) old); - fprintf(stderr, "new: " - FMTPTR - " \n", (uintptr_t) new); - fprintf(stderr, "worklist: " - FMTPTR - " \n", (uintptr_t) s->worklist); - + fprintf(stderr, "old: "FMTPTR" \n", (uintptr_t) old); + fprintf(stderr, "new: "FMTPTR" \n", (uintptr_t) new); + fprintf(stderr, "worklist: "FMTPTR" \n", (uintptr_t) s->worklist); } free(old); @@ -100,7 +92,6 @@ bool isEmptyWorklist(GC_state s) { return false; else return true; - } @@ -187,6 +178,7 @@ GC_objectTypeTag getObjectType(GC_state s, pointer p) { bool isWorklistShaded(GC_state s) { /* Enforce invariant: * Mutator holds no white references*/ + START_PERF; LOCK_WL; int i; @@ -201,12 +193,16 @@ bool isWorklistShaded(GC_state s) { } UNLOCK_WL; + STOP_PERF; + return true; } static void markWorklist(GC_state s) { int i, tmplength; + START_PERF; + LOCK_WL; @@ -244,11 +240,15 @@ static void markWorklist(GC_state s) { UNLOCK_WL; + STOP_PERF; + } static void markChunk(pointer p, GC_objectTypeTag tag, GC_markMode m, GC_state s, uint16_t numObjptrs) { + START_PERF; + if (tag == NORMAL_TAG || tag == STACK_TAG || tag == WEAK_TAG) { if (p >= s->umheap.start && @@ -369,6 +369,7 @@ void markChunk(pointer p, GC_objectTypeTag tag, GC_markMode m, GC_state s, uint1 } } + STOP_PERF; } @@ -491,6 +492,8 @@ bool isContainerChunkMarkedByMode(pointer p, GC_markMode m, GC_objectTypeTag tag * */ void umDfsMarkObjects(GC_state s, objptr *opp, GC_markMode m) { + START_PERF; + pointer p = objptrToPointer(*opp, s->umheap.start); if (DEBUG_DFS_MARK) fprintf(stderr, "umDFSMarkObjects: original obj: "FMTPTR", obj: "FMTPTR"\n", @@ -544,6 +547,8 @@ void umDfsMarkObjects(GC_state s, objptr *opp, GC_markMode m) { foreachObjptrInObject(s, p, umDfsMarkObjectsUnMark, false); } } + + STOP_PERF; } @@ -552,6 +557,8 @@ void markUMArrayChunks(GC_state s, GC_UM_Array_Chunk p, GC_markMode m) { * be marked. Objects pointed to via an Lnode will not be marked. * The marking of those objects is performed in foreachObjptrInObject */ + START_PERF; + assert (p->array_chunk_magic == UM_ARRAY_SENTINEL); if (DEBUG_DFS_MARK) @@ -581,10 +588,14 @@ void markUMArrayChunks(GC_state s, GC_UM_Array_Chunk p, GC_markMode m) { markUMArrayChunks(s, pcur, m); } } + + STOP_PERF; + } void umDfsMarkObjectsToWorklist(GC_state s, objptr *opp, GC_markMode m) { + START_PERF; pointer p = objptrToPointer(*opp, s->umheap.start); GC_header *headerp = getHeaderp(p); GC_header header = *headerp; @@ -608,8 +619,7 @@ void umDfsMarkObjectsToWorklist(GC_state s, objptr *opp, GC_markMode m) { /* Using MLton object to track if containing chunk marked */ if (isContainerChunkMarkedByMode(p, m, tag)) { if (DEBUG_DFS_MARK) - fprintf(stderr, FMTPTR - "marked by mark_mode: %d, RETURN\n", + fprintf(stderr, FMTPTR"marked by mark_mode: %d, RETURN\n", (uintptr_t) p, (m == MARK_MODE)); return; @@ -641,4 +651,6 @@ void umDfsMarkObjectsToWorklist(GC_state s, objptr *opp, GC_markMode m) { foreachObjptrInObject(s, p, umDfsMarkObjectsUnMark, false); } } + + STOP_PERF; } From 23b8b5961c6f87c0d9698492faff6ec87cafdd0b Mon Sep 17 00:00:00 2001 From: jeff murphy Date: Mon, 11 Apr 2022 09:40:53 -0400 Subject: [PATCH 26/39] lock debug, instrumentation --- include/c-chunk.h | 5 +++-- mlton/backend/gc-check.fun | 6 ++---- runtime/gc/debug.h | 10 +++++----- runtime/gc/garbage-collection.c | 2 +- runtime/gc/new-object.c | 2 ++ runtime/gc/um.c | 23 ++++++++++++++--------- runtime/gc/umarray-allocate.c | 4 +++- 7 files changed, 30 insertions(+), 22 deletions(-) diff --git a/include/c-chunk.h b/include/c-chunk.h index 285260463..57348afe8 100755 --- a/include/c-chunk.h +++ b/include/c-chunk.h @@ -134,9 +134,10 @@ void um_dumpFrame (void *s, void *f); *(ty*)(CurrentFrame + (i)))), \ (ty*)(CurrentFrame + (i)))) +#define LOCK_DEBUG(LN) if(getenv("DEBUG_LOCKS")) {fprintf(stderr, "%d] LOCKDBG %s %s\n", PTHREAD_NUM, __FUNCTION__, LN);} #define IFED(X) do { int x = X; if (x) { perror("(in codegen code) perror " #X); printf(" rv=%d\n", x); exit(-1); } } while(0) -#define Lock_fl(s) IFED(pthread_mutex_lock(&s)) -#define Unlock_fl(s) IFED(pthread_mutex_unlock(&s)) +#define Lock_fl(s) LOCK_DEBUG("Lock_fl"); IFED(pthread_mutex_lock(&s)) +#define Unlock_fl(s) LOCK_DEBUG("Unlock_fl"); IFED(pthread_mutex_unlock(&s)) #define ChunkExnHandler ((struct GC_UM_Chunk*)(CurrentFrame - STACKHEADER))->handler #define ChunkExnLink ((struct GC_UM_Chunk*)(CurrentFrame - STACKHEADER))->link diff --git a/mlton/backend/gc-check.fun b/mlton/backend/gc-check.fun index 53fd31461..8b027faaa 100755 --- a/mlton/backend/gc-check.fun +++ b/mlton/backend/gc-check.fun @@ -187,23 +187,21 @@ struct Operand.Runtime FLChunks, Operand.Var {var = res, ty = resTy}, {ifTrue=block, ifFalse=check}) - val (ss2, ts2) = primApp (Prim.wordLt (WordSize.csize (), {signed = false}), Operand.Runtime FLChunks, Operand.Runtime HeuristicChunks, {ifTrue=collect, ifFalse=dontCollect}) - in [ Block.T { args = args , kind = kind , label = label , statements = Vector.new3 (lockstmt, sAdd, ss) , transfer = ts } - , + , Block.T { args = Vector.new0 () , kind = Kind.Jump , label = check - , statements = Vector.fromList ([ss2] @ (incReserved chunksNeeded) + , statements = Vector.fromList ([ss2] @ (incReserved chunksNeeded) @[ unlockstmt]) , transfer = ts2 } ] @ blockingGC block check diff --git a/runtime/gc/debug.h b/runtime/gc/debug.h index 04298c990..4ebefaed1 100755 --- a/runtime/gc/debug.h +++ b/runtime/gc/debug.h @@ -13,9 +13,9 @@ //#define PROFILE_UMGC enum { - DEBUG_ALLOC = FALSE, + DEBUG_ALLOC = TRUE, DEBUG_ALLOC_PACK = FALSE, - DEBUG_ARRAY = FALSE, + DEBUG_ARRAY = TRUE, DEBUG_ARRAY_OFFSET = FALSE, DEBUG_CALL_STACK = FALSE, DEBUG_CARD_MARKING = FALSE, @@ -44,9 +44,9 @@ enum { FORCE_GENERATIONAL = FALSE, FORCE_MARK_COMPACT = FALSE, DEBUG_OLD = FALSE, - DEBUG_RTGC = FALSE, - DEBUG_RTGC_MARKING = FALSE, - DEBUG_RTGC_VERBOSE = FALSE, + DEBUG_RTGC = TRUE, + DEBUG_RTGC_MARKING = TRUE, + DEBUG_RTGC_VERBOSE = TRUE, DEBUG_WB = FALSE, DISPLAY_GC_STATS = FALSE }; diff --git a/runtime/gc/garbage-collection.c b/runtime/gc/garbage-collection.c index 98fcda2ea..1bf8d461b 100755 --- a/runtime/gc/garbage-collection.c +++ b/runtime/gc/garbage-collection.c @@ -390,7 +390,7 @@ void *GCrunner(void *_s) { //not_dirty:; RTSYNC_UNLOCK; - /*sending out singals after unlocking RTSYNC allows the woken up thread to perform GC_collect if it starts before RTSYNC is unlocked*/ + /*sending out signals after unlocking RTSYNC allows the woken up thread to perform GC_collect if it starts before RTSYNC is unlocked*/ /*Need to acquire s->fl_lock before braodcast to have predictable scheduling behavior. man pthread_cond_broadcast*/ LOCK_FL_FROMGC; BROADCAST; diff --git a/runtime/gc/new-object.c b/runtime/gc/new-object.c index 619020ac8..c7bf65a46 100755 --- a/runtime/gc/new-object.c +++ b/runtime/gc/new-object.c @@ -64,6 +64,8 @@ objptr newStack_um(GC_state s, size_t stackSizeInBytes, size_t *stackSizeInChunk if (stackSizeInChunks) *stackSizeInChunks = need_chunks; + // instrument() calls are in UM_Object_alloc + assert(s->maxFrameSize <= UM_CHUNK_PAYLOAD_SIZE); /* Reserve the allocation before actually allocating. diff --git a/runtime/gc/um.c b/runtime/gc/um.c index 609ac010b..df374fafa 100755 --- a/runtime/gc/um.c +++ b/runtime/gc/um.c @@ -39,7 +39,9 @@ void reserveAllocation(GC_state s, size_t numChunksToRequest) { } LOCK_FL; - while ((s->fl_chunks < (s->reserved + numChunksToRequest)))// || (s->fl_chunks < (size_t)(s->hPercent * s->maxChunksAvailable))) + while ((s->fl_chunks < (s->reserved + numChunksToRequest)) + || (s->fl_chunks < (size_t)(s->hPercent * s->maxChunksAvailable)) + ) { fprintf(stderr, "%d] either fl (%d) is < reserved+req (%d) or fl (%d) < heuristic (%d)\n", PTHREAD_NUM, s->fl_chunks, (s->reserved + numChunksToRequest), s->fl_chunks, (size_t)(s->hPercent * s->maxChunksAvailable) ); @@ -163,10 +165,6 @@ UM_Object_alloc_packing_stage1(GC_state s, C_Size_t num_chunks, uint32_t header, */ assert (num_chunks == 1); - if (s->packingStage2Enabled == false) { - User_instrument_counter(310, num_chunks); /* JEFF packed1 total */ - } - if (s->activeChunk[PTHREAD_NUM] != BOGUS_POINTER) { chunk = (GC_UM_Chunk)s->activeChunk[PTHREAD_NUM]; @@ -213,6 +211,8 @@ UM_Object_alloc_packing_stage1(GC_state s, C_Size_t num_chunks, uint32_t header, (unsigned int)(UM_CHUNK_PAYLOAD_SIZE-(chunk->used)), sz+hdrsz ); + User_instrument_counter(310, num_chunks); /* JEFF packed1 no new chunk needed */ + LOCK_FL; s->reserved -= 1; UNLOCK_FL; @@ -236,6 +236,7 @@ UM_Object_alloc_packing_stage1(GC_state s, C_Size_t num_chunks, uint32_t header, } else { if (DEBUG_ALLOC_PACK) fprintf(stderr, "%d] unable to find space in another threads chunk, and:\n", PTHREAD_NUM); + User_instrument_counter(330, num_chunks); /* JEFF packed1, new chunk required */ } } else { User_instrument_counter(330, num_chunks); /* JEFF packed1, new chunk required */ @@ -346,8 +347,10 @@ if (upper_ev) upper_bound = atoi(upper_ev); // no-packing. in order for stage2 to occur, stage1 must be enabled if (gc_stat->packingStage1Enabled == false || allowedToPack[PTHREAD_NUM] == 0) { - if (header == GC_STACK_HEADER) - User_instrument_counter(100, num_chunks); /* JEFF Stack Allocs */ + if (header == GC_STACK_HEADER) { + User_instrument_counter(100, 1); /* JEFF Stack Allocs */ + User_instrument_counter(110, num_chunks); /* JEFF Stack Allocs */ + } else User_instrument_counter(300, num_chunks); /* JEFF Normal allocs, unpacked */ return UM_Object_alloc_no_packing(gc_stat, num_chunks, header, s); @@ -364,8 +367,10 @@ if (upper_ev) upper_bound = atoi(upper_ev); GC_THREAD_HEADER, GC_WEAK_GONE_HEADER, GC_STACK_HEADER ); - if (header == GC_STACK_HEADER) - User_instrument_counter(100, num_chunks); /* JEFF stack alloc */ + if (header == GC_STACK_HEADER) { + User_instrument_counter(100, 1); /* JEFF Stack Allocs */ + User_instrument_counter(110, num_chunks); /* JEFF stack alloc */ + } else User_instrument_counter(300, num_chunks); /* JEFF normal alloc, unpacked */ diff --git a/runtime/gc/umarray-allocate.c b/runtime/gc/umarray-allocate.c index a8f7da71d..22110696e 100644 --- a/runtime/gc/umarray-allocate.c +++ b/runtime/gc/umarray-allocate.c @@ -204,7 +204,6 @@ pointer GC_arrayAllocate(GC_state s, /* calc number of leaves */ - User_instrument(11); /* JEFF */ splitHeader(s, header, NULL, NULL, &bytesNonObjptrs, &numObjptrs); bytesPerElement = bytesNonObjptrs + (numObjptrs * OBJPTR_SIZE); @@ -221,6 +220,8 @@ pointer GC_arrayAllocate(GC_state s, //size_t numChunks = (POW(UM_CHUNK_ARRAY_INTERNAL_POINTERS,treeHeight+1)-1) / (UM_CHUNK_ARRAY_INTERNAL_POINTERS-1); size_t numChunks = numLeaves + (POW(UM_CHUNK_ARRAY_INTERNAL_POINTERS,treeHeight)-1) / (UM_CHUNK_ARRAY_INTERNAL_POINTERS-1); + User_instrument_counter(200, 1); /* JEFF array allocs total */ + /* calc total number of internal chunks needed to construct the tree * to do this we dont simply calculate the number of nodes needed to fully * populate the tree, but instead we need to find the minimum number of internal @@ -251,6 +252,7 @@ pointer GC_arrayAllocate(GC_state s, if (numChunks == 0) numChunks = 1; assert (numChunks > 0); + User_instrument_counter(210, numChunks); /* JEFF array allocs chunks */ /* reserve chunks: will block if there aren't enough chunks */ From 3b518bfae8abc1edd031f51dcae4e2093264d740 Mon Sep 17 00:00:00 2001 From: jeff murphy Date: Tue, 12 Apr 2022 16:57:40 -0400 Subject: [PATCH 27/39] rework gc-check to be just a ccall. more lock debug --- include/c-chunk.h | 2 +- mlton/atoms/prim.fun | 7 ++ mlton/atoms/prim.sig | 1 + mlton/backend/chunked-allocation.fun | 5 + mlton/backend/gc-check.fun | 158 ++++++--------------------- mlton/backend/rep-type.fun | 18 +++ mlton/backend/rep-type.sig | 1 + mlton/backend/ssa-to-rssa.fun | 6 + runtime/gc/atomic.c | 32 +++--- runtime/gc/debug.h | 1 + runtime/gc/done.c | 2 +- runtime/gc/garbage-collection.c | 38 +++---- runtime/gc/gc_state.c | 4 +- runtime/gc/um.c | 11 +- runtime/gc/um.h | 1 + runtime/gc/umheap.c | 23 ++-- runtime/gc/umheap.h | 1 + runtime/gc/ummark.c | 6 +- ub/testgcbench.sml | 52 ++------- 19 files changed, 144 insertions(+), 225 deletions(-) mode change 100644 => 100755 ub/testgcbench.sml diff --git a/include/c-chunk.h b/include/c-chunk.h index 57348afe8..8b96062aa 100755 --- a/include/c-chunk.h +++ b/include/c-chunk.h @@ -137,7 +137,7 @@ void um_dumpFrame (void *s, void *f); #define LOCK_DEBUG(LN) if(getenv("DEBUG_LOCKS")) {fprintf(stderr, "%d] LOCKDBG %s %s\n", PTHREAD_NUM, __FUNCTION__, LN);} #define IFED(X) do { int x = X; if (x) { perror("(in codegen code) perror " #X); printf(" rv=%d\n", x); exit(-1); } } while(0) #define Lock_fl(s) LOCK_DEBUG("Lock_fl"); IFED(pthread_mutex_lock(&s)) -#define Unlock_fl(s) LOCK_DEBUG("Unlock_fl"); IFED(pthread_mutex_unlock(&s)) +#define Unlock_fl(s) IFED(pthread_mutex_unlock(&s)); LOCK_DEBUG("Unlock_fl") #define ChunkExnHandler ((struct GC_UM_Chunk*)(CurrentFrame - STACKHEADER))->handler #define ChunkExnLink ((struct GC_UM_Chunk*)(CurrentFrame - STACKHEADER))->link diff --git a/mlton/atoms/prim.fun b/mlton/atoms/prim.fun index 53fa5ca57..1cb707419 100644 --- a/mlton/atoms/prim.fun +++ b/mlton/atoms/prim.fun @@ -66,6 +66,7 @@ datatype 'a t = | FFI_Symbol of {name: string, cty: CType.t option, symbolScope: CFunction.SymbolScope.t } (* codegen *) + | UM_reserveAllocation (* ssa to rssa *) | GC_collect (* ssa to rssa *) | IntInf_add (* ssa to rssa *) | IntInf_andb (* ssa to rssa *) @@ -255,6 +256,7 @@ fun toString (n: 'a t): string = | FFI f => (CFunction.Target.toString o CFunction.target) f | FFI_getOpArgsResPtr => "FFI_getOpArgsResPtr" | FFI_Symbol {name, ...} => name + | UM_reserveAllocation => "UM_reserveAllocation" | GC_collect => "GC_collect" | IntInf_add => "IntInf_add" | IntInf_andb => "IntInf_andb" @@ -400,6 +402,7 @@ val equals: 'a t * 'a t -> bool = | (FFI f, FFI f') => CFunction.equals (f, f') | (FFI_getOpArgsResPtr, FFI_getOpArgsResPtr) => true | (FFI_Symbol {name = n, ...}, FFI_Symbol {name = n', ...}) => n = n' + | (UM_reserveAllocation, UM_reserveAllocation) => true | (GC_collect, GC_collect) => true | (IntInf_add, IntInf_add) => true | (IntInf_andb, IntInf_andb) => true @@ -570,6 +573,7 @@ val map: 'a t * ('a -> 'b) -> 'b t = | FFI_Symbol {name, cty, symbolScope} => FFI_Symbol {name = name, cty = cty, symbolScope = symbolScope} | GC_collect => GC_collect + | UM_reserveAllocation => UM_reserveAllocation | IntInf_add => IntInf_add | IntInf_andb => IntInf_andb | IntInf_arshift => IntInf_arshift @@ -830,6 +834,7 @@ val kind: 'a t -> Kind.t = | FFI_getOpArgsResPtr => SideEffect | FFI_Symbol _ => Functional | GC_collect => SideEffect + | UM_reserveAllocation => SideEffect | IntInf_add => Functional | IntInf_andb => Functional | IntInf_arshift => Functional @@ -1035,6 +1040,7 @@ in Exn_setExtendExtra, FFI_getOpArgsResPtr, GC_collect, + UM_reserveAllocation, IntInf_add, IntInf_andb, IntInf_arshift, @@ -1300,6 +1306,7 @@ fun 'a checkApp (prim: 'a t, noTargs (fn () => (nArgs (CFunction.args f), CFunction.return f)) | FFI_getOpArgsResPtr => noTargs (fn () => (noArgs, cpointer)) | FFI_Symbol _ => noTargs (fn () => (noArgs, cpointer)) + | UM_reserveAllocation => noTargs (fn () => (noArgs, unit)) | GC_collect => noTargs (fn () => (noArgs, unit)) | IntInf_add => intInfBinary () | IntInf_andb => intInfBinary () diff --git a/mlton/atoms/prim.sig b/mlton/atoms/prim.sig index 6980d7c8b..bf82a1a71 100644 --- a/mlton/atoms/prim.sig +++ b/mlton/atoms/prim.sig @@ -58,6 +58,7 @@ signature PRIM = | FFI_Symbol of {name: string, (* codegen *) cty: CType.t option, symbolScope: CFunction.SymbolScope.t} + | UM_reserveAllocation (* ssa to rssa *) | GC_collect (* ssa to rssa *) | IntInf_add (* ssa to rssa *) | IntInf_andb (* ssa to rssa *) diff --git a/mlton/backend/chunked-allocation.fun b/mlton/backend/chunked-allocation.fun index c366f9167..c1f11e378 100644 --- a/mlton/backend/chunked-allocation.fun +++ b/mlton/backend/chunked-allocation.fun @@ -110,7 +110,12 @@ fun insertChunkedAllocation (b as Block.T {args, kind, label, statements, transf fun handleFunction (f: Function.t): Function.t = let + val {args, blocks, name, raises, returns, start} = Function.dest f + + val _ = TextIO.output (TextIO.stdErr, ("chunked-allocation.fun: ")) + val _ = Layout.outputl (Func.layout(Function.name f), Out.error) (* JEFF *) + val newBlocks = ref [] val () = Vector.foreach (blocks, diff --git a/mlton/backend/gc-check.fun b/mlton/backend/gc-check.fun index 8b027faaa..196f0aefd 100755 --- a/mlton/backend/gc-check.fun +++ b/mlton/backend/gc-check.fun @@ -57,64 +57,33 @@ struct val chunksNeeded = Block.objChunksAllocated b val dontCollect = Label.newNoname () val collect = Label.newNoname () - val func = CFunction.gc {maySwitchThreads = false} + val reserve_allocation = Label.newNoname () - fun gcAndJumpToBlock (to) = + val gc_collect_func = CFunction.gc {maySwitchThreads = false} + val gc_reserve_allocation = CFunction.reserveAllocation {maySwitchThreads = false} + + fun reserveAndJumpToBlock (to) = let - val collectReturn = Label.newNoname () + val collectReturn = Label.newNoname () in [ Block.T {args = Vector.new0 (), kind = Kind.Jump, - label = collect, + label = reserve_allocation, statements = Vector.new0 (), transfer = (Transfer.CCall - {args = Vector.new4 (Operand.GCState, - (Operand.word - (WordX.zero (WordSize.csize ()))), - Operand.bool false, - Operand.bool true), - func = func, - return = SOME collectReturn})} + {args = Vector.new2 (Operand.GCState, Operand.constWord chunksNeeded (WordSize.word32)), (* Operand.word (WordX.fromIntInf (Word.toIntInf (chunksNeeded, WordSize.csize)))), *) + func = gc_reserve_allocation, + return = SOME collectReturn })} , Block.T { args = Vector.new0 () - , kind = Kind.CReturn {func = func} - , label = collectReturn - , statements = Vector.new0 () - , transfer = Transfer.Goto { dst = to - , args = Vector.new0 () }} ] + , kind = Kind.CReturn {func = gc_reserve_allocation} + , label = collectReturn + , statements = Vector.new0 () + , transfer = Transfer.Goto { dst = to + , args = Vector.new0 () }} ] end datatype z = datatype Runtime.GCField.t - fun decFreeChunks n = - let - val flChunks = Operand.Runtime FLChunks - val res = Var.newNoname () - val resTy = Operand.ty flChunks - in - [Statement.PrimApp {args = (Vector.new2 - (flChunks, Operand.constWord n (WordSize.word32))), - dst = SOME (res, resTy), - prim = Prim.wordSub WordSize.word32}, - Statement.Move {dst = flChunks, - src = Operand.Var {ty = resTy, var = res}}] - end - - - fun incReserved n = - let - val reserved = Operand.Runtime Reserved - val res = Var.newNoname () - val resTy = Operand.ty reserved - in - [Statement.PrimApp {args = (Vector.new2 - (reserved, Operand.constWord n (WordSize.word32))), - dst = SOME (res, resTy), - prim = Prim.wordAdd WordSize.word32}, - Statement.Move {dst = reserved, - src = Operand.Var {ty = resTy, var = res}}] - end - - fun primApp (prim, op1, op2, {ifTrue, ifFalse}) = let val res = Var.newNoname () @@ -131,92 +100,24 @@ struct (s, transfer) end - - val lockstmt = Statement.PrimApp {args = Vector.new1 (Operand.Runtime FLLock), - dst = NONE, - prim = Prim.lockfl} - - val unlockstmt = Statement.PrimApp {args = Vector.new1 (Operand.Runtime FLLock), - dst = NONE, - prim = Prim.unlockfl} - - fun blockingGC blLbl check = - let - val return = Label.newNoname () - val (ss, ts) = primApp (Prim.wordLt (WordSize.csize (), {signed = false}), - Operand.Runtime FLChunks, - Operand.constWord chunksNeeded (WordSize.csize ()), - {ifTrue=blLbl, ifFalse=check}) - in - [ Block.T {args = Vector.new0 (), - kind = Kind.Jump, - label = blLbl, - statements = Vector.new1 (unlockstmt), - transfer = (Transfer.CCall - {args = Vector.new4 (Operand.GCState, - (Operand.word - (WordX.zero (WordSize.csize ()))), - Operand.bool true, - Operand.bool true), - func = func, - return = SOME return})} - , Block.T { args = Vector.new0 () - , kind = Kind.CReturn {func = func} - , label = return - , statements = Vector.new2 (lockstmt,ss) - , transfer = ts} ] - - - end - - - val startBlock = - let - val check = Label.newNoname () - val block = Label.newNoname () - val reserved = Operand.Runtime Reserved - val res = Var.newNoname () - val resTy = Operand.ty reserved - val sAdd = Statement.PrimApp {args = (Vector.new2 - (reserved, Operand.constWord chunksNeeded (WordSize.word32))), - dst = SOME (res, resTy), - prim = Prim.wordAdd WordSize.word32} - - val (ss, ts) = primApp (Prim.wordLt (WordSize.csize (), {signed = false}), - Operand.Runtime FLChunks, - Operand.Var {var = res, ty = resTy}, - {ifTrue=block, ifFalse=check}) - val (ss2, ts2) = primApp (Prim.wordLt (WordSize.csize (), {signed = false}), - Operand.Runtime FLChunks, - Operand.Runtime HeuristicChunks, - {ifTrue=collect, ifFalse=dontCollect}) - in - [ Block.T { args = args + Block.T { args = args , kind = kind , label = label - , statements = Vector.new3 (lockstmt, sAdd, ss) - , transfer = ts } - , - Block.T { args = Vector.new0 () - , kind = Kind.Jump - , label = check - , statements = Vector.fromList ([ss2] @ (incReserved chunksNeeded) - @[ unlockstmt]) - , transfer = ts2 } - ] @ blockingGC block check + , statements = Vector.new0 () + , transfer = Transfer.Goto { dst = reserve_allocation + , args = Vector.new0 () }} - end in - if chunksNeeded = Word.fromInt 0 - then [b] - else startBlock @ - gcAndJumpToBlock dontCollect @ - [Block.T { args = Vector.new0 () - , kind = Kind.Jump - , label = dontCollect - , statements = statements - , transfer = transfer }] + if chunksNeeded = Word.fromInt 0 + then [b] + else [startBlock] @ + reserveAndJumpToBlock dontCollect @ + [Block.T { args = Vector.new0 () + , kind = Kind.Jump + , label = dontCollect + , statements = statements + , transfer = transfer }] end (* @@ -235,6 +136,9 @@ struct (blocks, fn block => List.push (newBlocks, insertCheck block)) + + val _ = TextIO.output (TextIO.stdErr, ("gc-check.fun: ")) + val _ = Layout.outputl (Func.layout(Function.name f), Out.error) (* JEFF *) in Function.new { args = args , blocks = Vector.fromList (List.concat (!newBlocks)) diff --git a/mlton/backend/rep-type.fun b/mlton/backend/rep-type.fun index 763533921..042c84a48 100644 --- a/mlton/backend/rep-type.fun +++ b/mlton/backend/rep-type.fun @@ -890,10 +890,28 @@ structure BuiltInCFunction = return = Type.unit, symbolScope = SymbolScope.Private, target = Direct "GC_collect"} + fun make2 b = fn () => + T {args = Vector.new2 (Type.gcState (), Type.csize ()), + convention = Cdecl, + kind = Kind.Runtime {bytesNeeded = NONE, + ensuresBytesFree = true, + mayGC = true, + maySwitchThreads = b, + modifiesFrontier = true, + readsStackTop = true, + writesStackTop = true}, + prototype = (Vector.new2 (CType.cpointer, CType.csize ()), + NONE), + return = Type.unit, + symbolScope = SymbolScope.Private, + target = Direct "GC_reserveAllocation"} val t = make true val f = make false + val t2 = make2 true + val f2 = make2 false in fun gc {maySwitchThreads = b} = if b then t () else f () + fun reserveAllocation {maySwitchThreads = b} = if b then t2 () else f2 () end end diff --git a/mlton/backend/rep-type.sig b/mlton/backend/rep-type.sig index a39075354..398578591 100644 --- a/mlton/backend/rep-type.sig +++ b/mlton/backend/rep-type.sig @@ -109,5 +109,6 @@ signature REP_TYPE = sig val bug: unit -> t CFunction.t val gc: {maySwitchThreads: bool} -> t CFunction.t + val reserveAllocation: {maySwitchThreads: bool} -> t CFunction.t end end diff --git a/mlton/backend/ssa-to-rssa.fun b/mlton/backend/ssa-to-rssa.fun index 342fae0b6..5681d2d6a 100644 --- a/mlton/backend/ssa-to-rssa.fun +++ b/mlton/backend/ssa-to-rssa.fun @@ -1232,6 +1232,12 @@ fun convert (program as S.Program.T {functions, globals, main, ...}, | FFI_getOpArgsResPtr => simpleCCallWithGCState (CFunction.ffiGetOpArgsResPtr ()) + | UM_reserveAllocation => + ccall + {args = (Vector.new2 + (GCState, + Operand.zero (WordSize.csize ()))), + func = (CFunction.reserveAllocation {maySwitchThreads = false})} | GC_collect => ccall {args = (Vector.new4 diff --git a/runtime/gc/atomic.c b/runtime/gc/atomic.c index b48ff8472..8f6888487 100644 --- a/runtime/gc/atomic.c +++ b/runtime/gc/atomic.c @@ -14,56 +14,56 @@ static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; void incAtomicBy (GC_state s, uint32_t v) { DECVARS; - lockop = pthread_mutex_lock(&lock); + LOCK_DEBUG("LOCK incAtomicBy"); lockop = pthread_mutex_lock(&lock); assert(lockop == 0); s->atomicState += v; - unlockop = pthread_mutex_unlock(&lock); + unlockop = pthread_mutex_unlock(&lock); LOCK_DEBUG("UNLOCK incAtomicBy"); assert(unlockop == 0); } void decAtomicBy (GC_state s, uint32_t v) { DECVARS; - lockop = pthread_mutex_lock(&lock); + LOCK_DEBUG("LOCK decAtomicBy"); lockop = pthread_mutex_lock(&lock); assert(lockop == 0); s->atomicState -= v; - unlockop = pthread_mutex_unlock(&lock); + unlockop = pthread_mutex_unlock(&lock); LOCK_DEBUG("UNLOCK decAtomicBy"); assert(unlockop == 0); } void setAtomic (GC_state s, uint32_t v) { DECVARS; - lockop = pthread_mutex_lock(&lock); + LOCK_DEBUG("LOCK setAtomic"); lockop = pthread_mutex_lock(&lock); assert(lockop == 0); s->atomicState = v; - unlockop = pthread_mutex_unlock(&lock); + unlockop = pthread_mutex_unlock(&lock); LOCK_DEBUG("UNLOCK setAtomic"); assert(unlockop == 0); } void incAtomic (GC_state s) { DECVARS; - lockop = pthread_mutex_lock(&lock); + LOCK_DEBUG("LOCK incAtomic"); lockop = pthread_mutex_lock(&lock); assert(lockop == 0); s->atomicState++; - unlockop = pthread_mutex_unlock(&lock); + unlockop = pthread_mutex_unlock(&lock); LOCK_DEBUG("UNLOCK incAtomic"); assert(unlockop == 0); } void decAtomic (GC_state s) { DECVARS; - lockop = pthread_mutex_lock(&lock); + LOCK_DEBUG("LOCK decAtomic"); lockop = pthread_mutex_lock(&lock); assert(lockop == 0); s->atomicState--; - unlockop = pthread_mutex_unlock(&lock); + unlockop = pthread_mutex_unlock(&lock); LOCK_DEBUG("UNLOCK decAtomic"); assert(unlockop == 0); } void beginAtomic (GC_state s) { DECVARS; - - lockop = pthread_mutex_lock(&lock); + LOCK_DEBUG("LOCK beginAtomic"); lockop = pthread_mutex_lock(&lock); assert(lockop == 0); s->atomicState++; - unlockop = pthread_mutex_unlock(&lock); + unlockop = pthread_mutex_unlock(&lock); LOCK_DEBUG("UNLOCK beginAtomic"); + assert(unlockop == 0); if (0 == s->limit) @@ -72,11 +72,11 @@ void beginAtomic (GC_state s) { void endAtomic (GC_state s) { DECVARS; - - lockop = pthread_mutex_lock(&lock); + LOCK_DEBUG("LOCK endAtomic"); lockop = pthread_mutex_lock(&lock); assert(lockop == 0); s->atomicState--; - unlockop = pthread_mutex_unlock(&lock); + unlockop = pthread_mutex_unlock(&lock); LOCK_DEBUG("UNLOCK endAtomic"); + assert(unlockop == 0); if (0 == s->atomicState diff --git a/runtime/gc/debug.h b/runtime/gc/debug.h index 4ebefaed1..113ca0654 100755 --- a/runtime/gc/debug.h +++ b/runtime/gc/debug.h @@ -46,6 +46,7 @@ enum { DEBUG_OLD = FALSE, DEBUG_RTGC = TRUE, DEBUG_RTGC_MARKING = TRUE, + DEBUG_RTGC_MARKING_SHADING = FALSE, DEBUG_RTGC_VERBOSE = TRUE, DEBUG_WB = FALSE, DISPLAY_GC_STATS = FALSE diff --git a/runtime/gc/done.c b/runtime/gc/done.c index 6f6705482..0173af675 100755 --- a/runtime/gc/done.c +++ b/runtime/gc/done.c @@ -11,7 +11,7 @@ #define IFED(X) do { if (X) { printf(__FUNCTION__);perror("-perror " #X); exit(-1); } } while(0) #define LOCK_FL LOCK_DEBUG("LOCK_FL"); IFED(pthread_mutex_lock(&s->fl_lock)) -#define UNLOCK_FL LOCK_DEBUG("UNLOCK_FL"); IFED(pthread_mutex_unlock(&s->fl_lock)) +#define UNLOCK_FL IFED(pthread_mutex_unlock(&s->fl_lock)); LOCK_DEBUG("UNLOCK_FL") #define BLOCK LOCK_DEBUG("BLOCK"); IFED(pthread_cond_wait(&s->fl_empty_cond,&s->fl_lock)) diff --git a/runtime/gc/garbage-collection.c b/runtime/gc/garbage-collection.c index 1bf8d461b..365c70bf6 100755 --- a/runtime/gc/garbage-collection.c +++ b/runtime/gc/garbage-collection.c @@ -31,24 +31,22 @@ struct thrctrl { //#define IFED(X) do { if (X) { fprintf(stderr, "%s:%d ", __FUNCTION__, __LINE__); perror("perror " #X); exit(-1); } } while(0) #define LOCK_FL_FROMGC LOCK_DEBUG("LOCK_FL_FROMGC"); IFED(pthread_mutex_lock(&s->fl_lock)) -#define UNLOCK_FL_FROMGC LOCK_DEBUG("UNLOCK_FL_FROMGC"); IFED(pthread_mutex_unlock(&s->fl_lock)) +#define UNLOCK_FL_FROMGC IFED(pthread_mutex_unlock(&s->fl_lock)); LOCK_DEBUG("UNLOCK_FL_FROMGC") #define BROADCAST LOCK_DEBUG("BROADCAST"); IFED(pthread_cond_broadcast(&s->fl_empty_cond)) - -#define BROADCAST_EMPTY LOCK_DEBUG("BROADCAST_EMPTY"); IFED(pthread_cond_broadcast(&s->fl_empty_cond)) #define BLOCK_EMPTY LOCK_DEBUG("BLOCK_EMPTY"); IFED(pthread_cond_wait(&s->fl_empty_cond,&s->fl_lock)) #define RTSYNC_LOCK LOCK_DEBUG("RTSYNC_LOCK"); IFED(pthread_mutex_lock(&s->rtSync_lock)) -#define RTSYNC_UNLOCK LOCK_DEBUG("RTSYNC_UNLOCK"); IFED(pthread_mutex_unlock(&s->rtSync_lock)) +#define RTSYNC_UNLOCK IFED(pthread_mutex_unlock(&s->rtSync_lock)); LOCK_DEBUG("RTSYNC_UNLOCK") #define RTSYNC_SIGNAL LOCK_DEBUG("RTSYNC_SIGNAL"); IFED(pthread_cond_signal(&s->rtSync_cond)) #define RTSYNC_BLOCK LOCK_DEBUG("RTSYNC_BLOCK"); IFED(pthread_cond_wait(&s->rtSync_cond,&s->rtSync_lock)) #define RTSYNC_TRYLOCK LOCK_DEBUG("RTSYNC_TRYLOCK"); pthread_mutex_trylock(&s->rtSync_lock) -#define TC_LOCK if (DEBUG or DEBUG_RTGC) fprintf(stderr, "%d] TC_LOCK thr:%d boot:%d\n", PTHREAD_NUM, TC.running_threads, TC.booted); IFED(pthread_mutex_lock(&TC.lock)) -#define TC_UNLOCK if (DEBUG or DEBUG_RTGC) fprintf(stderr, "%d] TC_UNLOCK thr:%d boot:%d\n", PTHREAD_NUM, TC.running_threads, TC.booted); IFED(pthread_mutex_unlock(&TC.lock)) -#define TCSP_LOCK if (DEBUG or DEBUG_RTGC) fprintf(stderr, "%d] TCSP_LOCK thr:%d boot:%d\n", PTHREAD_NUM, TC.running_threads, TC.booted); IFED(pthread_mutex_lock(&TC.safepoint_lock)) -#define TCSP_UNLOCK if (DEBUG or DEBUG_RTGC) fprintf(stderr, "%d] TCSP_UNLOCK thr:%d boot:%d\n", PTHREAD_NUM, TC.running_threads, TC.booted); IFED(pthread_mutex_unlock(&TC.safepoint_lock)) +#define TC_LOCK LOCK_DEBUG("TC_LOCK"); IFED(pthread_mutex_lock(&TC.lock)) +#define TC_UNLOCK IFED(pthread_mutex_unlock(&TC.lock)); LOCK_DEBUG("TC_UNLOCK") +#define TCSP_LOCK LOCK_DEBUG("TCSP_LOCK"); IFED(pthread_mutex_lock(&TC.safepoint_lock)) +#define TCSP_UNLOCK IFED(pthread_mutex_unlock(&TC.safepoint_lock)); LOCK_DEBUG("TCSP_UNLOCK") /* * - threads can ask for GC's by setting gc_needed to 1 @@ -389,7 +387,7 @@ void *GCrunner(void *_s) { //not_dirty:; RTSYNC_UNLOCK; - +pthread_yield(); /*sending out signals after unlocking RTSYNC allows the woken up thread to perform GC_collect if it starts before RTSYNC is unlocked*/ /*Need to acquire s->fl_lock before braodcast to have predictable scheduling behavior. man pthread_cond_broadcast*/ LOCK_FL_FROMGC; @@ -721,10 +719,13 @@ User_instrument_counter(400, 1); /* JEFF normal collect */ s->cGCStats.numSweeps++; if (1||DEBUG_RTGC) { + size_t foo = count_freelist(s, &(s->umheap)); + fprintf(stderr, "%d] "GREEN("Finished one sweep cycle and freed %d chunks\n"), PTHREAD_NUM, freed); - fprintf(stderr, "%d] "GREEN("Chunks; Visited: %d, Marked: %d, Greys: %d Reds: %d\n"), PTHREAD_NUM, visited, marked, grey, - red); + fprintf(stderr, "%d] "GREEN("Chunks; Visited: %d, Marked: %d, Greys: %d Reds: %d Sanity: %d\n"), + PTHREAD_NUM, visited, marked, grey, + red, foo); } STOP_PERF; @@ -913,7 +914,7 @@ void GC_collect(GC_state s, size_t bytesRequested, bool force, bool collectRed) if (s->rtSync[PTHREAD_NUM] && force) { if (DEBUG_RTGC) { - fprintf(stderr, "%d] Came to block until GC finishes. ChunksAllocated = %s, FC = %d\n", PTHREAD_NUM, + fprintf(stderr, "%d] %s: Came to block until GC finishes. ChunksAllocated = %s, FC = %d\n", PTHREAD_NUM, __FUNCTION__, uintmaxToCommaString(s->cGCStats.numChunksAllocated), s->fl_chunks); } } @@ -941,11 +942,10 @@ void GC_collect(GC_state s, size_t bytesRequested, bool force, bool collectRed) if (DEBUG_RTGC) { - fprintf(stderr, "%d] GC_collect: Is dirty bit set? %s, Are enough Chunks Available? %s\n", PTHREAD_NUM, + fprintf(stderr, "%d] %s: Is dirty bit set? %s, Are enough Chunks Available? %s\n", PTHREAD_NUM, __FUNCTION__, s->dirty ? "Y" : "N", ensureChunksAvailable(s) ? "Y" : "N"); - fprintf(stderr, "%d] ChunksAllocated = %s, FC = %d\n", PTHREAD_NUM, + fprintf(stderr, "%d] %s: ChunksAllocated = %s, FC = %d\n", PTHREAD_NUM, __FUNCTION__, uintmaxToCommaString(s->cGCStats.numChunksAllocated), s->fl_chunks); - } GC_collect_real(s, bytesRequested, true); /*marks stack*/ @@ -957,7 +957,7 @@ void GC_collect(GC_state s, size_t bytesRequested, bool force, bool collectRed) int i; int ready_to_sync_count = 0; for (i = 0; i < MAXPRI; i++) { -fprintf(stderr, "%d] check rtsync[%d] = %d\n", PTHREAD_NUM, i, s->rtSync[i]); +fprintf(stderr, "%d] %s: check rtsync[%d] = %d\n", PTHREAD_NUM, __FUNCTION__, i, s->rtSync[i]); if (i == 1 || i == PTHREAD_NUM) // GC thr and our thr are not counted continue; if (s->rtSync[i]) @@ -968,7 +968,7 @@ fprintf(stderr, "%d] check rtsync[%d] = %d\n", PTHREAD_NUM, i, s->rtSync[i]); if (force) s->threadsBlockedForGC++; -fprintf(stderr, "%d] force %d threadsBlockedForGC %d i=%d MAXPRI=%d dirty=%d ready_to_sync_count=%d\n", PTHREAD_NUM, force, +fprintf(stderr, "%d] %s: force %d threadsBlockedForGC %d i=%d MAXPRI=%d dirty=%d ready_to_sync_count=%d\n", PTHREAD_NUM, __FUNCTION__, force, s->threadsBlockedForGC, i,MAXPRI, s->dirty, ready_to_sync_count); if (ready_to_sync_count == MAXPRI-2) /* all threads are ready to sync and GC */ @@ -976,11 +976,11 @@ s->threadsBlockedForGC, i,MAXPRI, s->dirty, ready_to_sync_count); s->dirty = true; RTSYNC_SIGNAL; if (DEBUG_RTGC) - fprintf(stderr, "%d] Signal sent to wake GC\n", PTHREAD_NUM); + fprintf(stderr, "%d] %s: Signal sent to wake GC\n", PTHREAD_NUM, __FUNCTION__); } else { if (DEBUG_RTGC) - fprintf(stderr, "%d] All Threads not synced\n", PTHREAD_NUM); + fprintf(stderr, "%d] %s: All Threads not synced\n", PTHREAD_NUM, __FUNCTION__); } diff --git a/runtime/gc/gc_state.c b/runtime/gc/gc_state.c index 836529fff..150b99c00 100755 --- a/runtime/gc/gc_state.c +++ b/runtime/gc/gc_state.c @@ -11,8 +11,8 @@ //#define BROADCAST_RT_THREADS IFED(pthread_cond_broadcast(&s->rtThreads_cond)) -#define LOCK_RT_TH IFED(pthread_mutex_lock(&s->rtThreads_lock)) -#define UNLOCK_RT_TH IFED(pthread_mutex_unlock(&s->rtThreads_lock)) +#define LOCK_RT_TH LOCK_DEBUG("LOCK_RT_TH"); IFED(pthread_mutex_lock(&s->rtThreads_lock)) +#define UNLOCK_RT_TH IFED(pthread_mutex_unlock(&s->rtThreads_lock)); LOCK_DEBUG("UNLOCK_RT_TH") void displayGCState(GC_state s, FILE *stream) { diff --git a/runtime/gc/um.c b/runtime/gc/um.c index df374fafa..5bac2394b 100755 --- a/runtime/gc/um.c +++ b/runtime/gc/um.c @@ -8,7 +8,7 @@ #endif #define LOCKIT(X) LOCK_DEBUG("LOCKIT"); IFED(pthread_mutex_lock(&(X))) -#define UNLOCKIT(X) LOCK_DEBUG("UNLOCKIT"); IFED(pthread_mutex_unlock(&(X))) +#define UNLOCKIT(X) IFED(pthread_mutex_unlock(&(X))); LOCK_DEBUG("UNLOCKIT") #undef DBG @@ -19,11 +19,15 @@ * define the free list */ +void GC_reserveAllocation(GC_state s, size_t numChunksToRequest) { + reserveAllocation(s, numChunksToRequest); +} + void reserveAllocation(GC_state s, size_t numChunksToRequest) { assert (numChunksToRequest > 0); /* This what the gc-check pass inserts for all objects allocated in basic block. - * SInce the number of chunks for an array is calculated at runtime, it becomes necessary to do + * Since the number of chunks for an array is calculated at runtime, it becomes necessary to do * the gc-check at runtime as well. This is different from the other allocations because * array allocation is treated as a CCall and therefore all temp registers are pushed to stack before * this function is called, thus allowing us to perform this check at runtime while preserving the @@ -43,9 +47,10 @@ void reserveAllocation(GC_state s, size_t numChunksToRequest) { || (s->fl_chunks < (size_t)(s->hPercent * s->maxChunksAvailable)) ) { - fprintf(stderr, "%d] either fl (%d) is < reserved+req (%d) or fl (%d) < heuristic (%d)\n", + fprintf(stderr, "%d] "PURPLE("either fl (%d) is < reserved+req (%d) or fl (%d) < heuristic (%d)\n"), PTHREAD_NUM, s->fl_chunks, (s->reserved + numChunksToRequest), s->fl_chunks, (size_t)(s->hPercent * s->maxChunksAvailable) ); UNLOCK_FL; + pthread_yield(); GC_collect(s, 0, true, true); LOCK_FL; } diff --git a/runtime/gc/um.h b/runtime/gc/um.h index c628e6a6d..c20ffe237 100644 --- a/runtime/gc/um.h +++ b/runtime/gc/um.h @@ -13,6 +13,7 @@ Pointer UM_Object_alloc_packing_stage2(GC_state gc_stat, C_Size_t num_chunks, ui void CompareAndSet(GC_state s, int lockOrUnlock); bool CompareExchange(volatile int *ptr, int expected, int desired); void reserveAllocation(GC_state s, size_t numChunksTorequest); +void GC_reserveAllocation(GC_state s, size_t numChunksToRequest); bool is_on_um_heap(GC_state s, Pointer p); void writeBarrier(GC_state s,Pointer dstbase, Pointer srcbase); diff --git a/runtime/gc/umheap.c b/runtime/gc/umheap.c index a06d1786a..52d476057 100755 --- a/runtime/gc/umheap.c +++ b/runtime/gc/umheap.c @@ -3,7 +3,7 @@ //#define IFED(X) do { if (X) { fprintf(stderr, "%s:%d ", __FUNCTION__, __LINE__); perror("perror " #X); exit(-1); } } while(0) #define LOCK_FL LOCK_DEBUG("LOCK_FL"); IFED(pthread_mutex_lock(&s->fl_lock)) -#define UNLOCK_FL LOCK_DEBUG("UNLOCK_FL"); IFED(pthread_mutex_unlock(&s->fl_lock)) +#define UNLOCK_FL IFED(pthread_mutex_unlock(&s->fl_lock)); LOCK_DEBUG("UNLOCK_FL") #define BLOCK LOCK_DEBUG("BLOCK"); IFED(pthread_cond_wait(&s->fl_empty_cond,&s->fl_lock)) @@ -271,12 +271,11 @@ void insertChunktoSubList(GC_state s, GC_UM_heap h, pointer c) { s->sl_chunks +=1; } - } -void addSweepListToFL(GC_state s,GC_UM_heap h){ +void addSweepListToFL(GC_state s, GC_UM_heap h){ if(s->sl_chunks == 0) return; @@ -299,18 +298,24 @@ void addSweepListToFL(GC_state s,GC_UM_heap h){ /*clear the sub list*/ h->sl_head = NULL; h->sl_tail = NULL; - s->sl_chunks =0; - - + s->sl_chunks = 0; UNLOCK_FL; } - - } - +size_t count_freelist(GC_state s, GC_UM_heap h) { + size_t c = 0; + LOCK_FL; + UM_Mem_Chunk pc = h->fl_head; + while (pc) { + c++; + pc = pc->next_chunk; + } + UNLOCK_FL; + return c; +} GC_UM_Array_Chunk insertArrayFreeChunk(GC_state s, GC_UM_heap h, diff --git a/runtime/gc/umheap.h b/runtime/gc/umheap.h index 7d6060d85..72a0a5259 100644 --- a/runtime/gc/umheap.h +++ b/runtime/gc/umheap.h @@ -92,5 +92,6 @@ static GC_UM_Chunk allocNextChunk(GC_state s, GC_UM_heap h, UM_header chunkType) GC_UM_Array_Chunk allocNextArrayChunk(GC_state s, GC_UM_heap h); GC_UM_Array_Chunk allocateArrayChunks(GC_state s, GC_UM_heap h, size_t numChunks); +size_t count_freelist(GC_state s, GC_UM_heap h); #endif diff --git a/runtime/gc/ummark.c b/runtime/gc/ummark.c index 64c086628..b8c668859 100755 --- a/runtime/gc/ummark.c +++ b/runtime/gc/ummark.c @@ -1,8 +1,8 @@ #include "../gc.h" -#define LOCK_WL IFED(pthread_mutex_lock(&s->wl_lock)) -#define UNLOCK_WL IFED(pthread_mutex_unlock(&s->wl_lock)) +#define LOCK_WL LOCK_DEBUG("LOCK_WL"); IFED(pthread_mutex_lock(&s->wl_lock)) +#define UNLOCK_WL IFED(pthread_mutex_unlock(&s->wl_lock)); LOCK_DEBUG("UNLOCK_WL") void umDfsMarkObjectsUnMark(GC_state s, objptr *opp) { @@ -158,7 +158,7 @@ void umShadeObject(GC_state s, objptr *opp) { splitHeader(s, header, &tag, NULL, &bytesNonObjptrs, &numObjptrs); markChunk(p, tag, GREY_MODE, s, numObjptrs); - if (DEBUG_RTGC_MARKING) { + if (DEBUG_RTGC_MARKING_SHADING) { printTag(__func__, tag, p); fprintf(stderr, "%d] shade "FMTPTR"\n", PTHREAD_NUM, (uintptr_t) p); } diff --git a/ub/testgcbench.sml b/ub/testgcbench.sml old mode 100644 new mode 100755 index 7adfce434..087bcd194 --- a/ub/testgcbench.sml +++ b/ub/testgcbench.sml @@ -166,50 +166,14 @@ struct fun doit () = gcbench 18 end -val _ = gcbench 18 - -(*fun printTime () = TextIO.output (TextIO.stdOut, "Time: " ^ Time.toString (Time.now()) ^ "\n") -open MLton -open PrimThread -open MLton.Thread - -val a = 9320 - - -fun fib n = - if n < 3 then - 1 - else - fib (n-1) + fib (n-2) - -fun printfib n = print ( Int.toString (fib (n)) ^ "\n ************** \n" ) - - -(*val _ = MLton.Thread.spawn (fn () => printfib (10))*) - -(*val _ = MLton.Thread.spawn(fn () => gcbench 18)*) - +open MLton.PrimThread -open OS.Process -fun inf_sleep t= OS.Process.sleep t +fun pause () = (print "sleep\n"; Posix.Process.sleep (Time.fromSeconds 1) + ; pause ()) +val _ = pspawn (fn () => pause (),2) +val _ = pspawn (fn () => pause (),3) +val _ = pspawn (fn () => pause (),4) +val _ = pspawn (fn () => pause (),5) +val _ = gcbench 18 - -fun dogcbench () = (printTime(); gcbench(18); printTime()) - -val rec loop = - fn 0 => () - | n => (print (Int.toString n ^ "\n"); dogcbench(); loop (n - 1)) - -val _ = loop 1 - - -val _ = PrimThread.setBooted() - -val _ = print "test2 was running and is going to sleep\n" -fun pause () = (print "sleep\n"; inf_sleep (Time.fromSeconds 1) - ; PrimThread.gcSafePoint(); pause ()) - -val _ = pause () - -*) From 163bc1fd88077c248357ce6278a024b2acc368fc Mon Sep 17 00:00:00 2001 From: jeff murphy Date: Wed, 13 Apr 2022 22:01:32 -0400 Subject: [PATCH 28/39] lock debugging, instrumentation --- runtime/gc/debug.h | 11 ++++++----- runtime/gc/garbage-collection.c | 14 +++++++++----- runtime/gc/realtime_thread.c | 3 ++- runtime/gc/um.c | 9 +++++---- runtime/gc/umheap.c | 1 + 5 files changed, 23 insertions(+), 15 deletions(-) diff --git a/runtime/gc/debug.h b/runtime/gc/debug.h index 113ca0654..e0fff4ffc 100755 --- a/runtime/gc/debug.h +++ b/runtime/gc/debug.h @@ -13,9 +13,9 @@ //#define PROFILE_UMGC enum { - DEBUG_ALLOC = TRUE, + DEBUG_ALLOC = FALSE, DEBUG_ALLOC_PACK = FALSE, - DEBUG_ARRAY = TRUE, + DEBUG_ARRAY = FALSE, DEBUG_ARRAY_OFFSET = FALSE, DEBUG_CALL_STACK = FALSE, DEBUG_CARD_MARKING = FALSE, @@ -44,10 +44,10 @@ enum { FORCE_GENERATIONAL = FALSE, FORCE_MARK_COMPACT = FALSE, DEBUG_OLD = FALSE, - DEBUG_RTGC = TRUE, - DEBUG_RTGC_MARKING = TRUE, + DEBUG_RTGC = FALSE, + DEBUG_RTGC_MARKING = FALSE, DEBUG_RTGC_MARKING_SHADING = FALSE, - DEBUG_RTGC_VERBOSE = TRUE, + DEBUG_RTGC_VERBOSE = FALSE, DEBUG_WB = FALSE, DISPLAY_GC_STATS = FALSE }; @@ -67,3 +67,4 @@ enum { #endif #define LOCK_DEBUG(LN) if(getenv("DEBUG_LOCKS")) {fprintf(stderr, "%d] LOCKDBG %s %s\n", PTHREAD_NUM, __FUNCTION__, LN);} +#define LOCK_DEBUG2(LNAME, LNUM) if(getenv("DEBUG_LOCKS")) {fprintf(stderr, "%d] LOCKDBG %s %s(%d)\n", PTHREAD_NUM, __FUNCTION__, LNAME, LNUM);} diff --git a/runtime/gc/garbage-collection.c b/runtime/gc/garbage-collection.c index 365c70bf6..de9378fff 100755 --- a/runtime/gc/garbage-collection.c +++ b/runtime/gc/garbage-collection.c @@ -320,7 +320,7 @@ void *GCrunner(void *_s) { RTSYNC_LOCK; while (!s->dirty) { - fprintf(stderr, "%d] not dirty\n", PTHREAD_NUM); + //fprintf(stderr, "%d] not dirty\n", PTHREAD_NUM); RTSYNC_BLOCK; } @@ -569,7 +569,10 @@ void sweep(GC_state s, size_t ensureObjectChunksAvailable, * If it were reachable, then the Red would have been marked or Shaded*/ if (s->collectAll) { header = UM_CHUNK_HEADER_CLEAN; - + + User_instrument_counter(400, 1); /* JEFF normal collect */ + User_instrument_counter(322, pc->used); /* JEFF normal collect */ + if(s->oneByOne) insertChunkToFL(s, &(s->umheap), pchunk); else @@ -601,6 +604,8 @@ void sweep(GC_state s, size_t ensureObjectChunksAvailable, { assert(ISUNMARKED(header)); User_instrument_counter(400, 1); /* JEFF normal collect */ +User_instrument_counter(322, pc->used); /* JEFF normal collect */ + if (DEBUG_MEM or DEBUG_RTGC) { fprintf(stderr, "%d] Collecting: "FMTPTR", %d, %x\n", PTHREAD_NUM, (uintptr_t) pc, (int)pc->sentinel, (unsigned int)pc->chunk_header); @@ -957,7 +962,7 @@ void GC_collect(GC_state s, size_t bytesRequested, bool force, bool collectRed) int i; int ready_to_sync_count = 0; for (i = 0; i < MAXPRI; i++) { -fprintf(stderr, "%d] %s: check rtsync[%d] = %d\n", PTHREAD_NUM, __FUNCTION__, i, s->rtSync[i]); +//fprintf(stderr, "%d] %s: check rtsync[%d] = %d\n", PTHREAD_NUM, __FUNCTION__, i, s->rtSync[i]); if (i == 1 || i == PTHREAD_NUM) // GC thr and our thr are not counted continue; if (s->rtSync[i]) @@ -968,8 +973,7 @@ fprintf(stderr, "%d] %s: check rtsync[%d] = %d\n", PTHREAD_NUM, __FUNCTION__, i, if (force) s->threadsBlockedForGC++; -fprintf(stderr, "%d] %s: force %d threadsBlockedForGC %d i=%d MAXPRI=%d dirty=%d ready_to_sync_count=%d\n", PTHREAD_NUM, __FUNCTION__, force, -s->threadsBlockedForGC, i,MAXPRI, s->dirty, ready_to_sync_count); +//fprintf(stderr, "%d] %s: force %d threadsBlockedForGC %d i=%d MAXPRI=%d dirty=%d ready_to_sync_count=%d\n", PTHREAD_NUM, __FUNCTION__, force, s->threadsBlockedForGC, i,MAXPRI, s->dirty, ready_to_sync_count); if (ready_to_sync_count == MAXPRI-2) /* all threads are ready to sync and GC */ { diff --git a/runtime/gc/realtime_thread.c b/runtime/gc/realtime_thread.c index 9ac505a93..0f3c500c2 100755 --- a/runtime/gc/realtime_thread.c +++ b/runtime/gc/realtime_thread.c @@ -382,7 +382,7 @@ void ML_unlock (void) { void User_lock (Int32 p){ - + LOCK_DEBUG2("User_lock", p); do { AGAIN: if (User_mutexes[p] >= 0) @@ -393,6 +393,7 @@ void User_lock (Int32 p){ } void User_unlock (Int32 p) { + LOCK_DEBUG2("User_unlock", p); //fprintf (stderr, "unlock %d\n", Parallel_holdingMutex); diff --git a/runtime/gc/um.c b/runtime/gc/um.c index 5bac2394b..af9387c7b 100755 --- a/runtime/gc/um.c +++ b/runtime/gc/um.c @@ -22,7 +22,7 @@ void GC_reserveAllocation(GC_state s, size_t numChunksToRequest) { reserveAllocation(s, numChunksToRequest); } - + void reserveAllocation(GC_state s, size_t numChunksToRequest) { assert (numChunksToRequest > 0); @@ -200,6 +200,7 @@ UM_Object_alloc_packing_stage1(GC_state s, C_Size_t num_chunks, uint32_t header, fprintf(stderr, "%d] unable to find space in another threads chunk, and:\n", PTHREAD_NUM); } } else { + User_instrument_counter(321, chunk->used); /* JEFF packed: note the utilization of the previous chunk */ User_instrument_counter(330, num_chunks); /* JEFF packed1, new chunk required */ } @@ -255,8 +256,8 @@ UM_Object_alloc_packing_stage1(GC_state s, C_Size_t num_chunks, uint32_t header, } /* - the first object is at the start of the chunk, but is offset by - 's'. we want the header offset field to contain 0. so we do + the first object is at the start of the chunk, but is offset by 's'. + we want the header offset field to contain 0. so we do header = *(objptr - s); offset = extract from header; @@ -339,7 +340,7 @@ if (upper_ev) upper_bound = atoi(upper_ev); User_instrument_counter(50, num_chunks); /* JEFF um_obj_alloc calls, num chunks asked for */ - if (1||DEBUG_ALLOC) { + if (DEBUG_ALLOC) { fprintf(stderr, "%d] UM_Object_alloc %s numchk:%u hd:0x%x(%d) (%s [%d] index:%u) sz:%d freelist:%d reserved:%d\n", PTHREAD_NUM, (header == GC_THREAD_HEADER)?"*** thread ***":"", diff --git a/runtime/gc/umheap.c b/runtime/gc/umheap.c index 52d476057..48fa9b8cb 100755 --- a/runtime/gc/umheap.c +++ b/runtime/gc/umheap.c @@ -257,6 +257,7 @@ void insertChunktoSubList(GC_state s, GC_UM_heap h, pointer c) { /*Insert free chunk to back of sub list*/ UM_Mem_Chunk pc = (UM_Mem_Chunk) c; + if (s->sl_chunks == 0) { h->sl_head = pc; h->sl_tail = pc; From d3bcb7c0fb89dec42fe78d51bcbe5aba3eee57e1 Mon Sep 17 00:00:00 2001 From: jeff murphy Date: Thu, 14 Apr 2022 11:14:49 -0400 Subject: [PATCH 29/39] disable debugging, add more instrumentation --- runtime/gc/debug.h | 9 +++++++-- runtime/gc/garbage-collection.c | 2 +- runtime/gc/gc_state.h | 3 ++- runtime/gc/init.c | 13 +++++++++++++ runtime/gc/um.c | 12 ++++++------ runtime/gc/umheap.c | 5 +++++ 6 files changed, 34 insertions(+), 10 deletions(-) diff --git a/runtime/gc/debug.h b/runtime/gc/debug.h index e0fff4ffc..808d54e45 100755 --- a/runtime/gc/debug.h +++ b/runtime/gc/debug.h @@ -66,5 +66,10 @@ enum { # define STOP_PERF do {} while(0) #endif -#define LOCK_DEBUG(LN) if(getenv("DEBUG_LOCKS")) {fprintf(stderr, "%d] LOCKDBG %s %s\n", PTHREAD_NUM, __FUNCTION__, LN);} -#define LOCK_DEBUG2(LNAME, LNUM) if(getenv("DEBUG_LOCKS")) {fprintf(stderr, "%d] LOCKDBG %s %s(%d)\n", PTHREAD_NUM, __FUNCTION__, LNAME, LNUM);} +#ifdef DO_LOCK_DEBUG +# define LOCK_DEBUG(LN) if(getenv("DEBUG_LOCKS")) {fprintf(stderr, "%d] LOCKDBG %s %s\n", PTHREAD_NUM, __FUNCTION__, LN);} +# define LOCK_DEBUG2(LNAME, LNUM) if(getenv("DEBUG_LOCKS")) {fprintf(stderr, "%d] LOCKDBG %s %s(%d)\n", PTHREAD_NUM, __FUNCTION__, LNAME, LNUM);} +#else +# define LOCK_DEBUG(LN) +# define LOCK_DEBUG2(LNAME, LNUM) +#endif diff --git a/runtime/gc/garbage-collection.c b/runtime/gc/garbage-collection.c index de9378fff..db0c46ba6 100755 --- a/runtime/gc/garbage-collection.c +++ b/runtime/gc/garbage-collection.c @@ -724,7 +724,7 @@ User_instrument_counter(322, pc->used); /* JEFF normal collect */ s->cGCStats.numSweeps++; if (1||DEBUG_RTGC) { - size_t foo = count_freelist(s, &(s->umheap)); + size_t foo = 0; //count_freelist(s, &(s->umheap)); fprintf(stderr, "%d] "GREEN("Finished one sweep cycle and freed %d chunks\n"), PTHREAD_NUM, freed); diff --git a/runtime/gc/gc_state.h b/runtime/gc/gc_state.h index 82462e9f5..9ba68bfe6 100755 --- a/runtime/gc/gc_state.h +++ b/runtime/gc/gc_state.h @@ -128,7 +128,8 @@ struct GC_state { size_t numAllocedByRT; bool oneByOne; bool useRTThreads; - + int lower_bound; // object packing um.c + int upper_bound; // object packing um.c /* end of rt-threading additions */ pointer ffiOpArgsResPtr[MAXPRI]; diff --git a/runtime/gc/init.c b/runtime/gc/init.c index 907c18a8c..a33252c03 100755 --- a/runtime/gc/init.c +++ b/runtime/gc/init.c @@ -302,6 +302,16 @@ int processAtMLton(GC_state s, int start, int argc, char **argv, if (i == argc) die("@MLton rtthreads missing argument."); s->useRTThreads = stringToBool(argv[i++]); + } else if (0 == strcmp(arg, "lower-bound")) { + i++; + if (i == argc) + die("@MLton lower-bound missing argument."); + s->lower_bound = atoi(argv[i++]); + } else if (0 == strcmp(arg, "upper-bound")) { + i++; + if (i == argc) + die("@MLton upper-bound missing argument."); + s->upper_bound = atoi(argv[i++]); } else if (0 == strcmp(arg, "packingstage1")) { i++; if (i == argc) @@ -342,6 +352,9 @@ int GC_init(GC_state s, int argc, char **argv) { assert(sizeofThread(s) == sizeofThread(s)); assert(sizeofWeak(s) == sizeofWeak(s)); + s->lower_bound = 40; + s->upper_bound = 98; + s->amInGC = TRUE; s->amOriginal = TRUE; s->atomicState = 0; diff --git a/runtime/gc/um.c b/runtime/gc/um.c index af9387c7b..2b63d1fdd 100755 --- a/runtime/gc/um.c +++ b/runtime/gc/um.c @@ -328,16 +328,13 @@ UM_Object_alloc(GC_state gc_stat, C_Size_t num_chunks, uint32_t header, C_Size_t unsigned int objectTypeIndex = (header & TYPE_INDEX_MASK) >> TYPE_INDEX_SHIFT; splitHeader(gc_stat, header, &tagRet, NULL, NULL, NULL); -int lower_bound = 40; // JEFF -int upper_bound = 98; -char *lower_ev = getenv("LOWER"); -char *upper_ev = getenv("UPPER"); -if (lower_ev) lower_bound = atoi(lower_ev); -if (upper_ev) upper_bound = atoi(upper_ev); + int lower_bound = gc_stat->lower_bound; // JEFF + int upper_bound = gc_stat->upper_bound; assert (num_chunks > 0); assert (header != 0); + User_instrument(60); User_instrument_counter(50, num_chunks); /* JEFF um_obj_alloc calls, num chunks asked for */ if (DEBUG_ALLOC) { @@ -359,6 +356,7 @@ if (upper_ev) upper_bound = atoi(upper_ev); } else User_instrument_counter(300, num_chunks); /* JEFF Normal allocs, unpacked */ + User_instrument(60); return UM_Object_alloc_no_packing(gc_stat, num_chunks, header, s); } @@ -385,6 +383,7 @@ if (upper_ev) upper_bound = atoi(upper_ev); p = UM_Object_alloc_no_packing(gc_stat, num_chunks, header, s); if (DEBUG_ALLOC) fprintf(stderr, " UM_Object_alloc returns: p = %x\n", (unsigned int)p); + User_instrument(60); return p; } } @@ -397,6 +396,7 @@ if (upper_ev) upper_bound = atoi(upper_ev); p = UM_Object_alloc_packing_stage1(gc_stat, num_chunks, header, s, sz); if (DEBUG_ALLOC_PACK) fprintf(stderr, " UM_Object_alloc returns: p = %x\n", (unsigned int)p); + User_instrument(60); return p; } diff --git a/runtime/gc/umheap.c b/runtime/gc/umheap.c index 48fa9b8cb..1888a3fc0 100755 --- a/runtime/gc/umheap.c +++ b/runtime/gc/umheap.c @@ -60,6 +60,8 @@ GC_UM_Chunk allocNextChunk(GC_state s, s->reserved -= 1; s->cGCStats.numChunksAllocated++; + User_instrument_counter(401, 1); + return c; } @@ -172,6 +174,9 @@ GC_UM_Array_Chunk allocNextArrayChunk(GC_state s, s->fl_chunks -= 1; s->reserved -= 1; s->cGCStats.numChunksAllocated++; + + User_instrument_counter(421, 1); + return c; } From 05647c98d0640c65c943dc01a36e66e11e71ceac Mon Sep 17 00:00:00 2001 From: jeff murphy Date: Tue, 19 Apr 2022 23:08:57 -0400 Subject: [PATCH 30/39] rtlinux - implement spinsleep --- basis-library/mlton/primthread.sig | 1 + basis-library/mlton/primthread.sml | 2 + runtime/gc/gc_state.h | 2 +- runtime/gc/init.c | 7 +++ runtime/gc/ssleep.c | 84 +++++++++++++++++++++++++----- 5 files changed, 81 insertions(+), 15 deletions(-) diff --git a/basis-library/mlton/primthread.sig b/basis-library/mlton/primthread.sig index f615b7c0c..cd7e4ce2e 100755 --- a/basis-library/mlton/primthread.sig +++ b/basis-library/mlton/primthread.sig @@ -47,6 +47,7 @@ signature PRIM_THREAD = val getMyPriority: unit -> int val set_schedule: int * int * int * int -> unit + val ssleep: int * int -> int val schedule_yield: bool -> unit val wait_for_next_period: bool -> unit diff --git a/basis-library/mlton/primthread.sml b/basis-library/mlton/primthread.sml index b4502caec..eddefd65d 100755 --- a/basis-library/mlton/primthread.sml +++ b/basis-library/mlton/primthread.sml @@ -143,6 +143,7 @@ struct val lock__ = _import "User_lock" : int -> unit; val unlock__ = _import "User_unlock" : int -> unit; val setsch = _import "set_schedule" : int * int * int * int -> unit; + val ssleep__ = _import "ssleep": int * int -> int; val schyld = _import "schedule_yield" : Primitive.MLton.GCState.t * bool -> unit; in fun instrument_counter a = instc__ a @@ -150,6 +151,7 @@ struct fun instrument a = inst__ a fun dump_instrument_stderr a = dise__ a fun get_ticks_since_boot () = gtsb__ () + fun ssleep (s, us) = ssleep__ (s, us) fun rtlock a = if a <= 9 then lock__ a else print "Invalid lock. Valid locks are [0-9]\n" fun rtunlock a = if a <= 9 then unlock__ a else print "Invalid lock. Valid locks are [0-9]\n" fun set_schedule (rt, dl, per, packing) = setsch (rt, dl, per, packing) diff --git a/runtime/gc/gc_state.h b/runtime/gc/gc_state.h index 9ba68bfe6..31c168d66 100755 --- a/runtime/gc/gc_state.h +++ b/runtime/gc/gc_state.h @@ -103,7 +103,7 @@ struct GC_state { pthread_t *realtimeThreads[MAXPRI]; pointer activeChunk[MAXPRI]; pthread_mutex_t activeChunkLock[MAXPRI]; - int packingStageForThread[MAXPRI]; + int packingStageForThread[MAXPRI]; // not used, remove bool packingStage1Enabled, packingStage2Enabled; volatile bool mainBooted; diff --git a/runtime/gc/init.c b/runtime/gc/init.c index a33252c03..f355462b6 100755 --- a/runtime/gc/init.c +++ b/runtime/gc/init.c @@ -343,6 +343,13 @@ int GC_init(GC_state s, int argc, char **argv) { char *worldFile; int res, __i, __j; +#ifdef RTLINUX + // DOI: 10.2514/6.2019-0502 + if(mlockall(MCL_CURRENT | MCL_FUTURE)) { + die ("could not mlockall"); + } +#endif + User_instrument_initialize(); assert(s->alignment >= GC_MODEL_MINALIGN); diff --git a/runtime/gc/ssleep.c b/runtime/gc/ssleep.c index 9596e4aeb..8edfba9f8 100644 --- a/runtime/gc/ssleep.c +++ b/runtime/gc/ssleep.c @@ -1,23 +1,79 @@ -/* signal free sleep */ +#ifdef __rtems__ +#include +#endif +#ifdef RTLINUX +#include +#endif + +#define NSEC_PER_SEC 1000000000 + + +#ifndef USE_NANO_SLEEP +static int spinsleep(int s, int us); +static int spinsleep(int s, int us) { + struct timespec a, b; + clock_gettime(CLOCK_MONOTONIC_RAW, &a); + double ad = ((double)(a.tv_sec) + ((double)(a.tv_nsec) / NSEC_PER_SEC)); + double interval = ((double)s + ((double)(us*1000)/NSEC_PER_SEC)); + int done = 0; + if (DEBUG) fprintf(stderr, "spinsleep(%d, %d) for %f\n", s, us, interval); + while (!done) { + clock_gettime(CLOCK_MONOTONIC_RAW, &b); + double bd = ((double)(b.tv_sec) + ((double)(b.tv_nsec) / NSEC_PER_SEC)); + if ((bd-ad) > interval) done = 1; + } + return 0; +} +#endif + + +/* signal free sleep + * on rtlinux, using nanosleep or select wasn't predictable + * and measuring the actual time sleeping would vary quite + * a bit. so on that platform we call spinsleep (above) whose + * timing measurements were much more consistent. for a deadline + * scheduled task, spinning is ok provided the entire schedule + * validates, and the spin time is factored into the task's runtime + */ int ssleep(int s, int us) { - int ret = 0; + int ret = 0; #if defined(__rtems__) -# include - usleep(s*1000000 + us); + usleep(s*1000000 + us); +#elif defined(RTLINUX) + struct timespec a, b; +#ifdef USE_NANO_SLEEP + struct timespec ts; + ts.tv_sec = s; + ts.tv_nsec = us * 1000; +#endif + + clock_gettime(CLOCK_MONOTONIC_RAW, &a); +#ifdef USE_NANO_SLEEP + nanosleep(&ts, NULL); +#else + ret = spinsleep(s, us); +#endif + clock_gettime(CLOCK_MONOTONIC_RAW, &b); + + double ad = ((double)(a.tv_sec) + ((double)(a.tv_nsec) / NSEC_PER_SEC)); + double bd = ((double)(b.tv_sec) + ((double)(b.tv_nsec) / NSEC_PER_SEC)); + double dd = bd - ad; + if (DEBUG) fprintf(stderr, "ssleep>>> %d %d ... %f\n", s, us, dd); + #else - struct timeval tv; + struct timeval tv; - if (s == 0 && us == 0) s = 1; + if (s == 0 && us == 0) s = 1; - tv.tv_sec = s; - tv.tv_usec = us; + tv.tv_sec = s; + tv.tv_usec = us; - do - { - ret = select(1, NULL, NULL, NULL, &tv); - } - while((ret == -1)&&(errno == EINTR)); + do + { + ret = select(1, NULL, NULL, NULL, &tv); + } + while((ret == -1)&&(errno == EINTR)); #endif - return ret; + return ret; } From 063fbb2965a83e467e435389504324e0aa6f807d Mon Sep 17 00:00:00 2001 From: jeff murphy Date: Fri, 29 Apr 2022 21:24:42 -0400 Subject: [PATCH 31/39] indent --- runtime/gc/ssleep.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/gc/ssleep.c b/runtime/gc/ssleep.c index 8edfba9f8..2b0901b4e 100644 --- a/runtime/gc/ssleep.c +++ b/runtime/gc/ssleep.c @@ -57,9 +57,9 @@ int ssleep(int s, int us) clock_gettime(CLOCK_MONOTONIC_RAW, &b); double ad = ((double)(a.tv_sec) + ((double)(a.tv_nsec) / NSEC_PER_SEC)); - double bd = ((double)(b.tv_sec) + ((double)(b.tv_nsec) / NSEC_PER_SEC)); + double bd = ((double)(b.tv_sec) + ((double)(b.tv_nsec) / NSEC_PER_SEC)); double dd = bd - ad; - if (DEBUG) fprintf(stderr, "ssleep>>> %d %d ... %f\n", s, us, dd); + if (DEBUG) fprintf(stderr, "ssleep>>> %d %d ... %f\n", s, us, dd); #else struct timeval tv; From f6d8e9028097e6c33c365fc35d7f7fdc54ee693e Mon Sep 17 00:00:00 2001 From: jeff murphy Date: Fri, 24 Feb 2023 17:54:53 -0500 Subject: [PATCH 32/39] mods to adapt cdsml for SB-packing --- CDSml/driver-read-from-file.sml | 14 ++++---------- CDSml/driver.sml | 22 +++++++++++++++++++--- CDSml/runCD.mlb | 4 ++-- Makefile | 6 ++++++ basis-library/primitive/basis-ffi.sml | 0 include/c-common.h | 2 +- runtime/gc/realtime_thread.h | 2 +- 7 files changed, 33 insertions(+), 17 deletions(-) mode change 100755 => 100644 basis-library/primitive/basis-ffi.sml diff --git a/CDSml/driver-read-from-file.sml b/CDSml/driver-read-from-file.sml index 59f0c6627..d718afe24 100755 --- a/CDSml/driver-read-from-file.sml +++ b/CDSml/driver-read-from-file.sml @@ -169,28 +169,22 @@ struct fun loop_framesim ([],i,frameBuf) = if not (i=maxFrames) then loop_framesim(frameBuf,i,frameBuf) else () | loop_framesim(x::xs,i,frameBuf) = if not(i = maxFrames) then (Array.update(ts,i,Time.toMicroseconds (Time.now())); - (*print(IntInf.toString(Array.sub(ts,i))^"\n"); *) + print(IntInf.toString(Array.sub(ts,i))^"\n"); TransientDetector.TRANSIENTDETECTOR_run(x) ; Array.update(tc,i,Time.toMicroseconds(Time.now ()) ); - (*print(IntInf.toString(Time.toMicroseconds(Time.now()))^"\n");*) + print(IntInf.toString(Time.toMicroseconds(Time.now()))^"\n"); maybeSleep (Array.sub(ts,i)); loop_framesim(xs,(i+1),frameBuf) ) else () in - (*print (Int.toString(List.length(maxFrames)))*) + print (Int.toString(maxFrames)^"\n"); loop_framesim(frameBuffer, 0,frameBuffer); - - (*printArray(ts);*) - - populateIdealTime(Array.sub(ts,0)); - - + populateIdealTime(Array.sub(ts,0)); (benchmarkCD ts tc tr) - end; diff --git a/CDSml/driver.sml b/CDSml/driver.sml index d8c47ebe8..da27d763d 100755 --- a/CDSml/driver.sml +++ b/CDSml/driver.sml @@ -612,10 +612,26 @@ val rec loop = | n => ((*print ("loop" ^ Int.toString(n) ^"\n");*) delay 50000000; loop (n - 1)) -(*val _ = (PThread.spawn(fn () => Driver.main());PThread.spawn(fn () => loop -* 10); PThread.run())*) +open MLton.PrimThread -val _ = Driver.main(); +fun printit2 s = () +fun printit s = print (Int.toString(getMyPriority ())^"] "^s^"\n") +fun gettime () = get_ticks_since_boot () + +val _ = pspawn ( + fn () => let in + while true do ( Driver.main() ; schedule_yield false ) + end, 2) + + +val _ = pspawn ( + fn () => let in + while true do ( Driver.main() ; schedule_yield false ) + end, 3) + +val _ = while true do ( + OS.Process.sleep (Time.fromMicroseconds 10000000); printit "main: running"; () +) (*Run with rtobj 5 for RTMLton*) diff --git a/CDSml/runCD.mlb b/CDSml/runCD.mlb index 66293fbf7..e8c5bb561 100644 --- a/CDSml/runCD.mlb +++ b/CDSml/runCD.mlb @@ -9,5 +9,5 @@ voxel.sml reducer.sml collision.sml transientdetector.sml -(*driver.sml*) -driver-read-from-file.sml +driver.sml +(* driver-read-from-file.sml *) diff --git a/Makefile b/Makefile index 82b39c025..6958cdc39 100644 --- a/Makefile +++ b/Makefile @@ -439,3 +439,9 @@ rpms: | $(GZIP) >"$(SOURCEDIR).tgz" rm -rf "$(SOURCEDIR)" rpm -ba --quiet --clean "$(TOPDIR)/SPECS/mlton.spec" + +docker-build: + docker build -t rtmlton32_intel . + +docker-run: + docker run -it -e DISPLAY=$(shell hostname):0 -v /Users/jcmurphy/git/cse/CSE/rtml-apps:/apps -v "$(shell pwd)":/work -v /tmp/.X11-unix:/tmp/.X11-unix rtmlton32_intel /bin/bash diff --git a/basis-library/primitive/basis-ffi.sml b/basis-library/primitive/basis-ffi.sml old mode 100755 new mode 100644 diff --git a/include/c-common.h b/include/c-common.h index 49992548d..6076342a6 100755 --- a/include/c-common.h +++ b/include/c-common.h @@ -12,7 +12,7 @@ /* maxpri is an upper array bound, not a count. see * realtime_thread.c realtimeThreadInit loop (~line 251) */ -#define MAXPRI 6 /* XXX dup'd in runtime/realtime_thread.h */ +#define MAXPRI 4 /* XXX dup'd in runtime/realtime_thread.h */ #define PTHREAD_MAX MAXPRI #ifndef DEBUG_CCODEGEN #define DEBUG_CCODEGEN FALSE diff --git a/runtime/gc/realtime_thread.h b/runtime/gc/realtime_thread.h index 529c12192..9ada115e4 100755 --- a/runtime/gc/realtime_thread.h +++ b/runtime/gc/realtime_thread.h @@ -5,7 +5,7 @@ * realtime_thread.c realtimeThreadInit loop (~line 251) */ -#define MAXPRI 6 /* 0 = main, 1 = GC, also in include/c-common.h */ +#define MAXPRI 4 /* 0 = main, 1 = GC, also in include/c-common.h */ #define PTHREAD_MAX MAXPRI /* transitioning to this instead of MAXPRI */ #define NUM_USER_MUTEXES 10 From 439dc299971ceeaf709e239c5a28ce573bffe05c Mon Sep 17 00:00:00 2001 From: jeff murphy Date: Fri, 24 Feb 2023 17:55:18 -0500 Subject: [PATCH 33/39] docker --- Dockerfile | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..5da3e63b0 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,5 @@ +FROM i386/ubuntu +RUN apt update -y +RUN apt upgrade -y +RUN apt install -y gcc libgmp-dev make smlnj patch mlton +CMD ["/bin/bash"] From fb1d5909b1e29a52c0e378312dcbff00835e6263 Mon Sep 17 00:00:00 2001 From: jeff murphy Date: Mon, 27 Feb 2023 22:49:31 -0500 Subject: [PATCH 34/39] cdsml rt sched changes --- CDSml/Makefile | 16 +++++++++++++ CDSml/driver.sml | 58 ++++++++++++++++++++++++++++++++++++++++-------- CDSml/pincpu.sh | 16 +++++++++++++ 3 files changed, 81 insertions(+), 9 deletions(-) create mode 100644 CDSml/Makefile create mode 100644 CDSml/pincpu.sh diff --git a/CDSml/Makefile b/CDSml/Makefile new file mode 100644 index 000000000..d866e208b --- /dev/null +++ b/CDSml/Makefile @@ -0,0 +1,16 @@ +RTML=/home/jcmurphy/RTMLton/build/bin/mlton + +build: + $(RTML) -debug false -keep g -default-ann 'allowFFI true' runCD.mlb + +dbgbuild: + $(RTML) -debug true -keep g -default-ann 'allowFFI true' runCD.mlb + +testrun: + sudo ./runCD @MLton lower-bound 40 upper-bound 200 hpercent $(HPERC) rtthreads true max-heap $(HEAP) packingstage1 false packingstage2 false -- + +collect: + sudo ./runCD @MLton lower-bound 40 upper-bound 200 hpercent $(HPERC) rtthreads true max-heap $(HEAP) packingstage1 false packingstage2 false -- 2> $(RUN)-pack0.txt + sudo ./runCD @MLton lower-bound 40 upper-bound 200 hpercent $(HPERC) rtthreads true max-heap $(HEAP) packingstage1 true packingstage2 false -- 2> $(RUN)-pack1.txt + sudo ./runCD @MLton lower-bound 40 upper-bound 200 hpercent $(HPERC) rtthreads true max-heap $(HEAP) packingstage1 true packingstage2 true -- 2> $(RUN)-pack2.txt + diff --git a/CDSml/driver.sml b/CDSml/driver.sml index da27d763d..a4aa20374 100755 --- a/CDSml/driver.sml +++ b/CDSml/driver.sml @@ -1,3 +1,4 @@ +open MLton.PrimThread structure Driver = struct @@ -580,7 +581,8 @@ Frames.createFrame( 40, Array.fromList( [ "plane0","plane1","plane2","plane3","p Array.update(tc,i,Time.toMicroseconds(Time.now ()) ); (*print(IntInf.toString(Time.toMicroseconds(Time.now()))^"\n");*) - maybeSleep (Array.sub(ts,i)); + (*maybeSleep (Array.sub(ts,i)); *) + wait_for_next_period false; loop(xs,(i+1),frameBuf) ) else () @@ -612,26 +614,64 @@ val rec loop = | n => ((*print ("loop" ^ Int.toString(n) ^"\n");*) delay 50000000; loop (n - 1)) -open MLton.PrimThread fun printit2 s = () fun printit s = print (Int.toString(getMyPriority ())^"] "^s^"\n") fun gettime () = get_ticks_since_boot () + +val runtime = 220000000 (* 22 s *) +val deadline = 220000000 (* 22 s *) +val period = 220000000 (* 22 s *) + + val _ = pspawn ( - fn () => let in - while true do ( Driver.main() ; schedule_yield false ) + fn () => let + val iteration = ref 0 + val _ = set_schedule (runtime, deadline, period, 2) + in + while true do ( + Driver.main(); + iteration := !iteration + 1; + schedule_yield false + ) end, 2) val _ = pspawn ( - fn () => let in - while true do ( Driver.main() ; schedule_yield false ) + fn () => let + val _ = set_schedule (runtime, deadline, period, 2) + val iteration = ref 0 + in + while true do ( + Driver.main(); + iteration := !iteration + 1; + schedule_yield false + ) end, 3) -val _ = while true do ( - OS.Process.sleep (Time.fromMicroseconds 10000000); printit "main: running"; () -) +val _ = let + val iteration = ref 0 + in + while true do ( + OS.Process.sleep (Time.fromMicroseconds 10000000); + iteration := !iteration + 1; + printit ("main: running #"^Int.toString(!iteration)); +schedule_yield false; + if (!iteration > 10) then ( + dump_instrument_stderr 0; + dump_instrument_stderr 1; + dump_instrument_stderr 2; + dump_instrument_stderr 3; + dump_instrument_counter_stderr 0; + dump_instrument_counter_stderr 1; + dump_instrument_counter_stderr 2; + dump_instrument_counter_stderr 3; + OS.Process.terminate(OS.Process.success) + ) else (); + () + ) + end (*Run with rtobj 5 for RTMLton*) diff --git a/CDSml/pincpu.sh b/CDSml/pincpu.sh new file mode 100644 index 000000000..ee168a9e4 --- /dev/null +++ b/CDSml/pincpu.sh @@ -0,0 +1,16 @@ +#!/bin/sh -x +# +# use this to pin deadline scheduled tasks +# to cpu0 in rtlinux + +mkdir /dev/cpuset +mount -t cgroup -o cpuset cpuset /dev/cpuset +cd /dev/cpuset +mkdir cpu0 +echo 0 > cpu0/cpuset.cpus +echo 0 > cpu0/cpuset.mems +echo 1 > cpuset.cpu_exclusive +echo 0 > cpuset.sched_load_balance +echo 1 > cpu0/cpuset.cpu_exclusive +echo 1 > cpu0/cpuset.mem_exclusive +echo $$ > cpu0/tasks From 1699085a6381c136b4e8a00304960c8fa977e7d4 Mon Sep 17 00:00:00 2001 From: jeff murphy Date: Tue, 28 Feb 2023 14:06:56 -0500 Subject: [PATCH 35/39] add timing measurements to cd funcs --- CDSml/driver.sml | 54 ++++++++++++++++++++++--------------- CDSml/pincpu.sh | 28 +++++++++++-------- CDSml/transientdetector.sml | 36 +++++++++++++++---------- 3 files changed, 72 insertions(+), 46 deletions(-) mode change 100644 => 100755 CDSml/pincpu.sh diff --git a/CDSml/driver.sml b/CDSml/driver.sml index a4aa20374..d82a61188 100755 --- a/CDSml/driver.sml +++ b/CDSml/driver.sml @@ -1,10 +1,21 @@ open MLton.PrimThread -structure Driver = -struct +(* sched_runtime <= sched_deadline <= sched_period *) +val runtime = 1 * 1000000 (* 22 s *) +val deadline = 2 * 1000000 (* 22 s *) +val period = 3 * 1000000 (* 22 s *) - + + +fun printit2 s = () +fun printit s = print (Int.toString(getMyPriority ())^"] "^s^"\n") +fun gettime () = get_ticks_since_boot () + + + +structure Driver = +struct (*To do read properly from file*) datatype for = to of int * int @@ -568,21 +579,22 @@ Frames.createFrame( 40, Array.fromList( [ "plane0","plane1","plane2","plane3","p - - - + val starttime = ref (gettime ()) + val stoptime = ref (gettime ()) fun loop ([],i,frameBuf) = if not (i=maxFrames) then loop(frameBuf,i,frameBuf) else () | loop(x::xs,i,frameBuf) = if not(i = maxFrames) then (Array.update(ts,i,Time.toMicroseconds (Time.now())); (*print(IntInf.toString(Array.sub(ts,i))^"\n"); *) +starttime := gettime (); TransientDetector.TRANSIENTDETECTOR_run(x) ; - - - +stoptime := gettime (); +printit ("Driver: TRANSIENTDETECTOR_run: runtime "^Real.toString(Real.-(!stoptime, !starttime))); Array.update(tc,i,Time.toMicroseconds(Time.now ()) ); (*print(IntInf.toString(Time.toMicroseconds(Time.now()))^"\n");*) (*maybeSleep (Array.sub(ts,i)); *) +printit("Wait for next period.."); wait_for_next_period false; +printit("awake for next period.."); loop(xs,(i+1),frameBuf) ) else () @@ -615,23 +627,18 @@ val rec loop = -fun printit2 s = () -fun printit s = print (Int.toString(getMyPriority ())^"] "^s^"\n") -fun gettime () = get_ticks_since_boot () - - -val runtime = 220000000 (* 22 s *) -val deadline = 220000000 (* 22 s *) -val period = 220000000 (* 22 s *) - - val _ = pspawn ( fn () => let val iteration = ref 0 val _ = set_schedule (runtime, deadline, period, 2) + val starttime = ref (gettime ()) + val stoptime = ref (gettime ()) in while true do ( + starttime := gettime (); Driver.main(); + stoptime := gettime (); + printit ("Driver[2]: runtime "^Real.toString(Real.-(!stoptime, !starttime))); iteration := !iteration + 1; schedule_yield false ) @@ -641,10 +648,15 @@ val _ = pspawn ( val _ = pspawn ( fn () => let val _ = set_schedule (runtime, deadline, period, 2) + val starttime = ref (gettime ()) + val stoptime = ref (gettime ()) val iteration = ref 0 in while true do ( + starttime := gettime (); Driver.main(); + stoptime := gettime (); + printit ("Driver[3]: runtime "^Real.toString(Real.-(!stoptime, !starttime))); iteration := !iteration + 1; schedule_yield false ) @@ -659,10 +671,10 @@ val _ = let printit ("main: running #"^Int.toString(!iteration)); schedule_yield false; if (!iteration > 10) then ( - dump_instrument_stderr 0; + (* dump_instrument_stderr 0; dump_instrument_stderr 1; dump_instrument_stderr 2; - dump_instrument_stderr 3; + dump_instrument_stderr 3; *) dump_instrument_counter_stderr 0; dump_instrument_counter_stderr 1; dump_instrument_counter_stderr 2; diff --git a/CDSml/pincpu.sh b/CDSml/pincpu.sh old mode 100644 new mode 100755 index ee168a9e4..1d5243078 --- a/CDSml/pincpu.sh +++ b/CDSml/pincpu.sh @@ -1,16 +1,22 @@ -#!/bin/sh -x +#!/bin/bash -x # # use this to pin deadline scheduled tasks # to cpu0 in rtlinux -mkdir /dev/cpuset +mkdir -p /dev/cpuset/cpu0 mount -t cgroup -o cpuset cpuset /dev/cpuset -cd /dev/cpuset -mkdir cpu0 -echo 0 > cpu0/cpuset.cpus -echo 0 > cpu0/cpuset.mems -echo 1 > cpuset.cpu_exclusive -echo 0 > cpuset.sched_load_balance -echo 1 > cpu0/cpuset.cpu_exclusive -echo 1 > cpu0/cpuset.mem_exclusive -echo $$ > cpu0/tasks + +echo 0 > /dev/cpuset/cpu0/cpuset.cpus +echo 0 > /dev/cpuset/cpu0/cpuset.mems +echo 1 > /dev/cpuset/cpuset.cpu_exclusive +echo 0 > /dev/cpuset/cpuset.sched_load_balance +echo 1 > /dev/cpuset/cpu0/cpuset.cpu_exclusive +echo 1 > /dev/cpuset/cpu0/cpuset.mem_exclusive + +echo $$ > /dev/cpuset/cpu0/tasks +echo ./runCD @MLton lower-bound 40 upper-bound 200 hpercent 0.9 rtthreads true max-heap $3 packingstage1 $1 packingstage2 $2 -- +bash + +#sleep 10 +#exec ./runCD @MLton lower-bound 40 upper-bound 200 hpercent 0.9 rtthreads true max-heap $3 packingstage1 $1 packingstage2 $2 -- + diff --git a/CDSml/transientdetector.sml b/CDSml/transientdetector.sml index 85fad8838..8c36be978 100644 --- a/CDSml/transientdetector.sml +++ b/CDSml/transientdetector.sml @@ -1,13 +1,16 @@ +open MLton.PrimThread - - +fun printit2 s = () +fun printit s = print (Int.toString(getMyPriority ())^"] "^s^"\n") +fun gettime () = get_ticks_since_boot () structure StateTable = struct + type t = string * Pos.t ref; val table : t list ref = ref []; @@ -141,11 +144,15 @@ struct | printcheck (x :: xs) = print("Check list i length "^Int.toString(List.length(x))^"\n") val ls = map determineCollisions check + val starttime = ref (gettime ()) + val stoptime = ref (gettime ()) in (*print("check length " ^ Int.toString(List.length(check))^"\n");*) (*printcheck check; print ("Collision length "^ Int.toString(List.length(ls)) ^"\n");*) - c @ ls + stoptime := gettime (); + printit ("lookforCollisions: runtime "^Real.toString(Real.-(!stoptime, !starttime))); + c @ ls end @@ -182,9 +189,13 @@ struct fun TRANSIENTDETECTOR_createMotions(currentFrame) = let val mo : Motion.t list ref= ref [] - + val starttime = ref (gettime ()) + val stoptime = ref (gettime ()) in + starttime := gettime (); for (0 to (Frames.getPlaneCnt(currentFrame)-1)) (fn i => mo := !mo @ [TCM(i,currentFrame)]); + stoptime := gettime (); + printit ("TRANSIENTDETECTOR_createMotions: runtime "^Real.toString(Real.-(!stoptime, !starttime))); !mo end; @@ -194,8 +205,9 @@ struct fun TRANSIENTDETECTOR_run(currentFrame) = let val motions : Motion.t list = TRANSIENTDETECTOR_createMotions(currentFrame); - - val collisions = lookforCollisions(motions) + val collisions = lookforCollisions(motions) + val starttime = ref (gettime ()) + val stoptime = ref (gettime ()) fun printResults ([],index) = () | printResults (c :: tl,index) = (print("CD Collision" ^ Int.toString(index) ^ "occured at location " ^ Pos.getString(Collision.getLocation(c)) ^ @@ -205,15 +217,11 @@ struct in (*(*Motion.printListOfMotions(motions);*)print ("CD detected " ^ Int.toString(List.length(collisions)) ^ " collisions \n"); printResults(collisions,0) - *)() + *) + stoptime := gettime (); + printit ("TRANSIENTDETECTOR_run: runtime "^Real.toString(Real.-(!stoptime, !starttime))); + () end; end - - - - - - - From 8011aef17522dbbdf31360bf2bba30986ae548d7 Mon Sep 17 00:00:00 2001 From: jeff murphy Date: Wed, 1 Mar 2023 19:49:57 -0500 Subject: [PATCH 36/39] atomic begin/end prims call cfunc now --- CDSml/Makefile | 4 +- CDSml/driver.sml | 51 ++++++++++++++++++-------- CDSml/transientdetector.sml | 4 +- basis-library/primitive/prim-mlton.sml | 7 ++-- include/c-common.h | 2 +- include/c-main.h | 2 +- mlton/backend/machine.fun | 3 +- mlton/backend/ssa-to-rssa.fun | 45 ++++++++++++++++++++++- runtime/gc/atomic.c | 11 ++++++ runtime/gc/atomic.h | 8 ++++ runtime/gc/copy-thread.c | 10 ++--- runtime/gc/debug.h | 4 +- runtime/gc/realtime_thread.h | 2 +- 13 files changed, 118 insertions(+), 35 deletions(-) diff --git a/CDSml/Makefile b/CDSml/Makefile index d866e208b..21728ae73 100644 --- a/CDSml/Makefile +++ b/CDSml/Makefile @@ -1,10 +1,10 @@ RTML=/home/jcmurphy/RTMLton/build/bin/mlton build: - $(RTML) -debug false -keep g -default-ann 'allowFFI true' runCD.mlb + $(RTML) -debug false -keep g -default-ann 'allowFFI true' -const 'Exn.keepHistory false' runCD.mlb dbgbuild: - $(RTML) -debug true -keep g -default-ann 'allowFFI true' runCD.mlb + $(RTML) -debug true -keep g -default-ann 'allowFFI true' -const 'Exn.keepHistory false' runCD.mlb testrun: sudo ./runCD @MLton lower-bound 40 upper-bound 200 hpercent $(HPERC) rtthreads true max-heap $(HEAP) packingstage1 false packingstage2 false -- diff --git a/CDSml/driver.sml b/CDSml/driver.sml index d82a61188..5f63495a0 100755 --- a/CDSml/driver.sml +++ b/CDSml/driver.sml @@ -2,9 +2,9 @@ open MLton.PrimThread (* sched_runtime <= sched_deadline <= sched_period *) -val runtime = 1 * 1000000 (* 22 s *) -val deadline = 2 * 1000000 (* 22 s *) -val period = 3 * 1000000 (* 22 s *) +val runtime = 12 * 1000000 (* 22 s *) +val deadline = 13 * 1000000 (* 22 s *) +val period = 14 * 1000000 (* 22 s *) @@ -629,7 +629,6 @@ val rec loop = val _ = pspawn ( fn () => let - val iteration = ref 0 val _ = set_schedule (runtime, deadline, period, 2) val starttime = ref (gettime ()) val stoptime = ref (gettime ()) @@ -638,39 +637,61 @@ val _ = pspawn ( starttime := gettime (); Driver.main(); stoptime := gettime (); - printit ("Driver[2]: runtime "^Real.toString(Real.-(!stoptime, !starttime))); - iteration := !iteration + 1; - schedule_yield false + printit ("Driver[2]: runtime "^Real.toString(Real.-(!stoptime, !starttime))) ) end, 2) - val _ = pspawn ( fn () => let val _ = set_schedule (runtime, deadline, period, 2) val starttime = ref (gettime ()) val stoptime = ref (gettime ()) - val iteration = ref 0 in while true do ( starttime := gettime (); Driver.main(); stoptime := gettime (); - printit ("Driver[3]: runtime "^Real.toString(Real.-(!stoptime, !starttime))); - iteration := !iteration + 1; - schedule_yield false + printit ("Driver[3]: runtime "^Real.toString(Real.-(!stoptime, !starttime))) ) end, 3) +val _ = pspawn ( + fn () => let + val _ = set_schedule (runtime, deadline, period, 2) + val starttime = ref (gettime ()) + val stoptime = ref (gettime ()) + in + while true do ( + starttime := gettime (); + Driver.main(); + stoptime := gettime (); + printit ("Driver[4]: runtime "^Real.toString(Real.-(!stoptime, !starttime))) + ) + end, 4) + +val _ = pspawn ( + fn () => let + val _ = set_schedule (runtime, deadline, period, 2) + val starttime = ref (gettime ()) + val stoptime = ref (gettime ()) + in + while true do ( + starttime := gettime (); + Driver.main(); + stoptime := gettime (); + printit ("Driver[5]: runtime "^Real.toString(Real.-(!stoptime, !starttime))) + ) + end, 5) + val _ = let val iteration = ref 0 in while true do ( + printit ("main: running #"^Int.toString(!iteration)); OS.Process.sleep (Time.fromMicroseconds 10000000); iteration := !iteration + 1; - printit ("main: running #"^Int.toString(!iteration)); -schedule_yield false; - if (!iteration > 10) then ( + schedule_yield false; + if (!iteration > 3) then ( (* dump_instrument_stderr 0; dump_instrument_stderr 1; dump_instrument_stderr 2; diff --git a/CDSml/transientdetector.sml b/CDSml/transientdetector.sml index 8c36be978..02f6a6ed8 100644 --- a/CDSml/transientdetector.sml +++ b/CDSml/transientdetector.sml @@ -2,8 +2,8 @@ open MLton.PrimThread -fun printit2 s = () -fun printit s = print (Int.toString(getMyPriority ())^"] "^s^"\n") +fun printit s = () +fun printit2 s = print (Int.toString(getMyPriority ())^"] "^s^"\n") fun gettime () = get_ticks_since_boot () diff --git a/basis-library/primitive/prim-mlton.sml b/basis-library/primitive/prim-mlton.sml index ff4b0de89..e975dffc1 100644 --- a/basis-library/primitive/prim-mlton.sml +++ b/basis-library/primitive/prim-mlton.sml @@ -321,10 +321,11 @@ structure Thread = val atomicState = _prim "Thread_atomicState": unit -> Word32.word; val atomicBegin = _prim "Thread_atomicBegin": unit -> unit; - fun atomicEnd () = + val atomicEnd = _prim "Thread_atomicEnd": unit -> unit; + fun atomicEnd_x () = if atomicState () = 0w0 - then raise Primitive.Exn.Fail8 "Thread.atomicEnd" - else _prim "Thread_atomicEnd": unit -> unit; () + then raise Primitive.Exn.Fail8 "Thread.atomicEnd" + else _prim "Thread_atomicEnd": unit -> unit; () val copy = _prim "Thread_copy": preThread -> thread; (* copyCurrent's result is accesible via savedPre (). * It is not possible to have the type of copyCurrent as diff --git a/include/c-common.h b/include/c-common.h index 6076342a6..49992548d 100755 --- a/include/c-common.h +++ b/include/c-common.h @@ -12,7 +12,7 @@ /* maxpri is an upper array bound, not a count. see * realtime_thread.c realtimeThreadInit loop (~line 251) */ -#define MAXPRI 4 /* XXX dup'd in runtime/realtime_thread.h */ +#define MAXPRI 6 /* XXX dup'd in runtime/realtime_thread.h */ #define PTHREAD_MAX MAXPRI #ifndef DEBUG_CCODEGEN #define DEBUG_CCODEGEN FALSE diff --git a/include/c-main.h b/include/c-main.h index 6133bcb0a..c95b07f85 100755 --- a/include/c-main.h +++ b/include/c-main.h @@ -59,7 +59,7 @@ static void MLton_callFromC (pointer ffiOpArgsResPtr) { \ if (DEBUG_CCODEGEN) fprintf(stderr, "%d] back from C->SML call\n", PTHREAD_NUM); \ GC_switchToThread (s, GC_getSavedThread (s), 0); \ decAtomic(s); /*s->atomicState -= 1;*/ \ - if (0 == s->atomicState \ + if ((0 == s->atomicState) \ && s->signalsInfo.signalIsPending) \ s->limit = 0; \ if (DEBUG_CCODEGEN) \ diff --git a/mlton/backend/machine.fun b/mlton/backend/machine.fun index 4bb1fcf74..0846ac3c9 100755 --- a/mlton/backend/machine.fun +++ b/mlton/backend/machine.fun @@ -481,8 +481,9 @@ structure Statement = fun chunkedObject {dst, header, size, numChunks} = let +(* val _ = TextIO.output (TextIO.stdErr, - ("chunkedObject: size:"^Int.toString(Bytes.toInt(size))^" numChunks:"^Int.toString(Word.toInt(numChunks))^"\n")) (* JEFF *) + ("chunkedObject: size:"^Int.toString(Bytes.toInt(size))^" numChunks:"^Int.toString(Word.toInt(numChunks))^"\n")) *)(* JEFF *) datatype z = datatype Operand.t fun bytes (b: Bytes.t): Operand.t = diff --git a/mlton/backend/ssa-to-rssa.fun b/mlton/backend/ssa-to-rssa.fun index 5681d2d6a..6a6974356 100644 --- a/mlton/backend/ssa-to-rssa.fun +++ b/mlton/backend/ssa-to-rssa.fun @@ -56,6 +56,39 @@ structure CFunction = datatype z = datatype SymbolScope.t datatype z = datatype Target.t + + val beginAtomic = fn () => + T {args = Vector.new1 (Type.gcState ()), + convention = Cdecl, + kind = Kind.Runtime {bytesNeeded = NONE, + ensuresBytesFree = false, + mayGC = true, + maySwitchThreads = false, + modifiesFrontier = true, + readsStackTop = true, + writesStackTop = true}, + prototype = (Vector.new1 CType.gcState, NONE), + return = Type.unit, + symbolScope = Private, + target = Direct "GC_beginAtomic"} + + val endAtomic = fn () => + T {args = Vector.new1 (Type.gcState ()), + convention = Cdecl, + kind = Kind.Runtime {bytesNeeded = NONE, + ensuresBytesFree = false, + mayGC = true, + maySwitchThreads = false, + modifiesFrontier = true, + readsStackTop = true, + writesStackTop = true}, + prototype = (Vector.new1 CType.gcState, NONE), + return = Type.unit, + symbolScope = Private, + target = Direct "GC_endAtomic"} + + + val copyCurrentThread = fn () => T {args = Vector.new1 (Type.gcState ()), convention = Cdecl, @@ -1108,7 +1141,7 @@ fun convert (program as S.Program.T {functions, globals, main, ...}, (atomicState, (Operand.word (WordX.fromIntInf - (IntInf.fromInt n, + (IntInf.fromInt 9876, WordSize.word32))))), dst = SOME (res, resTy), prim = Prim.wordAdd WordSize.word32}, @@ -1335,6 +1368,9 @@ fun convert (program as S.Program.T {functions, globals, main, ...}, * if (gcState.signalsInfo.signalIsPending) * gcState.limit = gcState.limitPlusSlop - LIMIT_SLOP; *) + ccall {args = (Vector.new1 (GCState)), + func = CFunction.beginAtomic ()} +(* split (Vector.new0 (), Kind.Jump, ss, fn continue => @@ -1377,13 +1413,17 @@ fun convert (program as S.Program.T {functions, globals, main, ...}, else Transfer.Goto {args = Vector.new0 (), dst = continue}) - end) + end) *) | Thread_atomicEnd => (* gcState.atomicState--; * if (gcState.signalsInfo.signalIsPending * and 0 == gcState.atomicState) * gc; *) + ccall {args = (Vector.new1 (GCState)) + , + func = CFunction.endAtomic ()} +(* split (Vector.new0 (), Kind.Jump, ss, fn continue => @@ -1437,6 +1477,7 @@ fun convert (program as S.Program.T {functions, globals, main, ...}, Transfer.Goto {args = Vector.new0 (), dst = continue}) end) +*) | Thread_atomicState => move (Runtime GCField.AtomicState) | Thread_copy => diff --git a/runtime/gc/atomic.c b/runtime/gc/atomic.c index 8f6888487..42594e1df 100644 --- a/runtime/gc/atomic.c +++ b/runtime/gc/atomic.c @@ -17,6 +17,7 @@ void incAtomicBy (GC_state s, uint32_t v) { LOCK_DEBUG("LOCK incAtomicBy"); lockop = pthread_mutex_lock(&lock); assert(lockop == 0); s->atomicState += v; +fprintf(stderr, "%d] %s by=%d atomicState %d\n", PTHREAD_NUM, __FUNCTION__, v, s->atomicState); unlockop = pthread_mutex_unlock(&lock); LOCK_DEBUG("UNLOCK incAtomicBy"); assert(unlockop == 0); } @@ -26,6 +27,7 @@ void decAtomicBy (GC_state s, uint32_t v) { LOCK_DEBUG("LOCK decAtomicBy"); lockop = pthread_mutex_lock(&lock); assert(lockop == 0); s->atomicState -= v; +fprintf(stderr, "%d] %s atomicState %d\n", PTHREAD_NUM, __FUNCTION__, s->atomicState); unlockop = pthread_mutex_unlock(&lock); LOCK_DEBUG("UNLOCK decAtomicBy"); assert(unlockop == 0); } @@ -35,6 +37,7 @@ void setAtomic (GC_state s, uint32_t v) { LOCK_DEBUG("LOCK setAtomic"); lockop = pthread_mutex_lock(&lock); assert(lockop == 0); s->atomicState = v; +fprintf(stderr, "%d] %s atomicState %d\n", PTHREAD_NUM, __FUNCTION__, s->atomicState); unlockop = pthread_mutex_unlock(&lock); LOCK_DEBUG("UNLOCK setAtomic"); assert(unlockop == 0); } @@ -44,6 +47,7 @@ void incAtomic (GC_state s) { LOCK_DEBUG("LOCK incAtomic"); lockop = pthread_mutex_lock(&lock); assert(lockop == 0); s->atomicState++; +fprintf(stderr, "%d] %s atomicState %d\n", PTHREAD_NUM, __FUNCTION__, s->atomicState); unlockop = pthread_mutex_unlock(&lock); LOCK_DEBUG("UNLOCK incAtomic"); assert(unlockop == 0); } @@ -53,6 +57,7 @@ void decAtomic (GC_state s) { LOCK_DEBUG("LOCK decAtomic"); lockop = pthread_mutex_lock(&lock); assert(lockop == 0); s->atomicState--; +fprintf(stderr, "%d] %s atomicState %d\n", PTHREAD_NUM, __FUNCTION__, s->atomicState); unlockop = pthread_mutex_unlock(&lock); LOCK_DEBUG("UNLOCK decAtomic"); assert(unlockop == 0); } @@ -62,6 +67,7 @@ void beginAtomic (GC_state s) { LOCK_DEBUG("LOCK beginAtomic"); lockop = pthread_mutex_lock(&lock); assert(lockop == 0); s->atomicState++; +fprintf(stderr, "%d] %s atomicState %d\n", PTHREAD_NUM, __FUNCTION__, s->atomicState); unlockop = pthread_mutex_unlock(&lock); LOCK_DEBUG("UNLOCK beginAtomic"); assert(unlockop == 0); @@ -70,11 +76,14 @@ void beginAtomic (GC_state s) { s->limit = s->limitPlusSlop - GC_HEAP_LIMIT_SLOP; } +void GC_beginAtomic (GC_state s) { beginAtomic(s); } + void endAtomic (GC_state s) { DECVARS; LOCK_DEBUG("LOCK endAtomic"); lockop = pthread_mutex_lock(&lock); assert(lockop == 0); s->atomicState--; +fprintf(stderr, "%d] %s atomicState %d\n", PTHREAD_NUM, __FUNCTION__, s->atomicState); unlockop = pthread_mutex_unlock(&lock); LOCK_DEBUG("UNLOCK endAtomic"); assert(unlockop == 0); @@ -83,3 +92,5 @@ void endAtomic (GC_state s) { and s->signalsInfo.signalIsPending) s->limit = 0; } + +void GC_endAtomic(GC_state s) { endAtomic(s); } diff --git a/runtime/gc/atomic.h b/runtime/gc/atomic.h index d5771869e..b1637479f 100644 --- a/runtime/gc/atomic.h +++ b/runtime/gc/atomic.h @@ -21,3 +21,11 @@ void incAtomicBy (GC_state s, uint32_t v); +#if (defined (MLTON_GC_INTERNAL_BASIS)) + +PRIVATE void GC_beginAtomic (GC_state s); +PRIVATE void GC_endAtomic (GC_state s); + + +#endif /* (defined (MLTON_GC_INTERNAL_BASIS)) */ + diff --git a/runtime/gc/copy-thread.c b/runtime/gc/copy-thread.c index 76805f54a..ce3bca2b8 100755 --- a/runtime/gc/copy-thread.c +++ b/runtime/gc/copy-thread.c @@ -16,18 +16,18 @@ GC_thread copyThread(GC_state s, GC_thread from, size_t used) { * Hence we need to stash from someplace that the GC can find it. */ - /*if (s->savedThread[PTHREAD_NUM] != BOGUS_OBJPTR) { + if (s->savedThread[PTHREAD_NUM] != BOGUS_OBJPTR) { fprintf(stderr, PURPLE("%d] savedThread "FMTPTR" currentThread "FMTPTR" \n"), PTHREAD_NUM, s->savedThread[PTHREAD_NUM], s->currentThread[PTHREAD_NUM]); - }*/ + } assert (s->savedThread[PTHREAD_NUM] == BOGUS_OBJPTR); s->savedThread[PTHREAD_NUM] = pointerToObjptr((pointer) from - offsetofThread(s), s->umheap.start); if (DEBUG_THREADS) - fprintf(stderr, "%d] %s "RED("setting savedThread")" to "FMTPTR"\n", + fprintf(stderr, "%d] %s "RED("setting savedThread 1")" to "FMTPTR"\n", PTHREAD_NUM, __FUNCTION__, (uintptr_t)s->savedThread[PTHREAD_NUM]); if (DEBUG_THREADS) @@ -43,8 +43,8 @@ GC_thread copyThread(GC_state s, GC_thread from, size_t used) { from = (GC_thread) (objptrToPointer(s->savedThread[PTHREAD_NUM], s->umheap.start) + offsetofThread(s)); s->savedThread[PTHREAD_NUM] = BOGUS_OBJPTR; - if (DEBUG_THREADS) { - fprintf(stderr, "%d] %s "RED("setting savedThread")" to "FMTPTR"\n", + if (DEBUG_THREADS) { + fprintf(stderr, "%d] %s "RED("setting savedThread 2")" to "FMTPTR"\n", PTHREAD_NUM, __FUNCTION__, (uintptr_t)s->savedThread[PTHREAD_NUM]); } diff --git a/runtime/gc/debug.h b/runtime/gc/debug.h index 808d54e45..76ecce7f4 100755 --- a/runtime/gc/debug.h +++ b/runtime/gc/debug.h @@ -13,8 +13,8 @@ //#define PROFILE_UMGC enum { - DEBUG_ALLOC = FALSE, - DEBUG_ALLOC_PACK = FALSE, + DEBUG_ALLOC = TRUE, + DEBUG_ALLOC_PACK = TRUE, DEBUG_ARRAY = FALSE, DEBUG_ARRAY_OFFSET = FALSE, DEBUG_CALL_STACK = FALSE, diff --git a/runtime/gc/realtime_thread.h b/runtime/gc/realtime_thread.h index 9ada115e4..529c12192 100755 --- a/runtime/gc/realtime_thread.h +++ b/runtime/gc/realtime_thread.h @@ -5,7 +5,7 @@ * realtime_thread.c realtimeThreadInit loop (~line 251) */ -#define MAXPRI 4 /* 0 = main, 1 = GC, also in include/c-common.h */ +#define MAXPRI 6 /* 0 = main, 1 = GC, also in include/c-common.h */ #define PTHREAD_MAX MAXPRI /* transitioning to this instead of MAXPRI */ #define NUM_USER_MUTEXES 10 From a6464084280e315dbaa84f5084e1211b73fe802c Mon Sep 17 00:00:00 2001 From: jeff murphy Date: Wed, 1 Mar 2023 21:22:48 -0500 Subject: [PATCH 37/39] wrap atomic debug statements --- CDSml/driver.sml | 2 ++ include/c-common.h | 2 +- runtime/gc/atomic.c | 14 +++++++------- runtime/gc/debug.h | 5 +++-- runtime/gc/realtime_thread.h | 2 +- 5 files changed, 14 insertions(+), 11 deletions(-) diff --git a/CDSml/driver.sml b/CDSml/driver.sml index 5f63495a0..642a8efd7 100755 --- a/CDSml/driver.sml +++ b/CDSml/driver.sml @@ -655,6 +655,7 @@ val _ = pspawn ( ) end, 3) +(* val _ = pspawn ( fn () => let val _ = set_schedule (runtime, deadline, period, 2) @@ -682,6 +683,7 @@ val _ = pspawn ( printit ("Driver[5]: runtime "^Real.toString(Real.-(!stoptime, !starttime))) ) end, 5) +*) val _ = let val iteration = ref 0 diff --git a/include/c-common.h b/include/c-common.h index 49992548d..6076342a6 100755 --- a/include/c-common.h +++ b/include/c-common.h @@ -12,7 +12,7 @@ /* maxpri is an upper array bound, not a count. see * realtime_thread.c realtimeThreadInit loop (~line 251) */ -#define MAXPRI 6 /* XXX dup'd in runtime/realtime_thread.h */ +#define MAXPRI 4 /* XXX dup'd in runtime/realtime_thread.h */ #define PTHREAD_MAX MAXPRI #ifndef DEBUG_CCODEGEN #define DEBUG_CCODEGEN FALSE diff --git a/runtime/gc/atomic.c b/runtime/gc/atomic.c index 42594e1df..515732a6a 100644 --- a/runtime/gc/atomic.c +++ b/runtime/gc/atomic.c @@ -17,7 +17,7 @@ void incAtomicBy (GC_state s, uint32_t v) { LOCK_DEBUG("LOCK incAtomicBy"); lockop = pthread_mutex_lock(&lock); assert(lockop == 0); s->atomicState += v; -fprintf(stderr, "%d] %s by=%d atomicState %d\n", PTHREAD_NUM, __FUNCTION__, v, s->atomicState); + if (DEBUG_ATOMIC) fprintf(stderr, "%d] %s by=%d atomicState %d\n", PTHREAD_NUM, __FUNCTION__, v, s->atomicState); unlockop = pthread_mutex_unlock(&lock); LOCK_DEBUG("UNLOCK incAtomicBy"); assert(unlockop == 0); } @@ -27,7 +27,7 @@ void decAtomicBy (GC_state s, uint32_t v) { LOCK_DEBUG("LOCK decAtomicBy"); lockop = pthread_mutex_lock(&lock); assert(lockop == 0); s->atomicState -= v; -fprintf(stderr, "%d] %s atomicState %d\n", PTHREAD_NUM, __FUNCTION__, s->atomicState); + if (DEBUG_ATOMIC) fprintf(stderr, "%d] %s atomicState %d\n", PTHREAD_NUM, __FUNCTION__, s->atomicState); unlockop = pthread_mutex_unlock(&lock); LOCK_DEBUG("UNLOCK decAtomicBy"); assert(unlockop == 0); } @@ -37,7 +37,7 @@ void setAtomic (GC_state s, uint32_t v) { LOCK_DEBUG("LOCK setAtomic"); lockop = pthread_mutex_lock(&lock); assert(lockop == 0); s->atomicState = v; -fprintf(stderr, "%d] %s atomicState %d\n", PTHREAD_NUM, __FUNCTION__, s->atomicState); + if (DEBUG_ATOMIC) fprintf(stderr, "%d] %s atomicState %d\n", PTHREAD_NUM, __FUNCTION__, s->atomicState); unlockop = pthread_mutex_unlock(&lock); LOCK_DEBUG("UNLOCK setAtomic"); assert(unlockop == 0); } @@ -47,7 +47,7 @@ void incAtomic (GC_state s) { LOCK_DEBUG("LOCK incAtomic"); lockop = pthread_mutex_lock(&lock); assert(lockop == 0); s->atomicState++; -fprintf(stderr, "%d] %s atomicState %d\n", PTHREAD_NUM, __FUNCTION__, s->atomicState); + if (DEBUG_ATOMIC) fprintf(stderr, "%d] %s atomicState %d\n", PTHREAD_NUM, __FUNCTION__, s->atomicState); unlockop = pthread_mutex_unlock(&lock); LOCK_DEBUG("UNLOCK incAtomic"); assert(unlockop == 0); } @@ -57,7 +57,7 @@ void decAtomic (GC_state s) { LOCK_DEBUG("LOCK decAtomic"); lockop = pthread_mutex_lock(&lock); assert(lockop == 0); s->atomicState--; -fprintf(stderr, "%d] %s atomicState %d\n", PTHREAD_NUM, __FUNCTION__, s->atomicState); + if (DEBUG_ATOMIC) fprintf(stderr, "%d] %s atomicState %d\n", PTHREAD_NUM, __FUNCTION__, s->atomicState); unlockop = pthread_mutex_unlock(&lock); LOCK_DEBUG("UNLOCK decAtomic"); assert(unlockop == 0); } @@ -67,7 +67,7 @@ void beginAtomic (GC_state s) { LOCK_DEBUG("LOCK beginAtomic"); lockop = pthread_mutex_lock(&lock); assert(lockop == 0); s->atomicState++; -fprintf(stderr, "%d] %s atomicState %d\n", PTHREAD_NUM, __FUNCTION__, s->atomicState); + if (DEBUG_ATOMIC) fprintf(stderr, "%d] %s atomicState %d\n", PTHREAD_NUM, __FUNCTION__, s->atomicState); unlockop = pthread_mutex_unlock(&lock); LOCK_DEBUG("UNLOCK beginAtomic"); assert(unlockop == 0); @@ -83,7 +83,7 @@ void endAtomic (GC_state s) { LOCK_DEBUG("LOCK endAtomic"); lockop = pthread_mutex_lock(&lock); assert(lockop == 0); s->atomicState--; -fprintf(stderr, "%d] %s atomicState %d\n", PTHREAD_NUM, __FUNCTION__, s->atomicState); + if (DEBUG_ATOMIC) fprintf(stderr, "%d] %s atomicState %d\n", PTHREAD_NUM, __FUNCTION__, s->atomicState); unlockop = pthread_mutex_unlock(&lock); LOCK_DEBUG("UNLOCK endAtomic"); assert(unlockop == 0); diff --git a/runtime/gc/debug.h b/runtime/gc/debug.h index 76ecce7f4..6fd37c92d 100755 --- a/runtime/gc/debug.h +++ b/runtime/gc/debug.h @@ -13,10 +13,11 @@ //#define PROFILE_UMGC enum { - DEBUG_ALLOC = TRUE, - DEBUG_ALLOC_PACK = TRUE, + DEBUG_ALLOC = FALSE, + DEBUG_ALLOC_PACK = FALSE, DEBUG_ARRAY = FALSE, DEBUG_ARRAY_OFFSET = FALSE, + DEBUG_ATOMIC = FALSE, DEBUG_CALL_STACK = FALSE, DEBUG_CARD_MARKING = FALSE, DEBUG_CHUNK_ARRAY = FALSE, diff --git a/runtime/gc/realtime_thread.h b/runtime/gc/realtime_thread.h index 529c12192..9ada115e4 100755 --- a/runtime/gc/realtime_thread.h +++ b/runtime/gc/realtime_thread.h @@ -5,7 +5,7 @@ * realtime_thread.c realtimeThreadInit loop (~line 251) */ -#define MAXPRI 6 /* 0 = main, 1 = GC, also in include/c-common.h */ +#define MAXPRI 4 /* 0 = main, 1 = GC, also in include/c-common.h */ #define PTHREAD_MAX MAXPRI /* transitioning to this instead of MAXPRI */ #define NUM_USER_MUTEXES 10 From 93fd2d72f8416e2a14b497489dff1d9df378af5f Mon Sep 17 00:00:00 2001 From: jeff murphy Date: Fri, 3 Mar 2023 20:49:12 -0500 Subject: [PATCH 38/39] merging notes --- notes | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/notes b/notes index 32668bdfc..d3dc1b908 100755 --- a/notes +++ b/notes @@ -1,3 +1,15 @@ +Merging from mlton/master + +git clone mlton +cd RTMLton + 1271 git checkout mlton-master + 1272 git pull + 1273 git remote add mltonmaster ../mlton + 1277 git remote update + 1278 git merge mltonmaster/master + 1282 git push + 1284 git checkout jeff/working + GDB/libcheck export CK_FORK=no From 1a09bf635962608188016301a2dc2935c3293834 Mon Sep 17 00:00:00 2001 From: jeff murphy Date: Tue, 13 Feb 2024 08:37:16 -0500 Subject: [PATCH 39/39] 64bit --- include/c-chunk.h | 2 +- runtime/basis/Posix/Signal.c | 2 +- runtime/gc/array.c | 2 +- runtime/gc/foreach.c | 10 ++++----- runtime/gc/garbage-collection.c | 4 ++-- runtime/gc/int-inf.c | 4 ++-- runtime/gc/realtime_thread.c | 2 +- runtime/gc/um.c | 40 ++++++++++++++++----------------- runtime/gc/um_constants.h | 4 ++-- runtime/gc/umarray-allocate.c | 2 ++ runtime/gc/ummark.c | 6 ++--- runtime/gc/umstack.c | 32 +++++++++++++------------- 12 files changed, 56 insertions(+), 54 deletions(-) diff --git a/include/c-chunk.h b/include/c-chunk.h index 8b96062aa..57f3a4891 100755 --- a/include/c-chunk.h +++ b/include/c-chunk.h @@ -288,7 +288,7 @@ void um_dumpFrame (void *s, void *f); * you must keep umheap.h and this definition in sync. */ -#define UM_CHUNK_PAYLOAD_SIZE 302 +#define UM_CHUNK_PAYLOAD_SIZE 304 #define UM_CHUNK_PAYLOAD_SAFE_REGION 16 typedef uintptr_t GC_returnAddress; diff --git a/runtime/basis/Posix/Signal.c b/runtime/basis/Posix/Signal.c index 927ab1a1d..c51b7ba22 100644 --- a/runtime/basis/Posix/Signal.c +++ b/runtime/basis/Posix/Signal.c @@ -100,7 +100,7 @@ C_Errno_t(C_Int_t) Posix_Signal_sigismember (C_Signal_t signum) { } C_Errno_t(C_Int_t) Posix_Signal_sigprocmask (C_Int_t how) { - return sigprocmask (how, &Posix_Signal_sigset, &Posix_Signal_sigset); + return sigprocmask (how, &Posix_Signal_sigset, NULL); } #if ASSERT diff --git a/runtime/gc/array.c b/runtime/gc/array.c index 4aa614f16..9e30b6ae0 100755 --- a/runtime/gc/array.c +++ b/runtime/gc/array.c @@ -24,7 +24,7 @@ GC_arrayLength* getArrayLengthp (pointer a) { GC_arrayLength getArrayLength (pointer a) { GC_UM_Array_Chunk root0 = (GC_UM_Array_Chunk)(a - GC_HEADER_SIZE - sizeof(Word32_t)); if (root0->array_chunk_magic != UM_ARRAY_SENTINEL) { - fprintf(stderr, "root0 %x\n", (int)root0); + fprintf(stderr, "root0 %p\n", root0); } assert (root0->array_chunk_magic == UM_ARRAY_SENTINEL); return root0->num_els; diff --git a/runtime/gc/foreach.c b/runtime/gc/foreach.c index 983c9ce87..62e2b406c 100644 --- a/runtime/gc/foreach.c +++ b/runtime/gc/foreach.c @@ -17,7 +17,7 @@ void callIfIsObjptr (GC_state s, GC_foreachObjptrFun f, objptr *opp) { } if (DEBUG_MEM) - fprintf(stderr, " callIfIsObjptr: Not objptr 0x%x\n", *opp); + fprintf(stderr, " callIfIsObjptr: Not objptr 0x%p\n", (void *)*opp); } @@ -205,7 +205,7 @@ pointer foreachObjptrInObject (GC_state s, pointer p, dataBytes = numElements * bytesPerElement; if (DEBUG_MEM) fprintf(stderr, "%d] "GREEN("marking array (new heap)") - " numObjptrs(%d) bytesNonObjptrs(%d) numElements(%d) bpe(%d)\n", + " numObjptrs(%d) bytesNonObjptrs(%d) numElements(%ld) bpe(%d)\n", PTHREAD_NUM, numObjptrs, bytesNonObjptrs, numElements, (int)bytesPerElement); @@ -296,9 +296,9 @@ pointer foreachObjptrInObject (GC_state s, pointer p, fprintf(stderr, "%d] offset 0x%"PRIx16" (%d) stackaddress "FMTOBJPTR" objptr "FMTOBJPTR"\n", PTHREAD_NUM, frameOffsets[i + 1], - frameOffsets[i + 1], - (int)x, - xv); + (unsigned int) frameOffsets[i + 1], + x, + (long unsigned int)xv); callIfIsObjptr(s, f, (objptr *)x); } diff --git a/runtime/gc/garbage-collection.c b/runtime/gc/garbage-collection.c index db0c46ba6..7ae488ec4 100755 --- a/runtime/gc/garbage-collection.c +++ b/runtime/gc/garbage-collection.c @@ -728,9 +728,9 @@ User_instrument_counter(322, pc->used); /* JEFF normal collect */ fprintf(stderr, "%d] "GREEN("Finished one sweep cycle and freed %d chunks\n"), PTHREAD_NUM, freed); - fprintf(stderr, "%d] "GREEN("Chunks; Visited: %d, Marked: %d, Greys: %d Reds: %d Sanity: %d\n"), + fprintf(stderr, "%d] "GREEN("Chunks; Visited: %d, Marked: %d, Greys: %d Reds: %d Sanity: %ld\n"), PTHREAD_NUM, visited, marked, grey, - red, foo); + red, (long unsigned int)foo); } STOP_PERF; diff --git a/runtime/gc/int-inf.c b/runtime/gc/int-inf.c index d29a61a81..39a98bfde 100644 --- a/runtime/gc/int-inf.c +++ b/runtime/gc/int-inf.c @@ -7,9 +7,9 @@ * See the file MLton-LICENSE for details. */ -#if defined(__rtems__) #pragma GCC diagnostic ignored "-Waddress-of-packed-member" -#endif + + /* * Test if a intInf is a fixnum. diff --git a/runtime/gc/realtime_thread.c b/runtime/gc/realtime_thread.c index 0f3c500c2..dd5f9f75b 100755 --- a/runtime/gc/realtime_thread.c +++ b/runtime/gc/realtime_thread.c @@ -312,7 +312,7 @@ void set_schedule(int runtime, int deadline, int period, int packing) { if(DEBUG_THREADS) fprintf(stderr, "%d] "YELLOW("set_schedule")" runtime:%llu period:%llu deadline:%llu packing:%d\n", - PTHREAD_NUM, (uint64_t)runtime, (uint64_t)period, (uint64_t)deadline, packing); + PTHREAD_NUM, (long long unsigned int)runtime, (long long unsigned int)period, (long long unsigned int)deadline, packing); allowedToPack[PTHREAD_NUM] = packing; diff --git a/runtime/gc/um.c b/runtime/gc/um.c index 2b63d1fdd..cde87a83a 100755 --- a/runtime/gc/um.c +++ b/runtime/gc/um.c @@ -47,7 +47,7 @@ void reserveAllocation(GC_state s, size_t numChunksToRequest) { || (s->fl_chunks < (size_t)(s->hPercent * s->maxChunksAvailable)) ) { - fprintf(stderr, "%d] "PURPLE("either fl (%d) is < reserved+req (%d) or fl (%d) < heuristic (%d)\n"), + fprintf(stderr, "%d] "PURPLE("either fl (%d) is < reserved+req (%ld) or fl (%d) < heuristic (%ld)\n"), PTHREAD_NUM, s->fl_chunks, (s->reserved + numChunksToRequest), s->fl_chunks, (size_t)(s->hPercent * s->maxChunksAvailable) ); UNLOCK_FL; pthread_yield(); @@ -86,7 +86,7 @@ UM_Object_alloc_no_packing(GC_state gc_stat, C_Size_t num_chunks, uint32_t heade } if (DEBUG_ALLOC_PACK) - fprintf(stderr, "%d] %s returns %x\n", PTHREAD_NUM, __FUNCTION__, (unsigned int) (chunk->ml_object + s)); + fprintf(stderr, "%d] %s returns %p\n", PTHREAD_NUM, __FUNCTION__, (void *) (chunk->ml_object + s)); return (Pointer) (chunk->ml_object + s); } @@ -134,7 +134,7 @@ UM_Object_alloc_packing_stage2(GC_state s, C_Size_t num_chunks, uint32_t header, UNLOCK_FL; if (DEBUG_ALLOC_PACK) - fprintf(stderr, "%d] writing header 0x%x(%d) with offset %d\n", + fprintf(stderr, "%d] writing header 0x%x(%d) with offset %ld\n", PTHREAD_NUM, header, header, used+hdrsz); *piggybackedOnThreadNum = i; @@ -212,7 +212,7 @@ UM_Object_alloc_packing_stage1(GC_state s, C_Size_t num_chunks, uint32_t header, } else { if (DEBUG_ALLOC_PACK) - fprintf(stderr, "%d] there is space in this chunk (%u) to fit our object (%d)\n", + fprintf(stderr, "%d] there is space in this chunk (%u) to fit our object (%ld)\n", PTHREAD_NUM, (unsigned int)(UM_CHUNK_PAYLOAD_SIZE-(chunk->used)), sz+hdrsz ); @@ -280,7 +280,7 @@ UM_Object_alloc_packing_stage1(GC_state s, C_Size_t num_chunks, uint32_t header, chunk->used += (sz + hdrsz); if (DEBUG_ALLOC_PACK) - fprintf(stderr, "%d] writing header 0x%x(%d) with offset %d\n", + fprintf(stderr, "%d] writing header 0x%x(%d) with offset %ld\n", PTHREAD_NUM, header, header, used+hdrsz); // the following line violates C aliasing rules (undefined behavior): @@ -338,7 +338,7 @@ UM_Object_alloc(GC_state gc_stat, C_Size_t num_chunks, uint32_t header, C_Size_t User_instrument_counter(50, num_chunks); /* JEFF um_obj_alloc calls, num chunks asked for */ if (DEBUG_ALLOC) { - fprintf(stderr, "%d] UM_Object_alloc %s numchk:%u hd:0x%x(%d) (%s [%d] index:%u) sz:%d freelist:%d reserved:%d\n", + fprintf(stderr, "%d] UM_Object_alloc %s numchk:%lu hd:0x%x(%d) (%s [%d] index:%u) sz:%ld freelist:%d reserved:%d\n", PTHREAD_NUM, (header == GC_THREAD_HEADER)?"*** thread ***":"", num_chunks, header, @@ -367,7 +367,7 @@ UM_Object_alloc(GC_state gc_stat, C_Size_t num_chunks, uint32_t header, C_Size_t || header == GC_STACK_HEADER || header == GC_WEAK_GONE_HEADER) { if (DEBUG_ALLOC) - fprintf(stderr, "** me=%d THR %d WEAK %d STACK %d\n", header, + fprintf(stderr, "** me=%d THR %ld WEAK %ld STACK %ld\n", header, GC_THREAD_HEADER, GC_WEAK_GONE_HEADER, GC_STACK_HEADER ); @@ -382,7 +382,7 @@ UM_Object_alloc(GC_state gc_stat, C_Size_t num_chunks, uint32_t header, C_Size_t fprintf(stderr, RED("** no packing for this type\n")); p = UM_Object_alloc_no_packing(gc_stat, num_chunks, header, s); if (DEBUG_ALLOC) - fprintf(stderr, " UM_Object_alloc returns: p = %x\n", (unsigned int)p); + fprintf(stderr, " UM_Object_alloc returns: p = %p\n", (void *)p); User_instrument(60); return p; } @@ -395,7 +395,7 @@ UM_Object_alloc(GC_state gc_stat, C_Size_t num_chunks, uint32_t header, C_Size_t p = UM_Object_alloc_packing_stage1(gc_stat, num_chunks, header, s, sz); if (DEBUG_ALLOC_PACK) - fprintf(stderr, " UM_Object_alloc returns: p = %x\n", (unsigned int)p); + fprintf(stderr, " UM_Object_alloc returns: p = %p\n", (void *)p); User_instrument(60); return p; } @@ -531,12 +531,12 @@ Pointer UM_Array_offset(GC_state gc_stat, Pointer base, C_Size_t index, Pointer heap_end = (gc_stat->umheap).start + (gc_stat->umheap).size; if (DEBUG_ARRAY_OFFSET) - fprintf(stderr, "%d] UM_Array_offset(base="FMTPTR", index=%d, elemSize=%d, offset=%d)\n", + fprintf(stderr, "%d] UM_Array_offset(base="FMTPTR", index=%ld, elemSize=%ld, offset=%ld)\n", PTHREAD_NUM, (uintptr_t)base, index, elemSize, offset); if (base < gc_stat->umheap.start || base >= heap_end) { if (DEBUG_ARRAY_OFFSET) { - fprintf(stderr, "%d] UM_Array_offset: not current heap: "FMTPTR" offset: %d\n", + fprintf(stderr, "%d] UM_Array_offset: not current heap: "FMTPTR" offset: %ld\n", PTHREAD_NUM, (uintptr_t)base, offset); } return base + index * elemSize + offset; @@ -552,15 +552,15 @@ Pointer UM_Array_offset(GC_state gc_stat, Pointer base, C_Size_t index, if (root->array_chunk_type == UM_CHUNK_ARRAY_LEAF) { if (DEBUG_MEM) - fprintf(stderr, " root type is LEAF so return direct calculation of base+%d\n", + fprintf(stderr, " root type is LEAF so return direct calculation of base+%ld\n", index * elemSize + offset); Pointer res = ((Pointer)&(root->ml_array_payload.ml_object[0])) + index * elemSize + offset; if (DEBUG_MEM) fprintf(stderr, - " --> Chunk_addr: "FMTPTR", index: %d, chunk base: "FMTPTR", " - "offset: %d, addr "FMTPTR" word: %x, %d, " + " --> Chunk_addr: "FMTPTR", index: %ld, chunk base: "FMTPTR", " + "offset: %ld, addr "FMTPTR" word: %x, %d, " " char: %c\n", (uintptr_t)root, index, @@ -583,7 +583,7 @@ Pointer UM_Array_offset(GC_state gc_stat, Pointer base, C_Size_t index, assert (root->array_height > 0); assert (root->array_chunk_magic == UM_ARRAY_SENTINEL); if (root->array_chunk_type != UM_CHUNK_ARRAY_INTERNAL) { - fprintf(stderr, "%d] root-not-internal UM_Array_offset(base="FMTPTR", index=%d, elemSize=%d, offset=%d)\n", + fprintf(stderr, "%d] root-not-internal UM_Array_offset(base="FMTPTR", index=%ld, elemSize=%ld, offset=%ld)\n", PTHREAD_NUM, (uintptr_t)base, index, elemSize, offset); } @@ -621,7 +621,7 @@ Pointer UM_Array_offset(GC_state gc_stat, Pointer base, C_Size_t index, size_t slice_width_in_elements = width_in_elements; if (DEBUG_ARRAY_OFFSET) { - fprintf(stderr, " IP^CH * EPC = %d^%d (%d) * %d = %d (max width_in_elements)\n", + fprintf(stderr, " IP^CH * EPC = %d^%d (%f) * %d = %d (max width_in_elements)\n", (int)UM_CHUNK_ARRAY_INTERNAL_POINTERS, (int)curHeight, POW(UM_CHUNK_ARRAY_INTERNAL_POINTERS, curHeight), (int)root->num_els_per_chunk, (int)width_in_elements); @@ -666,7 +666,7 @@ Pointer UM_Array_offset(GC_state gc_stat, Pointer base, C_Size_t index, if (DEBUG_ARRAY_OFFSET) - fprintf(stderr, " next: %f = (%d-%d)/%d * %d, h=%d e/c=%d, e0 %d eX %d\n", + fprintf(stderr, " next: %f = (%ld-%d)/%d * %d, h=%d e/c=%d, e0 %d eX %d\n", next, index, (int)e0, (int)slice_width_in_elements, (int)UM_CHUNK_ARRAY_INTERNAL_POINTERS, (int)curHeight, (int)root->num_els_per_chunk, (int)e0, (int)eX); @@ -681,7 +681,7 @@ Pointer UM_Array_offset(GC_state gc_stat, Pointer base, C_Size_t index, * chunk. */ if (DEBUG_ARRAY_OFFSET) - fprintf(stderr, " (%d-%d)*%d+%d = %d = (index-e0) * elemSize + offset\n", + fprintf(stderr, " (%ld-%d)*%ld+%ld = %ld = (index-e0) * elemSize + offset\n", index, (int)e0, elemSize, offset, (int)(index-e0)*elemSize+offset); @@ -693,8 +693,8 @@ Pointer UM_Array_offset(GC_state gc_stat, Pointer base, C_Size_t index, (index-e0) * elemSize + offset; if (DEBUG_ARRAY_OFFSET) fprintf(stderr, - " --> Chunk_addr: "FMTPTR", index: %d, chunk base: "FMTPTR", " - "offset: %d, addr "FMTPTR" word: %x, %d, " + " --> Chunk_addr: "FMTPTR", index: %ld, chunk base: "FMTPTR", " + "offset: %ld, addr "FMTPTR" word: %x, %d, " " char: %c\n", (uintptr_t)root, index, diff --git a/runtime/gc/um_constants.h b/runtime/gc/um_constants.h index c63b0e989..60fb408d2 100755 --- a/runtime/gc/um_constants.h +++ b/runtime/gc/um_constants.h @@ -2,12 +2,12 @@ #if (defined (MLTON_GC_INTERNAL_TYPES)) -#define UM_CHUNK_PAYLOAD_SIZE 302 /*Change in include/c-chunk.h too*/ +#define UM_CHUNK_PAYLOAD_SIZE 304 /*Change in include/c-chunk.h too*/ #define UM_CHUNK_PAYLOAD_SAFE_REGION 16 #define UM_CHUNK_ARRAY_PAYLOAD_SIZE 300 /* this should be divisible by platform wordsize */ #define UM_CHUNK_ARRAY_INTERNAL_POINTERS (UM_CHUNK_ARRAY_PAYLOAD_SIZE/sizeof(void*)) -_Static_assert (UM_CHUNK_ARRAY_PAYLOAD_SIZE%sizeof(void*)==0, +_Static_assert ((UM_CHUNK_ARRAY_PAYLOAD_SIZE%sizeof(void*))!=0, "UM_CHUNK_ARRAY_PAYLOAD_SIZE is not evenly divisible by platform word size"); #define UM_CHUNK_SENTINEL 0x9999 diff --git a/runtime/gc/umarray-allocate.c b/runtime/gc/umarray-allocate.c index 22110696e..752ebdea4 100644 --- a/runtime/gc/umarray-allocate.c +++ b/runtime/gc/umarray-allocate.c @@ -1,5 +1,7 @@ #include "../gc.h" +#pragma GCC diagnostic ignored "-Wunused-function" + static int ipow(int, unsigned int); static /* see doc/rtmlton/pow-or-ipow.md */ diff --git a/runtime/gc/ummark.c b/runtime/gc/ummark.c index b8c668859..d66cb0a7b 100755 --- a/runtime/gc/ummark.c +++ b/runtime/gc/ummark.c @@ -455,9 +455,9 @@ bool isContainerChunkMarkedByMode(pointer p, GC_markMode m, GC_objectTypeTag tag if (chunkOffset > 0) chunkOffset -= GC_NORMAL_HEADER_SIZE; if (DEBUG_DFS_MARK) - fprintf(stderr, "%d] isContainerChunkMarkedByMode %x header %x coffset %d\n", - PTHREAD_NUM, (unsigned int)p, - header, chunkOffset + fprintf(stderr, "%d] isContainerChunkMarkedByMode %p header %p coffset %d\n", + PTHREAD_NUM, (void *)p, + (void *)header, chunkOffset ); GC_UM_Chunk pchunk = (GC_UM_Chunk)((char*)p-chunkOffset); diff --git a/runtime/gc/umstack.c b/runtime/gc/umstack.c index 4fb77fab0..8cca16598 100755 --- a/runtime/gc/umstack.c +++ b/runtime/gc/umstack.c @@ -49,8 +49,8 @@ void um_dumpFrame (GC_state s, objptr frame, GC_returnAddress raoverride) { fprintf(stderr, "%d] offset 0x%"PRIx16" (%d) stackaddress "FMTOBJPTR" objptr "FMTOBJPTR"\n", PTHREAD_NUM, frameOffsets[i + 1], frameOffsets[i + 1], - (int)x, - xv); + (long unsigned int)x, + (long unsigned int)xv); } } @@ -129,7 +129,7 @@ void um_copyStack (GC_state s, GC_thread from, GC_thread to) { to->exnStack = BOGUS_EXN_STACK; if (DEBUG_CCODEGEN) - fprintf(stderr, "%d] um_copyStack from:%08x -> to:%08x\n", PTHREAD_NUM, (unsigned int) f, (unsigned int)t); + fprintf(stderr, "%d] um_copyStack from:%p -> to:%p\n", PTHREAD_NUM, f, t); for( ; f ; f = (GC_UM_Chunk)f->next_chunk, t = (GC_UM_Chunk)t->next_chunk) { assert (f->sentinel == UM_STACK_SENTINEL); @@ -141,9 +141,9 @@ void um_copyStack (GC_state s, GC_thread from, GC_thread to) { if (from->exnStack == (objptr)f + GC_HEADER_SIZE) { if (DEBUG_CCODEGEN) { - fprintf(stderr, GREEN("found exnStack: from:%08x -> to:%08x (handler %d, ra %d)\n"), - (unsigned int) f, - (unsigned int) t, + fprintf(stderr, GREEN("found exnStack: from:%p -> to:%p (handler %d, ra %d)\n"), + f, + t, (int)f->handler, (int)*(uintptr_t*)(f->ml_object + f->ra + GC_HEADER_SIZE)); } @@ -151,7 +151,7 @@ void um_copyStack (GC_state s, GC_thread from, GC_thread to) { } if (from->currentFrame - GC_HEADER_SIZE == (objptr)f) { if (DEBUG_CCODEGEN) { - fprintf(stderr, "found cf at from:%08x -> to:%08x\n", (unsigned int) f, (unsigned int)t); + fprintf(stderr, "found cf at from:%p -> to:%p\n", f, t); } to->currentFrame = (objptr)t + GC_HEADER_SIZE; f = f->next_chunk; @@ -161,7 +161,7 @@ void um_copyStack (GC_state s, GC_thread from, GC_thread to) { } if (to->currentFrame == BOGUS_OBJPTR) { if (DEBUG_CCODEGEN) - fprintf(stderr, "did not find cf yet! from:%08x -> to:%08x\n", (unsigned int) f, (unsigned int)t); + fprintf(stderr, "did not find cf yet! from:%p -> to:%p\n", f, t); } cc++; } @@ -173,15 +173,15 @@ void um_copyStack (GC_state s, GC_thread from, GC_thread to) { fprintf(stderr, YELLOW("No exnStack found in from thread\n")); } fprintf(stderr, YELLOW("copyStacklet") " [Thr %d] copied %d chunks," - " old-first %08x" - " old-cur %08x" - " new-first %08x" - " new-cur %08x\n", + " old-first %p" + " old-cur %p" + " new-first %p" + " new-cur %p\n", PTHREAD_NUM, cc, - (unsigned int) from->firstFrame, - (unsigned int) from->currentFrame, - (unsigned int) to->firstFrame, - (unsigned int) to->currentFrame); + (void *)from->firstFrame, + (void *)from->currentFrame, + (void *)to->firstFrame, + (void *)to->currentFrame); } if (to->currentFrame == BOGUS_OBJPTR)