Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes&updates for tlmu-1.4.0 after trying it #1

Open
wants to merge 8 commits into
base: tlmu-1.4.0
Choose a base branch
from

Conversation

buaaliyi
Copy link

Hi,

I'm interest in your project hdlab/tlmu. After trying build and run the code on my test bench, I've made little update commits to it. As the followings:

  1. fix vnc-tls compilation with newer versions of GNU-TLS
    I found the code can't compile correctly in case that the current version of GNU-TLS changes an interface
  2. tlmu:fixed makefile for tlmu-doc.html generation
    after make && make tlmu, I found the tlmu-doc.html is not generated, so this commit fix the issue
  3. tlmu:modern SystemC includes TLM, so removed duplicate includings
    now that SystemC releases together with TLM-2.0, there is dumplicate including of it
  4. tlmu:fix SDL multithreading bug by temporary add '-nographic'
    I found there's an issue with multi-threading SDL call, so here using arg '-nographic' to avoid it when launching with qemu. Maybe this is an temporary solution, any better one may carry on in the future.

After all, I will keep on watching on this nice project TLMu and try my best to make it better, as well as, up-to-date with QEMU mainstream.

Thank you for your work!

LI Yi

issue description:
  [xcb] Unknown request in queue while dequeuing
  [xcb] Most likely this is a multi-threaded client and XInitThreads has
  not been called
  [xcb] Aborting, sorry about that.
  ../../src/xcb_io.c:178: dequeue_pending_request: Assertion
  `!xcb_xlib_unknown_req_in_deq' failed. Aborted
@yTakatsukasa
Copy link

Hi, LI Yi

Thank you for paying attention for our project.
I appliciate your patches.

Examples failes on my environment. Now I am checking it.
So please give me some more time to fix it.

I will pull 3 of your commits, but
I would like to keep tests/tlmu/sc_example/Makefile to let TLMu example still compatible with SystemC-2.2.
If you find a problem with SystemC-2.3, please let me know.

TLMu uses small portion of QEMU codes, so it is safe to disable non-necessary features during configure.
I use the following setting.

./configure --extra-cflags=-fPIC --disable-pie --disable-curses --disable-sdl --disable-vnc --disable-xen --disable-kvm --target-list=or32-softmmu,arm-softmmu,mipsel-softmmu,cris-softmmu

I am very happy to have feedback from you.
Regards, Yutetsu.

@buaaliyi
Copy link
Author

Hi,
Thank you for your reply. The followings are those topics I hope to discuss with you.

""" Examples failes on my environment. Now I am checking it. """
I have met "Segment Fault" trouble when I did run 'sc_example' (unmodified with NR_CPU3==3, NR_DEVICES==3) for several times. On the other side, it seems not parallel run as expected, only mipsel output availiable (c_example ).
Here is an example output that I run this program three times, and the last one crashed with "Segment Fault", while the first two print MIPSEL's output only.
output
So I propose that qemu-1.4.0 may not be well compatible with pthread or SystemC-2.3, I'll tracking this problem and come up with solution if possible.

""" I will pull 3 of your commits, but
I would like to keep tests/tlmu/sc_example/Makefile to let TLMu example still compatible with SystemC-2.2. """
You're right, thank you

Otherwise, I'd like to introduce process-level qemu-tlm model besides multi-threading c_example and sc_example. For example, add new example programs to introduce how to launch TLMu with other process (written in SystemC), in this mean TLMu is regarded as simulator core, and another SystemC process may be the TLM-level simulation of a bus model or else analogous. What do you think about it, worth for work?

Best Regards,
LI Yi

@yTakatsukasa
Copy link

Hi

Program stucks after I inserted some usleep() to change the timing of threads. The behavior depends on the environment because it looks racing problem. I guess this problem appears SEGV in your environment.
I think this problem happens in the synchroize mechanism with real-world, which is not necessary for TLMu.
So the solutions I have now are following 3 ideas.

  • Disable synchronize functionality for TLMu
  • Use IPC instead of pthreads (your idea)
  • Static Link for each libtlmu-arch.so

The first one provides better performance but I have to dive into the deep source code.
The second one should allow us to avoid such instability. But it will get slower, inter process communication is expensive and requires SystemC-2.3 to integrate with.
The third one is ugly trick and I have less confident than the former 2 ideas. The racing may happening at threading part of GTK, which is shared between TLMu instances. If GTK is linked staticaly for each TLMu instance, I hope the racing will be avoided.

Your idea sounds best so far. I would appriciate if you make it in public.
I will consider the 1st idea or any other way.

Regards,
Yutetsu.

@alexcmoa
Copy link

Hi,

Thanks for this project.
Just to say that I've reproduced the problem you were discussing 9 months ago.
It failed from time to time with the callstack below.
Any news about the possible fix you were mentionning ?

Thanks & Regards,
Alexandre

anabais@SFLinux:~/work/simu/hdlab/tlmu/build-tlmu/tests/tlmu$ gdb ./sc_example/sc_example
GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
http://bugs.launchpad.net/gdb-linaro/...
Reading symbols from /home/anabais/work/simu/hdlab/tlmu/build-tlmu/tests/tlmu/sc_example/sc_example...done.
(gdb) r
Starting program: /home/anabais/work/simu/hdlab/tlmu/build-tlmu/tests/tlmu/sc_example/sc_example
warning: no loadable sections found in added symbol-file system-supplied DSO at 0x7ffff7ffa000
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

         SystemC 2.3.0-ASI --- Jan  3 2014 09:57:29
    Copyright (c) 1996-2012 by all Contributors,
    ALL RIGHTS RESERVED

[New Thread 0x7fffef96c700 (LWP 31476)]
[New Thread 0x7fffed036700 (LWP 31477)]

Program received signal SIGUSR1, User defined signal 1.
[Switching to Thread 0x7fffef96c700 (LWP 31476)]
0x00007ffff6c156e0 in sigprocmask () from /lib/x86_64-linux-gnu/libc.so.6
(gdb) bt
#0 0x00007ffff6c156e0 in sigprocmask () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x000000000041db07 in tlmu_hosttimer_block () at /home/anabais/work/simu/hdlab/tlmu/tlmu.c:113
edgarigl#2 tlmu_timer_start (o=0x68e430, cb_o=0x0, cb=0x7ffff4628c30, delta_ns=250000) at /home/anabais/work/simu/hdlab/tlmu/tlmu.c:144
edgarigl#3 0x00007ffff4629932 in ?? () from .tlmu/libtlmu-arm.so-top.arm0
edgarigl#4 0x00007ffff4629902 in ?? () from .tlmu/libtlmu-arm.so-top.arm0
edgarigl#5 0x00007ffff45cb1b0 in ?? () from .tlmu/libtlmu-arm.so-top.arm0
edgarigl#6 0x00007ffff469e406 in ?? () from .tlmu/libtlmu-arm.so-top.arm0
edgarigl#7 0x00007ffff469fb87 in ?? () from .tlmu/libtlmu-arm.so-top.arm0
edgarigl#8 0x00007ffff4717886 in ?? () from .tlmu/libtlmu-arm.so-top.arm0
#9 0x00007ffff471a555 in ?? () from .tlmu/libtlmu-arm.so-top.arm0
#10 0x00007ffff47191de in ?? () from .tlmu/libtlmu-arm.so-top.arm0
#11 0x00007ffff469ec0a in ?? () from .tlmu/libtlmu-arm.so-top.arm0
#12 0x00007ffff469eca1 in ?? () from .tlmu/libtlmu-arm.so-top.arm0
#13 0x00007ffff45ca8f2 in ?? () from .tlmu/libtlmu-arm.so-top.arm0
#14 0x00007ffff4675eef in vl_main () from .tlmu/libtlmu-arm.so-top.arm0
#15 0x000000000040f6ee in tlmu_sc::process (this=0x68d9f0) at /home/anabais/work/simu/hdlab/tlmu/tests/tlmu/sc_example/tlmu_sc.cc:439
#16 0x0000000000438600 in sc_core::sc_thread_cor_fn(void*) ()
#17 0x0000000000000000 in ?? ()
(gdb) f 15
#15 0x000000000040f6ee in tlmu_sc::process (this=0x68d9f0) at /home/anabais/work/simu/hdlab/tlmu/tests/tlmu/sc_example/tlmu_sc.cc:439
439 tlmu_run(&q);
(gdb) p q
$1 = {name = 0x68d558 "top.arm0", timer = {expire_time = 0, pending = 0, o = 0x0, cb = 0, next = 0x6813a8}, dl_handle = 0x691d70, argv = {
0x45b584 "TLMu", 0x45b589 "-qmp", 0x45b58e "null", 0x451c87 "-clock", 0x451c8e "tlm", 0x451c82 "-cpu", 0x44a82e "arm926",
0x451c87 "-clock", 0x451c8e "tlm", 0x451c92 "-M", 0x451c95 "tlm-mach", 0x451c9e "-kernel", 0x44a844 "arm-guest/guest",
0x451ca6 "-icount", 0x45d5b9 "1", 0x0 <repeats 85 times>}, main = 0x7ffff4674fe0 <vl_main>, tlm_map_ram = 0x7ffff45cb690 <tlm_map_ram>,
tlm_opaque = 0x7ffff5360bc0, tlm_timer_opaque = 0x7ffff5360bc8, tlm_image_load_base = 0x7ffff4b00af8,
tlm_image_load_size = 0x7ffff4b00af0, tlm_set_log_filename = 0x7ffff4686950 <cpu_set_log_filename>,
tlm_notify_event = 0x7ffff45cb430 <tlm_notify_event>, tlm_timer_start = 0x7ffff5360bd0, tlm_sync = 0x7ffff5360be0,
tlm_sync_period_ns = 0x7ffff4b00b00, tlm_boot_state = 0x7ffff5360be8, tlm_bus_access_cb = 0x7ffff5360bb8,
tlm_bus_access_dbg_cb = 0x7ffff5360bd8, tlm_bus_access = 0x7ffff45cb300 <tlm_bus_access>,
tlm_bus_access_dbg = 0x7ffff45cb340 <tlm_bus_access_dbg>, tlm_get_dmi_ptr_cb = 0x7ffff4b00b08,
tlm_get_dmi_ptr = 0x7ffff45cb380 <tlm_get_dmi_ptr>, qemu_system_shutdown_request = 0x7ffff4674c10 <qemu_system_shutdown_request>}
(gdb) q
A debugging session is active.

    Inferior 1 [process 31473] will be killed.

Quit anyway? (y or n) y

@yTakatsukasa
Copy link

Hi

I am sorry for my late response.
Honestly, the situation is same.
The problem happens only when more than 2 TLMu instances are created, so you can ignore this if you want to use a single instance of TLMu.
If you try to fix this, multi-process method as LI Yi mentioned will be the easiest way though it may have some performance degradation.

Regards,
Yutetsu.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants