gem5.git
9 years agodev: Add a VirtIO console device model
Andreas Sandberg [Sat, 20 Sep 2014 21:17:52 +0000 (17:17 -0400)]
dev: Add a VirtIO console device model

9 years agodev, pci: Implement basic VirtIO support
Andreas Sandberg [Sat, 20 Sep 2014 21:17:51 +0000 (17:17 -0400)]
dev, pci: Implement basic VirtIO support

This patch adds support for VirtIO over the PCI bus. It does so by
providing the following new SimObjects:

 * VirtIODeviceBase - Abstract base class for VirtIO devices.
 * PciVirtIO - VirtIO PCI transport interface.

A VirtIO device is hooked up to the guest system by adding a PciVirtIO
device to the PCI bus and connecting it to a VirtIO device using the
vio parameter.

New VirtIO devices should inherit from VirtIODevice base and
implementing one or more VirtQueues. The VirtQueues are usually
device-specific and all derive from the VirtQueue class. Queues must
be registered with the base class from the constructor since the
device assumes that the number of queues stay constant.

9 years agodev: Refactor terminal<->UART interface to make it more generic
Andreas Sandberg [Sat, 20 Sep 2014 21:17:50 +0000 (17:17 -0400)]
dev: Refactor terminal<->UART interface to make it more generic

The terminal currently assumes that the transport to the guest always
inherits from the Uart class. This assumption breaks when
implementing, for example, a VirtIO consoles. This patch removes this
assumption by adding pointer to the from the terminal to the uart and
replacing it with a more general callback interface. The Uart, or any
other class using the terminal, class implements an instance of the
callbacks class and registers it with the terminal.

9 years agobase: Clean up redundant string functions and use C++11
Andreas Hansson [Sat, 20 Sep 2014 21:17:49 +0000 (17:17 -0400)]
base: Clean up redundant string functions and use C++11

This patch does a bit of housekeeping on the string helper functions
and relies on the C++11 standard library where possible. It also does
away with our custom string hash as an implementation is already part
of the standard library.

9 years agobase: Add getSectionNames to IniFile
Andrew Bardsley [Sat, 20 Sep 2014 21:17:47 +0000 (17:17 -0400)]
base: Add getSectionNames to IniFile

Add an accessor to IniFile to list all the sections in the file.

9 years agotests: automatically kill regressions that take too long
Curtis Dunham [Mon, 25 Aug 2014 19:32:00 +0000 (14:32 -0500)]
tests: automatically kill regressions that take too long

When GNU coreutils 'timeout' is available, limit each regression
simulation to 4 hours.

9 years agocpu: Add ExecFlags debug flag
Mitch Hayenga [Sat, 20 Sep 2014 21:17:45 +0000 (17:17 -0400)]
cpu: Add ExecFlags debug flag

Adds a debug flag to print out the flags a instruction is tagged with.

9 years agomem: Remove the GHB prefetcher from the source tree
Mitch Hayenga [Sat, 20 Sep 2014 21:17:44 +0000 (17:17 -0400)]
mem: Remove the GHB prefetcher from the source tree

There are two primary issues with this code which make it deserving of deletion.

1) GHB is a way to structure a prefetcher, not a definitive type of prefetcher
2) This prefetcher isn't even structured like a GHB prefetcher.
   It's basically a worse version of the stride prefetcher.

It primarily serves to confuse new gem5 users and most functionality is already
present in the stride prefetcher.

9 years agocpu: use probes infrastructure to do simpoint profiling
Dam Sunwoo [Sat, 20 Sep 2014 21:17:43 +0000 (17:17 -0400)]
cpu: use probes infrastructure to do simpoint profiling

Instead of having code embedded in cpu model to do simpoint profiling use
the probes infrastructure to do it.

9 years agoconfig: Cleanup .json config file generation
Andrew Bardsley [Sat, 20 Sep 2014 21:17:42 +0000 (17:17 -0400)]
config: Cleanup .json config file generation

This patch 'completes' .json config files generation by adding in the
SimObject references and String-valued parameters not currently
printed.

TickParamValues are also changed to print in the same tick-value
format as in .ini files.

This allows .json files to describe a system as fully as the .ini files
currently do.

This patch adds a new function config_value (which mirrors ini_str) to
each ParamValue and to SimObject.  This function can then be explicitly
changed to give different .json and .ini printing behaviour rather than
being written in terms of ini_str.

9 years agoarch: Pass faults by const reference where possible
Andreas Hansson [Fri, 19 Sep 2014 14:35:18 +0000 (10:35 -0400)]
arch: Pass faults by const reference where possible

This patch changes how faults are passed between methods in an attempt
to copy as few reference-counting pointer instances as possible. This
should avoid unecessary copies being created, contributing to the
increment/decrement of the reference counters.

9 years agocpu: Use a deque in o3 rename instruction queue
Andreas Hansson [Fri, 19 Sep 2014 14:35:14 +0000 (10:35 -0400)]
cpu: Use a deque in o3 rename instruction queue

Switch from a list to a data structure with better data layout.

9 years agobase: Ensure the CP annotation compiles again
Andreas Hansson [Fri, 19 Sep 2014 14:35:12 +0000 (10:35 -0400)]
base: Ensure the CP annotation compiles again

A bit of revamping to get the CP annotate functionality to compile.

9 years agomisc: Use safe_cast when assumptions are made about return value
Andreas Hansson [Fri, 19 Sep 2014 14:35:11 +0000 (10:35 -0400)]
misc: Use safe_cast when assumptions are made about return value

This patch changes two dynamic_cast to safe_cast as we assume the
return value is not NULL (without checking).

9 years agomisc: Restore ostream flags where needed
Andreas Hansson [Fri, 19 Sep 2014 14:35:09 +0000 (10:35 -0400)]
misc: Restore ostream flags where needed

This patch ensures we adhere to the normal ostream usage rules, and
restore the flags after modifying them.

9 years agostats: Fix flow-control bug in Vector2D printing
Andreas Hansson [Fri, 19 Sep 2014 14:35:08 +0000 (10:35 -0400)]
stats: Fix flow-control bug in Vector2D printing

9 years agomisc: Remove assertions ensuring unsigned values >= 0
Andreas Hansson [Fri, 19 Sep 2014 14:35:07 +0000 (10:35 -0400)]
misc: Remove assertions ensuring unsigned values >= 0

