gem5.git
9 years agomem: Unify all cache DPRINTF address formatting
Andreas Hansson [Mon, 2 Mar 2015 09:00:56 +0000 (04:00 -0500)]
mem: Unify all cache DPRINTF address formatting

This patch changes all the DPRINTF messages in the cache to use
'%#llx' every time a packet address is printed. The inclusion of '#'
ensures '0x' is prepended, and since the address type is a uint64_t %x
really should be %llx.

9 years agomem: Fix cache MSHR conflict determination
Andreas Hansson [Mon, 2 Mar 2015 09:00:54 +0000 (04:00 -0500)]
mem: Fix cache MSHR conflict determination

This patch fixes a rather subtle issue in the sending of MSHR requests
in the cache, where the logic previously did not check for conflicts
between the MSRH queue and the write queue when requests were not
ready. The correct thing to do is to always check, since not having a
ready MSHR does not guarantee that there is no conflict.

The underlying problem seems to have slipped past due to the symmetric
timings used for the write queue and MSHR queue. However, with the
recent timing changes the bug caused regressions to fail.

9 years agomem: Add byte mask to Packet::checkFunctional
Andreas Hansson [Mon, 2 Mar 2015 09:00:52 +0000 (04:00 -0500)]
mem: Add byte mask to Packet::checkFunctional

This patch changes the valid-bytes start/end to a proper byte
mask. With the changes in timing introduced in previous patches there
are more packets waiting in queues, and there are regressions using
the checker CPU failing due to non-contigous read data being found in
the various cache queues.

This patch also adds some more comments explaining what is going on,
and adds the fourth and missing case to Packet::checkFunctional.

9 years agomem: Add option to force in-order insertion in PacketQueue
Stephan Diestelhorst [Mon, 2 Mar 2015 09:00:49 +0000 (04:00 -0500)]
mem: Add option to force in-order insertion in PacketQueue

By default, the packet queue is ordered by the ticks of the to-be-sent
packages. With the recent modifications of packages sinking their header time
when their resposne leaves the caches, there could be cases of MSHR targets
being allocated and ordered A, B, but their responses being sent out in the
order B,A. This led to inconsistencies in bus traffic, in particular the snoop
filter observing first a ReadExResp and later a ReadRespWithInv.  Logically,
these were ordered the other way around behind the MSHR, but due to the timing
adjustments when inserting into the PacketQueue, they were sent out in the
wrong order on the bus, confusing the snoop filter.

This patch adds a flag (off by default) such that these special cases can
request in-order insertion into the packet queue, which might offset timing
slighty. This is expected to occur rarely and not affect timing results.

9 years agomem: Downstream components consumes new crossbar delays
Marco Balboni [Mon, 2 Mar 2015 09:00:48 +0000 (04:00 -0500)]
mem: Downstream components consumes new crossbar delays

This patch makes the caches and memory controllers consume the delay
that is annotated to a packet by the crossbar. Previously many
components simply threw these delays away. Note that the devices still
do not pay for these delays.

9 years agomem: Move crossbar default latencies to subclasses
Andreas Hansson [Mon, 2 Mar 2015 09:00:47 +0000 (04:00 -0500)]
mem: Move crossbar default latencies to subclasses

This patch introduces a few subclasses to the CoherentXBar and
NoncoherentXBar to distinguish the different uses in the system. We
use the crossbar in a wide range of places: interfacing cores to the
L2, as a system interconnect, connecting I/O and peripherals,
etc. Needless to say, these crossbars have very different performance,
and the clock frequency alone is not enough to distinguish these
scenarios.

Instead of trying to capture every possible case, this patch
introduces dedicated subclasses for the three primary use-cases:
L2XBar, SystemXBar and IOXbar. More can be added if needed, and the
defaults can be overridden.

9 years agomem: Add crossbar latencies
Marco Balboni [Mon, 2 Mar 2015 09:00:46 +0000 (04:00 -0500)]
mem: Add crossbar latencies

This patch introduces latencies in crossbar that were neglected
before. In particular, it adds three parameters in crossbar model:
front_end_latency, forward_latency, and response_latency. Along with
these parameters, three corresponding members are added:
frontEndLatency, forwardLatency, and responseLatency. The coherent
crossbar has an additional snoop_response_latency.

The latency of the request path through the xbar is set as
--> frontEndLatency + forwardLatency

In case the snoop filter is enabled, the request path latency is charged
also by look-up latency of the snoop filter.
--> frontEndLatency + SF(lookupLatency) + forwardLatency.

The latency of the response path through the xbar is set instead as
--> responseLatency.

In case of snoop response, if the response is treated as a normal response
the latency associated is again
--> responseLatency;

If instead it is forwarded as snoop response we add an additional variable
+ snoopResponseLatency
and the latency associated is
--> snoopResponseLatency;

Furthermore, this patch lets the crossbar progress on the next clock
edge after an unused retry, changing the time the crossbar considers
itself busy after sending a retry that was not acted upon.

9 years agodev, arm: Clean up PL011 and rewrite interrupt handling
Andreas Sandberg [Mon, 2 Mar 2015 09:00:44 +0000 (04:00 -0500)]
dev, arm: Clean up PL011 and rewrite interrupt handling

The ARM PL011 UART model didn't clear and raise interrupts
correctly. This changeset rewrites the whole interrupt handling and
makes it both simpler and fixes several cases where the correct
interrupts weren't raised or cleared. Additionally, it cleans up many
other aspects of the code.

9 years agoarm: Share a port for the two table walker objects
Andreas Hansson [Mon, 2 Mar 2015 09:00:42 +0000 (04:00 -0500)]
arm: Share a port for the two table walker objects

This patch changes how the MMU and table walkers are created such that
a single port is used to connect the MMU and the TLBs to the memory
system. Previously two ports were needed as there are two table walker
objects (stage one and stage two), and they both had a port. Now the
port itself is moved to the Stage2MMU, and each TableWalker is simply
using the port from the parent.

