gem5.git
10 years agoruby: removed the very old double trigger hack stable_2013_10_14
Brad Beckmann [Thu, 11 Jul 2013 18:56:05 +0000 (13:56 -0500)]
ruby: removed the very old double trigger hack

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

10 years agoregressions: update a couple stats.txt
Nilay Vaish [Tue, 2 Jul 2013 15:11:00 +0000 (10:11 -0500)]
regressions: update a couple stats.txt
The statistics for 30.eio-mp, pc-simple-timing-ruby tests are being updated
to incorporate the changes due to recent patches.

10 years agoregressions: update a couple of configs
Nilay Vaish [Tue, 2 Jul 2013 15:10:58 +0000 (10:10 -0500)]
regressions: update a couple of configs
The configs for pc-simple-timing-ruby, t1000-simple-atomic had not been
updated correctly in the patch 6e6cefc1db1f.

10 years agoruby: append transition comment only when in opt/debug
Nilay Vaish [Sat, 29 Jun 2013 02:42:27 +0000 (21:42 -0500)]
ruby: append transition comment only when in opt/debug

10 years agoconfigs: rearrange the available options in Options.py
Nilay Vaish [Sat, 29 Jun 2013 02:42:26 +0000 (21:42 -0500)]
configs: rearrange the available options in Options.py
It also changes the instantiation of physmem in se.py so as to make
use of the memory size supplied by the mem_size option.

10 years agoruby: network: remove reconfiguration code
Nilay Vaish [Sat, 29 Jun 2013 02:36:37 +0000 (21:36 -0500)]
ruby: network: remove reconfiguration code
This code seems not to be of any use now. There is no path in the simulator
that allows for reconfiguring the network. A better approach would be to
take a checkpoint and start the simulation from the checkpoint with the new
configuration.

10 years agoruby: check for compatibility between mem size and num dirs
Nilay Vaish [Sat, 29 Jun 2013 02:36:11 +0000 (21:36 -0500)]
ruby: check for compatibility between mem size and num dirs
The configuration scripts provided for ruby assume that the available
physical memory is equally distributed amongst the directory controllers.
But there is no check to ensure this assumption has been adhered to. This
patch adds the required check.

10 years agostats: Update stats for monitor, cache and bus changes
Andreas Hansson [Thu, 27 Jun 2013 09:49:51 +0000 (05:49 -0400)]
stats: Update stats for monitor, cache and bus changes

This patch removes the sparse histogram total from the CommMonitor
stats. It also bumps the stats after the unit fixes in the atomic
cache access. Lastly, it updates the stats to match the new port
ordering. All numbers are the same, and the only thing that changes is
which master corresponds to what port index.

10 years agomem: Reorganize cache tags and make them a SimObject
Prakash Ramrakhyani [Thu, 27 Jun 2013 09:49:50 +0000 (05:49 -0400)]
mem: Reorganize cache tags and make them a SimObject

This patch reorganizes the cache tags to allow more flexibility to
implement new replacement policies. The base tags class is now a
clocked object so that derived classes can use a clock if they need
one. Also having deriving from SimObject allows specialized Tag
classes to be swapped in/out in .py files.

The cache set is now templatized to allow it to contain customized
cache blocks with additional informaiton. This involved moving code to
the .hh file and removing cacheset.cc.

The statistics belonging to the cache tags are now including ".tags"
in their name. Hence, the stats need an update to reflect the change
in naming.

10 years agomem: Remove the cache builder
Andreas Hansson [Thu, 27 Jun 2013 09:49:50 +0000 (05:49 -0400)]
mem: Remove the cache builder

This patch removes the redundant cache builder class.

10 years agoconfig: Remove Clock parameter multiplication
Andreas Hansson [Thu, 27 Jun 2013 09:49:50 +0000 (05:49 -0400)]
config: Remove Clock parameter multiplication

This patch removes the multiplication operator support for Clock
parameters as this functionality is now achieved by creating derived
clock domains.

Nate, this one is for you.

10 years agosim: Add the notion of clock domains to all ClockedObjects
Akash Bagdia [Thu, 27 Jun 2013 09:49:49 +0000 (05:49 -0400)]
sim: Add the notion of clock domains to all ClockedObjects

This patch adds the notion of source- and derived-clock domains to the
ClockedObjects. As such, all clock information is moved to the clock
domain, and the ClockedObjects are grouped into domains.

The clock domains are either source domains, with a specific clock
period, or derived domains that have a parent domain and a divider
(potentially chained). For piece of logic that runs at a derived clock
(a ratio of the clock its parent is running at) the necessary derived
clock domain is created from its corresponding parent clock
domain. For now, the derived clock domain only supports a divider,
thus ensuring a lower speed compared to its parent. Multiplier
functionality implies a PLL logic that has not been modelled yet
(create a separate clock instead).

The clock domains should be used as a mechanism to provide a
controllable clock source that affects clock for every clocked object
lying beneath it. The clock of the domain can (in a future patch) be
controlled by a handler responsible for dynamic frequency scaling of
the respective clock domains.

All the config scripts have been retro-fitted with clock domains. For
the System a default SrcClockDomain is created. For CPUs that run at a
different speed than the system, there is a seperate clock domain
created. This domain incorporates the CPU and the associated
caches. As before, Ruby runs under its own clock domain.

The clock period of all domains are pre-computed, such that no virtual
functions or multiplications are needed when calling
clockPeriod. Instead, the clock period is pre-computed when any
changes occur. For this to be possible, each clock domain tracks its
children.

10 years agoconfig: Add a BaseSESystem builder for re-use in regressions
Andreas Hansson [Thu, 27 Jun 2013 09:49:49 +0000 (05:49 -0400)]
config: Add a BaseSESystem builder for re-use in regressions

This patch extends the existing system builders to also include a
syscall-emulation builder. This builder is deployed in all
syscall-emulation regressions that do not involve Ruby,
i.e. o3-timing, simple-timing and simple-atomic, as well as the
multi-processor regressions o3-timing-mp, simple-timing-mp and
simple-atomic-mp (the latter are only used by SPARC at this point).