9 years agomem: Check return value of checkFunctional in SimpleMemory
Andreas Hansson [Fri, 19 Sep 2014 14:35:06 +0000 (10:35 -0400)]
mem: Check return value of checkFunctional in SimpleMemory

Simple fix to ensure we only iterate until we are done.

9 years agomem: Add checks to sendTimingReq in cache
Andreas Hansson [Fri, 19 Sep 2014 14:35:04 +0000 (10:35 -0400)]
mem: Add checks to sendTimingReq in cache

A small fix to ensure the return value is not ignored.

9 years agoruby: network: revert some of the changes from ad9c042dce54
Nilay Vaish [Mon, 15 Sep 2014 21:19:38 +0000 (16:19 -0500)]
ruby: network: revert some of the changes from ad9c042dce54
The changeset ad9c042dce54 made changes to the structures under the network
directory to use a map of buffers instead of vector of buffers.
The reasoning was that not all vnets that are created are used and we
needlessly allocate more buffers than required and then iterate over them
while processing network messages.  But the move to map resulted in a slow
down which was pointed out by Andreas Hansson.  This patch moves things
back to using vector of message buffers.

9 years agostats: Minor update of Minor stats after uncacheable fix
Andreas Hansson [Fri, 12 Sep 2014 14:22:50 +0000 (10:22 -0400)]
stats: Minor update of Minor stats after uncacheable fix

9 years agocpu: Fix memory access in Minor not setting parent Request flags
Andrew Bardsley [Fri, 12 Sep 2014 14:22:49 +0000 (10:22 -0400)]
cpu: Fix memory access in Minor not setting parent Request flags

This patch fixes cases where uncacheable/memory type flags are not set
correctly on a memory op which is split in the LSQ.  Without this
patch, request->request if freely used to check flags where the flags
should actually come from the accumulation of request fragment flags.

This patch also fixes a bug where an uncacheable access which passes
through tryToSendRequest more than once can increment
LSQ::numAccessesInMemorySystem more than once.

9 years agostyle: Fix line continuation, especially in debug messages
Andrew Bardsley [Fri, 12 Sep 2014 14:22:47 +0000 (10:22 -0400)]
style: Fix line continuation, especially in debug messages

This patch closes a number of space gaps in debug messages caused by
the incorrect use of line continuation within strings. (There's also
one consistency change to a similar, but correct, use of line
continuation)

9 years agominor: Fix typo in DPRINTF for Minor branch prediction
Andreas Hansson [Fri, 12 Sep 2014 14:22:46 +0000 (10:22 -0400)]
minor: Fix typo in DPRINTF for Minor branch prediction

9 years agosim: Automatically unregister probe listeners
Andreas Sandberg [Tue, 9 Sep 2014 08:36:43 +0000 (04:36 -0400)]
sim: Automatically unregister probe listeners

The ProbeListener base class automatically registers itself with a
probe manager. Currently, the class does not unregister a itself when
it is destroyed, which makes removing probes listeners somewhat
cumbersome. This patch adds an automatic call to
manager->removeListener in the ProbeListener destructor, which solves
the problem.

9 years agoconfig: Fix vectorparam command line parsing
Geoffrey Blake [Tue, 9 Sep 2014 08:36:34 +0000 (04:36 -0400)]
config: Fix vectorparam command line parsing

Parsing vectorparams from the command was slightly broken
in that it wouldn't accept the input that the help message
provided to the user and it didn't do the conversion
on the second code path used to convert the string input
to the actual internal representation.  This patch fixes these bugs.

9 years agocpu: Only iterate over possible threads on the o3 cpu
Mitch Hayenga [Tue, 9 Sep 2014 08:36:34 +0000 (04:36 -0400)]
cpu: Only iterate over possible threads on the o3 cpu

Some places in O3 always iterated over "Impl::MaxThreads" even if a CPU had
fewer threads.  This removes a few of those instances.

9 years agomem: Add accessor function for vaddr
Mitch Hayenga [Tue, 9 Sep 2014 08:36:33 +0000 (04:36 -0400)]
mem: Add accessor function for vaddr

Determine if a request has an associated virtual address.

9 years agosim: Fix resource leak in BaseGlobalEvent
Andreas Sandberg [Tue, 9 Sep 2014 08:36:32 +0000 (04:36 -0400)]
sim: Fix resource leak in BaseGlobalEvent

Static analysis revealed that BaseGlobalEvent::barrier was never
deallocated. This changeset solves this leak by making the barrier
allocation a part of the BaseGlobalEvent instead of storing a pointer
to a separate heap-allocated barrier.

9 years agomisc: Fix a number of unitialised variables and members
Andreas Hansson [Tue, 9 Sep 2014 08:36:31 +0000 (04:36 -0400)]
misc: Fix a number of unitialised variables and members

Static analysis unearther a bunch of uninitialised variables and
members, and this patch addresses the problem. In all cases these
omissions seem benign in the end, but at least fixing them means less
false positives next time round.

9 years agodev: seperate legacy io offsets from PCI offset
Ali Saidi [Wed, 3 Sep 2014 11:43:06 +0000 (07:43 -0400)]
dev: seperate legacy io offsets from PCI offset

The PC platform has a single IO range that is used both legacy IO and PCI IO
while other platforms may use seperate regions. Provide another mechanism to
configure the legacy IO base address range and set it to the PCI IO address
range for x86.

9 years agoarm: Support >2GB of memory for AArch64 systems
Ali Saidi [Wed, 3 Sep 2014 11:43:05 +0000 (07:43 -0400)]
arm: Support >2GB of memory for AArch64 systems

9 years agoarm: Assume we have a kernel that supports pci devices
Ali Saidi [Wed, 3 Sep 2014 11:43:04 +0000 (07:43 -0400)]
arm: Assume we have a kernel that supports pci devices

Change the default kernel for AArch64 and since it supports PCI devices
remove the hack that made it use CF. Unfortunately, there isn't really
a half-way here and we need to switch. Current users will get an error
message that the kernel isn't found and hopefully go download a new
kernel that supports PCI.