By using the same port we also remove the need for having an
additional crossbar joining the two ports before the walker cache or
the L2. This simplifies the creation of the CPU cache topology in
BaseCPU.py considerably. Moreover, for naming and symmetry reasons,
the TLB walker port is connected through the stage-one table walker
thus making the naming identical to x86. Along the same line, we use
the stage-one table walker to generate the master id that is used by
all TLB-related requests.

9 years agoarm: Remove unnecessary dependencies between AArch64 FP instructions
Giacomo Gabrielli [Mon, 2 Mar 2015 09:00:41 +0000 (04:00 -0500)]
arm: Remove unnecessary dependencies between AArch64 FP instructions

9 years agocpu: o3 register renaming request handling improved
Rekai [Mon, 2 Mar 2015 09:00:38 +0000 (04:00 -0500)]
cpu: o3 register renaming request handling improved

Now, prior to the renaming, the instruction requests the exact amount of
registers it will need, and the rename_map decides whether the instruction is
allowed to proceed or not.

9 years agomem: Tidy up the cache debug messages
Andreas Hansson [Mon, 2 Mar 2015 09:00:37 +0000 (04:00 -0500)]
mem: Tidy up the cache debug messages

Avoid redundant inclusion of the name in the DPRINTF string.

9 years agomem: Split port retry for all different packet classes
Andreas Hansson [Mon, 2 Mar 2015 09:00:35 +0000 (04:00 -0500)]
mem: Split port retry for all different packet classes

This patch fixes a long-standing isue with the port flow
control. Before this patch the retry mechanism was shared between all
different packet classes. As a result, a snoop response could get
stuck behind a request waiting for a retry, even if the send/recv
functions were split. This caused message-dependent deadlocks in
stress-test scenarios.

The patch splits the retry into one per packet (message) class. Thus,
sendTimingReq has a corresponding recvReqRetry, sendTimingResp has
recvRespRetry etc. Most of the changes to the code involve simply
clarifying what type of request a specific object was accepting.

The biggest change in functionality is in the cache downstream packet
queue, facing the memory. This queue was shared by requests and snoop
responses, and it is now split into two queues, each with their own
flow control, but the same physical MasterPort. These changes fixes
the previously seen deadlocks.

9 years agomem: Fix prefetchSquash + memInhibitAsserted bug
Ali Jafri [Mon, 2 Mar 2015 09:00:34 +0000 (04:00 -0500)]
mem: Fix prefetchSquash + memInhibitAsserted bug

This patch resolves a bug with hardware prefetches. Before a hardware prefetch
is sent towards the memory, the system generates a snoop request to check all
caches above the prefetch generating cache for the presence of the prefetth
target. If the prefetch target is found in the tags or the MSHRs of the upper
caches, the cache sets the prefetchSquashed flag in the snoop packet. When the
snoop packet returns with the prefetchSquashed flag set, the prefetch
generating cache deallocates the MSHR reserved for the prefetch. If the
prefetch target is found in the writeback buffer of the upper cache, the cache
sets the memInhibit flag, which signals the prefetch generating cache to
expect the data from the writeback. When the snoop packet returns with the
memInhibitAsserted flag set, it marks the allocated MSHR as inService and
waits for the data from the writeback.

If the prefetch target is found in multiple upper level caches, specifically
in the tags or MSHRs of one upper level cache and the writeback buffer of
another, the snoop packet will return with both prefetchSquashed and
memInhibitAsserted set, while the current code is not written to handle such
an outcome. Current code checks for the prefetchSquashed flag first, if it
finds the flag, it deallocates the reserved MSHR. This leads to assert failure
when the data from the writeback appears at cache. In this fix, we simply
switch the order of checks. We first check for memInhibitAsserted and then for
prefetch squashed.

9 years agocpu: Add a PC-value to the traffic generator requests
Stephan Diestelhorst [Mon, 2 Mar 2015 09:00:31 +0000 (04:00 -0500)]
cpu: Add a PC-value to the traffic generator requests

Have the traffic generator add its masterID as the PC address to the
requests. That way, prefetchers (and other components) that use a PC
for request classification will see per-tester streams of requests.
This enables us to test strided prefetchers with the memchecker, too.

9 years agotests: Run regression timeout as foreground
Andreas Hansson [Mon, 2 Mar 2015 09:00:29 +0000 (04:00 -0500)]
tests: Run regression timeout as foreground

Allow the user to send signals such as Ctrl C to the gem5 runs. Note
that this assumes coreutils >= 8.13, which aligns with Ubuntu 12.04
and RHE6.

9 years agoarm: Don't truncate 16-bit ASIDs to 8 bits
Andreas Sandberg [Mon, 2 Mar 2015 09:00:28 +0000 (04:00 -0500)]
arm: Don't truncate 16-bit ASIDs to 8 bits

The ISA code sometimes stores 16-bit ASIDs as 8-bit unsigned integers
and has a couple of inverted checks that mask out the high 8 bits of
an ASID if 16-bit ASIDs have been /enabled/. This changeset fixes both
of those issues.

9 years agoarm: Correctly access the stack pointer in GDB
Andreas Sandberg [Mon, 2 Mar 2015 09:00:27 +0000 (04:00 -0500)]
arm: Correctly access the stack pointer in GDB

We curently use INTREG_X31 instead of INTREG_SPX when accessing the
stack pointer in GDB. gem5 normally uses INTREG_SPX to access the
stack pointer, which gets mapped to the stack pointer corresponding
(INTREG_SPn) to the current exception level. This changeset updates
the GDB interface to use SPX instead of X31 (which is always zero)
when transfering CPU state to gdb.

