gem5.git
10 years agoconfig: add num-work-ids command line option
Gedare Bloom [Thu, 10 Apr 2014 18:43:33 +0000 (13:43 -0500)]
config: add num-work-ids command line option
Adds the parameter --num-work-ids to Options.py and reads the parameter
into the System params in Simulation.py. This parameter enables setting
the number of possible work items to different than 16. Support for this
parameter already exists in src/sim/System.py, so this changeset only
affects the Python config files.

Committed by: Nilay Vaish <nilay@cs.wisc.edu>

10 years agoscons: compile on systems where python2 and python3 co-exist
Stian Hvatum [Thu, 10 Apr 2014 18:40:15 +0000 (13:40 -0500)]
scons: compile on systems where python2 and python3 co-exist
Compile gem5 on systems where python2 and python3 co-exists without any
changes in path. python2-config is chosen over python-config if it exists.

Committed by: Nilay Vaish <nilay@cs.wisc.edu>

10 years agokvm, x86: Add initial support for multicore simulation
Andreas Sandberg [Wed, 9 Apr 2014 14:01:58 +0000 (16:01 +0200)]
kvm, x86: Add initial support for multicore simulation

Simulating a SMP or multicore requires devices to be shared between
multiple KVM vCPUs. This means that locking is required when accessing
devices. This changeset adds the necessary locking to allow devices to
execute correctly. It is implemented by temporarily migrating the KVM
CPU to the VM's (and devices) event queue when handling
MMIO. Similarly, the VM migrates to the interrupt controller's event
queue when delivering an interrupt.

The support for fast-forwarding of multicore simulations added by this
changeset assumes that all devices in a system are simulated in the
same thread and each vCPU has its own thread. Special care must be
taken to ensure that devices living under the CPU in the object
hierarchy (e.g., the interrupt controller) do not inherit the parent
CPUs thread and are assigned to device thread. The KvmVM object is
assumed to live in the same thread as the other devices in the system.

10 years agodev: Protect PollEvent processing when running in parallel mode
Andreas Sandberg [Wed, 9 Apr 2014 14:01:43 +0000 (16:01 +0200)]
dev: Protect PollEvent processing when running in parallel mode

The calling thread is undefined when the PollQueue services events.
This implies that PollEvents need to handle the case where they are
processed from a different thread than the thread that created the
event. This changeset adds temporary event queue migrations to the VNC
server, the ethernet tap device, and the terminal to protect them from
inter-thread calls.

10 years agoruby: slicc: change enqueue statement
Nilay Vaish [Tue, 8 Apr 2014 18:26:30 +0000 (13:26 -0500)]
ruby: slicc: change enqueue statement
As of now, the enqueue statement can take in any number of 'pairs' as
argument.  But we only use the pair in which latency is the key.  This
latency is allowed to be either a fixed integer or a member variable of
controller in which the expression appears.  This patch drops the use of pairs
in an enqueue statement.  Instead, an expression is allowed which will be
interpreted to be the latency of the enqueue.  This expression can anything
allowed by slicc including a constant integer or a member variable.

10 years agoruby: coherence protocols: drop the phrase IntraChip
Nilay Vaish [Tue, 8 Apr 2014 18:26:29 +0000 (13:26 -0500)]
ruby: coherence protocols: drop the phrase IntraChip
The phrase is no longer valid since we do not distinguish between
inter and intra chip communication.

10 years agosim: Add the ability to lock and migrate between event queues
Andreas Sandberg [Thu, 3 Apr 2014 09:22:49 +0000 (11:22 +0200)]
sim: Add the ability to lock and migrate between event queues

We need the ability to lock event queues to enable device accesses
across threads. The serviceOne() method now takes a service lock prior
to handling a new event. By locking an event queue, a different
thread/eq can effectively execute in the context of the locked event
queue. To simplify temporary event queue migrations, this changeset
introduces the EventQueue::ScopedMigration class that unlocks the
current event queue, locks a new event queue, and updates the current
event queue variable.

In order to prevent deadlocks, event queues need to be released when
waiting on barriers. This is implemented using the
EventQueue::ScopedRelease class. An instance of this class is, for
example, used in the BaseGlobalEvent class to release the event queue
when waiting on the synchronization barrier.

The intended use for this functionality is when devices need to be
accessed across thread boundaries. For example, when fast-forwarding,
it might be useful to run devices and CPUs in separate threads. In
such a case, the CPU locks the device queue whenever it needs to
perform IO.  This functionality is primarily intended for KVM.

Note: Migrating between event queues can lead to non-deterministic
timing. Use with extreme care!

--HG--
extra : rebase_source : 23e3a741a1fd73861d1339782dbbe1bc76285315

10 years agoext: add McPAT source
Anthony Gutierrez [Tue, 1 Apr 2014 16:44:30 +0000 (12:44 -0400)]
ext: add McPAT source

this patch adds the source for mcpat, a power, area, and timing modeling
framework.

10 years agoarm: fix typos in makefile for ARM m5 util and link statically
Anthony Gutierrez [Tue, 1 Apr 2014 16:35:31 +0000 (12:35 -0400)]
arm: fix typos in makefile for ARM m5 util and link statically

1) fixes a typo for clean target libgemOpJni.so -> libgem5OpJni.so
2) addes jni_gem5Op.h to clean since it is added during make
3) links the m5 utility statically since it won't work on some images otherwise

10 years agoconfigs: use SimpleMemory when using ruby in se mode
Nilay Vaish [Tue, 1 Apr 2014 16:17:46 +0000 (11:17 -0500)]
configs: use SimpleMemory when using ruby in se mode
A recent changeset altered the default memory class to DRAMCtrl.  In se mode,
ruby uses the physical memory to check if a given address is within the bounds
of the physical memory.  SimpleMemory is enough for this.  Moreover,
SimpleMemory does not check whether it is connected or not, something which
DRAMCtrl does.