The values chosen for the cache sizes match those that were used in
the existing config scripts (despite being on the large
side). Similarly, a mem_class parameter is added to the builder base
class to enable simple-atomic to use SimpleMemory and o3-timing to use
the default DDR3 configuration.

Due to the different order the ports are connected, the bus stats get
shuffled around for the multi-processor regressions. A separate patch
bumps the port indices. Besides this, all behaviour is exactly the
same.

10 years agoconfig: Rename clock option to Ruby clock
Akash Bagdia [Thu, 27 Jun 2013 09:49:49 +0000 (05:49 -0400)]
config: Rename clock option to Ruby clock

This patch changes the 'clock' option to 'ruby-clock' as it is only
used by Ruby.

10 years agoconfig: Add a system clock command-line option
Akash Bagdia [Thu, 27 Jun 2013 09:49:49 +0000 (05:49 -0400)]
config: Add a system clock command-line option

This patch adds a 'sys_clock' command-line option and use it to assign
clocks to the system during instantiation.

As part of this change, the default clock in the System class is
removed and whenever a system is instantiated a system clock value
must be set. A default value is provided for the command-line option.

The configs and tests are updated accordingly.

10 years agoconfig: Add a CPU clock command-line option
Akash Bagdia [Thu, 27 Jun 2013 09:49:49 +0000 (05:49 -0400)]
config: Add a CPU clock command-line option

This patch adds a 'cpu_clock' command-line option and uses the value
to assign clocks to components running at the CPU speed (L1 and L2
including the L2-bus). The configuration scripts are updated
accordingly.

The 'clock' option is left unchanged in this patch as it is still used
by a number of components. In follow-on patches the latter will be
disambiguated further.

10 years agoconfig: Remove redundant explicit setting of default clocks
Akash Bagdia [Thu, 27 Jun 2013 09:49:49 +0000 (05:49 -0400)]
config: Remove redundant explicit setting of default clocks

This patch removes the explicit setting of the clock period for
certain instances of CoherentBus, NonCoherentBus and IOCache where the
specified clock is same as the default value of the system clock. As
all the values used are the defaults, there are no performance
changes. There are similar cases where the toL2Bus is set to use the
parent CPU clock which is already the default behaviour.

The main motivation for these simplifications is to ease the
introduction of clock domains.

10 years agotests: Prune 00.gzip from the regressions
Andreas Hansson [Thu, 27 Jun 2013 09:49:49 +0000 (05:49 -0400)]
tests: Prune 00.gzip from the regressions

This patch prunes the 00.gzip regressions with the main motivation
being that it adds little (or no) coverage and requires a substantial
amount of run time.

A complete regression run, including compilation from a clean repo, is
almost 20% faster(!).

10 years agomem: Tidy up the bridge with const and additional checks
Andreas Hansson [Thu, 27 Jun 2013 09:49:49 +0000 (05:49 -0400)]
mem: Tidy up the bridge with const and additional checks

This patch does a bit of tidying up in the bridge code, adding const
where appropriate and also removing redundant checks and adding a few
new ones.

There are no changes to the behaviour of any regressions.

10 years agomem: Fix CommMonitor style and response check
Andreas Hansson [Thu, 27 Jun 2013 09:49:49 +0000 (05:49 -0400)]
mem: Fix CommMonitor style and response check

This patch fixes the CommMonitor local variable names, and also
introduces a variable to capture if it expects to see a response. The
latter check considers both needsResponse and memInhibitAsserted.

10 years agomem: Align cache timing to clock edges
Andreas Hansson [Thu, 27 Jun 2013 09:49:49 +0000 (05:49 -0400)]
mem: Align cache timing to clock edges

This patch changes the cache timing calculations such that the results
are aligned to clock edges.

Plenty stats change as a results of this patch.

10 years agocpu: Consider instructions waiting for FU completion in draining
Andreas Hansson [Thu, 27 Jun 2013 09:49:49 +0000 (05:49 -0400)]
cpu: Consider instructions waiting for FU completion in draining

This patch changes the IEW drain check to include the FU pool as there
can be instructions that are "stored" in FU completion events and thus
not covered by the existing checks. With this patch, we simply include
a check to see if all the FUs are considered non-busy in the next
tick.

Without this patch, the pc-switcheroo-full regression fails after
minor changes to the cache timing (aligning to clock edge).

10 years agomem: Cycles converted to Ticks in atomic cache accesses
Andreas Hansson [Thu, 27 Jun 2013 09:49:49 +0000 (05:49 -0400)]
mem: Cycles converted to Ticks in atomic cache accesses

This patch fixes an outstanding issue in the cache timing calculations
where an atomic access returned a time in Cycles, but the port
forwarded it on as if it was in Ticks.

A separate patch will update the regression stats.

10 years agoscons: Identify runs that fail and runs with stats differences
Andreas Hansson [Thu, 27 Jun 2013 09:49:49 +0000 (05:49 -0400)]
scons: Identify runs that fail and runs with stats differences

This patch changes the regression script such that it is possible to
identify the runs that fail with an exit code, and those that finish
with stats differences. The ones that truly fail are reported as
FAILED, and those that finish with changed stats as CHANGED.

The yellow colour has been reclaimed from the skipped regressions and
is now used for the changed ones. With no obvious good option left the
skipped ones are now in cyan.

While I was editing the script I also bumped any occurence of M5 to
gem5.

10 years agobase: Fix address range granularity calculation
Andreas Hansson [Thu, 27 Jun 2013 09:49:49 +0000 (05:49 -0400)]
base: Fix address range granularity calculation

This patch fixes a bug in the granularity calculation. For example, if
the high bit is 6 (counting from 0) and we have one interleaving bit,
then the granularity is now 2 ** (6 - 1 + 1) = 64.

10 years agomem: Remove a redundant heap allocation for a snoop packet
Andreas Hansson [Thu, 27 Jun 2013 09:49:49 +0000 (05:49 -0400)]
mem: Remove a redundant heap allocation for a snoop packet