9 years agodev, arm: Add support for linux generic pci host driver
Ali Saidi [Wed, 3 Sep 2014 11:43:04 +0000 (07:43 -0400)]
dev, arm: Add support for linux generic pci host driver

This change adds support for a generic pci host bus driver that
has been included in recent Linux kernel instead of the more
bespoke one we've been using to date. It also works with
aarch64 so it provides PCI support for 64-bit ARM Linux.

To make this work a new configuration option pci_io_base is added
to the RealView platform that should be set to the start of
the memory used as memory mapped IO ports (IO ports that are
memory mapped, not regular memory mapped IO). And a parameter
pci_cfg_gen_offsets which specifies if the config space
offsets should be used that the generic driver expects.

To use the pci-host-generic device you need to:
pci_io_base = 0x2f000000 (Valid for VExpress EMM)
pci_cfg_gen_offsets = True

and add the following to your device tree:

    pci {
        compatible = "pci-host-ecam-generic";
        device_type = "pci";
        #address-cells = <0x3>;
        #size-cells = <0x2>;
        #interrupt-cells = <0x1>;
        //bus-range = <0x0 0x1>;

        // CPU_PHYSICAL(2)  SIZE(2)
        // Note, some DTS blobs only support 1 size
        reg = <0x0 0x30000000 0x0 0x10000000>;

        // IO (1), no bus address (2), cpu address (2), size (2)
        // MMIO (1), at address (2), cpu address (2), size (2)
        ranges = <0x01000000 0x0 0x00000000 0x0 0x2f000000 0x0 0x10000>,
                 <0x02000000 0x0 0x40000000 0x0 0x40000000 0x0 0x10000000>;

        // With gem5 we typically use INTA/B/C/D one per device
        interrupt-map = <0x0000 0x0 0x0 0x1 0x1 0x0 0x11 0x1
                         0x0000 0x0 0x0 0x2 0x1 0x0 0x12 0x1
                         0x0000 0x0 0x0 0x3 0x1 0x0 0x13 0x1
                         0x0000 0x0 0x0 0x4 0x1 0x0 0x14 0x1>;

        // Only match INTA/B/C/D and not BDF
        interrupt-map-mask = <0x0000 0x0 0x0 0x7>;
    };

9 years agoconfig: Add port splicing capability to PortRef class
Geoffrey Blake [Wed, 3 Sep 2014 11:43:03 +0000 (07:43 -0400)]
config: Add port splicing capability to PortRef class

The new configuration scripts need the ability to splice
a simobject between a pair of ports that are already connected.
The primary use case is when a CommMonitor needs to be
created after the system is configured and then spliced between
the pair of ports it will monitor.

9 years agoconfig: Update Streamline scripts and configs
Dam Sunwoo [Wed, 3 Sep 2014 11:43:02 +0000 (07:43 -0400)]
config: Update Streamline scripts and configs

Updated the stat_config.ini files to reflect new structure.

Moved to a more generic stat naming scheme that can easily handle
multiple CPUs and L2s by letting the script replace pre-defined #
symbols to CPU or L2 ids.

Removed the previous per_switch_cpus sections. Still can be used by
spelling out the stat names if necessary. (Resuming from checkpoints
no longer use switch_cpus. Only fast-forwarding does.)

9 years agoconfig: Refactor RealviewEMM to fit into new config system
Geoffrey Blake [Wed, 3 Sep 2014 11:43:01 +0000 (07:43 -0400)]
config: Refactor RealviewEMM to fit into new config system

This eliminates some default devices and adds in helper functions
to connect the devices defined here to associate with the proper
clock domains.

9 years agostats: Update stats for CPU and cache changes
Andreas Hansson [Wed, 3 Sep 2014 11:42:59 +0000 (07:42 -0400)]
stats: Update stats for CPU and cache changes

This patch updates the stats to reflect the fixes and changes to the
CPU (mainly the o3), and the caches.

9 years agotests: Use medium dataset for perlbmk regressions
Andreas Hansson [Wed, 3 Sep 2014 11:42:57 +0000 (07:42 -0400)]
tests: Use medium dataset for perlbmk regressions

This patch changes the perlbmk regression script from the large to the
medium dataset to reduce the regression run time. For all ISAs and CPU
models, the total perlbmk host CPU time with the large dataset is
roughly 12 hours (constituting >30% of the total regression host
time). There is, most likely, almost no added value in terms of code
coverage for this rather excessive run time.

9 years agoalpha: Stop using 'inorder' and rely entirely on 'minor'
Andreas Hansson [Wed, 3 Sep 2014 11:42:56 +0000 (07:42 -0400)]
alpha: Stop using 'inorder' and rely entirely on 'minor'

This patch avoids building the 'inorder' CPU model for any permutation
of ALPHA, and also removes the ALPHA regressions using the 'inorder'
CPU. The 'minor' CPU is already providing a broader test coverage.

9 years agobase: Use STL C++11 random number generation
Andreas Hansson [Wed, 3 Sep 2014 11:42:55 +0000 (07:42 -0400)]
base: Use STL C++11 random number generation

This patch changes the random number generator from the in-house
Mersenne twister to an implementation relying entirely on C++11 STL.

The format for the checkpointing of the twister is simplified. As the
functionality was never used this should not matter. Note that this
patch does not actually make use of the checkpointing
functionality. As the random number generator is not thread safe, it
may be sensible to create one generator per thread, system, or even
object. Until this is decided the status quo is maintained in that no
generator state is part of the checkpoint.

9 years agobase: Use the global Mersenne twister throughout
Andreas Hansson [Wed, 3 Sep 2014 11:42:54 +0000 (07:42 -0400)]
base: Use the global Mersenne twister throughout

This patch tidies up random number generation to ensure that it is
done consistently throughout the code base. In essence this involves a
clean-up of Ruby, and some code simplifications in the traffic
generator.

As part of this patch a bunch of skewed distributions (off-by-one etc)
have been fixed.

Note that a single global random number generator is used, and that
the object instantiation order will impact the behaviour (the sequence
of numbers will be unaffected, but if module A calles random before
module B then they would obviously see a different outcome). The
dependency on the instantiation order is true in any case due to the
execution-model of gem5, so we leave it as is. Also note that the
global ranom generator is not thread safe at this point.

Regressions using the memtest, TrafficGen or any Ruby tester are
affected and will be updated accordingly.

9 years agomem: Avoid unecessary retries when bus peer is not ready
Andreas Hansson [Wed, 3 Sep 2014 11:42:53 +0000 (07:42 -0400)]
mem: Avoid unecessary retries when bus peer is not ready

This patch removes unecessary retries that happened when the bus layer
itself was no longer busy, but the the peer was not yet ready. Instead
of sending a retry that will inevitably not succeed, the bus now
silenty waits until the peer sends a retry.

9 years agoarm: Make memory ops work on 64bit/128-bit quantities
Mitch Hayenga [Wed, 3 Sep 2014 11:42:52 +0000 (07:42 -0400)]
arm: Make memory ops work on 64bit/128-bit quantities

Multiple instructions assume only 32-bit load operations are available,
this patch increases load sizes to 64-bit or 128-bit for many load pair and
load multiple instructions.

10 years agomem: write streaming support via WriteInvalidate promotion
Curtis Dunham [Fri, 27 Jun 2014 17:29:00 +0000 (12:29 -0500)]
mem: write streaming support via WriteInvalidate promotion

Support full-block writes directly rather than requiring RMW:
 * a cache line is allocated in the cache upon receipt of a
   WriteInvalidateReq, not the WriteInvalidateResp.
 * only top-level caches allocate the line; the others just pass
   the request along and invalidate as necessary.
 * to close a timing window between the *Req and the *Resp, a new
   metadata bit tracks whether another cache has read a copy of
   the new line before the writeback to memory.

9 years agomem: Fix a bug in the cache port flow control
Andreas Hansson [Wed, 3 Sep 2014 11:42:50 +0000 (07:42 -0400)]
mem: Fix a bug in the cache port flow control

This patch fixes a bug in the cache port where the retry flag was
reset too early, allowing new requests to arrive before the retry was
actually sent, but with the event already scheduled. This caused a
deadlock in the interactions with the O3 LSQ.

The patche fixes the underlying issue by shifting the resetting of the
flag to be done by the event that also calls sendRetry(). The patch
also tidies up the flow control in recvTimingReq and ensures that we
also check if we already have a retry outstanding.

10 years agocpu, mem: Make software prefetches non-blocking
Curtis Dunham [Tue, 13 May 2014 17:20:49 +0000 (12:20 -0500)]
cpu, mem: Make software prefetches non-blocking

Previously, they were treated so much like loads that they could stall
at the head of the ROB.  Now they are always treated like L1 hits.
If they actually miss, a new request is created at the L1 and tracked
from the MSHRs there if necessary (i.e. if it didn't coalesce with
an existing outstanding load).

10 years agomem: Refactor assignment of Packet types
Curtis Dunham [Tue, 13 May 2014 17:20:48 +0000 (12:20 -0500)]
mem: Refactor assignment of Packet types

Put the packet type swizzling (that is currently done in a lot of places)
into a refineCommand() member function.

9 years agox86: Flag instructions that call suspend as IsQuiesce
Mitch Hayenga [Wed, 3 Sep 2014 11:42:46 +0000 (07:42 -0400)]
x86: Flag instructions that call suspend as IsQuiesce

The o3 cpu relies upon instructions that suspend a thread context being
flagged as "IsQuiesce".  If they are not, unpredictable behavior can occur.
This patch fixes that for the x86 ISA.

9 years agocpu: Fix o3 drain bug
Mitch Hayenga [Wed, 3 Sep 2014 11:42:45 +0000 (07:42 -0400)]
cpu: Fix o3 drain bug

For X86, the o3 CPU would get stuck with the commit stage not being
drained if an interrupt arrived while drain was pending. isDrained()
makes sure that pcState.microPC() == 0, thus ensuring that we are at
an instruction boundary. However, when we take an interrupt we
execute:

    pcState.upc(romMicroPC(entry));
    pcState.nupc(romMicroPC(entry) + 1);
    tc->pcState(pcState);

As a result, the MicroPC is no longer zero. This patch ensures the drain is
delayed until no interrupts are present.  Once draining, non-synchronous
interrupts are deffered until after the switch.

9 years agoarm: Fix v8 neon latency issue for loads/stores
Mitch Hayenga [Wed, 3 Sep 2014 11:42:44 +0000 (07:42 -0400)]
arm: Fix v8 neon latency issue for loads/stores

Neon memory ops that operate on multiple registers currently have very poor
performance because of interleave/deinterleave micro-ops.

This patch marks the deinterleave/interleave micro-ops as "No_OpClass" such
that they take minumum cycles to execute and are never resource constrained.

Additionaly the micro-ops over-read registers.  Although one form may need
to read up to 20 sources, not all do.  This adds in new forms so false
dependencies are not modeled.  Instructions read their minimum number of
sources.

10 years agoarm: use condition code registers for ARM ISA
Curtis Dunham [Tue, 29 Apr 2014 21:05:02 +0000 (16:05 -0500)]
arm: use condition code registers for ARM ISA

Analogous to ee049bf (for x86).  Requires a bump of the checkpoint version
and corresponding upgrader code to move the condition code register values
to the new register file.

9 years agoarm: ISA X31 destination register fix
Andrew Bardsley [Wed, 3 Sep 2014 11:42:43 +0000 (07:42 -0400)]
arm: ISA X31 destination register fix

This patch substituted the zero register for X31 used as a
destination register.  This prevents false dependencies based on
X31.

9 years agotests: Use O3_ARM_v7a config for full-system ARM regressions
Andreas Hansson [Wed, 3 Sep 2014 11:42:41 +0000 (07:42 -0400)]
tests: Use O3_ARM_v7a config for full-system ARM regressions

This patch changes the CPU configuration used for the full-system ARM
regressions to increase the test coverage. Note that it is only the
core configuration, and not the caches etc.

9 years agocpu: fix bimodal predictor to use correct global history reg
Dam Sunwoo [Wed, 3 Sep 2014 11:42:41 +0000 (07:42 -0400)]
cpu: fix bimodal predictor to use correct global history reg

A small bug in the bimodal predictor caused significant degradation in
performance on some benchmarks. This was caused by using the wrong
globalHistoryReg during the update phase. This patches fixes the bug
and brings the performance to normal level.