10 years agocpu: o3: lsq: Fix TSO implementation
Marco Elver [Tue, 25 Mar 2014 18:15:04 +0000 (13:15 -0500)]
cpu: o3: lsq: Fix TSO implementation
This patch fixes violation of TSO in the O3CPU, as all loads must be
ordered with all other loads. In the LQ, if a snoop is observed, all
subsequent loads need to be squashed if the system is TSO.

Prior to this patch, the following case could be violated:

 P0         | P1          ;
 MOV [x],mail=/usr/spool/mail/nilay | MOV EAX,[y] ;
 MOV [y],mail=/usr/spool/mail/nilay | MOV EBX,[x] ;

exists (1:EAX=1 /\ 1:EBX=0) [is a violation]

The problem was found using litmus [http://diy.inria.fr].

Committed by: Nilay Vaish <nilay@cs.wisc.edu

10 years agostats: Update stats for DRAM changes
Andreas Hansson [Sun, 23 Mar 2014 15:12:19 +0000 (11:12 -0400)]
stats: Update stats for DRAM changes

This patch updates the stats to reflect the changes to the DRAM
controller.

10 years agomem: Track DRAM read/write switching and add hysteresis
Andreas Hansson [Sun, 23 Mar 2014 15:12:14 +0000 (11:12 -0400)]
mem: Track DRAM read/write switching and add hysteresis

This patch adds stats for tracking the number of reads/writes per bus
turn around, and also adds hysteresis to the write-to-read switching
to ensure that the queue does not oscilate around the low threshold.

10 years agomem: Rename SimpleDRAM to a more suitable DRAMCtrl
Andreas Hansson [Sun, 23 Mar 2014 15:12:12 +0000 (11:12 -0400)]
mem: Rename SimpleDRAM to a more suitable DRAMCtrl

This patch renames the not-so-simple SimpleDRAM to a more suitable
DRAMCtrl. The name change is intended to ensure that we do not send
the wrong message (although the "simple" in SimpleDRAM was originally
intended as in cleverly simple, or elegant).

As the DRAM controller modelling work is being presented at ISPASS'14
our hope is that a broader audience will use the model in the future.

--HG--
rename : src/mem/SimpleDRAM.py => src/mem/DRAMCtrl.py
rename : src/mem/simple_dram.cc => src/mem/dram_ctrl.cc
rename : src/mem/simple_dram.hh => src/mem/dram_ctrl.hh

10 years agomem: Change memory defaults to be more representative
Andreas Hansson [Sun, 23 Mar 2014 15:12:10 +0000 (11:12 -0400)]
mem: Change memory defaults to be more representative

Make the default memory type DDR3-1600 x64, and use the open-adaptive
page policy. This change is aiming to ensure that users by default are
using a realistic memory system.

10 years agomem: Add close adaptive paging policy to DRAM controller model
Wendy Elsasser [Sun, 23 Mar 2014 15:12:08 +0000 (11:12 -0400)]
mem: Add close adaptive paging policy to DRAM controller model

This patch adds a second adaptive page policy to the DRAM controller,
closing the page unless there are already queued accesses to the open
page.

10 years agomem: DRAM controller tidying up
Andreas Hansson [Sun, 23 Mar 2014 15:12:06 +0000 (11:12 -0400)]
mem: DRAM controller tidying up

Minor tidying up and removing of redundant code, including the
printing of queue state every million accesses.

10 years agomem: Fix bug in DRAM bytes per activate
Andreas Hansson [Sun, 23 Mar 2014 15:12:05 +0000 (11:12 -0400)]
mem: Fix bug in DRAM bytes per activate

This patch ensures that we do not sample the bytes per activate when
the row has already been closed.

10 years agomem: Limit the accesses to a page before forcing a precharge
Andreas Hansson [Sun, 23 Mar 2014 15:12:03 +0000 (11:12 -0400)]
mem: Limit the accesses to a page before forcing a precharge

This patch adds a basic starvation-prevention mechanism where a DRAM
page is forced to close after a certain number of accesses. The limit
is combined with the open and open-adaptive page policy and if reached
causes an auto-precharge.

10 years agomem: Make DRAM write queue draining more aggressive
Andreas Hansson [Sun, 23 Mar 2014 15:12:01 +0000 (11:12 -0400)]
mem: Make DRAM write queue draining more aggressive

This patch changes the triggering condition for the write draining
such that we grab the opportunity to issue writes if there are no
reads waiting (as opposed to waiting for the writes to reach the high
threshold). As a result, we potentially drain some of the writes in read
idle periods (if any).

A low threshold is added to be able to control how many write bursts
are kept in the memory controller queue (acting as on-chip storage).

The high and low thresholds are updated to sensible values for a 32/64
size write buffer. Note that the thresholds should be adjusted along
with the queue sizes.

This patch also adds some basic initialisation sanity checks and moves
part of the initialisation to the constructor.

10 years agoconfig: Add a DRAM efficiency-sweep script
Andreas Hansson [Sun, 23 Mar 2014 15:12:00 +0000 (11:12 -0400)]
config: Add a DRAM efficiency-sweep script

This patch adds a configuration that simplifies evaluation of DRAM
controller configurations by automating a sweep of stride size and
bank parallelism. It works in a rather unconventional way, as it needs
to print the traffic generator stimuli based on the memory
organisation. Hence, it starts by configuring the memory, then it
prints a traffic-generator config file, and loads it.

The resulting stats have one period per data point, identified by the
stride size, and the number of banks being used.

10 years agocpu: DRAM Traffic Generator
Neha Agarwal [Sun, 23 Mar 2014 15:11:58 +0000 (11:11 -0400)]
cpu: DRAM Traffic Generator

This patch enables a new 'DRAM' mode to the existing traffic
generator, catered to generate specific requests to DRAM based on
required hit length (stride size) and bank utilization. It is an add on
to the Random mode.

The basic idea is to control how many successive packets target the
same page, and how many banks are being used in parallel. This gives a
two-dimensional space that stresses different aspects of the DRAM
timing.

The configuration file needed to use this patch has to be changed as
follow: (reference to Random Mode, LPDDR3 memory type)

'STATE 0 10000000000 RANDOM 50 0 134217728 64 3004 5002 0'
-> 'STATE 0 10000000000 DRAM 50 0 134217728 32 3004 5002 0 96 1024 8 6 1'

The last 4 parameters to be added are:
<stride size (bytes), page size(bytes), number of banks available in DRAM,
    number of banks to be utilized, address mapping scheme>

The address mapping information is used to get the stride address
stream of the specified size and to know where to find the bank
bits. The configuration file has a parameter where '0'-> RoCoRaBaCh,
'1'-> RoRaBaCoCh/RoRaBaChCo address-mapping schemes. Note that the
generator currently assumes a single channel and a single rank. This
is to avoid overwhelming the traffic generator with information about
the memory organisation.

10 years agomem: DDR3 config for comparing with DRAMSim2
Neha Agarwal [Sun, 23 Mar 2014 15:11:56 +0000 (11:11 -0400)]
mem: DDR3 config for comparing with DRAMSim2

This patch adds a new DDR3 configuration to match with the parameters
that are specified in one of the DDR3 configs used in DRAMSim2.

10 years agomem: More descriptive address-mapping scheme names
Andreas Hansson [Sun, 23 Mar 2014 15:11:53 +0000 (11:11 -0400)]
mem: More descriptive address-mapping scheme names

This patch adds the row bits to the name of the address mapping
schemes to make it more clear that all the current schemes places the
row bits as the most significant bits.

10 years agoscons: Shush scons
Curtis Dunham [Sun, 23 Mar 2014 15:11:51 +0000 (11:11 -0400)]
scons: Shush scons

make 'scons -s' actually silent.

10 years agomisc: Fix -q (quiet) flag
Stan Czerniawski [Sun, 23 Mar 2014 15:11:49 +0000 (11:11 -0400)]
misc: Fix -q (quiet) flag

Check the right flag.

10 years agoruby: Move Ruby debug flags to ruby dir and remove stale options
Andreas Hansson [Sun, 23 Mar 2014 15:11:48 +0000 (11:11 -0400)]
ruby: Move Ruby debug flags to ruby dir and remove stale options

This patch moves the Ruby-related debug flags to the ruby
sub-directory, and also removes the state SConsopts that add the
no-longer-used NO_VECTOR_BOUNDS_CHECK.

10 years agoutil: Add support for detection of gzipped packet traces
Andreas Hansson [Sun, 23 Mar 2014 15:11:46 +0000 (11:11 -0400)]
util: Add support for detection of gzipped packet traces

This patch adds support for automatically detecting a gzipped packet
trace, thus accepting either a compressed or uncompressed trace.

10 years agomem: Include the DRAMSim2 wrapper in NULL build
Andreas Hansson [Sun, 23 Mar 2014 15:11:44 +0000 (11:11 -0400)]
mem: Include the DRAMSim2 wrapper in NULL build

This patch makes sure DRAMSim2 is included in a build of the NULL ISA.

10 years agoext: Fix typo in DRAMSim2 SConscript
Andreas Hansson [Sun, 23 Mar 2014 15:11:42 +0000 (11:11 -0400)]
ext: Fix typo in DRAMSim2 SConscript

This patch fixes a typo in the SConscript which caused the DRAMSim2
sources to be built without the appropriate flags.

10 years agomem: CommMonitor trace warn on non-timing mode
Sascha Bischoff [Sun, 23 Mar 2014 15:11:40 +0000 (11:11 -0400)]
mem: CommMonitor trace warn on non-timing mode

Add a warning to the CommMonitor which will alert the user if they try
and record a trace when the system is not in timing mode.

10 years agocpu: Add basic check to TrafficGen initial state
Stan Czerniawski [Sun, 23 Mar 2014 15:11:39 +0000 (11:11 -0400)]
cpu: Add basic check to TrafficGen initial state

Prevent incomplete configuration of TrafficGen class from causing
segmentation faults. If an 'INIT' line is not present in the
configuration file then the currState variable will remain
uninitialized which may result in a crash.

10 years agodev: Fix IsaFake's cxx_header setting
Andrew Bardsley [Sun, 23 Mar 2014 15:11:37 +0000 (11:11 -0400)]
dev: Fix IsaFake's cxx_header setting

cxx_header was set incorrectly on IsaFake

10 years agoarm: m5ops readfile64 args broken, offset coming through garbage
Eric Van Hensbergen [Sun, 23 Mar 2014 15:11:34 +0000 (11:11 -0400)]
arm: m5ops readfile64 args broken, offset coming through garbage

There were several sections of the m5ops code which were
essentially copy/pasted versions of the 32-bit code. The
problem is that some of these didn't account fo4 64-bit
registers leading to arguments being in the wrong registers.
This patch addresses the args for readfile64, writefile64,
and addsymbol64 -- all of which seemed to suffer from a
similar set of problems when moving to 64-bit.

10 years agobase: Fix error message time unit (cycle -> tick)
Andreas Hansson [Sun, 23 Mar 2014 15:11:32 +0000 (11:11 -0400)]
base: Fix error message time unit (cycle -> tick)

This patch fixes the unit used in all error messages.

10 years agostats: updates due to changes to ruby config scripts
Nilay Vaish [Thu, 20 Mar 2014 14:16:35 +0000 (09:16 -0500)]
stats: updates due to changes to ruby config scripts
These updates to ruby regression stats are due to renaming piobus to iobus
and dropping piobus in the se mode.

10 years agoruby: consumer: avoid accessing wakeup times when waking up
Nilay Vaish [Thu, 20 Mar 2014 14:14:14 +0000 (09:14 -0500)]
ruby: consumer: avoid accessing wakeup times when waking up
Each consumer object maintains a set of tick values when the object is supposed
to wakeup and do some processing.  As of now, the object accesses this set both
when scheduling a wakeup event and when the object actually wakes up.  The set
is accessed during wakeup to remove the current tick value from the set.  This
functionality is now being moved to the scheduling function where ticks are
removed at a later time.

10 years agoruby: garnet: convert network interfaces into clocked objects
Nilay Vaish [Thu, 20 Mar 2014 14:14:14 +0000 (09:14 -0500)]
ruby: garnet: convert network interfaces into clocked objects
This helps in configuring the network interfaces from the python script and
these objects no longer rely on the network object for the timing information.

10 years agoruby: slicc: code refactor
Nilay Vaish [Thu, 20 Mar 2014 14:14:14 +0000 (09:14 -0500)]
ruby: slicc: code refactor

10 years agoconfig: ruby: rename _cpu_ruby_ports to _cpu_ports
Nilay Vaish [Thu, 20 Mar 2014 14:14:14 +0000 (09:14 -0500)]
config: ruby: rename _cpu_ruby_ports to _cpu_ports

10 years agoconfig: fs.py: move creating of test/drive systems to functions
Nilay Vaish [Thu, 20 Mar 2014 14:14:08 +0000 (09:14 -0500)]
config: fs.py: move creating of test/drive systems to functions
The code that creates test and drive systems is being moved to separate
functions so as to make the code more readable.  Ultimately the two
functions would be combined so that the replicated code is eliminated.

10 years agoconfig: remove ruby_fs.py
Nilay Vaish [Thu, 20 Mar 2014 13:03:09 +0000 (08:03 -0500)]
config: remove ruby_fs.py

The patch removes the ruby_fs.py file.  The functionality is being moved to
fs.py.  This would being ruby fs simulations in line with how ruby se
simulations are started (using --ruby option).  The alpha fs config functions
are being combined for classing and ruby memory systems.  This required
renaming the piobus in ruby to iobus.  So, we will have stats being renamed
in the stats file for ruby fs regression.

10 years agoruby: no piobus in se mode
Nilay Vaish [Thu, 20 Mar 2014 13:03:09 +0000 (08:03 -0500)]
ruby: no piobus in se mode
Piobus was recently added to se scripts for ruby so that the interrupt
controller can be connected to something (required since the interrupt
controller sends address range messages).  This patch removes the piobus
and instead, the pio port of ruby port will now ignore the range change
messages in se mode.

10 years agoconfig: ruby: remove piobus from protocols
Nilay Vaish [Mon, 17 Mar 2014 22:40:15 +0000 (17:40 -0500)]
config: ruby: remove piobus from protocols
This patch removes the piobus from the protocol config files.  The ports
are now connected to the piobus in the Ruby.py file.

10 years agoruby: remove some of the unnecessary code
Nilay Vaish [Mon, 17 Mar 2014 22:40:14 +0000 (17:40 -0500)]
ruby: remove some of the unnecessary code

10 years agokvm: Clean up signal handling
Andreas Sandberg [Sun, 16 Mar 2014 16:40:58 +0000 (17:40 +0100)]
kvm: Clean up signal handling

KVM used to use two signals, one for instruction count exits and one
for timer exits. There is really no need to distinguish between the
two since they only trigger exits from KVM. This changeset unifies and
renames the signals and adds a method, kick(), that can be used to
raise the control signal in the vCPU thread. It also removes the early
timer warning since we do not normally see if the signal was
delivered.

--HG--
extra : rebase_source : cd0e45ca90894c3d6f6aa115b9b06a1d8f0fda4d

10 years agokvm: x86: Adjust PC to remove the CS segment base address
Andreas Sandberg [Sun, 16 Mar 2014 16:30:24 +0000 (17:30 +0100)]
kvm: x86: Adjust PC to remove the CS segment base address

gem5 seems to store the PC as RIP+CS_BASE. This is not what KVM
expects, so we need to subtract CS_BASE prior to transferring the PC
into KVM. This changeset adds the necessary PC manipulation and
refactors thread context updates slightly to avoid reading registers
multiple times from KVM.

--HG--
extra : rebase_source : 3f0569dca06a1fcd8694925f75c8918d954ada44

10 years agokvm: x86: Add support for x86 INIT and STARTUP handling
Andreas Sandberg [Sun, 16 Mar 2014 16:28:23 +0000 (17:28 +0100)]
kvm: x86: Add support for x86 INIT and STARTUP handling

This changeset adds support for INIT and STARTUP IPI handling. We
currently handle both of these interrupts in gem5 and transfer the
state to KVM. Since we do not have a BIOS loaded, we pretend that the
INIT interrupt suspends the CPU after reset.

--HG--
extra : rebase_source : 7f3b25f3801d68f668b6cd91eaf50d6f48ee2a6a

10 years agoalpha: Small removal of dead comments/code from alpha ISA
Paul Rosenfeld [Wed, 12 Mar 2014 12:03:22 +0000 (07:03 -0500)]
alpha: Small removal of dead comments/code from alpha ISA

Committed by: Nilay Vaish <nilay@cs.wisc.edu>

10 years agocpu: Make CPU and ThreadContext getters const
Andreas Hansson [Fri, 7 Mar 2014 20:56:23 +0000 (15:56 -0500)]
cpu: Make CPU and ThreadContext getters const

This patch merely tidies up the CPU and ThreadContext getters by
making them const where appropriate.

10 years agoarm: Handle functional TLB walks properly
Geoffrey Blake [Fri, 7 Mar 2014 20:56:23 +0000 (15:56 -0500)]
arm: Handle functional TLB walks properly

The table walker code currently accounts for two types of walks,
Atomic and Timing, and treats them differently. Atomic walks keep a
single instance of WalkerState around for all walks to use in
currState. Timing mode keeps a queue of in-flight WalkerStates and
maintains currState as NULL between walks.

If a functional walk is done during Timing mode, it is treated as an
atomic walk and either creates a persistent WalkerState if in between
Timing walks, or stomps an existing currState for an in-progress
Timing walk.

This patch distinguishes functional walks as being able to exist at
any time and sets up a temporary WalkerState for its exclusive use and
then cleans up when finished, leaving any in progress Atomic or Timing
walks undisturbed.

10 years agomem: Fix incorrect assert failure in the Cache
Prakash Ramrakhyani [Fri, 7 Mar 2014 20:56:23 +0000 (15:56 -0500)]
mem: Fix incorrect assert failure in the Cache

This patch fixes an assert condition that is not true at all
times. There are valid situations that arise in dual-core
dual-workload runs where the assert condition is false. The function
call following the assert however needs to be called only when the
condition is true (a block cannot be invalidated in the tags structure
if has not been allocated in the structure, and the tempBlock is never
allocated). Hence the 'assert' has been replaced with an 'if'.

10 years agomem: Edit proto Packet and enhance the python script
Radhika Jagtap [Fri, 7 Mar 2014 20:56:23 +0000 (15:56 -0500)]
mem: Edit proto Packet and enhance the python script

This patch changes the decode script to output the optional fields of
the proto message Packet, namely id and flags. The flags field is set
by the communication monitor.

The id field is useful for CPU trace experiments, e.g. linking the
fetch side to decode side. It had to be renamed because it clashes
with a built in python function id() for getting the "identity" of an
object.

This patch also takes a few common function definitions out from the
multiple scripts and adds them to a protolib python module.

10 years agoscons: Fix clang version identification for OSX
Mitch Hayenga [Fri, 7 Mar 2014 20:56:23 +0000 (15:56 -0500)]
scons: Fix clang version identification for OSX

The version string may have additional trailing information

10 years agomisc: Add panic_if / fatal_if / chatty_assert
Stephan Diestelhorst [Fri, 7 Mar 2014 20:56:23 +0000 (15:56 -0500)]
misc: Add panic_if / fatal_if / chatty_assert

This snippet can be used to replace if + {panics, fatals, asserts} constructs.
The idea is to have both the condition checking and a verbose printout in a single statement.  The interface is as follows:

panic_if(foo != bar, "These should be equal: foo %i bar %i", foo, bar);
fatal_if(foo != bar, "These should be equal: foo %i bar %i", foo, bar);
chatty_assert(foo == bar, "These should be equal: foo %i bar %i", foo, bar);

10 years agoscons: Fixes uninitialized warnings issued by clang
Mitch Hayenga [Fri, 7 Mar 2014 20:56:23 +0000 (15:56 -0500)]
scons: Fixes uninitialized warnings issued by clang

Small fixes to appease recent clang versions.

10 years agoarm: Fix uninitialised warning with gcc 4.8
Stephan Diestelhorst [Fri, 7 Mar 2014 20:56:23 +0000 (15:56 -0500)]
arm: Fix uninitialised warning with gcc 4.8

Small fix for a warning that prevents compilation with gcc 4.8.1 due
to detecting that a variable might be uninitialised. The fix is to
assign a safe default.

10 years agomem: Wakeup sleeping CPUs without caches on LLSC
Ali Saidi [Fri, 7 Mar 2014 20:56:23 +0000 (15:56 -0500)]
mem: Wakeup sleeping CPUs without caches on LLSC

For systems without caches, the LLSC code does not get snoops for
wake-ups. We add the LLSC code in the abstract memory to do the job
for us.

10 years agosim: Schedule the global sync event at curTick() + simQuantum
Andreas Sandberg [Thu, 6 Mar 2014 14:59:53 +0000 (15:59 +0100)]
sim: Schedule the global sync event at curTick() + simQuantum

The global synchronization event used to be scheduled at
simQuantum. This prevented repeated entries into gem5 from Python as
it can be scheduled in the past. This changeset ensures that the first
global synchronization happens at curTick() + simQuantum instead.

10 years agox86: Setup correct TSL/TR segment attributes on INIT
Andreas Sandberg [Mon, 3 Mar 2014 13:44:57 +0000 (14:44 +0100)]
x86: Setup correct TSL/TR segment attributes on INIT

The TSL/LDT & TR/TSS segments didn't contain valid attributes. This
caused problems when transfering the state into KVM where invalid
state is a no-go. Fixup the attributes with values from AMD's
architecture programmer's manual.

10 years agokvm: x86: Always assume segments to be usable
Andreas Sandberg [Mon, 3 Mar 2014 13:34:33 +0000 (14:34 +0100)]
kvm: x86: Always assume segments to be usable

When transferring segment registers into kvm, we need to find the
value of the unusable bit. We used to assume that this could be
inferred from the selector since segments are generally unusable if
their selector is 0. This assumption breaks in some weird corner
cases.  Instead, we just assume that segments are always usable. This
is what qemu does so it should work.

10 years agokvm: Initialize signal handlers from startupThread()
Andreas Sandberg [Mon, 3 Mar 2014 13:31:39 +0000 (14:31 +0100)]
kvm: Initialize signal handlers from startupThread()

Signal handlers in KVM are controlled per thread and should be
initialized from the thread that is going to execute the CPU. This
changeset moves the initialization call from startup() to
startupThread().

10 years agoruby: message buffer: changes related to tracking push/pop times
Nilay Vaish [Sun, 2 Mar 2014 05:59:58 +0000 (23:59 -0600)]
ruby: message buffer: changes related to tracking push/pop times
The last pop operation is now tracked as a Tick instead of in Cycles.
This helps in avoiding use of the receiver's clock during the enqueue
operation.

10 years agoruby: make the max_size variable of the MessageBuffer unsigned
Nilay Vaish [Sun, 2 Mar 2014 05:59:57 +0000 (23:59 -0600)]
ruby: make the max_size variable of the MessageBuffer unsigned

10 years agocpu: Enable fast-forwarding for MIPS InOrderCPU and O3CPU
Christopher Torng [Sun, 2 Mar 2014 05:35:23 +0000 (23:35 -0600)]
cpu: Enable fast-forwarding for MIPS InOrderCPU and O3CPU
A copyRegs() function is added to MIPS utilities
to copy architectural state from the old CPU to
the new CPU during fast-forwarding. This
addition alone enables fast-forwarding for the
o3 cpu model running MIPS.

The patch also adds takeOverFrom() and
drainResume() functions to the InOrderCPU to
enable it to take over from another CPU. This
change enables fast-forwarding for the inorder
cpu model running MIPS, but not for Alpha.

Committed by: Nilay Vaish <nilay@cs.wisc.edu>

10 years agoruby: profiler: statically allocate stats variable
Nilay Vaish [Sun, 2 Mar 2014 05:35:21 +0000 (23:35 -0600)]
ruby: profiler: statically allocate stats variable
Couple of users observed segmentation fault when the simulator tries to
register the statistical variable m_IncompleteTimes.  It seems that there
is some problem with the initialization of these variables when allocated
in the constructor.

10 years agostats: updates due to c0db268f811b
Nilay Vaish [Tue, 25 Feb 2014 02:50:06 +0000 (20:50 -0600)]
stats: updates due to c0db268f811b

10 years agoruby: correct errors in changeset 4eec7bdde5b0
Nilay Vaish [Tue, 25 Feb 2014 02:50:05 +0000 (20:50 -0600)]
ruby: correct errors in changeset 4eec7bdde5b0
Couple of errors were discovered in 4eec7bdde5b0 which necessitated this patch.
Firstly, we create interrupt controllers in the se mode, but no piobus was
being created.  RubyPort, which earlier used to ignore range changes now
forwards those to the piobus.  The lack of piobus resulted in segmentation
fault.  This patch creates a piobus even in se mode.  It is not created only
when some tester is running.  Secondly,  I had missed out on modifying port
connections for other coherence protocols.

10 years agostats: updates due to changes to ruby pio access handling
Nilay Vaish [Mon, 24 Feb 2014 01:16:16 +0000 (19:16 -0600)]
stats: updates due to changes to ruby pio access handling

10 years agoruby: route all packets through ruby port
Nilay Vaish [Mon, 24 Feb 2014 01:16:16 +0000 (19:16 -0600)]
ruby: route all packets through ruby port
Currently, the interrupt controller in x86 is connected to the io bus
directly.  Therefore the packets between the io devices and the interrupt
controller do not go through ruby.  This patch changes ruby port so that
these packets arrive at the ruby port first, which then routes them to their
destination.  Note that the patch does not make these packets go through the
ruby network.  That would happen in a subsequent patch.

10 years agoruby: Simplify RubyPort flow control and routing
Andreas Hansson [Mon, 24 Feb 2014 01:16:16 +0000 (19:16 -0600)]
ruby: Simplify RubyPort flow control and routing

This patch simplfies the retry logic in the RubyPort, avoiding
redundant attributes, and enforcing more stringent checks on the
interactions with the normal ports. The patch also simplifies the
routing done by the RubyPort, using the port identifiers instead of a
heavy-weight sender state.

The patch also fixes a bug in the sending of responses from PIO
ports. Previously these responses bypassed the queue in the queued
port, and ignored the return value, potentially leading to response
packets being lost.

Committed by: Nilay Vaish <nilay@cs.wisc.edu>

10 years agoconfig: topologies: slight code refactor
Nilay Vaish [Mon, 24 Feb 2014 01:16:15 +0000 (19:16 -0600)]
config: topologies: slight code refactor

10 years agoruby: message buffer: refactor code
Nilay Vaish [Mon, 24 Feb 2014 01:16:15 +0000 (19:16 -0600)]
ruby: message buffer: refactor code
Code in two of the functions was exactly the same.  This patch moves
this code to a new function which is called from the two functions
mentioned initially.

10 years agoruby: remove few not required #includes
Nilay Vaish [Mon, 24 Feb 2014 01:16:15 +0000 (19:16 -0600)]
ruby: remove few not required #includes

10 years agoruby: slicc: remove unused COPY_HEAD functionality
Nilay Vaish [Mon, 24 Feb 2014 01:16:15 +0000 (19:16 -0600)]
ruby: slicc: remove unused COPY_HEAD functionality

10 years agoruby: protocols: remove unused action z_stall
Nilay Vaish [Mon, 24 Feb 2014 01:16:15 +0000 (19:16 -0600)]
ruby: protocols: remove unused action z_stall

10 years agoconfig: ruby_random_test: updates due to recent unrelated changes
Nilay Vaish [Fri, 21 Feb 2014 14:02:06 +0000 (08:02 -0600)]
config: ruby_random_test: updates due to recent unrelated changes

10 years agoruby: network: move message buffers to base network class.
Nilay Vaish [Fri, 21 Feb 2014 14:02:05 +0000 (08:02 -0600)]
ruby: network: move message buffers to base network class.

10 years agoruby: network: garnet: fixed: removes net_ptr from links
Nilay Vaish [Fri, 21 Feb 2014 14:02:04 +0000 (08:02 -0600)]
ruby: network: garnet: fixed: removes net_ptr from links

10 years agoruby: cache: remove not required variable m_cache_name
Nilay Vaish [Fri, 21 Feb 2014 14:02:02 +0000 (08:02 -0600)]
ruby: cache: remove not required variable m_cache_name

10 years agoruby: network: garnet: fixed: removes next cycle functions
Nilay Vaish [Thu, 20 Feb 2014 23:28:01 +0000 (17:28 -0600)]
ruby: network: garnet: fixed: removes next cycle functions
At several places, there are functions that take a cycle value as input
and performs some computation.  Along with each such function, another
function was being defined that simply added one more cycle to input and
computed the same function.  This patch removes this second copy of the
function.  Places where these functions were being called have been updated
to use the original function with argument being current cycle + 1.

10 years agoruby: controller: slight code refactoring
Nilay Vaish [Thu, 20 Feb 2014 23:27:45 +0000 (17:27 -0600)]
ruby: controller: slight code refactoring

10 years agoruby: mesi three level: rename incorrectly named files
Nilay Vaish [Thu, 20 Feb 2014 23:27:17 +0000 (17:27 -0600)]
ruby: mesi three level: rename incorrectly named files
Two files had been incorrectly named with a .cache suffix.

--HG--
rename : src/mem/protocol/MESI_Three_Level-L0.cache => src/mem/protocol/MESI_Three_Level-L0cache.sm
rename : src/mem/protocol/MESI_Three_Level-L1.cache => src/mem/protocol/MESI_Three_Level-L1cache.sm

10 years agoruby: network: removes unused code.
Nilay Vaish [Thu, 20 Feb 2014 23:27:07 +0000 (17:27 -0600)]
ruby: network: removes unused code.

10 years agoruby: slicc: slight code refactoring
Nilay Vaish [Thu, 20 Feb 2014 23:26:49 +0000 (17:26 -0600)]
ruby: slicc: slight code refactoring

10 years agoruby: message buffer: removes some unecessary functions.
Nilay Vaish [Thu, 20 Feb 2014 23:26:41 +0000 (17:26 -0600)]
ruby: message buffer: removes some unecessary functions.

10 years agokvm: Add support for multi-system simulation
Andreas Sandberg [Thu, 20 Feb 2014 14:43:53 +0000 (15:43 +0100)]
kvm: Add support for multi-system simulation

The introduction of parallel event queues added most of the support
needed to run multiple VMs (systems) within the same gem5
instance. This changeset fixes up signal delivery so that KVM's
control signals are delivered to the thread that executes the CPU's
event queue. Specifically:

  * Timers and counters are now initialized from a separate method
    (startupThread) that is scheduled as the first event in the
    thread-specific event queue. This ensures that they are
    initialized from the thread that is going to execute the CPUs
    event queue and enables signal delivery to the right thread when
    exiting from KVM.

  * The POSIX-timer-based KVM timer (used to force exits from KVM) has
    been updated to deliver signals to the thread that's executing KVM
    instead of the process (thread is undefined in that case). This
    assumes that the timer is instantiated from the thread that is
    going to execute the KVM vCPU.

  * Signal masking is now done using pthread_sigmask instead of
    sigprocmask. The behavior of the latter is undefined in threaded
    applications.

  * Since signal masks can be inherited, make sure to actively unmask
    the control signals when setting up the KVM signal mask.

There are currently no facilities to multiplex between multiple KVM
CPUs in the same event queue, we are therefore limited to
configurations where there is only one KVM CPU per event queue. In
practice, this means that multi-system configurations can be
simulated, but not multiple CPUs in a shared-memory configuration.

10 years agoarm: Bump stats after FS config script update
Andreas Hansson [Wed, 19 Feb 2014 12:59:46 +0000 (07:59 -0500)]
arm: Bump stats after FS config script update

This patch updates the stats to reflect the change in kernel options
needed for armv8 (but used for all FS regressions).

10 years agoarm: armv8 boot options to enable v8
Anthony Gutierrez [Tue, 18 Feb 2014 22:20:56 +0000 (17:20 -0500)]
arm: armv8 boot options to enable v8

Modifies FSConfig.py to enable ARMv8 compatibility.
To boot gem5 with ARMv8:
   Download the v8 kernel, .dtb file, and root FS from: http://gem5.org/Download
   Download the ARMv8 toolchain, and add the bin dir to your path:
       http://www.linaro.org/engineering/engineering-projects/armv8
   Build gem5 for ARM
   Build the v8 bootloader (in gem5/system/arm/aarch64_bootloader)
   Make script in gem5/system/arm/aarch64_bootloader will require v8 toolchain,
   drop the produced boot_emm.arm64 in $(M5_PATH)/binaries/
Run:
   $ build/ARM/gem5.fast configs/example/fs.py --machine-type=VExpress_EMM64 \
     --kernel=/path/to/kernel/vmlinux-linaro-tracking \
     --dtb-filename=/path/to/dtb/rtsm_ve-aemv8a.dtb \
     --disk-image=/path/to/img/linaro-minimal-armv8.img

10 years agomem: Fix bug in PhysicalMemory use of mmap and munmap
Andreas Hansson [Tue, 18 Feb 2014 10:51:01 +0000 (05:51 -0500)]
mem: Fix bug in PhysicalMemory use of mmap and munmap

This patch fixes a bug in how physical memory used to be mapped and
unmapped. Previously we unmapped and re-mapped if restoring from a
checkpoint. However, we never checked that the new mapping was
actually the same, it was just magically working as the OS seems to
fairly reliably give us the same chunk back. This patch fixes this
issue by relying entirely on the mmap call in the constructor.

10 years agodev: Include basic devices in NULL ISA build
Andreas Hansson [Tue, 18 Feb 2014 10:50:59 +0000 (05:50 -0500)]
dev: Include basic devices in NULL ISA build

This patch enbles use of the basic PIO devices as part of the NULL
build. Although it might seem counter intuitive to have a PIO device
without being able to execute a driver, this change enables us to
break a device class hierarchy into an ISA-agnostic part, and an
ISA-specific part, without requiring multiple-inheritance. The
ISA-agnostic base class is a PIO device, but does not make use of the
port.

10 years agoscons: Add PROTOC from the environment
Andreas Hansson [Tue, 18 Feb 2014 10:50:58 +0000 (05:50 -0500)]
scons: Add PROTOC from the environment

This patch adds PROTOC to the build environment.

10 years agomem: Filter cache snoops based on address ranges
Andreas Hansson [Tue, 18 Feb 2014 10:50:58 +0000 (05:50 -0500)]
mem: Filter cache snoops based on address ranges

This patch adds a filter to the cache to drop snoop requests that are
not for a range covered by the cache. This fixes an issue observed
when multiple caches are placed in parallel, covering different
address ranges. Without this patch, all the caches will forward the
snoop upwards, when only one should do so.

10 years agomem: Add a wrapped DRAMSim2 memory controller
Andreas Hansson [Tue, 18 Feb 2014 10:50:53 +0000 (05:50 -0500)]
mem: Add a wrapped DRAMSim2 memory controller

This patch adds DRAMSim2 as a memory controller by wrapping the
external library and creating a sublass of AbstractMemory that bridges
between the semantics of gem5 and the DRAMSim2 interface.

The DRAMSim2 wrapper extracts the clock period from the config
file. There is no way of extracting this information from DRAMSim2
itself, so we simply read the same config file and get it from there.

To properly model the response queue, the wrapper keeps track of how
many transactions are in the actual controller, and how many are
stacking up waiting to be sent back as responses (in the wrapper). The
latter requires us to move away from the queued port and manage the
packets ourselves. This is due to DRAMSim2 not having any flow control
on the response path.

DRAMSim2 assumes that the transactions it is given are matching the
burst size of the choosen memory. The wrapper checks to ensure the
cache line size of the system matches the burst size of DRAMSim2 as
there are currently no provisions to split the system requests. In
theory we could allow a cache line size smaller than the burst size,
but that would lead to inefficient use of the DRAM, so for not we
fatal also in this case.

10 years agoutil: Enhance the error messages for packet encode/decode
Andreas Hansson [Tue, 18 Feb 2014 10:50:52 +0000 (05:50 -0500)]
util: Enhance the error messages for packet encode/decode

This patch adds a more verbose error message when the Python protobuf
module cannot be loaded.

10 years agomem: Fix input to DPRINTF in CommMonitor
Andreas Hansson [Tue, 18 Feb 2014 10:50:51 +0000 (05:50 -0500)]
mem: Fix input to DPRINTF in CommMonitor

Minor fix of the debug message parameters.

10 years agostats: updates due to branch predictor warming
Nilay Vaish [Sun, 16 Feb 2014 17:40:34 +0000 (11:40 -0600)]
stats: updates due to branch predictor warming

10 years agoAdded tag stable_2014_02_15 to the changeset 459491344fcf
Nilay Vaish [Sat, 15 Feb 2014 18:44:09 +0000 (12:44 -0600)]
Added tag stable_2014_02_15 to the changeset 459491344fcf

10 years agocpu: simple: Add support for using branch predictors
Andreas Sandberg [Sun, 9 Feb 2014 19:49:28 +0000 (20:49 +0100)]
cpu: simple: Add support for using branch predictors

This changesets adds branch predictor support to the
BaseSimpleCPU. The simple CPUs normally don't need a branch predictor,
however, there are at least two cases where it can be desirable:

  1) A simple CPU can be used to warm the branch predictor of an O3
     CPU before switching to the slower O3 model.

  2) The simple CPU can be used as a quick way of evaluating/debugging
     new branch predictors since it exposes branch predictor
     statistics.

Limitations:
  * Since the simple CPU doesn't speculate, only one instruction will
    be active in the branch predictor at a time (i.e., the branch
    predictor will never see speculative branches).

  * The outcome of a branch prediction does not affect the performance
    of the simple CPU.

10 years agobase: calls abort() from fatal
Nilay Vaish [Thu, 6 Feb 2014 22:30:13 +0000 (16:30 -0600)]
base: calls abort() from fatal
Currently fatal() ends the simulation in a normal fashion.  This results in
the call stack getting lost when using a debugger and it is not always
possible to debug the simulation just from the information provided by the
printed error message.  Even though the error is likely due to a user's fault,
the information available should not be thrown away.  Hence, this patch to
call abort() from fatal().