This patch changes the updards snoop packet to avoid allocating and
later deleting it. As the code executes in 0 time and the lifetime of
the packet does not extend beyond the block there is no reason to heap
allocate it.

10 years agomem: Remove CoherentBus snoop port unused private member
Andreas Hansson [Thu, 27 Jun 2013 09:49:49 +0000 (05:49 -0400)]
mem: Remove CoherentBus snoop port unused private member

This patch removes an unused member to avoid getting compiler warnings
when using clang.

10 years agostats: Remove printing of SparseHist total
Sascha Bischoff [Thu, 27 Jun 2013 09:49:49 +0000 (05:49 -0400)]
stats: Remove printing of SparseHist total

This patch removes the printing of the SparseHist total in the
stats.txt output file. This has been removed as a sparse histogram has
no total, and therefore this was printing out the value of a
non-local, unrelated variable.

10 years agostats: updates due to changes to stat collection in ruby
Nilay Vaish [Tue, 25 Jun 2013 05:32:04 +0000 (00:32 -0500)]
stats: updates due to changes to stat collection in ruby

10 years agoruby: moesi cmp directory: separate actions for external hits
Nilay Vaish [Tue, 25 Jun 2013 05:32:04 +0000 (00:32 -0500)]
ruby: moesi cmp directory: separate actions for external hits
This patch adds separate actions for requests that missed in the local cache
and messages were sent out to get the requested line. These separate actions
are required for differentiating between the hit and miss latencies in the
statistics collected.

10 years agoruby: mesi cmp directory: separate actions for external hits
Nilay Vaish [Tue, 25 Jun 2013 05:32:03 +0000 (00:32 -0500)]
ruby: mesi cmp directory: separate actions for external hits
This patch adds separate actions for requests that missed in the local cache
and messages were sent out to get the requested line. These separate actions
are required for differentiating between the hit and miss latencies in the
statistics collected.

10 years agoruby: profiler: lots of inter-related changes
Nilay Vaish [Tue, 25 Jun 2013 05:32:03 +0000 (00:32 -0500)]
ruby: profiler: lots of inter-related changes
The patch started of with removing the global variables from the profiler for
profiling the miss latency of requests made to the cache. The corrresponding
histograms have been moved to the Sequencer. These are combined together when
the histograms are printed. Separate histograms are now maintained for
tracking latency of all requests together, of hits only and of misses only.

A particular set of histograms used to use the type GenericMachineType defined
in one of the protocol files. This patch removes this type. Now, everything
that relied on this type would use MachineType instead. To do this, SLICC has
been changed so that multiple machine types can be declared by a controller
in its preamble.

10 years agostats: Bump x86 stats
Andreas Hansson [Mon, 24 Jun 2013 18:17:22 +0000 (14:17 -0400)]
stats: Bump x86 stats

This patch bumps the x86 stats to reflect the recent fixes.

10 years agoruby: remove the three files related to profiling
Nilay Vaish [Mon, 24 Jun 2013 13:59:08 +0000 (08:59 -0500)]
ruby: remove the three files related to profiling
This patch removes the following three files: RubySlicc_Profiler.sm,
RubySlicc_Profiler_interface.cc and RubySlicc_Profiler_interface.hh.
Only one function prototyped in the file RubySlicc_Profiler.sm. Rest of the
code appearing in any of these files is not in use. Therefore, these files
are being removed.

That one single function, profileMsgDelay(), is being moved to the protocol
files where it is in use. If we need any of these deleted functions, I think
the right way to make them visible is to have the AbstractController class in
a .sm and let the controller state machine inherit from this class. The
AbstractController class can then have the prototypes of these profiling
functions in its definition.

10 years agoruby: MessageBuffer: Remove unused m_size variable
Joel Hestness ext:(%2C%20Nilay%20Vaish%20%3Cnilay%40cs.wisc.edu%3E) [Mon, 24 Jun 2013 11:57:06 +0000 (06:57 -0500)]
ruby: MessageBuffer: Remove unused m_size variable

The m_size variable attempted to track m_prio_heap.size(), but it did so
incorrectly due to the functions reanalyzeMessages and reanalyzeAllMessages().
Since this variable is intended to track m_prio_heap.size(), we can simply
replace instances where m_size is referenced with m_prio_heap.size(), which
has the added bonus of removing the need for m_size.

Note: This patch also removes an extraneous DPRINTF format string designator
from reanalyzeAllMessages()

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

10 years agoruby: fix typo in MOESI_CMP_token protocol
Lena Olson [Thu, 20 Jun 2013 21:20:38 +0000 (16:20 -0500)]
ruby: fix typo in MOESI_CMP_token protocol

10 years agoruby: Fix prefetching for MESI_CMP_Directory
Lena Olson [Tue, 18 Jun 2013 21:59:22 +0000 (16:59 -0500)]
ruby: Fix prefetching for MESI_CMP_Directory

Transitions from present on PF_Ifetch were missing, causing a crash when
prefetching is enabled.

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

10 years agoruby: fix slicc compiler to complain about duplicate symbols
Lena Olson [Tue, 18 Jun 2013 21:58:52 +0000 (16:58 -0500)]
ruby: fix slicc compiler to complain about duplicate symbols

Previously, .sm files were allowed to use the same name for a type and a
variable. This is unnecessarily confusing and has some bad side effects, like
not being able to declare later variables in the same scope with the same type.
This causes the compiler to complain and die on things like Address Address.

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

10 years agoruby: restrict Address to being a type and not a variable name
Lena Olson [Tue, 18 Jun 2013 21:58:33 +0000 (16:58 -0500)]
ruby: restrict Address to being a type and not a variable name
Change all occurrances of Address as a variable name to instead use Addr.
Address is an allowed name in slicc even when Address is also being used as a
type, leading to declarations of "Address Address". While this works, it
prevents adding another field of type Address because the compiler then thinks
Address is a variable name, not type.

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

