Hello,

I believe that "copyOut" is what is actually taking the emulated data and
putting into the simulated process space (or vice versa...). By commenting
that out clock() will definitely not work correctly.

This seems like it might be a real bug. If you figure out what's going
wrong, we'd really appreciate it if you created a patch on gerrit (
gem5-review.googlesource.com).

Jason

On Tue, May 15, 2018 at 1:57 PM Øyvind Harboe <[email protected]>
wrote:

> If I comment out the line below, it no longer crashes:
>
> $ git diff
> diff --git a/src/sim/syscall_emul.hh b/src/sim/syscall_emul.hh
> index e5b0f455a..a5fba9879 100644
> --- a/src/sim/syscall_emul.hh
> +++ b/src/sim/syscall_emul.hh
> @@ -1756,7 +1756,7 @@ clock_gettimeFunc(SyscallDesc *desc, int num,
> Process *p, ThreadContext *tc)
>      tp->tv_sec = TheISA::htog(tp->tv_sec);
>      tp->tv_nsec = TheISA::htog(tp->tv_nsec);
>
> -    tp.copyOut(tc->getMemProxy());
> +    //    tp.copyOut(tc->getMemProxy());
>
>      return 0;
>  }
>
>
> On Tue, May 15, 2018 at 7:33 PM, Jason Lowe-Power <[email protected]>
> wrote:
>
>> You can try using debug flags. SyscallVerbose seems useful.
>>
>> It's possible that you'll need to update the implementation of the clock
>> syscall.
>>
>> Jason
>>
>> On Tue, May 15, 2018 at 6:50 AM Øyvind Harboe <[email protected]>
>> wrote:
>>
>>> I've tried with "-static" as well. Same result.
>>>
>>> When trying on a different machine, there result was slightly different.
>>> I guess memory corruption could pan out slightly differently and that this
>>> difference is not of any particular interest.
>>>
>>> $ ../gem5/build/X86/gem5.opt --listener-mode=off
>>> ../gem5/configs/example/se.py -c a.out
>>> gem5 Simulator System.  http://gem5.org
>>> gem5 is copyrighted software; use the --copyright option for details.
>>>
>>> gem5 compiled May 15 2018 06:42:21
>>> gem5 started May 15 2018 06:48:33
>>> gem5 executing on Mega-Minion, pid 10006
>>> command line: ../gem5/build/X86/gem5.opt --listener-mode=off
>>> ../gem5/configs/example/se.py -c a.out
>>>
>>> Global frequency set at 1000000000000 ticks per second
>>> warn: DRAM device capacity (8192 Mbytes) does not match the address
>>> range assigned (512 Mbytes)
>>> warn: Sockets disabled, not accepting gdb connections
>>> **** REAL SIMULATION ****
>>> info: Entering event queue @ 0.  Starting simulation...
>>> info: Increasing stack size by one page.
>>> warn: readlink() called on '/proc/self/exe' may yield unexpected results
>>> in various settings.
>>>       Returning '/home/jenkins/ascenium/a.out'
>>> warn: ignoring syscall access(...)
>>> fatal: readBlob(0x4080ae651, ...) failed
>>> Memory Usage: 97236700 KBytes
>>>
>>>
>>>
>>>
>>> On Mon, May 14, 2018 at 6:25 PM, Jason Lowe-Power <[email protected]>
>>> wrote:
>>>
>>>> Hello,
>>>>
>>>> Have you compiled your binary statically? I believe dynamically linked
>>>> executables will only work if the host and the guest are *exactly* the same
>>>> (e.g., both x86-64 in this case).
>>>>
>>>> Jason
>>>>
>>>> On Mon, May 14, 2018 at 7:10 AM Øyvind Harboe <[email protected]>
>>>> wrote:
>>>>
>>>>> I'm getting a "bad_alloc" from the config/examples/se.py script when I
>>>>> try to run the small C application below that calls clock().
>>>>>
>>>>> Any pointers on what's going on would be most welcome.
>>>>>
>>>>> Please find a transcript of how I've tested:
>>>>>
>>>>> I first test with 64 bit, then with 32 bit x86. 64 bit x86 works fine.
>>>>>
>>>>> $ cd gem5
>>>>> $ git describe --tags
>>>>> copyright_update-7291-gce00e6042
>>>>> $ cat test.c
>>>>> #include <time.h>
>>>>>
>>>>> int main(int argc, char **argv)
>>>>> {
>>>>>   clock();
>>>>>   return 0;
>>>>> }
>>>>> $ gcc ./test.c
>>>>> $ build/X86/gem5.opt configs/example/se.py -c ./a.out
>>>>> gem5 Simulator System.  http://gem5.org
>>>>> gem5 is copyrighted software; use the --copyright option for details.
>>>>>
>>>>> gem5 compiled May 14 2018 14:59:03
>>>>> gem5 started May 14 2018 16:00:16
>>>>> gem5 executing on davos, pid 31640
>>>>> command line: build/X86/gem5.opt configs/example/se.py -c ./a.out
>>>>>
>>>>> Global frequency set at 1000000000000 ticks per second
>>>>> warn: DRAM device capacity (8192 Mbytes) does not match the address
>>>>> range assigned (512 Mbytes)
>>>>> 0: system.remote_gdb: listening for remote gdb on port 7000
>>>>> **** REAL SIMULATION ****
>>>>> info: Entering event queue @ 0.  Starting simulation...
>>>>> warn: ignoring syscall access(...)
>>>>> warn: ignoring syscall access(...)
>>>>> warn: ignoring syscall access(...)
>>>>> warn: ignoring syscall mprotect(...)
>>>>> warn: ignoring syscall mprotect(...)
>>>>> warn: ignoring syscall mprotect(...)
>>>>> warn: ignoring syscall mprotect(...)
>>>>> Exiting @ tick 91225000 because exiting with last active thread context
>>>>>
>>>>>
>>>>> $ gcc -m32 ./test.c
>>>>> $ build/X86/gem5.opt configs/example/se.py -c ./a.out
>>>>> gem5 Simulator System.  http://gem5.org
>>>>> gem5 is copyrighted software; use the --copyright option for details.
>>>>>
>>>>> gem5 compiled May 14 2018 14:59:03
>>>>> gem5 started May 14 2018 16:00:23
>>>>> gem5 executing on davos, pid 31648
>>>>> command line: build/X86/gem5.opt configs/example/se.py -c ./a.out
>>>>>
>>>>> Global frequency set at 1000000000000 ticks per second
>>>>> warn: DRAM device capacity (8192 Mbytes) does not match the address
>>>>> range assigned (512 Mbytes)
>>>>> 0: system.remote_gdb: listening for remote gdb on port 7000
>>>>> **** REAL SIMULATION ****
>>>>> info: Entering event queue @ 0.  Starting simulation...
>>>>> warn: ignoring syscall access(...)
>>>>> warn: ignoring syscall access(...)
>>>>> warn: ignoring syscall access(...)
>>>>> warn: ignoring syscall mprotect(...)
>>>>> warn: ignoring syscall mprotect(...)
>>>>> warn: ignoring syscall mprotect(...)
>>>>> warn: ignoring syscall mprotect(...)
>>>>> Traceback (most recent call last):
>>>>>   File "<string>", line 1, in <module>
>>>>>   File "/home/oyvind/gem5/src/python/m5/main.py", line 435, in main
>>>>>     exec filecode in scope
>>>>>   File "configs/example/se.py", line 286, in <module>
>>>>>     Simulation.run(options, root, system, FutureClass)
>>>>>   File "/home/oyvind/gem5/configs/common/Simulation.py", line 712, in
>>>>> run
>>>>>     exit_event = benchCheckpoints(options, maxtick, cptdir)
>>>>>   File "/home/oyvind/gem5/configs/common/Simulation.py", line 268, in
>>>>> benchCheckpoints
>>>>>     exit_event = m5.simulate(maxtick - m5.curTick())
>>>>>   File "/home/oyvind/gem5/src/python/m5/simulate.py", line 176, in
>>>>> simulate
>>>>>     return _m5.event.simulate(*args, **kwargs)
>>>>> MemoryError: std::bad_alloc
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Øyvind Harboe, General Manager, Zylin AS, +47 917 86 146
>>>>> _______________________________________________
>>>>> gem5-users mailing list
>>>>> [email protected]
>>>>> http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
>>>>
>>>>
>>>> _______________________________________________
>>>> gem5-users mailing list
>>>> [email protected]
>>>> http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
>>>>
>>>
>>>
>>>
>>> --
>>> Øyvind Harboe, General Manager, Zylin AS, +47 917 86 146
>>> _______________________________________________
>>> gem5-users mailing list
>>> [email protected]
>>> http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
>>
>>
>> _______________________________________________
>> gem5-users mailing list
>> [email protected]
>> http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
>>
>
>
>
> --
> Øyvind Harboe, General Manager, Zylin AS, +47 917 86 146
> _______________________________________________
> gem5-users mailing list
> [email protected]
> http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
_______________________________________________
gem5-users mailing list
[email protected]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users

Reply via email to