[compiler-rt] r263160 - [Windows] Fix UnmapOrDie and MmapAlignedOrDie

Dmitry Vyukov via llvm-commits llvm-commits at lists.llvm.org
Thu May 12 11:30:08 PDT 2016


On Tue, May 10, 2016 at 11:59 PM, Reid Kleckner <rnk at google.com> wrote:
> On Mon, May 9, 2016 at 6:21 AM, Dmitry Vyukov <dvyukov at google.com> wrote:
>> Reid,
>>
>> How do you think we should fix it?
>
> Does this problem only occur in CreateThreadContext? I would say, we
> solve this by not overallocating and attempting to trim the
> allocation, but then we have this comment:
>   new((void*)hdr) Trace();
>   // We are going to use only a small part of the trace with the default
>   // value of history_size. However, the constructor writes to the whole trace.
>   // Unmap the unused part.
>
> Does Trace really need to be one giant object, or can we do something like this?
>
> struct Trace {
>   Mutex mtx;
>   ...
>   TraceHeader *getTrailingTraceHeaders() { return
> reinterpret_cast<TraceHeader*>(this + 1); }
> };
>
> If so, then we can compute the size for MapThreadTrace up front and we
> don't need to trim the allocation. That's probably good for Linux,
> too, right?

There is one other case where tsan uses FlushUnneededShadowMemory for
a middle of a mapping. It's empty on windows, so it "works".

I will look into making something more sane for traces.


> I wanted to find a way to test building tsan on Windows, but from
> lib/tsan/go/build.bat it looks like it only supports a unity-style
> mingw gcc build, and then I can't run any tests without a go
> implementation. There's no need to port tsan to build with MSVC, but
> it would be nice if I could build and test it with mingw and cmake.

Yes, there is a problem with testing.

Build requires a 64-bit mingw gcc (not provided by official
distribution last time I checked) and a Go checkout on a particular
revision.
Is it possible to upload binary blobs with gcc and Go onto windows
bots? Do we already have some bat script where I can add Go testing?
Can you give me RDC access to a windows machine for testing?

... and tests will be broken for some periods because lots of changes
require updating both tsan runtime and Go side which is not possible
to do atomically.


More information about the llvm-commits mailing list