10 years agox86: Add support for maintaining the x87 tag word
Andreas Sandberg [Tue, 18 Jun 2013 14:36:08 +0000 (16:36 +0200)]
x86: Add support for maintaining the x87 tag word

The current implementation of the x87 never updates the x87 tag
word. This is currently not a big issue since the simulated x87 never
checks for stack overflows, however this becomes an issue when
switching between a virtualized CPU and a simulated CPU. This
changeset adds support, which is enabled by default, for updating the
tag register to every floating point microop that updates the stack
top using the spm mechanism.

The new tag words is generated by the helper function
X86ISA::genX87Tags(). This function is currently limited to flagging a
stack position as valid or invalid and does not try to distinguish
between the valid, zero, and special states.

10 years agox86: Fix loading of floating point constants
Andreas Sandberg [Tue, 18 Jun 2013 14:30:06 +0000 (16:30 +0200)]
x86: Fix loading of floating point constants

This changeset actually fixes two issues:

 * The lfpimm instruction didn't work correctly when applied to a
   floating point constant (it did work for integers containing the
   bit string representation of a constant) since it used
   reinterpret_cast to convert a double to a uint64_t. This caused a
   compilation error, at least, in gcc 4.6.3.

 * The instructions loading floating point constants in the x87
   processor didn't work correctly since they just stored a truncated
   integer instead of a double in the floating point register. This
   changeset fixes the old microcode by using lfpimm instruction
   instead of the limm instructions.

10 years agox86: Initialize the MXCSR register
Andreas Sandberg [Tue, 18 Jun 2013 14:28:36 +0000 (16:28 +0200)]
x86: Initialize the MXCSR register

10 years agox86: Make the boot state VMX compliant
Andreas Sandberg [Tue, 18 Jun 2013 14:27:28 +0000 (16:27 +0200)]
x86: Make the boot state VMX compliant

This patch allows the default x86 state to be used when by CPUs that
use hardware virtualization.

10 years agox86: Make fprem like the fprem on a real x87
Andreas Sandberg [Tue, 18 Jun 2013 14:10:42 +0000 (16:10 +0200)]
x86: Make fprem like the fprem on a real x87

The current implementation of fprem simply does an fmod and doesn't
simulate any of the iterative behavior in a real fprem. This isn't
normally a problem, however, it can lead to problems when switching
between CPU models. If switching from a real CPU in the middle of an
fprem loop to a simulated CPU, the output of the fprem loop becomes
correupted. This changeset changes the fprem implementation to work
like the one on real hardware.

10 years agokvm: Use the address finalization code in the TLB
Andreas Sandberg [Tue, 18 Jun 2013 14:10:22 +0000 (16:10 +0200)]
kvm: Use the address finalization code in the TLB

Reuse the address finalization code in the TLB instead of replicating
it when handling MMIO. This patch also adds support for injecting
memory mapped IPR requests into the memory system.

10 years agox86: Add helper functions to access rflags
Andreas Sandberg [Tue, 18 Jun 2013 14:10:22 +0000 (16:10 +0200)]
x86: Add helper functions to access rflags

The rflags register is spread across several different registers. Most
of the flags are stored in MISCREG_RFLAGS, but some are stored in
microcode registers. When accessing RFLAGS, we need to reconstruct it
from these registers. This changeset adds two functions,
X86ISA::getRFlags() and X86ISA::setRFlags(), that take care of this
magic.

10 years agox86: Fix the flag handling code in FABS and FCHS
Andreas Sandberg [Tue, 18 Jun 2013 14:10:21 +0000 (16:10 +0200)]
x86: Fix the flag handling code in FABS and FCHS

This changeset fixes two problems in the FABS and FCHS
implementation. First, the ISA parser expects the assignment in
flag_code to be a pure assignment and not an and-assignment, which
leads to the isa_parser omitting the misc reg update. Second, the FCHS
and FABS macro-ops don't set the SetStatus flag, which means that the
default micro-op version, which doesn't update FSW, is executed.

10 years agoAdded tag stable_2013_06_16 for changeset 07352f119e48
Nilay Vaish [Sun, 16 Jun 2013 13:27:42 +0000 (08:27 -0500)]
Added tag stable_2013_06_16 for changeset 07352f119e48

10 years agoconfig: Do not instantiate membus when using ruby
Nilay Vaish [Thu, 13 Jun 2013 12:24:25 +0000 (07:24 -0500)]
config: Do not instantiate membus when using ruby
This patch moves the instantiation of system.membus in se.py to the area of
code where classic memory system has been dealt with. Ruby does not require
this bus and hence it should not be instantiated.

10 years agokvm: Add more VM stats
Andreas Sandberg [Tue, 11 Jun 2013 07:43:05 +0000 (09:43 +0200)]
kvm: Add more VM stats

This changeset adds the following stats to KVM:
 * numVMHalfEntries: Number of entries into KVM to finalize pending
   IO operations without executing guest instructions. These typically
   happen as a result of a drain where the guest must finalize some
   operations before the guest state is consistent.
 * numExitSignal: Number of VM exits that have been triggered by a
   signal. These usually happen as a result of the timer that limits
   the time spent in KVM.

10 years agokvm: Separate host frequency from simulated CPU frequency
Andreas Sandberg [Tue, 11 Jun 2013 07:24:55 +0000 (09:24 +0200)]
kvm: Separate host frequency from simulated CPU frequency

We used to use the KVM CPU's clock to specify the host frequency. This
was not ideal for several reasons. One of them being that the clock
parameter of a CPU determines the frequency of some of the components
connected to the CPU. This changeset adds a separate hostFreq
parameter that should be used to specify the host frequency until we
add code to autodetect it. The hostFactor should still be used to
specify the conversion factor between the host performance and that of
the simulated system.

10 years agokvm: Don't handle IO and execute in the same tick
Andreas Sandberg [Tue, 11 Jun 2013 07:24:51 +0000 (09:24 +0200)]
kvm: Don't handle IO and execute in the same tick

We currently execute instructions in the guest and then handle any IO
request right after we break out of the virtualized environment. This
has the effect of executing IO requests in the exact same tick as the
first instruction in the sequence that was just run. There seem to be
cases where this simplification upsets some timing-sensitive devices.