9 years agoarm: Mark v7 cbz instructions as direct branches
Mitch Hayenga [Wed, 3 Sep 2014 11:42:40 +0000 (07:42 -0400)]
arm: Mark v7 cbz instructions as direct branches

v7 cbz/cbnz instructions were improperly marked as indirect branches.

9 years agocpu: Fix cache blocked load behavior in o3 cpu
Mitch Hayenga [Wed, 3 Sep 2014 11:42:39 +0000 (07:42 -0400)]
cpu: Fix cache blocked load behavior in o3 cpu

This patch fixes the load blocked/replay mechanism in the o3 cpu.  Rather than
flushing the entire pipeline, this patch replays loads once the cache becomes
unblocked.

Additionally, deferred memory instructions (loads which had conflicting stores),
when replayed would not respect the number of functional units (only respected
issue width).  This patch also corrects that.

Improvements over 20% have been observed on a microbenchmark designed to
exercise this behavior.

9 years agocpu: Fix o3 quiesce fetch bug
Mitch Hayenga [Wed, 3 Sep 2014 11:42:38 +0000 (07:42 -0400)]
cpu: Fix o3 quiesce fetch bug

O3 is supposed to stop fetching instructions once a quiesce is encountered.
However due to a bug, it would continue fetching instructions from the current
fetch buffer.  This is because of a break statment that only broke out of the
first of 2 nested loops.  It should have broken out of both.

9 years agocpu: Fix SMT scheduling issue with the O3 cpu
Mitch Hayenga [Wed, 3 Sep 2014 11:42:37 +0000 (07:42 -0400)]
cpu: Fix SMT scheduling issue with the O3 cpu

The o3 cpu could attempt to schedule inactive threads under round-robin SMT
mode.

This is because it maintained an independent priority list of threads from the
active thread list.  This priority list could be come stale once threads were
inactive, leading to the cpu trying to fetch/commit from inactive threads.

Additionally the fetch queue is now forcibly flushed of instrctuctions
from the de-scheduled thread.

Relevant output:

24557000: system.cpu: [tid:1]: Calling deactivate thread.
24557000: system.cpu: [tid:1]: Removing from active threads list

24557500: system.cpu:
FullO3CPU: Ticking main, FullO3CPU.
24557500: system.cpu.fetch: Running stage.
24557500: system.cpu.fetch: Attempting to fetch from [tid:1]

9 years agocpu: Fix incorrect speculative branch predictor behavior
Mitch Hayenga [Wed, 3 Sep 2014 11:42:36 +0000 (07:42 -0400)]
cpu: Fix incorrect speculative branch predictor behavior

When a branch mispredicted gem5 would squash all history after and including
the mispredicted branch.  However, the mispredicted branch is still speculative
and its history is required to rollback state if another, older, branch
mispredicts.  This leads to things like RAS corruption.

9 years agocpu: Add a fetch queue to the o3 cpu
Mitch Hayenga [Wed, 3 Sep 2014 11:42:35 +0000 (07:42 -0400)]
cpu: Add a fetch queue to the o3 cpu

This patch adds a fetch queue that sits between fetch and decode to the
o3 cpu.  This effectively decouples fetch from decode stalls allowing it
to be more aggressive, running futher ahead in the instruction stream.

9 years agocpu: Fix o3 front-end pipeline interlock behavior
Mitch Hayenga [Wed, 3 Sep 2014 11:42:34 +0000 (07:42 -0400)]
cpu: Fix o3 front-end pipeline interlock behavior

The o3 pipeline interlock/stall logic is incorrect.  o3 unnecessicarily stalled
fetch and decode due to later stages in the pipeline.  In general, a stage
should usually only consider if it is stalled by the adjacent, downstream stage.
Forcing stalls due to later stages creates and results in bubbles in the
pipeline.  Additionally, o3 stalled the entire frontend (fetch, decode, rename)
on a branch mispredict while the ROB is being serially walked to update the
RAT (robSquashing). Only should have stalled at rename.

9 years agocpu: Change writeback modeling for outstanding instructions
Mitch Hayenga [Wed, 3 Sep 2014 11:42:33 +0000 (07:42 -0400)]
cpu: Change writeback modeling for outstanding instructions

As highlighed on the mailing list gem5's writeback modeling can impact
performance.  This patch removes the limitation on maximum outstanding issued
instructions, however the number that can writeback in a single cycle is still
respected in instToCommit().

9 years agoarch: Properly guess OpClass from optional StaticInst flags
Mitch Hayenga [Wed, 3 Sep 2014 11:42:32 +0000 (07:42 -0400)]
arch: Properly guess OpClass from optional StaticInst flags

isa_parser.py guesses the OpClass if none were given based upon the StaticInst
flags.  The existing code does not take into account optionally set flags.
This code hoists the setting of optional flags so OpClass is properly assigned.

9 years agocache: Fix handling of LL/SC requests under contention
Geoffrey Blake [Wed, 3 Sep 2014 11:42:31 +0000 (07:42 -0400)]
cache: Fix handling of LL/SC requests under contention

If a set of LL/SC requests contend on the same cache block we
can get into a situation where CPUs will deadlock if they expect
a failed SC to supply them data.  This case happens where 3 or
more cores are contending for a cache block using LL/SC and the system
is configured where 2 cores are connected to a local bus and the
third is connected to a remote bus.  If a core on the local bus
sends an SCUpgrade and the core on the remote bus sends and SCUpgrade
they will race to see who will win the SC access.  In the meantime
if the other core appends a read to one of the SCUpgrades it will expect
to be supplied data by that SCUpgrade transaction.  If it happens that
the SCUpgrade that was picked to supply the data is failed, it will
drop the appended request for data and never respond, leaving the requesting
core to deadlock.  This patch makes all SC's behave as normal stores to
prevent this case but still makes sure to check whether it can perform
the update.

10 years agoarm: support 16kb vm granules
Curtis Dunham [Tue, 27 May 2014 16:00:56 +0000 (11:00 -0500)]
arm: support 16kb vm granules

9 years agomem: Add utility script to plot DRAM efficiency sweep
Andreas Hansson [Wed, 3 Sep 2014 11:42:29 +0000 (07:42 -0400)]
mem: Add utility script to plot DRAM efficiency sweep