9 years agoarm: Fix broken page table permissions checks in remote GDB
Andreas Sandberg [Mon, 2 Mar 2015 09:00:27 +0000 (04:00 -0500)]
arm: Fix broken page table permissions checks in remote GDB

The remote GDB interface currently doesn't check if translations are
valid before reading memory. This causes a panic when GDB tries to
access unmapped memory (e.g., when getting a stack trace). There are
two reasons for this: 1) The function used to check for valid
translations (virtvalid()) doesn't work and panics on invalid
translations. 2) The method in the GDB interface used to test if a
translation is valid (RemoteGDB::acc) always returns true regardless
of the return from virtvalid().

This changeset fixes both of these issues.

9 years agoRuby: Update backing store option to propagate through to all RubyPorts
Jason Power [Thu, 26 Feb 2015 15:58:26 +0000 (09:58 -0600)]
Ruby: Update backing store option to propagate through to all RubyPorts

Previously, the user would have to manually set access_backing_store=True
on all RubyPorts (Sequencers) in the config files.
Now, instead there is one global option that each RubyPort checks on
initialization.

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

9 years agoconfig: Add memcheck stress test
Andreas Hansson [Mon, 16 Feb 2015 08:35:23 +0000 (03:35 -0500)]
config: Add memcheck stress test

This is a rather unfortunate copy of the memtest.py example script,
that actually stresses the system with true sharing as opposed to the
false sharing of the MemTest. To do so it uses TrafficGen instances to
generate the reads/writes, and MemCheckerMonitor combined with the
MemChecker to check the validity of the read/written values.

As a bonus, this script also enables the addition of prefetchers, and
the traffic is created to have a mix of random addresses and linear
strides. We use the TaggedPrefetcher since the packets do not have a
request with a PC.

At the moment the code is almost identical to the memtest.py script,
and no effort has been made to factor out the construction of the
tree. The challenge is that the instantiation and connection of the
testers and monitors is done as part of the tree building.

9 years agocpu: TrafficGen sinks snoops without complaining
Andreas Hansson [Mon, 16 Feb 2015 08:34:55 +0000 (03:34 -0500)]
cpu: TrafficGen sinks snoops without complaining

To be able to use the TrafficGen in a system with caches we need to
allow it to sink incoming snoop requests. By default the master port
panics, so silently ignore any snoops.

9 years agomem: Fix initial value problem with MemChecker
Stephan Diestelhorst [Mon, 16 Feb 2015 08:34:47 +0000 (03:34 -0500)]
mem: Fix initial value problem with MemChecker

In highly loaded cases, reads might actually overlap with writes to the
initial memory state. The mem checker needs to detect such cases and
permit the read reading either from the writes (what it is doing now) or
read from the initial, unknown value.

This patch adds this logic.

9 years agodev: Fix undefined behaviuor in i8254xGBe
Andreas Hansson [Mon, 16 Feb 2015 08:34:35 +0000 (03:34 -0500)]
dev: Fix undefined behaviuor in i8254xGBe

This patch fixes a rather unfortunate oversight where the annotation
pointer was used even though it is null. Somehow the code still works,
but UBSan is rather unhappy. The use is now guarded, and the variable
is initialised in the constructor (as well as init()).

9 years agoarm: Wire up the GIC with the platform in the base class
Andreas Sandberg [Mon, 16 Feb 2015 08:34:18 +0000 (03:34 -0500)]
arm: Wire up the GIC with the platform in the base class

Move the (common) GIC initialization code that notifies the platform
code of the new GIC to the base class (BaseGic) instead of the Pl390
implementation.

9 years agomem: mmap the backing store with MAP_NORESERVE
Andreas Hansson [Mon, 16 Feb 2015 08:33:47 +0000 (03:33 -0500)]
mem: mmap the backing store with MAP_NORESERVE

This patch ensures we can run simulations with very large simulated
memories (at least 64 TB based on some quick runs on a Linux
workstation). In essence this allows us to efficiently deal with
sparse address maps without having to implement a redirection layer in
the backing store.

This opens up for run-time errors if we eventually exhausts the hosts
memory and swap space, but this should hopefully never happen.

9 years agomem: Use the range cache for lookup as well as access
Andreas Hansson [Mon, 16 Feb 2015 08:33:37 +0000 (03:33 -0500)]
mem: Use the range cache for lookup as well as access

This patch changes the range cache used in the global physical memory
to be an iterator so that we can use it not only as part of isMemAddr,
but also access and functionalAccess. This matches use-cases where a
core is using the atomic non-caching memory mode, and repeatedly calls
isMemAddr and access.

Linux boot on aarch32, with a single atomic CPU, is now more than 30%
faster when using "--fastmem" compared to not using the direct memory
access.

9 years agoarch: Make readMiscRegNoEffect const throughout
Andreas Hansson [Mon, 16 Feb 2015 08:33:28 +0000 (03:33 -0500)]
arch: Make readMiscRegNoEffect const throughout

Finally took the plunge and made this apply to all ISAs, not just ARM.

9 years agoconfig: add --root-device machine parameter
Curtis Dunham [Fri, 16 Jan 2015 20:12:03 +0000 (14:12 -0600)]
config: add --root-device machine parameter

In case /dev/sda1 is not actually the boot partition for an image,
we can override it on the command line or in a benchmark definition.

9 years agoarm: Merge ISA files with pseudo instructions
Andreas Sandberg [Mon, 16 Feb 2015 08:32:58 +0000 (03:32 -0500)]
arm: Merge ISA files with pseudo instructions

This changeset moves the pseudo instructions used to signal unknown
instructions and unimplemented instructions to the same source files
as the decoder fault.

9 years agocpu: add support for outputing a protobuf formatted CPU trace
Ali Saidi [Mon, 16 Feb 2015 08:32:38 +0000 (03:32 -0500)]
cpu: add support for outputing a protobuf formatted CPU trace

Doesn't support x86 due to static instruction representation.

--HG--
rename : src/cpu/CPUTracers.py => src/cpu/InstPBTrace.py

9 years agomem: Clarification of packet crossbar timings
Marco Balboni [Wed, 11 Feb 2015 15:23:47 +0000 (10:23 -0500)]
mem: Clarification of packet crossbar timings

This patch clarifies the packet timings annotated
when going through a crossbar.

The old 'firstWordDelay' is replaced by 'headerDelay' that represents
the delay associated to the delivery of the header of the packet.

The old 'lastWordDelay' is replaced by 'payloadDelay' that represents
the delay needed to processing the payload of the packet.

For now the uses and values remain identical. However, going forward
the payloadDelay will be additive, and not include the
headerDelay. Follow-on patches will make the headerDelay capture the
pipeline latency incurred in the crossbar, whereas the payloadDelay
will capture the additional serialisation delay.

9 years agomem: Clarify usage of latency in the cache
Marco Balboni [Wed, 11 Feb 2015 15:23:36 +0000 (10:23 -0500)]
mem: Clarify usage of latency in the cache

This patch adds some much-needed clarity in the specification of the
cache timing. For now, hit_latency and response_latency are kept as
top-level parameters, but the cache itself has a number of local
variables to better map the individual timing variables to different
behaviours (and sub-components).

The introduced variables are:
- lookupLatency: latency of tag lookup, occuring on any access
- forwardLatency: latency that occurs in case of outbound miss
- fillLatency: latency to fill a cache block
We keep the existing responseLatency

The forwardLatency is used by allocateInternalBuffer() for:
- MSHR allocateWriteBuffer (unchached write forwarded to WriteBuffer);
- MSHR allocateMissBuffer (cacheable miss in MSHR queue);
- MSHR allocateUncachedReadBuffer (unchached read allocated in MSHR
  queue)
It is our assumption that the time for the above three buffers is the
same. Similarly, for snoop responses passing through the cache we use
forwardLatency.

9 years agostyle: Fix broken m5format command
Andreas Sandberg [Wed, 11 Feb 2015 15:23:34 +0000 (10:23 -0500)]
style: Fix broken m5format command

The m5format command didn't actually work due to parameter handling
issues and missing language detection. This changeset fixes those
issues and cleans up some of the code to shared between the style
checker and the format checker.

9 years agostyle: Fix incorrect style checker option name
Andreas Sandberg [Wed, 11 Feb 2015 15:23:33 +0000 (10:23 -0500)]
style: Fix incorrect style checker option name

The style used to support the option -w to automatically fix white
space issues. However, this option was actually wired up to fix all
styles issues the checker encountered. This changeset cleans up the
code that handles automatic fixing and adds an option to fix all
issues, and separate options for white spaces and include ordering.

9 years agoconfig: Revamp memtest to allow testers on any level
Andreas Hansson [Wed, 11 Feb 2015 15:23:31 +0000 (10:23 -0500)]
config: Revamp memtest to allow testers on any level

This patch revamps the memtest example script and allows for the
insertion of testers at any level in the cache hierarchy. Previously
all created topologies placed testers only at the very top, and the
tree was thus entirely symmetric. With the changes made, it is possible
to not only place testers at the leaf caches (L1), but also to connect
testers at the L2, L3 etc.

As part of the changes the object hierarchy is also simplified to
ensure that the visual representation from the DOT printing looks
sensible. Using SubSystems to group the objects is one of the key
features.

9 years agostats: Bump the MemTest regression stats
Andreas Hansson [Wed, 11 Feb 2015 15:23:31 +0000 (10:23 -0500)]
stats: Bump the MemTest regression stats

Reflect changes in the tester behaviour.

9 years agocpu: Tidy up the MemTest and make false sharing more obvious
Andreas Hansson [Wed, 11 Feb 2015 15:23:28 +0000 (10:23 -0500)]
cpu: Tidy up the MemTest and make false sharing more obvious

The MemTest class really only tests false sharing, and as such there
was a lot of old cruft that could be removed. This patch cleans up the
tester, and also makes it more clear what the assumptions are. As part
of this simplification the reference functional memory is also
removed.

The regression configs using MemTest are updated to reflect the
changes, and the stats will be bumped in a separate patch. The example
config will be updated in a separate patch due to more extensive
re-work.

In a follow-on patch a new tester will be introduced that uses the
MemChecker to implement true sharing.

9 years agosim: Move the BaseTLB to src/arch/generic/
Andreas Sandberg [Wed, 11 Feb 2015 15:23:27 +0000 (10:23 -0500)]
sim: Move the BaseTLB to src/arch/generic/

The TLB-related code is generally architecture dependent and should
live in the arch directory to signify that.

--HG--
rename : src/sim/BaseTLB.py => src/arch/generic/BaseTLB.py
rename : src/sim/tlb.cc => src/arch/generic/tlb.cc
rename : src/sim/tlb.hh => src/arch/generic/tlb.hh

9 years agobase: Add compiler macros to add deprecation warnings
Andreas Sandberg [Wed, 11 Feb 2015 15:23:24 +0000 (10:23 -0500)]
base: Add compiler macros to add deprecation warnings

Gcc and clang both provide an attribute that can be used to flag a
function as deprecated at compile time. This changeset adds a gem5
compiler macro for that compiler feature. The macro can be used to
indicate that a legacy API within gem5 has been deprecated and provide
a graceful migration to the new API.

9 years agobase: Do not dereference NULL in CompoundFlag creation
Andreas Hansson [Wed, 11 Feb 2015 15:23:23 +0000 (10:23 -0500)]
base: Do not dereference NULL in CompoundFlag creation

This patch fixes the CompoundFlag constructor, ensuring that it does
not dereference NULL. Doing so has undefined behaviuor, and both clang
and gcc's undefined-behaviour sanitiser was rather unhappy.