This changeset splits execute and IO (and other services) across
multiple ticks. This is implemented by adding a separate
RunningService state to the CPU state machine. When a VM requires
service, it enters into this state and pending IO is then serviced in
the future instead of immediately. The delay between getting the
request and servicing it depends on the number of cycles executed in
the guest, which allows other components to catch up with the CPU.

10 years agokvm: Maintain a local instruction counter and update totalNumInsts
Andreas Sandberg [Tue, 11 Jun 2013 07:24:40 +0000 (09:24 +0200)]
kvm: Maintain a local instruction counter and update totalNumInsts

Update the system's totalNumInst counter when exiting from KVM and
maintain an internal absolute instruction count instead of relying on
the one from perf.

10 years agox86: Fix bug when copying TSC on CPU handover
Andreas Sandberg [Tue, 11 Jun 2013 07:24:38 +0000 (09:24 +0200)]
x86: Fix bug when copying TSC on CPU handover

The TSC value stored in MISCREG_TSC is actually just an offset from
the current CPU cycle to the actual TSC value. Writes with
side-effects to the TSC subtract the current cycle count before
storing the new value, while reads add the current cycle count. When
switching CPUs, the current value is copied without side-effects. This
works as long as the source and the destination CPUs have the same
clock frequencies. The TSC will jump, sometimes backwards, if they
have different clock frequencies. Most OSes assume the TSC to be
monotonic and break when this happens.

This changeset makes sure that the TSC is copied with side-effects to
ensure that the offset is updated to match the new CPU.

10 years agosim: Revert [34e3295b0e39] (sim: Fix early termination in mult...)
Andreas Sandberg [Tue, 11 Jun 2013 07:24:10 +0000 (09:24 +0200)]
sim: Revert [34e3295b0e39] (sim: Fix early termination in mult...)

HG changset 34e3295b0e39 introduced a check in the main simulation
loop that discards exit events that happen at the same tick as another
exit event. This was supposed to fix a problem where a simulation
script got confused by multiple exit events. This obviously breaks the
simulator since it can hide important simulation events, such as a
simulation failure, that happen at the same time as a non-fatal
simulation event.

10 years agocpu: Add support for scheduling multiple inst/load stop events
Andreas Sandberg [Tue, 11 Jun 2013 07:18:25 +0000 (09:18 +0200)]
cpu: Add support for scheduling multiple inst/load stop events

Currently, the only way to get a CPU to stop after a fixed number of
instructions/loads is to set a property on the CPU that causes a
SimLoopExitEvent to be scheduled when the CPU is constructed. This is
clearly not ideal in cases where the simulation script wants the CPU
to stop at multiple instruction counts (e.g., SimPoint generation).

This changeset adds the methods scheduleInstStop() and
scheduleLoadStop() to the BaseCPU. These methods are exported to
Python and are designed to be used from the simulation script. By
using these methods instead of the old properties, a simulation script
can schedule a stop at any point during simulation or schedule
multiple stops. The number of instructions specified when scheduling a
stop is relative to the current point of execution.

10 years agostats: updates due to changes to ruby
Nilay Vaish [Mon, 10 Jun 2013 11:46:20 +0000 (06:46 -0500)]
stats: updates due to changes to ruby
Ruby's controller statistics have been mostly moved to stats.txt now.
Plus stats.txt for solaris/t1000-simple-atomic and arm/20.parser are
also being updated.

10 years agoruby: remove several unused variables in Profiler
Nilay Vaish [Sun, 9 Jun 2013 12:30:00 +0000 (07:30 -0500)]
ruby: remove several unused variables in Profiler
This patch removes per processor cycle count, histogram for filter stats,
histogram for multicasts, histogram for prefetch wait, some function
prototypes that do not have definitions.

10 years agoruby: remove periodic event from Profiler
Nilay Vaish [Sun, 9 Jun 2013 12:29:59 +0000 (07:29 -0500)]
ruby: remove periodic event from Profiler
The Profiler class does not need an event for dumping statistics
periodically. This is because there is a method for dumping statistics
for all the sim objects periodically. Since Ruby is a sim object, its
statistics are also included.

10 years agoruby: stats: use gem5's stats for cache and memory controllers
Nilay Vaish [Sun, 9 Jun 2013 12:29:59 +0000 (07:29 -0500)]
ruby: stats: use gem5's stats for cache and memory controllers
This moves event and transition count statistics for cache controllers to
gem5's statistics. It does the same for the statistics associated with the
memory controller in ruby.

All the cache/directory/dma controllers individually collect the event and
transition counts. A callback function, collateStats(), has been added that
is invoked on the controller version 0 of each controller class. This
function adds all the individual controller statistics to a vector
variables. All the code for registering the statistical variables and
collating them is generated by SLICC. The patch removes the files
*_Profiler.{cc,hh} and *_ProfileDumper.{cc,hh} which were earlier used for
collecting and dumping statistics respectively.

10 years agoruby: remove undefined functions in Address class
Nilay Vaish [Sun, 9 Jun 2013 12:29:58 +0000 (07:29 -0500)]
ruby: remove undefined functions in Address class

10 years agostats: allow printing vectors on a single line
Nilay Vaish [Sun, 9 Jun 2013 12:29:57 +0000 (07:29 -0500)]
stats: allow printing vectors on a single line
This patch adds a new flag to specify if the data values for a given vector
should be printed in one line in the stats.txt file. The default behavior
will be to print the data in multiple lines. It makes changes to print
functions to enforce this behavior.

10 years agoconfig: add atomic cpu to X86_MESI_CMP_directory build options
Nilay Vaish [Sun, 9 Jun 2013 02:57:02 +0000 (21:57 -0500)]
config: add atomic cpu to X86_MESI_CMP_directory build options
There is some problem with the way listing cpu options right now.
Since Ruby uses the options variable, this variable has to be created in the
config file that runs the fs test for x86 and mesi cmp directory combination.
While creating the variable, some error is occurs due to the way list of cpu
types is now created. Hence, we need to compile all the cpu models.

10 years agoUpdating EIO regression reference outputs for new stats.
Steve Reinhardt [Sat, 8 Jun 2013 14:28:33 +0000 (10:28 -0400)]
Updating EIO regression reference outputs for new stats.

10 years agoscons: ammend swig warning error to version 2.0.10 as well
Ali Saidi [Tue, 4 Jun 2013 20:17:04 +0000 (15:17 -0500)]
scons: ammend swig warning error to version 2.0.10 as well

10 years agodev: Clarify why updates are delayed when the MC14818 is activated
Andreas Sandberg [Tue, 4 Jun 2013 08:08:21 +0000 (10:08 +0200)]
dev: Clarify why updates are delayed when the MC14818 is activated

10 years agoarch: Create a method to finalize physical addresses
Andreas Sandberg [Mon, 3 Jun 2013 11:55:41 +0000 (13:55 +0200)]
arch: Create a method to finalize physical addresses
 in the TLB

Some architectures (currently only x86) require some fixing-up of
physical addresses after a normal address translation. This is usually
to remap devices such as the APIC, but could be used for other memory
mapped devices as well. When running the CPU in a using hardware
virtualization, we still need to do these address fix-ups before
inserting the request into the memory system. This patch moves this
patch allows that code to be used by such CPUs without doing full
address translations.

10 years agobase: Make the Python module loader PEP302 compliant
Andreas Sandberg [Mon, 3 Jun 2013 11:51:03 +0000 (13:51 +0200)]
base: Make the Python module loader PEP302 compliant

The custom Python loader didn't comply with PEP302 for two reasons:

 * Previously, we would overwrite old modules on name
   conflicts. PEP302 explicitly states that: "If there is an existing
   module object named 'fullname' in sys.modules, the loader must use
   that existing module".

 * The "__package__" attribute wasn't set. PEP302: "The __package__
   attribute must be set."

This changeset addresses both of these issues.

10 years agoconfig: Add missing CPUs to --restore-with-cpu
Andreas Sandberg [Mon, 3 Jun 2013 11:40:05 +0000 (13:40 +0200)]
config: Add missing CPUs to --restore-with-cpu

The --restore-with-cpu option didn't use CpuConfig.cpu_names() to
determine which CPU names are valid, instead it used a static list of
known CPU names. This changeset makes the option parsing code use the
CPU list from the CpuConfig module instead.

10 years agokvm: Allow architectures to override the cycle accounting mechanism
Andreas Sandberg [Mon, 3 Jun 2013 11:39:11 +0000 (13:39 +0200)]
kvm: Allow architectures to override the cycle accounting mechanism

Some architectures have special registers in the guest that can be
used to do cycle accounting. This is generally preferrable since the
prevents the guest from seeing a non-monotonic clock. This changeset
adds a virtual method, getHostCycles(), that the architecture-specific
code can override to implement this functionallity. The default
implementation uses the hwCycles counter.

10 years agokvm: Add handling of EAGAIN when creating timers
Andreas Sandberg [Mon, 3 Jun 2013 11:38:59 +0000 (13:38 +0200)]
kvm: Add handling of EAGAIN when creating timers

timer_create can apparently return -1 and set errno to EAGAIN if the
kernel suffered a temporary failure when allocating a timer. This
happens from time to time, so we need to handle it.

10 years agosim: Add debug output when executing pseudo-instructions
Andreas Sandberg [Mon, 3 Jun 2013 11:21:21 +0000 (13:21 +0200)]
sim: Add debug output when executing pseudo-instructions

10 years agokvm: Add a call to thread->startup() in startup()
Andreas Sandberg [Mon, 3 Jun 2013 10:36:56 +0000 (12:36 +0200)]
kvm: Add a call to thread->startup() in startup()

It is now required to initialize the thread context by calling
startup() on it. Failing to do so currently causes decoder in
x86-based CPUs to get very confused when restoring from checkpoints.

10 years agodev: Add support for disabling ticking and the divider in MC146818
Andreas Sandberg [Mon, 3 Jun 2013 10:28:52 +0000 (12:28 +0200)]
dev: Add support for disabling ticking and the divider in MC146818

Some Linux versions disable updates (regB.set = 1) to prevent the chip
from updating its internal state while the OS is updating it. Support
for this was already there, this patch merely disables the check in
writeReg that prevented it from being enabled. The patch also includes
support for disabling the divider, which is used to control when clock
updates should start after setting the internal RTC state.

These changes are required to boot most vanilla Linux distributions
that update the RTC settings at boot.

10 years agodev: Clean up MC146818 register (A & B) handling
Andreas Sandberg [Mon, 3 Jun 2013 10:28:41 +0000 (12:28 +0200)]
dev: Clean up MC146818 register (A & B) handling

Rewrite reg A & B handling to use the bitunion stuff instead of bit
masking. Add better error messages when the kernel tries to enable
unsupported stuff.

10 years agostats: Update the stats to reflect bus and memory changes
Andreas Hansson [Thu, 30 May 2013 16:54:18 +0000 (12:54 -0400)]
stats: Update the stats to reflect bus and memory changes

This patch updates the stats to reflect the addition of the bus stats,
and changes to the bus layers. In addition it updates the stats to
match the addition of the static pipeline latency of the memory
conotroller and the addition of a stat tracking the bytes per
activate.

10 years agomem: More descriptive DRAM config names
Andreas Hansson [Thu, 30 May 2013 16:54:14 +0000 (12:54 -0400)]
mem: More descriptive DRAM config names

This patch changes the class names of the variuos DRAM configurations
to better reflect what memory they are based on. The speed and
interface width is now part of the name, and also the alias that is
used to select them on the command line.

Some minor changes are done to the actual parameters, to better
reflect the named configurations. As a result of these changes the
regressions change slightly and the stats will be bumped in a separate
patch.