This patch adds basic functionality to quickly visualise the output
from the DRAM efficiency script. There are some unfortunate hacks
needed to communicate the needed information from one script to the
other, and we fall back on (ab)using the simout to do this.

As part of this patch we also trim the efficiency sweep to stop at 512
bytes as this should be sufficient for all forseeable DRAMs.

9 years agomem: Packet queue clean up
Andreas Hansson [Wed, 3 Sep 2014 11:42:28 +0000 (07:42 -0400)]
mem: Packet queue clean up

No change in functionality, just a bit of tidying up.

9 years agodev: Avoid invalid sized reads in PL390 with DPRINTF enabled
Mitch Hayenga [Wed, 3 Sep 2014 11:42:27 +0000 (07:42 -0400)]
dev: Avoid invalid sized reads in PL390 with DPRINTF enabled

The first DPRINTF() in PL390::writeDistributor always read a uint32_t, though a
packet may have only been 1 or 2 bytes.  This caused an assertion in
packet->get().

9 years agosim: Fix checkpoint restore for Ticked
Andrew Bardsley [Wed, 3 Sep 2014 11:42:25 +0000 (07:42 -0400)]
sim: Fix checkpoint restore for Ticked

This patch makes restoring the 'lastStopped' value for Ticked-containing
objects (including MinorCPU) optional so that Ticked-containing objects
can be restored from non-Ticked-containing objects (such as AtomicSimpleCPU).

9 years agoarch, cpu: Factor out the ExecContext into a proper base class
Andreas Sandberg [Wed, 3 Sep 2014 11:42:22 +0000 (07:42 -0400)]
arch, cpu: Factor out the ExecContext into a proper base class

We currently generate and compile one version of the ISA code per CPU
model. This is obviously wasting a lot of resources at compile
time. This changeset factors out the interface into a separate
ExecContext class, which also serves as documentation for the
interface between CPUs and the ISA code. While doing so, this
changeset also fixes up interface inconsistencies between the
different CPU models.

The main argument for using one set of ISA code per CPU model has
always been performance as this avoid indirect branches in the
generated code. However, this argument does not hold water. Booting
Linux on a simulated ARM system running in atomic mode
(opt/10.linux-boot/realview-simple-atomic) is actually 2% faster
(compiled using clang 3.4) after applying this patch. Additionally,
compilation time is decreased by 35%.

9 years agoarch: Cleanup unused ISA traits constants
Andreas Hansson [Wed, 3 Sep 2014 11:42:21 +0000 (07:42 -0400)]
arch: Cleanup unused ISA traits constants

This patch prunes unused values, and also unifies how the values are
defined (not using an enum for ALPHA), aligning the use of int vs Addr
etc.

The patch also removes the duplication of PageBytes/PageShift and
VMPageSize/LogVMPageSize. For all ISAs the two pairs had identical
values and the latter has been removed.

9 years agoconfig: Change parsing of Addr so hex values work from scripts
Mitch Hayenga [Wed, 3 Sep 2014 11:42:20 +0000 (07:42 -0400)]
config: Change parsing of Addr so hex values work from scripts

When passed from a configuration script with a hexadecimal value (like
"0x80000000"), gem5 would error out. This is because it would call
"toMemorySize" which requires the argument to end with a size specifier (like
1MB, etc).

This modification makes it so raw hex values can be passed through Addr
parameters from the configuration scripts.

9 years agoarm: Fix ExtMachInst hash operator underlying type
Andreas Hansson [Wed, 3 Sep 2014 11:42:19 +0000 (07:42 -0400)]
arm: Fix ExtMachInst hash operator underlying type

This patch fixes the hash operator used for ARM ExtMachInst, which
incorrectly was still using uint32_t. Instead of changing it to
uint64_t it is not using the underlying data type of the BitUnion.

9 years agostats: updates due to recent ruby and x86 changes
Nilay Vaish [Mon, 1 Sep 2014 21:55:52 +0000 (16:55 -0500)]
stats: updates due to recent ruby and x86 changes
Also updates many out of date config files.

9 years agoruby: remove typedef of Index as int64
Nilay Vaish [Mon, 1 Sep 2014 21:55:50 +0000 (16:55 -0500)]
ruby: remove typedef of Index as int64
The Index type defined as typedef int64 does not really provide any help
since in most places we use primitive types instead of Index.  Also, the name
Index is very generic that it does not merit being used as a typename.

9 years agox86: set op class of two fp instructions
Nilay Vaish [Mon, 1 Sep 2014 21:55:49 +0000 (16:55 -0500)]
x86: set op class of two fp instructions
This patch sets op class of two fp instructions: movfp and pop x87 stack
as IntAluOp since these instructions do not make use of the fp alu.

9 years agoruby: PerfectSwitch: moves code to a per vnet helper function
Nilay Vaish [Mon, 1 Sep 2014 21:55:48 +0000 (16:55 -0500)]
ruby: PerfectSwitch: moves code to a per vnet helper function
This patch moves code from the wakeup() function to a operateVnet().
The aim is to improve the readiblity of the code.

9 years agoruby: message buffers: significant changes
Nilay Vaish [Mon, 1 Sep 2014 21:55:47 +0000 (16:55 -0500)]
ruby: message buffers:  significant changes

This patch is the final patch in a series of patches.  The aim of the series
is to make ruby more configurable than it was.  More specifically, the
connections between controllers are not at all possible (unless one is ready
to make significant changes to the coherence protocol).  Moreover the buffers
themselves are magically connected to the network inside the slicc code.
These connections are not part of the configuration file.

This patch makes changes so that these connections will now be made in the
python configuration files associated with the protocols.  This requires
each state machine to expose the message buffers it uses for input and output.
So, the patch makes these buffers configurable members of the machines.

The patch drops the slicc code that usd to connect these buffers to the
network.  Now these buffers are exposed to the python configuration system
as Master and Slave ports.  In the configuration files, any master port
can be connected any slave port.  The file pyobject.cc has been modified to
take care of allocating the actual message buffer.  This is inline with how
other port connections work.

9 years agobuild opts: add MI_example to NULL ISA
Nilay Vaish [Mon, 1 Sep 2014 21:55:46 +0000 (16:55 -0500)]
build opts: add MI_example to NULL ISA
A later changeset changes the file src/python/swig/pyobject.cc to include
a header file that includes a header file generated at build time depending
on the PROTOCOL in use.  Since NULL ISA was not specifying any protocol,
this resulted in compilation problems.  Hence, the changeset.

