changeset 9d0aef7a9b2e in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=9d0aef7a9b2e
description:
        config: Add --memchecker option

        This patch adds the --memchecker option, to denote that a MemChecker
        should be instantiated for the system. The exact usage of the MemChecker
        depends on the system configuration.

        For now CacheConfig.py makes use of the option, adding MemCheckerMonitor
        instances between CPUs and D-Caches.

        Note, however, that currently this only provides limited checking on a
        running system; other parts of the system, such as I/O devices are not
        monitored, and may cause warnings to be issued by the monitor.

diffstat:

 configs/common/CacheConfig.py |  25 +++++++++++++++++++++++++
 configs/common/Options.py     |   2 ++
 2 files changed, 27 insertions(+), 0 deletions(-)

diffs (61 lines):

diff -r 6332c9d471a8 -r 9d0aef7a9b2e configs/common/CacheConfig.py
--- a/configs/common/CacheConfig.py     Tue Dec 23 09:31:17 2014 -0500
+++ b/configs/common/CacheConfig.py     Tue Dec 23 09:31:18 2014 -0500
@@ -76,6 +76,9 @@
         system.l2.cpu_side = system.tol2bus.master
         system.l2.mem_side = system.membus.slave
 
+    if options.memchecker:
+        system.memchecker = MemChecker()
+
     for i in xrange(options.num_cpus):
         if options.caches:
             icache = icache_class(size=options.l1i_size,
@@ -83,6 +86,21 @@
             dcache = dcache_class(size=options.l1d_size,
                                   assoc=options.l1d_assoc)
 
+            if options.memchecker:
+                dcache_mon = MemCheckerMonitor(warn_only=True)
+                dcache_real = dcache
+
+                # Do not pass the memchecker into the constructor of
+                # MemCheckerMonitor, as it would create a copy; we require
+                # exactly one MemChecker instance.
+                dcache_mon.memchecker = system.memchecker
+
+                # Connect monitor
+                dcache_mon.mem_side = dcache.cpu_side
+
+                # Let CPU connect to monitors
+                dcache = dcache_mon
+
             # When connecting the caches, the clock is also inherited
             # from the CPU in question
             if buildEnv['TARGET_ISA'] == 'x86':
@@ -91,6 +109,13 @@
                                                       PageTableWalkerCache())
             else:
                 system.cpu[i].addPrivateSplitL1Caches(icache, dcache)
+
+            if options.memchecker:
+                # The mem_side ports of the caches haven't been connected yet.
+                # Make sure connectAllPorts connects the right objects.
+                system.cpu[i].dcache = dcache_real
+                system.cpu[i].dcache_mon = dcache_mon
+
         system.cpu[i].createInterruptController()
         if options.l2cache:
             system.cpu[i].connectAllPorts(system.tol2bus, system.membus)
diff -r 6332c9d471a8 -r 9d0aef7a9b2e configs/common/Options.py
--- a/configs/common/Options.py Tue Dec 23 09:31:17 2014 -0500
+++ b/configs/common/Options.py Tue Dec 23 09:31:18 2014 -0500
@@ -97,6 +97,8 @@
     parser.add_option("-l", "--lpae", action="store_true")
     parser.add_option("-V", "--virtualisation", action="store_true")
 
+    parser.add_option("--memchecker", action="store_true")
+
     # Cache Options
     parser.add_option("--caches", action="store_true")
     parser.add_option("--l2cache", action="store_true")
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to