10 years agomem: Add bytes per activate DRAM controller stat
Andreas Hansson [Thu, 30 May 2013 16:54:13 +0000 (12:54 -0400)]
mem: Add bytes per activate DRAM controller stat

This patch adds a histogram to track how many bytes are accessed in an
open row before it is closed. This metric is useful in characterising
a workload and the efficiency of the DRAM scheduler. For example, a
DDR3-1600 device requires 44 cycles (tRC) before it can activate
another row in the same bank. For a x32 interface (8 bytes per cycle)
that means 8 x 44 = 352 bytes must be transferred to hide the
preparation time.

10 years agomem: Add static latency to the DRAM controller
Andreas Hansson [Thu, 30 May 2013 16:54:12 +0000 (12:54 -0400)]
mem: Add static latency to the DRAM controller

This patch adds a frontend and backend static latency to the DRAM
controller by delaying the responses. Two parameters expressing the
frontend and backend contributions in absolute time are added to the
controller, and the appropriate latency is added to the responses when
adding them to the (infinite) queued port for sending.

For writes and reads that hit in the write buffer, only the frontend
latency is added. For reads that are serviced by the DRAM, the static
latency is the sum of the pipeline latencies of the entire frontend,
backend and PHY. The default values are chosen based on having roughly
10 pipeline stages in total at 500 MHz.

In the future, it would be sensible to make the controller use its
clock and convert these latencies (and a few of the DRAM timings) to
cycles.

10 years agomem: Spring cleaning of MSHR and MSHRQueue
Andreas Hansson [Thu, 30 May 2013 16:54:11 +0000 (12:54 -0400)]
mem: Spring cleaning of MSHR and MSHRQueue

This patch does some minor tidying up of the MSHR and MSHRQueue. The
clean up started as part of some ad-hoc tracing and debugging, but
seems worthwhile enough to go in as a separate patch.

The highlights of the changes are reduced scoping (private) members
where possible, avoiding redundant new/delete, and constructor
initialisation to please static code analyzers.

10 years agomem: Fix MSHR print format
Andreas Hansson [Thu, 30 May 2013 16:54:09 +0000 (12:54 -0400)]
mem: Fix MSHR print format

This patch fixes an incorrect print format string by adding an
additional string element.

10 years agocpu: Prune the stale TraceCPU
Andreas Hansson [Thu, 30 May 2013 16:54:09 +0000 (12:54 -0400)]
cpu: Prune the stale TraceCPU

This patch prunes the TraceCPU as the code is stale and the
functionality that it provided can now be achieved with the TrafficGen
using its trace playback mode.

The TraceCPU was able to play back pre-recorded memory traces of a few
different formats, and to achieve this level of flexibility with the
TrafficGen, use the util/encode_packet_trace (with suitable
modifications) to create a protobuf trace off-line.

10 years agocpu: Check that minimum TrafficGen period is less than max period
Sascha Bischoff [Thu, 30 May 2013 16:54:08 +0000 (12:54 -0400)]
cpu: Check that minimum TrafficGen period is less than max period

Add a check which ensures that the minumum period for the LINEAR and
RANDOM traffic generator states is less than or equal to the maximum
period. If the minimum period is greater than the maximum period a
fatal is triggered.

10 years agocpu: Fix bug when reading in TrafficGen state transitions
Sascha Bischoff [Thu, 30 May 2013 16:54:07 +0000 (12:54 -0400)]
cpu: Fix bug when reading in TrafficGen state transitions

This patch fixes a bug with the traffic generator which occured when
reading in the state transitions from the configuration
file. Previously, the size of the vector which stored the transitions
was used to get the size of the transitions matrix, rather than using
the number of states. Therefore, if there were more transitions than
states, i.e. some transitions has a probability of less than 1, then
the traffic generator would fatal when trying to check the
transitions.

This issue has been addressed by using the number of input states,
rather then the number of transitions.

10 years agocpu: Add request elasticity to the traffic generator
Andreas Hansson [Thu, 30 May 2013 16:54:06 +0000 (12:54 -0400)]
cpu: Add request elasticity to the traffic generator

This patch adds an optional request elasticity to the traffic
generator, effectievly compensating for it in the case of the linear
and random generators, and adding it in the case of the trace
generator. The accounting is left with the top-level traffic
generator, and the individual generators do the necessary math as part
of determining the next packet tick.

Note that in the linear and random generators we have to compensate
for the blocked time to not be elastic, i.e. without this patch the
aforementioned generators will slow down in the case of back-pressure.

10 years agocpu: Block traffic generator when requests have to retry
Andreas Hansson [Thu, 30 May 2013 16:54:05 +0000 (12:54 -0400)]
cpu: Block traffic generator when requests have to retry

This patch changes the queued port for a conventional master port and
stalls the traffic generator when requests are not immediately
accepted. This is a first step to allowing elasticity in the injection
of requests.

The patch also adds stats for the sent packets and retries, and
slightly changes how the nextPacketTick and getNextPacket
interact. The advancing of the trace is now moved to getNextPacket and
nextPacketTick is only responsible for answering the question when the
next packet should be sent.

10 years agocpu: Move traffic generator sending out of generator states
Andreas Hansson [Thu, 30 May 2013 16:54:04 +0000 (12:54 -0400)]
cpu: Move traffic generator sending out of generator states

This patch moves the responsibility for sending packets out of the
generator states and leaves it with the top-level traffic
generator. The main aim of this patch is to enable a transition to
non-queued ports, i.e. with send/retry flow control, and to do so it
is much more convenient to not wrap the port interactions and instead
leave it all local to the traffic generator.

The generator states now only govern when they are ready to send
something new, and the generation of the packets to send. They thus
have no knowledge of the port that is used.

10 years agocpu: Fold together the StateGraph and the TrafficGen
Andreas Hansson [Thu, 30 May 2013 16:54:03 +0000 (12:54 -0400)]
cpu: Fold together the StateGraph and the TrafficGen

This patch simplifies the object hierarchy of the traffic generator by
getting rid of the StateGraph class and folding this functionality
into the traffic generator itself.