9 years agomem: change the namespace Message to ProtoMessage
Nilay Vaish [Mon, 1 Sep 2014 21:55:46 +0000 (16:55 -0500)]
mem: change the namespace Message to ProtoMessage
The namespace Message conflicts with the Message data type used extensively
in Ruby.  Since Ruby is being moved to the same Master/Slave ports based
configuration style as the rest of gem5, this conflict needs to be resolved.
Hence, the namespace is being renamed to ProtoMessage.

9 years agoruby: slicc: change the way configurable members are specified
Nilay Vaish [Mon, 1 Sep 2014 21:55:45 +0000 (16:55 -0500)]
ruby: slicc: change the way configurable members are specified
There are two changes this patch makes to the way configurable members of a
state machine are specified in SLICC.  The first change is that the data
member declarations will need to be separated by a semi-colon instead of a
comma.  Secondly, the default value to be assigned would now use SLICC's
assignment operator i.e. ':='.

9 years agoruby: slicc: improve the grammar
Nilay Vaish [Mon, 1 Sep 2014 21:55:44 +0000 (16:55 -0500)]
ruby: slicc: improve the grammar
This patch changes the grammar for SLICC so as to remove some of the
redundant / duplicate rules.  In particular rules for object/variable
declaration and class member declaration have been unified. Similarly, the
rules for a general function and a class method have been unified.

One more change is in the priority of two rules.  The first rule is on
declaring a function with all the params typed and named.  The second rule is
on declaring a function with all the params only typed.  Earlier the second
rule had a higher priority.  Now the first rule has a higher priority.

9 years agoruby: mesi three level: slight naming changes.
Nilay Vaish [Mon, 1 Sep 2014 21:55:44 +0000 (16:55 -0500)]
ruby: mesi three level: slight naming changes.

9 years agoruby: slicc: donot prefix machine name to variables
Nilay Vaish [Mon, 1 Sep 2014 21:55:43 +0000 (16:55 -0500)]
ruby: slicc: donot prefix machine name to variables
This changeset does away with prefixing of member variables of state machines
with the identity of the machine itself.

9 years agoruby: remove unused toString() from AbstractController
Nilay Vaish [Mon, 1 Sep 2014 21:55:42 +0000 (16:55 -0500)]
ruby: remove unused toString() from AbstractController

9 years agoruby: network: move getNumNodes() to base class
Nilay Vaish [Mon, 1 Sep 2014 21:55:42 +0000 (16:55 -0500)]
ruby: network: move getNumNodes() to base class
All the implementations were doing the same things.

9 years agoruby: eliminate type Time
Nilay Vaish [Mon, 1 Sep 2014 21:55:41 +0000 (16:55 -0500)]
ruby: eliminate type Time
There is another type Time in src/base class which results in a conflict.

9 years agoruby: move files from ruby/system to ruby/structures
Nilay Vaish [Mon, 1 Sep 2014 21:55:40 +0000 (16:55 -0500)]
ruby: move files from ruby/system to ruby/structures

The directory ruby/system is crowded and unorganized. Hence, the files the
hold actual physical structures, are being moved to the directory
ruby/structures.  This includes Cache Memory, Directory Memory,
Memory Controller, Wire Buffer, TBE Table, Perfect Cache Memory, Timer Table,
Bank Array.

The directory ruby/systems has the glue code that holds these structures
together.

--HG--
rename : src/mem/ruby/system/MachineID.hh => src/mem/ruby/common/MachineID.hh
rename : src/mem/ruby/buffers/MessageBuffer.cc => src/mem/ruby/network/MessageBuffer.cc
rename : src/mem/ruby/buffers/MessageBuffer.hh => src/mem/ruby/network/MessageBuffer.hh
rename : src/mem/ruby/buffers/MessageBufferNode.cc => src/mem/ruby/network/MessageBufferNode.cc
rename : src/mem/ruby/buffers/MessageBufferNode.hh => src/mem/ruby/network/MessageBufferNode.hh
rename : src/mem/ruby/system/AbstractReplacementPolicy.hh => src/mem/ruby/structures/AbstractReplacementPolicy.hh
rename : src/mem/ruby/system/BankedArray.cc => src/mem/ruby/structures/BankedArray.cc
rename : src/mem/ruby/system/BankedArray.hh => src/mem/ruby/structures/BankedArray.hh
rename : src/mem/ruby/system/Cache.py => src/mem/ruby/structures/Cache.py
rename : src/mem/ruby/system/CacheMemory.cc => src/mem/ruby/structures/CacheMemory.cc
rename : src/mem/ruby/system/CacheMemory.hh => src/mem/ruby/structures/CacheMemory.hh
rename : src/mem/ruby/system/DirectoryMemory.cc => src/mem/ruby/structures/DirectoryMemory.cc
rename : src/mem/ruby/system/DirectoryMemory.hh => src/mem/ruby/structures/DirectoryMemory.hh
rename : src/mem/ruby/system/DirectoryMemory.py => src/mem/ruby/structures/DirectoryMemory.py
rename : src/mem/ruby/system/LRUPolicy.hh => src/mem/ruby/structures/LRUPolicy.hh
rename : src/mem/ruby/system/MemoryControl.cc => src/mem/ruby/structures/MemoryControl.cc
rename : src/mem/ruby/system/MemoryControl.hh => src/mem/ruby/structures/MemoryControl.hh
rename : src/mem/ruby/system/MemoryControl.py => src/mem/ruby/structures/MemoryControl.py
rename : src/mem/ruby/system/MemoryNode.cc => src/mem/ruby/structures/MemoryNode.cc
rename : src/mem/ruby/system/MemoryNode.hh => src/mem/ruby/structures/MemoryNode.hh
rename : src/mem/ruby/system/MemoryVector.hh => src/mem/ruby/structures/MemoryVector.hh
rename : src/mem/ruby/system/PerfectCacheMemory.hh => src/mem/ruby/structures/PerfectCacheMemory.hh
rename : src/mem/ruby/system/PersistentTable.cc => src/mem/ruby/structures/PersistentTable.cc
rename : src/mem/ruby/system/PersistentTable.hh => src/mem/ruby/structures/PersistentTable.hh
rename : src/mem/ruby/system/PseudoLRUPolicy.hh => src/mem/ruby/structures/PseudoLRUPolicy.hh
rename : src/mem/ruby/system/RubyMemoryControl.cc => src/mem/ruby/structures/RubyMemoryControl.cc
rename : src/mem/ruby/system/RubyMemoryControl.hh => src/mem/ruby/structures/RubyMemoryControl.hh
rename : src/mem/ruby/system/RubyMemoryControl.py => src/mem/ruby/structures/RubyMemoryControl.py
rename : src/mem/ruby/system/SparseMemory.cc => src/mem/ruby/structures/SparseMemory.cc
rename : src/mem/ruby/system/SparseMemory.hh => src/mem/ruby/structures/SparseMemory.hh
rename : src/mem/ruby/system/TBETable.hh => src/mem/ruby/structures/TBETable.hh
rename : src/mem/ruby/system/TimerTable.cc => src/mem/ruby/structures/TimerTable.cc
rename : src/mem/ruby/system/TimerTable.hh => src/mem/ruby/structures/TimerTable.hh
rename : src/mem/ruby/system/WireBuffer.cc => src/mem/ruby/structures/WireBuffer.cc
rename : src/mem/ruby/system/WireBuffer.hh => src/mem/ruby/structures/WireBuffer.hh
rename : src/mem/ruby/system/WireBuffer.py => src/mem/ruby/structures/WireBuffer.py
rename : src/mem/ruby/recorder/CacheRecorder.cc => src/mem/ruby/system/CacheRecorder.cc
rename : src/mem/ruby/recorder/CacheRecorder.hh => src/mem/ruby/system/CacheRecorder.hh