9 years agodev: Remove unused system pointer in the Platform base class
Andreas Sandberg [Wed, 11 Feb 2015 15:23:22 +0000 (10:23 -0500)]
dev: Remove unused system pointer in the Platform base class

The Platform base class contains a pointer to an instance of the
System which is never initialized. This can lead to subtle bugs since
some architecture-specific platform implementations contain their own
system pointer which is normally used. However, if the platform is
accessed through a pointer to its base class, the dangling pointer
will be used instead.

9 years agocpu: Idle CPU status logic revised
Alexandru Dutu [Sat, 7 Feb 2015 02:01:22 +0000 (18:01 -0800)]
cpu: Idle CPU status logic revised

This patch sets the CPU status to idle when the last active thread gets
suspended.

9 years agoconfig: rename 'file' var
Steve Reinhardt [Fri, 6 Feb 2015 00:45:12 +0000 (16:45 -0800)]
config: rename 'file' var

Rename uses of 'file' as a local variable to avoid conflict
with the built-in type of the same name.

9 years agoconfig: make M5_PATH a real search path
Steve Reinhardt [Fri, 6 Feb 2015 00:45:06 +0000 (16:45 -0800)]
config: make M5_PATH a real search path

Although you can put a list of colon-separated directory names
in M5_PATH, the current code just takes the first one that
exists and assumes all files must live there.  This change
makes the code search the specified list of directories
for each individual binary or disk image that's requested.