The main goal of this patch is to facilitate upcoming changes by
reducing the number of affected layers.

10 years agomem: Make returning snoop responses occupy response layer
Andreas Hansson [Thu, 30 May 2013 16:54:02 +0000 (12:54 -0400)]
mem: Make returning snoop responses occupy response layer

This patch introduces a mirrored internal snoop port to facilitate
easy addition of flow control for the snoop responses that are turned
into normal responses on their return. To perform this, the slave
ports of the coherent bus are wrapped in internal master ports that
are passed as the source ports to the response layer in question.

As a result of this patch, there is more contention for the response
resources, and as such system performance will decrease slightly.

A consequence of the mirrored internal port is that the port the bus
tells to retry (the internal one) and the port actually retrying (the
mirrored) one are not the same. Thus, the existing check in tryTiming
is not longer correct. In fact, the test is redundant as the layer is
only in the retry state while calling sendRetry on the waiting port,
and if the latter does not immediately call the bus then the retry
state is left. Consequently the check is removed.

10 years agomem: Make the buses multi layered
Andreas Hansson [Thu, 30 May 2013 16:54:01 +0000 (12:54 -0400)]
mem: Make the buses multi layered

This patch makes the buses multi layered, and effectively creates a
crossbar structure with distributed contention ports at the
destination ports. Before this patch, a bus could have a single
request, response and snoop response in flight at any time, and with
these changes there can be as many requests as connected slaves (bus
master ports), and as many responses as connected masters (bus slave
ports).

Together with address interleaving, this patch enables us to create
high-throughput memory interconnects, e.g. 50+ GByte/s.

10 years agomem: Separate the two snoop response cases in the bus
Andreas Hansson [Thu, 30 May 2013 16:54:00 +0000 (12:54 -0400)]
mem: Separate the two snoop response cases in the bus

This patch makes the flow control and state updates of the coherent
bus more clear by separating the two cases, i.e. forward as a snoop
response, or turn it into a normal response.

With this change it is also more clear what resources are being
occupied, and that we effectively bypass the busy check for the second
case. As a result of the change in resource usage some stats change.

10 years agomem: Tidy up a few variables in the bus
Andreas Hansson [Thu, 30 May 2013 16:53:59 +0000 (12:53 -0400)]
mem: Tidy up a few variables in the bus

This patch does some minor housekeeping on the bus code, removing
redundant code, and moving the extraction of the destination id to the
top of the functions using it.

10 years agomem: Add basic stats to the buses
Uri Wiener [Thu, 30 May 2013 16:53:58 +0000 (12:53 -0400)]
mem: Add basic stats to the buses

This patch adds a basic set of stats which are hard to impossible to
implement using only communication monitors, and are needed for
insight such as bus utilization, transactions through the bus etc.

Stats added include throughput and transaction distribution, and also
a two-dimensional vector capturing how many packets and how much data
is exchanged between the masters and slaves connected to the bus.

10 years agomem: Use unordered set in bus request tracking
Andreas Hansson [Thu, 30 May 2013 16:53:57 +0000 (12:53 -0400)]
mem: Use unordered set in bus request tracking

This patch changes the set used to track outstanding requests to an
unordered set (part of C++11 STL). There is no need to maintain the
order, and hopefully there might even be a small performance benefit.

10 years agomem: Check for waiting state in bus draining
Andreas Hansson [Thu, 30 May 2013 16:53:57 +0000 (12:53 -0400)]
mem: Check for waiting state in bus draining

This patch fixes a bug in the bus where the bus transitions from busy
to idle and still has a port that is waiting for a retry from a peer.

10 years agomem: Add a LPDDR3-1600 configuration
Andreas Hansson [Thu, 30 May 2013 16:53:56 +0000 (12:53 -0400)]
mem: Add a LPDDR3-1600 configuration

This patch adds a typical (leaning towards fast) LPDDR3 configuration
based on publically available data. As expected, it looks very similar
to the LPDDR2-S4 configuration, only with a slightly lower burst time.

10 years agomem: Adapt the LPDDR2 to match a single x32 channel
Andreas Hansson [Thu, 30 May 2013 16:53:55 +0000 (12:53 -0400)]
mem: Adapt the LPDDR2 to match a single x32 channel

This patch adapts the existing LPDDR2 configuration to make use of the
multi-channel functionality. Thus, to get a x64 interface two
controllers should be instantiated using the makeMultiChannel method.

The page size and ranks are also adapted to better suit with a typical
LPDDR2 part.

10 years agomem: Avoid explicitly zeroing the memory backing store
Andreas Hansson [Thu, 30 May 2013 16:53:54 +0000 (12:53 -0400)]
mem: Avoid explicitly zeroing the memory backing store

This patch removes the explicit memset as it is redundant and causes
the simulator to touch the entire space, forcing the host system to
allocate the pages.

Anonymous pages are mapped on the first access, and the page-fault
handler is responsible for zeroing them. Thus, the pages are still
zeroed, but we avoid touching the entire allocated space which enables
us to use much larger memory sizes as long as not all the memory is
actually used.

10 years agoutil: Auto generate the packet proto definitions
Andreas Hansson [Thu, 30 May 2013 16:53:53 +0000 (12:53 -0400)]
util: Auto generate the packet proto definitions

This patch simplifies the usage of the packet trace encoder/decoder by
attempting to automatically generating the packet proto definitions in
case they cannot be found.

10 years agobase: Avoid size limitation on protobuf coded streams
Andreas Hansson [Thu, 30 May 2013 16:53:53 +0000 (12:53 -0400)]
base: Avoid size limitation on protobuf coded streams

This patch changes how the streams are created to avoid the size
limitation on the coded streams. As we only read/write a single
message at a time, there is never any message larger than a few
bytes. However, the coded stream eventually complains that its
internal counter reaches 64+ MByte if the total file size exceeds this
value.

Based on suggestions in the protobuf discussion forums, the coded
stream is now created for every message that is read/written. The
result is that the internal byte count never goes about tens of bytes,
and we can read/write any size file that the underlying file I/O can
handle.