diff options
author | Tamar Christina <tamar@zhox.com> | 2020-08-31 10:35:56 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-10-09 08:41:50 -0400 |
commit | fd984d68e5ec4b04bc79395c099434e653eb1060 (patch) | |
tree | 9b3e3725cc82fbd8686f3e63ba5a62860afdcd58 /rts/Schedule.c | |
parent | a566c83d4fc3a90b209b33131a2972ea53ec81b2 (diff) | |
download | haskell-fd984d68e5ec4b04bc79395c099434e653eb1060.tar.gz |
rts: fix race condition in StgCRun
On windows the stack has to be allocated 4k at a time, otherwise we get
a segfault. This is done by using a helper ___chkstk_ms that is provided
by libgcc. The Haskell side already knows how to handle this but we need
to do the same from STG. Previously we would drop the stack in StgRun
but would only make it valid whenever the scheduler loop ran.
This approach was fundamentally broken in that it falls apart when you
take a signal from the OS. We see it less often because you initially
get allocated a 1MB stack block which you have to blow past first.
Concretely this means we must always keep the stack valid.
Fixes #18601.
Diffstat (limited to 'rts/Schedule.c')
-rw-r--r-- | rts/Schedule.c | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/rts/Schedule.c b/rts/Schedule.c index 6b10326859..41d0dba953 100644 --- a/rts/Schedule.c +++ b/rts/Schedule.c @@ -137,7 +137,6 @@ static Capability *schedule (Capability *initialCapability, Task *task); // abstracted only to make the structure and control flow of the // scheduler clearer. // -static void schedulePreLoop (void); static void scheduleFindWork (Capability **pcap); #if defined(THREADED_RTS) static void scheduleYield (Capability **pcap, Task *task); @@ -207,8 +206,6 @@ schedule (Capability *initialCapability, Task *task) debugTrace (DEBUG_sched, "cap %d: schedule()", initialCapability->no); - schedulePreLoop(); - // ----------------------------------------------------------- // Scheduler loop starts here: @@ -613,20 +610,6 @@ promoteInRunQueue (Capability *cap, StgTSO *tso) pushOnRunQueue(cap, tso); } -/* ---------------------------------------------------------------------------- - * Setting up the scheduler loop - * ------------------------------------------------------------------------- */ - -static void -schedulePreLoop(void) -{ - // initialisation for scheduler - what cannot go into initScheduler() - -#if defined(mingw32_HOST_OS) && !defined(USE_MINIINTERPRETER) - win32AllocStack(); -#endif -} - /* ----------------------------------------------------------------------------- * scheduleFindWork() * |