The main motivation is that the x86/Alpha binaries and the
ARM binaries are in separate downloads, and thus naturally
end up in separate directories.  With this change, you can
have M5_PATH point to those two directories, then run any
FS regression test without changing M5_PATH.  Currently,
you either have to merge the two download directories
or change M5_PATH (or do something else I haven't figured out).

9 years agomem: Clarify express snoop behaviour
Andreas Hansson [Tue, 3 Feb 2015 19:26:02 +0000 (14:26 -0500)]
mem: Clarify express snoop behaviour

This patch adds a bit of documentation with insights around how
express snoops really work.

9 years agomem: Clarify cache behaviour for pending dirty responses
Andreas Hansson [Tue, 3 Feb 2015 19:25:59 +0000 (14:25 -0500)]
mem: Clarify cache behaviour for pending dirty responses

This patch adds a bit of clarification around the assumptions made in
the cache when packets are sent out, and dirty responses are
pending. As part of the change, the marking of an MSHR as in service
is simplified slightly, and comments are added to explain what
assumptions are made.

9 years agobase: add an accessor and operators ==,!= to address ranges
Curtis Dunham [Tue, 3 Feb 2015 19:25:58 +0000 (14:25 -0500)]
base: add an accessor and operators ==,!= to address ranges

9 years agoconfig: Add XOR hashing to the DRAM channel interleaving
Andreas Hansson [Tue, 3 Feb 2015 19:25:55 +0000 (14:25 -0500)]
config: Add XOR hashing to the DRAM channel interleaving

This patch uses the recently added XOR hashing capabilities for the
DRAM channel interleaving. This avoids channel biasing due to strided
access patterns.

9 years agobase: Add XOR-based hashed address interleaving
Andreas Hansson [Tue, 3 Feb 2015 19:25:54 +0000 (14:25 -0500)]
base: Add XOR-based hashed address interleaving

This patch extends the current address interleaving with basic hashing
support. Instead of directly comparing a number of address bits with a
matching value, it is now possible to use two independent set of
address bits XOR'ed together. This avoids issues where strided address
patterns are heavily biased to a subset of the interleaved ranges.

9 years agoconfig: Adjust DRAM channel interleaving defaults
Andreas Hansson [Tue, 3 Feb 2015 19:25:52 +0000 (14:25 -0500)]
config: Adjust DRAM channel interleaving defaults

This patch changes the DRAM channel interleaving default behaviour to
be more representative. The default address mapping (RoRaBaCoCh) moves
the channel bits towards the least significant bits, and uses 128 byte
as the default channel interleaving granularity.

These defaults can be overridden if desired, but should serve as a
sensible starting point for most use-cases.

9 years agostyle: Update the style checker to handle new include order
Andreas Sandberg [Tue, 3 Feb 2015 19:25:50 +0000 (14:25 -0500)]
style: Update the style checker to handle new include order

As of August 2014, the gem5 style guide mandates that a source file's
primary header is included first in that source file. This helps to
ensure that the header file does not depend on include file ordering
and avoids surprises down the road when someone tries to reuse code.

In the new order, include files are grouped into the following blocks:
  * Primary header file (e.g., foo.hh for foo.cc)
  * Python headers
  * C system/stdlib includes
  * C++ stdlib includes
  * Include files in the gem5 source tree

Just like before, include files within a block are required to be
sorted in alphabetical order.

This changeset updates the style checker to enforce the new order.

9 years agosim: Remove test for non-NULL this in Event
Andreas Sandberg [Tue, 3 Feb 2015 19:25:48 +0000 (14:25 -0500)]
sim: Remove test for non-NULL this in Event

The method Event::initialized() tests if this != NULL as a part of the
expression that tests if an event is initialized. The only case when
this check could be false is if the method is called on a null
pointer, which is illegal and leads to undefined behavior (such as
eating your pets) according to the C++ standard. Because of this,
modern compilers (specifically, recent versions of clang) warn about
this which we treat as an error. This changeset removes the redundant
check to fix said warning.

9 years agodev: Correctly clear interrupts in VirtIO PCI
Andreas Sandberg [Tue, 3 Feb 2015 19:25:47 +0000 (14:25 -0500)]
dev: Correctly clear interrupts in VirtIO PCI

Correctly clear the PCI interrupt belonging to a VirtIO device when
the ISR register is read.

9 years agoscons: Avoid implicit command dependencies
Andreas Hansson [Tue, 3 Feb 2015 19:25:43 +0000 (14:25 -0500)]
scons: Avoid implicit command dependencies

Work around a bug in scons that causes the param wrappers being
compiled twice. The easiest way for us to do so is to tell scons to
ignore implicit command dependencies.

9 years agosim: prioritize async events; prevent starvation
Curtis Dunham [Fri, 19 Dec 2014 21:32:34 +0000 (15:32 -0600)]
sim: prioritize async events; prevent starvation

If a time quantum event is the only one in the queue, async
events (Ctrl-C, I/O, etc.) will never be processed.

So process them first.

9 years agocpu: Ensure timing CPU sinks response before sending new request
Andreas Hansson [Tue, 3 Feb 2015 19:25:27 +0000 (14:25 -0500)]
cpu: Ensure timing CPU sinks response before sending new request

This patch changes how the timing CPU deals with processing responses,
always scheduling an event, even if it is for the current tick. This
helps to avoid situations where a new request shows up before a
response is finished in the crossbar, and also is more in line with
any realistic behaviour.

9 years agoconfig: Fix typo in Float param
Geoffrey Blake [Tue, 3 Feb 2015 19:25:07 +0000 (14:25 -0500)]
config: Fix typo in Float param

The Float param was not settable on the command line
due to a typo in the class definition in
python/m5/params.py.  This corrects the typo and allows
floats to be set on the command line as intended.

9 years agoconfig: arm: fix os_flags stable_2015_04_15
Malek Musleh [Fri, 30 Jan 2015 21:49:34 +0000 (15:49 -0600)]
config: arm: fix os_flags
Fix the makeArmSystem routine to reflect recent changes that support kernel
commandline option when running android. Without this fix, trying to run
android encounters a 'reference before assignment' error.

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

9 years agoarm: always set the IsFirstMicroop flag
Ali Saidi [Sun, 25 Jan 2015 12:22:56 +0000 (07:22 -0500)]
arm: always set the IsFirstMicroop flag

While the IsFirstMicroop flag exists it was only occasionally used in the ARM
instructions that gem5 microOps and therefore couldn't be relied on to be correct.

9 years agosim: Clean up InstRecord
Ali Saidi [Sun, 25 Jan 2015 12:22:44 +0000 (07:22 -0500)]
sim: Clean up InstRecord

Track memory size and flags as well as add some comments and consts.

9 years agocpu: Remove all notion that we know when the cpu is misspeculating.
Ali Saidi [Sun, 25 Jan 2015 12:22:26 +0000 (07:22 -0500)]
cpu: Remove all notion that we know when the cpu is misspeculating.

We have no way of knowing if a CPU model is on the wrong path with
our execute-in-execute CPU models. Don't pretend that we do.

9 years agocpu: Put all CPU instruction tracers in a single file
Ali Saidi [Sun, 25 Jan 2015 12:22:17 +0000 (07:22 -0500)]
cpu: Put all CPU instruction tracers in a single file

9 years agocpu: remove legion tracer
Ali Saidi [Sun, 25 Jan 2015 12:22:05 +0000 (07:22 -0500)]
cpu: remove legion tracer

If someone wants to debug with legion again they can restore the
code from the repository, but no need to have it hang around indefinately.

9 years agosim: fix reference counting of PythonEvent
Curtis Dunham [Tue, 23 Dec 2014 17:51:40 +0000 (11:51 -0600)]
sim: fix reference counting of PythonEvent

When gem5 is a slave to another simulator and the Python is only used
to initialize the configuration (and not perform actual simulation), a
"debug start" (--debug-start) event will get freed during or immediately
after the initial Python frame's execution rather than remaining in the
event queue. This tricky patch fixes the GC issue causing this.

9 years agomem: Remove unused Packet src and dest fields
Andreas Hansson [Thu, 22 Jan 2015 10:01:31 +0000 (05:01 -0500)]
mem: Remove unused Packet src and dest fields

This patch takes the final step in removing the src and dest fields in
the packet. These fields were rather confusing in that they only
remember a single multiplexing component, and pushed the
responsibility to the bridge and caches to store the fields in a
senderstate, thus effectively creating a stack. With the recent
changes to the crossbar response routing the crossbar is now
responsible without relying on the packet fields. Thus, these
variables are now unused and can be removed.

9 years agomem: Remove Packet source from ForwardResponseRecord
Andreas Hansson [Thu, 22 Jan 2015 10:01:30 +0000 (05:01 -0500)]
mem: Remove Packet source from ForwardResponseRecord

This patch removes the source field from the ForwardResponseRecord,
but keeps the class as it is part of how the cache identifies
responses to hardware prefetches that are snooped upwards.

9 years agomem: Remove unused RequestState in the bridge
Andreas Hansson [Thu, 22 Jan 2015 10:01:27 +0000 (05:01 -0500)]
mem: Remove unused RequestState in the bridge

This patch removes the bridge sender state as the Crossbar now takes
care of remembering its own routing decisions.

9 years agomem: Always use SenderState for response routing in RubyPort
Andreas Hansson [Thu, 22 Jan 2015 10:01:24 +0000 (05:01 -0500)]
mem: Always use SenderState for response routing in RubyPort

This patch aligns how the response routing is done in the RubyPort,
using the SenderState for both memory and I/O accesses. Before this
patch, only the I/O used the SenderState, whereas the memory accesses
relied on the src field in the packet. With this patch we shift to
using SenderState in both cases, thus not relying on the src field any
longer.

9 years agomem: Make the XBar responsible for tracking response routing
Andreas Hansson [Thu, 22 Jan 2015 10:01:14 +0000 (05:01 -0500)]
mem: Make the XBar responsible for tracking response routing

This patch removes the need for a source and destination field in the
packet by shifting the onus of the tracking to the crossbar, much like
a real implementation. This change in behaviour also means we no
longer need a SenderState to remember the source/dest when ever we
have multiple crossbars in the system. Thus, the stack that was
created by the SenderState is not needed, and each crossbar locally
tracks the response routing.

The fields in the packet are still left behind as the RubyPort (which
also acts as a crossbar) does routing based on them. In the succeeding
patches the uses of the src and dest field will be removed. Combined,
these patches improve the simulation performance by roughly 2%.

9 years agostats: Update stats to reflect x86 table walker changes
Andreas Hansson [Thu, 22 Jan 2015 10:00:57 +0000 (05:00 -0500)]
stats: Update stats to reflect x86 table walker changes

9 years agox86: Delay X86 table walk on receiving walker response
Andreas Hansson [Thu, 22 Jan 2015 10:00:54 +0000 (05:00 -0500)]
x86: Delay X86 table walk on receiving walker response

This patch fixes a minor issue in the X86 page table walker where it
ended up sending new request packets to the crossbar before the
response processing was finished (recvTimingResp is directly calling
sendTimingReq). Under certain conditions this caused the crossbar to
see illegal combinations of request/response overlap, in turn causing
problems with a slightly modified crossbar implementation.

9 years agomem: Clean up Request initialisation
Andreas Hansson [Thu, 22 Jan 2015 10:00:53 +0000 (05:00 -0500)]
mem: Clean up Request initialisation

This patch tidies up how we create and set the fields of a Request. In
essence it tries to use the constructor where possible (as opposed to
setPhys and setVirt), thus avoiding spreading the information across a
number of locations. In fact, setPhys is made private as part of this
patch, and a number of places where we callede setVirt instead uses
the appropriate constructor.

9 years agoconfig, ruby: connect dma to network
Malek Musleh [Tue, 20 Jan 2015 20:15:28 +0000 (14:15 -0600)]
config, ruby: connect dma to network
DMA Controller was not being connected to the network for the MESI_Three_Level
protocol as was being done in the other protocol config files. Without this
patch, this protocol segfaults during startup.

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

9 years agocpu: commit probe notification on every microop or macroop
Nikos Nikoleris [Tue, 20 Jan 2015 20:15:27 +0000 (14:15 -0600)]
cpu: commit probe notification on every microop or macroop
The ppCommit should notify the attached listener every time the cpu commits
a microop or non microcoded insturction. The listener can then decide
whether it will process only the last microop (eg. SimPoint probe).

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

9 years agoscons: Do not build the InOrderCPU
Andreas Hansson [Tue, 20 Jan 2015 13:12:45 +0000 (08:12 -0500)]
scons: Do not build the InOrderCPU

One step closer to shifting focus to the MinorCPU.

9 years agotests: Remove deprecated InOrderCPU tests
Andreas Hansson [Tue, 20 Jan 2015 13:12:02 +0000 (08:12 -0500)]
tests: Remove deprecated InOrderCPU tests

This patch removes the three MIPS and SPARC regressions that use the
deprecated InOrderCPU.

This is the first step in completely removing the code from the tree,
avoiding confusion, and focusing all development efforts on the
MinorCPU. Brave new world.

9 years agomem: Fix bug in cache request retry mechanism
Andreas Hansson [Tue, 20 Jan 2015 13:12:01 +0000 (08:12 -0500)]
mem: Fix bug in cache request retry mechanism

This patch ensures that inhibited packets that are about to be turned
into express snoops do not update the retry flag in the cache.

9 years agocpu: Fix retry bug in MinorCPU LSQ
Andreas Hansson [Tue, 20 Jan 2015 13:11:58 +0000 (08:11 -0500)]
cpu: Fix retry bug in MinorCPU LSQ

9 years agomem: Move DRAM interleaving check to init
Andreas Hansson [Tue, 20 Jan 2015 13:11:55 +0000 (08:11 -0500)]
mem: Move DRAM interleaving check to init

This patch fixes a bug where the DRAM controller tried to access the
system cacheline size before the system pointer was initialised. It
also fixes a bug where the granularity is 0 (no interleaving).

9 years agostats: changes due to recent changesets.
Nilay Vaish [Sun, 11 Jan 2015 00:06:43 +0000 (18:06 -0600)]
stats: changes due to recent changesets.

9 years agox86 : fxsave and fxrestore missing template code
Emilio Castillo [Sat, 10 Jan 2015 20:30:53 +0000 (14:30 -0600)]
x86 : fxsave and fxrestore missing template code

This patch corrects the FXSAVE and FXRSTOR Macroops.  The actual code used for
saving/restore the FP registers is in the file but it was not used.

The FXSAVE and FXRSTOR instructions are used in the kernel for saving and
loading the state of the mmx,xmm and fpu registers.

This operation is triggered in FS by issuing a Device Not Available Fault.  The
cr0 register has a TS flag that is set upon each context change. Every time a
task access any FP related register (SIMD as well) if the TS flag is set to
one, the device not available fault is issued.  The kernel saves the current
state of the registers, and restore the previous state of the currently running
task.

Right now Gem5 lacks of this capability. the Device Not Available Fault is
never issued, leading to several problems when different threads share the same
CPU and SMT is not used. The PARSEC Ferret benchmark is an example of this
behavior.

In order to test this a hack in the atomic cpu code was done to detect if a
static instruction has any FP operands and the cr0 reg TS bit is set.  This
check must be done in the ISA dependent code. But it seems to be tricky to
access the cr0 register while executing an instruction.

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

9 years agocpu: fix RetiredStores probe point
Nikos Nikoleris [Sat, 10 Jan 2015 20:30:53 +0000 (14:30 -0600)]
cpu: fix RetiredStores probe point

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

9 years agodev: prevent intel 8254 timer counter events firing before startup
cdirik [Tue, 6 Jan 2015 22:10:22 +0000 (15:10 -0700)]
dev: prevent intel 8254 timer counter events firing before startup

This change includes edits to Intel8254Timer to prevent counter events firing
before startup to comply with SimObject initialization call sequence.

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

9 years agotest: Add a unittest for the BitUnion types.
Gabe Black [Wed, 7 Jan 2015 08:34:40 +0000 (00:34 -0800)]
test: Add a unittest for the BitUnion types.

9 years agobase: Fix assigning between identical bitfields.
Gabe Black [Wed, 7 Jan 2015 08:31:46 +0000 (00:31 -0800)]
base: Fix assigning between identical bitfields.

If two bitfields are of the same type, also implying that they have the same
first and last bit positions, the existing implementation would copy the
entire bitfield. That includes the __data member which is shared among all the
bitfields, effectively overwritting the entire bitunion.

This change also adjusts the write only signed bitfield assignment operator to
be like the unsigned version, using "using" instead of implementing it again
and calling down to the underlying implementation.

9 years agostats: x86: Update stats for the CPUID change.
Gabe Black [Wed, 7 Jan 2015 08:31:09 +0000 (00:31 -0800)]
stats: x86: Update stats for the CPUID change.

9 years agox86: Enable three bits in the FamilyModelStepping ECX CPUID bitfield.
Gabe Black [Wed, 7 Jan 2015 06:15:00 +0000 (22:15 -0800)]
x86: Enable three bits in the FamilyModelStepping ECX CPUID bitfield.

These are for the monitor/mwait instructions, SSSE3, and XSAVE.

9 years agocpuid, x86: Revert "Enabling more features in CPUid"
Gabe Black [Wed, 7 Jan 2015 06:13:56 +0000 (22:13 -0800)]
cpuid, x86: Revert "Enabling more features in CPUid"

That change enables CPUID bits for features that aren't implemented in gem5.
If a simulated system tries to use those features because it was told it
could, bad things can happen.

9 years agostats: changes due to recent changesets.
Nilay Vaish [Sun, 4 Jan 2015 19:02:12 +0000 (13:02 -0600)]
stats: changes due to recent changesets.

9 years agoarm: fix build_drive_system when not using default options
Anthony Gutierrez [Sat, 3 Jan 2015 23:51:48 +0000 (17:51 -0600)]
arm: fix build_drive_system when not using default options

when trying to dual boot on arm build_drive_system will only use the default
values for the dtb file, number of processors, and disk image. if you are using
the non-default files by passing values on the command line for example, or by
making a new entry in Benchmarks.py, the build config scripts will still look
for the default files. this will lead to the wrong system files being used, or
the simulator will fail if you do not have them.

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

9 years agominor: fixed LSQ MasterPortID
Andrew Lukefahr [Sat, 3 Jan 2015 23:51:48 +0000 (17:51 -0600)]
minor: fixed LSQ MasterPortID

Minor was reporting the data cache access as ".inst" accesses.
This just switches the MasterPortID to dataMasterPortId.

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

9 years agoarm: Add unlinkat syscall implementation
mike upton [Sat, 3 Jan 2015 23:51:48 +0000 (17:51 -0600)]
arm: Add unlinkat syscall implementation

added ARM aarch64 unlinkat syscall support, modeled on other <xxx>at syscalls.
This gets all of the cpu2006 int workloads passing in SE mode on aarch64.

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

9 years agox86: implements the simd128 ADDSUBPD instruction
Maxime Martinasso [Sat, 3 Jan 2015 23:51:48 +0000 (17:51 -0600)]
x86: implements the simd128 ADDSUBPD instruction

This patch implements the simd128 ADDSUBPD instruction for the x86 architecture.

Tested with a simple program in assembly language which executes the
instruction.  Checked that different versions of the instruction are executed
by using the execution tracing option.

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

9 years agodev: prevent RTC events firing before startup
Cagdas Dirik [Sat, 3 Jan 2015 23:51:48 +0000 (17:51 -0600)]
dev: prevent RTC events firing before startup

This change includes edits to MC146818 timer to prevent RTC events
firing before startup to comply with SimObject initialization call sequence.

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

9 years agoconfigs: ruby: removes bug introduced by 05b5a6cf3521
Nilay Vaish [Sat, 3 Jan 2015 23:51:48 +0000 (17:51 -0600)]
configs: ruby: removes bug introduced by 05b5a6cf3521

9 years agosyscall_emul: Return correct writev value
Joel Hestness [Sat, 27 Dec 2014 19:48:40 +0000 (13:48 -0600)]
syscall_emul: Return correct writev value

According to Linux man pages, if writev is successful, it returns the total
number of bytes written. Otherwise, it returns an error code. Instead of
returning 0, return the result from the actual call to writev in the system
call.

9 years agostats: Bump stats for decoder, TLB, prefetcher and DRAM changes
Andreas Hansson [Tue, 23 Dec 2014 14:31:20 +0000 (09:31 -0500)]
stats: Bump stats for decoder, TLB, prefetcher and DRAM changes

Changes due to speculative execution of an unaligned PC, introduction
of TLB stats, changes and re-work of the prefetcher, and the
introduction of rank-wise refresh in the DRAM controller.

9 years agomem: Change prefetcher to use random_mt
Mitch Hayenga [Tue, 23 Dec 2014 14:31:19 +0000 (09:31 -0500)]
mem: Change prefetcher to use random_mt

Prefechers has used rand() to generate random numers previously.

9 years agomem: Hide WriteInvalidate requests from prefetchers
Curtis Dunham [Tue, 23 Dec 2014 14:31:19 +0000 (09:31 -0500)]
mem: Hide WriteInvalidate requests from prefetchers

Without this tweak, a prefetcher will happily prefetch data that will
promptly be invalidated and overwritten by a WriteInvalidate.