9 years agoruby: Fixes clock domains in configuration files
Emilio Castillo ext:(%2C%20Nilay%20Vaish%20%3Cnilay%40cs.wisc.edu%3E) [Mon, 1 Sep 2014 21:55:30 +0000 (16:55 -0500)]
ruby: Fixes clock domains in configuration files

This patch fixes scripts related to ruby by adding the ruby clock domain.
Now the L1 controllers and  the Sequencer shares the cpu clock domain,
while the rest of the components use the ruby clock domain.

Before this patch, running simulations with the cpu clock set at 2GHz or
1GHz will output the same time results and could distort power measurements.

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

9 years agomem: adding architectural page table support for SE mode
Alexandru [Thu, 28 Aug 2014 15:11:44 +0000 (10:11 -0500)]
mem: adding architectural page table support for SE mode
This patch enables the use of page tables that are stored in system memory
and respect x86 specification, in SE mode. It defines an architectural
page table for x86 as a MultiLevelPageTable class and puts a placeholder
class for other ISAs page tables, giving the possibility for future
implementation.

10 years agomem: adding a multi-level page table class
Alexandru [Tue, 1 Apr 2014 17:18:12 +0000 (12:18 -0500)]
mem: adding a multi-level page table class
This patch defines a multi-level page table class that stores the page table in
system memory, consistent with ISA specifications. In this way, cpu models that
use the actual hardware to execute (e.g. KvmCPU), are able to traverse the page
table.

9 years agoAdded tag stable_2014_08_26 for changeset cb2e6950956d
Nilay Vaish [Tue, 26 Aug 2014 19:41:23 +0000 (14:41 -0500)]
Added tag stable_2014_08_26 for changeset cb2e6950956d

9 years agomem: Fix DRAMSim2 cycle check when restoring from checkpoint
Andreas Hansson [Tue, 26 Aug 2014 14:14:38 +0000 (10:14 -0400)]
mem: Fix DRAMSim2 cycle check when restoring from checkpoint

This patch ensures the cycle check is still valid even restoring from
a checkpoint. In this case the DRAMSim2 cycle count is relative to the
startTick rather than 0.

9 years agobase: Add const to intmath and be more flexible with typing
Andreas Hansson [Tue, 26 Aug 2014 14:14:32 +0000 (10:14 -0400)]
base: Add const to intmath and be more flexible with typing

This patch ensures the functions can be used on const variables.

9 years agostyle: Add support for a style ignore list and ignore ext/
Andreas Sandberg [Tue, 26 Aug 2014 14:14:30 +0000 (10:14 -0400)]
style: Add support for a style ignore list and ignore ext/

There are some directories within the repository where we don't want
to enforce our coding style. Specifically, we don't want the style
hooks to warn whenever we update external code in the ext/ directory.

9 years agostyle: Fixup strange semantics in hg m5style
Andreas Sandberg [Tue, 26 Aug 2014 14:14:07 +0000 (10:14 -0400)]
style: Fixup strange semantics in hg m5style

The 'hg m5style' command had some rather strange semantics. When
called without arguments, it applied the style checker to all added
files and modified regions of modified files. However, when providing
a list of files, it used that list as an ignore list instead of
specifically checking those files.

This patch makes the m5style command behave more like other Mercurial
commands where the arguments are used to specify which files to work
on instead of which files to ignore.

9 years agobase: Replace the internal varargs stuff with C++11 constructs
Andreas Sandberg [Tue, 26 Aug 2014 14:13:45 +0000 (10:13 -0400)]
base: Replace the internal varargs stuff with C++11 constructs

We currently use our own home-baked support for type-safe variadic
functions. This is confusing and somewhat limited (e.g., cprintf only
supports a limited number of arguments). This changeset converts all
uses of our internal varargs support to use C++11 variadic macros.

9 years agobase: Add compiler macros for C++11 final/override
Andreas Sandberg [Tue, 26 Aug 2014 14:13:33 +0000 (10:13 -0400)]
base: Add compiler macros for C++11 final/override

Add the macros M5_ATTR_FINAL and M5_ATTR_OVERRIDE which are defined to
final and override respectively if supported by the compiler. This is
done to allow a smooth transition to gcc >= 4.7.

9 years agomips: Fix RLIMIT_RSS naming
Mitch Hayenga [Tue, 26 Aug 2014 14:13:31 +0000 (10:13 -0400)]
mips: Fix RLIMIT_RSS naming

MIPS defined RLIMIT_RSS in a way that could cause a naming conflict with
RLIMIT_RSS from the host system.  Broke clang+MacOS build.