gem5.git
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.

9 years agomem: Fix event scheduling issue for prefetches
Mitch Hayenga [Tue, 23 Dec 2014 14:31:18 +0000 (09:31 -0500)]
mem: Fix event scheduling issue for prefetches

The cache's MemSidePacketQueue schedules a sendEvent based upon
nextMSHRReadyTime() which is the time when the next MSHR is ready or whenever
a future prefetch is ready.  However, a prefetch being ready does not guarentee
that it can obtain an MSHR.  So, when all MSHRs are full,
the simulation ends up unnecessiciarly scheduling a sendEvent every picosecond
until an MSHR is finally freed and the prefetch can happen.

This patch fixes this by not signaling the prefetch ready time if the prefetch
could not be generated.  The event is rescheduled as soon as a MSHR becomes
available.

9 years agomem: Fix bug relating to writebacks and prefetches
Mitch Hayenga [Tue, 23 Dec 2014 14:31:18 +0000 (09:31 -0500)]
mem: Fix bug relating to writebacks and prefetches

Previously the code commented about an unhandled case where it might be
possible for a writeback to arrive after a prefetch was generated but
before it was sent to the memory system.  I hit that case.  Luckily
the prefetchSquash() logic already in the code handles dropping prefetch
request in certian circumstances.

9 years agomem: Rework the structuring of the prefetchers
Mitch Hayenga [Tue, 23 Dec 2014 14:31:18 +0000 (09:31 -0500)]
mem: Rework the structuring of the prefetchers

Re-organizes the prefetcher class structure. Previously the
BasePrefetcher forced multiple assumptions on the prefetchers that
inherited from it. This patch makes the BasePrefetcher class truly
representative of base functionality. For example, the base class no
longer enforces FIFO order. Instead, prefetchers with FIFO requests
(like the existing stride and tagged prefetchers) now inherit from a
new QueuedPrefetcher base class.

Finally, the stride-based prefetcher now assumes a custimizable lookup table
(sets/ways) rather than the previous fully associative structure.

9 years agomem: Add parameter to reserve MSHR entries for demand access
Mitch Hayenga [Tue, 23 Dec 2014 14:31:18 +0000 (09:31 -0500)]
mem: Add parameter to reserve MSHR entries for demand access

Adds a new parameter that reserves some number of MSHR entries for demand
accesses.  This helps prevent prefetchers from taking all MSHRs, forcing demand
requests from the CPU to stall.

9 years agoarm: Add stats to table walker
Curtis Dunham [Tue, 23 Dec 2014 14:31:18 +0000 (09:31 -0500)]
arm: Add stats to table walker

This patch adds table walker stats for:
- Walk events
- Instruction vs Data
- Page size histogram
- Wait time and service time histograms
- Pending requests histogram (per cycle) - measures dist. of L
  (p(1..) = how often busy, p(0) = how often idle)
- Squashes, before starting and after completion

9 years agoconfig: Expose the DRAM ranks as a command-line option
Andreas Hansson [Tue, 23 Dec 2014 14:31:18 +0000 (09:31 -0500)]
config: Expose the DRAM ranks as a command-line option

This patch gives the user direct influence over the number of DRAM
ranks to make it easier to tune the memory density without affecting
the bandwidth (previously the only means of scaling the device count
was through the number of channels).

The patch also adds some basic sanity checks to ensure that the number
of ranks is a power of two (since we rely on bit slices in the address
decoding).

9 years agomem: Ensure DRAM controller is idle when in atomic mode
Andreas Hansson [Tue, 23 Dec 2014 14:31:18 +0000 (09:31 -0500)]
mem: Ensure DRAM controller is idle when in atomic mode

This patch addresses an issue seen with the KVM CPU where the refresh
events scheduled by the DRAM controller forces the simulator to switch
out of the KVM mode, thus killing performance.

The current patch works around the fact that we currently have no
proper API to inform a SimObject of the mode switches. Instead we rely
on drainResume being called after any switch, and cache the previous
mode locally to be able to decide on appropriate actions.

The switcheroo regression require a minor stats bump as a result.

9 years agomem: Add rank-wise refresh to the DRAM controller
Omar Naji [Tue, 23 Dec 2014 14:31:18 +0000 (09:31 -0500)]
mem: Add rank-wise refresh to the DRAM controller

This patch adds rank-wise refresh to the controller, as opposed to the
channel-wide refresh currently in place. In essence each rank can be
refreshed independently, and for this to be possible the controller
is extended with a state machine per rank.

Without this patch the data bus is always idle during a refresh, as
all the ranks are refreshing at the same time. With the rank-wise
refresh it is possible to use one rank while another one is
refreshing, and thus the data bus can be kept busy.

The patch introduces a Rank class to encapsulate the state per rank,
and also shifts all the relevant banks, activation tracking etc to the
rank. The arbitration is also updated to consider the state of the rank.

9 years agomem: Fix a bug in the DRAM controller arbitration
Omar Naji [Tue, 23 Dec 2014 14:31:18 +0000 (09:31 -0500)]
mem: Fix a bug in the DRAM controller arbitration

Fix a minor issue that affects multi-rank systems.

9 years agotests: Add a regression for the stack distance calculator
Andreas Hansson [Tue, 23 Dec 2014 14:31:18 +0000 (09:31 -0500)]
tests: Add a regression for the stack distance calculator

Re-use the existing traffic generator regression, and enable the stack
distance calculation in the comm monitor, along with the verification
stack.

The traffic generator config is also tuned to not increase the
run-time too much (and actually have some address re-use).

9 years agomem: Add stack distance statistics to the CommMonitor
Kanishk Sugand [Tue, 23 Dec 2014 14:31:18 +0000 (09:31 -0500)]
mem: Add stack distance statistics to the CommMonitor

This patch adds the stack distance calculator to the CommMonitor. The
stats are disabled by default.

9 years agomem: Add a stack distance calculator
Kanishk Sugand [Tue, 23 Dec 2014 14:31:18 +0000 (09:31 -0500)]
mem: Add a stack distance calculator

This patch adds a stand-alone stack distance calculator. The stack
distance calculator is a passive SimObject that observes the addresses
passed to it. It calculates stack distances (LRU Distances) of
incoming addresses based on the partial sum hierarchy tree algorithm
described by Alamasi et al. http://doi.acm.org/10.1145/773039.773043.

For each transaction a hashtable look-up is performed. At every
non-unique transaction the tree is traversed from the leaf at the
returned index to the root, the old node is deleted from the tree, and
the sums (to the right) are collected and decremented. The collected
sum represets the stack distance of the found node. At every unique
transaction the stack distance is returned as
numeric_limits<uint64>::max().

In addition to the basic stack distance calculation, a feature to mark
an old node in the tree is added. This is useful if it is required to
see the reuse pattern. For example, Writebacks to the lower level
(e.g. membus from L2), can be marked instead of being removed from the
stack (isMarked flag of Node set to True). And then later if this same
address is accessed (by L1), the value of the isMarked flag would be
True. This gives some insight on how the Writeback policy of the
lower level affect the read/write accesses in an application.

Debugging is enabled by setting the verify flag to true. Debugging is
implemented using a dummy stack that behaves in a naive way, using STL
vectors. Note that this has a large impact on run time.

9 years agoconfig: Add --memchecker option
Marco Elver [Tue, 23 Dec 2014 14:31:18 +0000 (09:31 -0500)]
config: Add --memchecker option

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

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

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

9 years agomem: Add MemChecker and MemCheckerMonitor
Marco Elver [Tue, 23 Dec 2014 14:31:17 +0000 (09:31 -0500)]
mem: Add MemChecker and MemCheckerMonitor

This patch adds the MemChecker and MemCheckerMonitor classes. While
MemChecker can be integrated anywhere in the system and is independent,
the most convenient usage is through the MemCheckerMonitor -- this
however, puts limitations on where the MemChecker is able to observe
read/write transactions.

9 years agoarm: Raise an alignment fault if a PC has illegal alignment
Andreas Sandberg [Tue, 23 Dec 2014 14:31:17 +0000 (09:31 -0500)]
arm: Raise an alignment fault if a PC has illegal alignment

We currently don't handle unaligned PCs correctly. There is one check
for unaligned PCs in the TLB when running in aarch64 mode, but this
check does not cover cases where the CPU does not do a TLB lookup when
decoding an instruction (e.g., a branch stays within the same cache
line). Additionally, the Decoder class sometimes throws an assertion
for unaligned PCs which breaks speculation.

This changeset introduces a decoder fault bit field in the ExtMachInst
structure. This field can be used to signal a decoder failure. If set,
the decoder generates an internal gem5fault instruction instead of a
normal instruction. This instruction in turns either panics (fault
type PANIC), returns an PCAlignmentFault (fault type UNALIGNED,
aarch64) or PrefetchAbort (fault type UNALIGNED, aarch32).

The patch causes minor changes to the realview64 regressions, and a
stats bump will follow.

9 years agoarm: Clean up and document decoder API
Andreas Sandberg [Tue, 23 Dec 2014 14:31:17 +0000 (09:31 -0500)]
arm: Clean up and document decoder API

This changeset adds more documentation to the ArmISA::Decoder class
and restructures it slightly to make API groups more obvious.

9 years agoarm: Add support for filtering in the PMU
Andreas Sandberg [Tue, 23 Dec 2014 14:31:17 +0000 (09:31 -0500)]
arm: Add support for filtering in the PMU

This patch adds support for filtering events in the PMU. In order to
do so, it updates the ISADevice base class to forward an ISA pointer
to ISA devices. This enables such devices to access the MiscReg file
to determine the current execution level.

9 years agoconfig: Add options to take/resume from SimPoint checkpoints
Dam Sunwoo [Tue, 23 Dec 2014 14:31:17 +0000 (09:31 -0500)]
config: Add options to take/resume from SimPoint checkpoints

More documentation at http://gem5.org/Simpoints

Steps to profile, generate, and use SimPoints with gem5:

1. To profile workload and generate SimPoint BBV file, use the
following option:

--simpoint-profile --simpoint-interval <interval length>

Requires single Atomic CPU and fastmem.
<interval length> is in number of instructions.

2. Generate SimPoint analysis using SimPoint 3.2 from UCSD.
(SimPoint 3.2 not included with this flow.)

3. To take gem5 checkpoints based on SimPoint analysis, use the
following option:

--take-simpoint-checkpoint=<simpoint file path>,<weight file
path>,<interval length>,<warmup length>

<simpoint file> and <weight file> is generated by SimPoint analysis
tool from UCSD. SimPoint 3.2 format expected. <interval length> and
<warmup length> are in number of instructions.

4. To resume from gem5 SimPoint checkpoints, use the following option:

--restore-simpoint-checkpoint -r <N> --checkpoint-dir <simpoint
checkpoint path>

<N> is (SimPoint index + 1). E.g., "-r 1" will resume from SimPoint
#0.

9 years agoscons: Make the USE_KVM variable available in C++.
Gabe Black [Tue, 23 Dec 2014 00:49:24 +0000 (16:49 -0800)]
scons: Make the USE_KVM variable available in C++.

We need it to determine whether we should expect KVM related parameters
exist in the cirrus graphics device.

9 years agoAdded tag stable_2014_12_14 for changeset bdb307e8be54
Nilay Vaish [Sun, 14 Dec 2014 22:21:04 +0000 (16:21 -0600)]
Added tag stable_2014_12_14 for changeset bdb307e8be54

9 years agoLet other objects set up memory like regions in a KVM VM.
Gabe Black [Wed, 10 Dec 2014 05:53:44 +0000 (21:53 -0800)]
Let other objects set up memory like regions in a KVM VM.

9 years agoarm: Fix decoding of PMXEVTYPER_EL0 and PMCCFILTR_EL0
Andreas Sandberg [Mon, 8 Dec 2014 09:49:53 +0000 (04:49 -0500)]
arm: Fix decoding of PMXEVTYPER_EL0 and PMCCFILTR_EL0

The aarch64 system register decoder is currently not decoding
PMXEVTYPER_EL0 and PMCCFILTR_EL0 correctly. This changeset updates the
decoder so that they are decoded using the values in table C5-6 in ARM
DDI 0478A.c.

9 years agodev: Add response sanity checks in PioPort
Andreas Sandberg [Mon, 8 Dec 2014 09:49:52 +0000 (04:49 -0500)]
dev: Add response sanity checks in PioPort

Add an assert in the PioPort that checks if a response packet from a
device has the right flags set before passing it to them rest of the
memory system.

9 years agodev: Correctly transform packets into responses
Andreas Sandberg [Mon, 8 Dec 2014 09:49:51 +0000 (04:49 -0500)]
dev: Correctly transform packets into responses

The VirtIO devices didn't correctly set the response flags in memory
packets. This changeset adds the required Packet::makeResponse()
calls.

9 years agomisc: Generalize GDB single stepping.
Gabe Black [Sat, 6 Dec 2014 06:37:03 +0000 (22:37 -0800)]
misc: Generalize GDB single stepping.

The new single stepping implementation for x86 doesn't rely on any ISA
specific properties or functionality. This change pulls out the per ISA
implementation of those functions and promotes the X86 implementation to the
base class.

One drawback of that implementation is that the CPU might stop on an
instruction twice if it's affected by both breakpoints and single stepping.
While that might be a little surprising, it's harmless and would only happen
under somewhat unlikely circumstances.

9 years agox86: Implement a remote GDB stub.
Gabe Black [Sat, 6 Dec 2014 06:36:16 +0000 (22:36 -0800)]
x86: Implement a remote GDB stub.

This stub should allow remote debugging of 32 bit and 64 bit targets. Single
stepping seems to work, as do breakpoints. If both breakpoints and single
stepping affect an instruction, gdb will stop at the instruction twice before
continuing. That's a little surprising, but is generally harmless.

9 years agomisc: Add some utility functions for schedule inst commit events.
Gabe Black [Sat, 6 Dec 2014 06:35:47 +0000 (22:35 -0800)]
misc: Add some utility functions for schedule inst commit events.

These can be used to simplify the implementation of single step in derived
classes.

9 years agomisc: Rename the GDB "Event" event class to InputEvent.
Gabe Black [Sat, 6 Dec 2014 06:34:42 +0000 (22:34 -0800)]
misc: Rename the GDB "Event" event class to InputEvent.

The "Event" name is the same as the base event class. That's a bit confusing,
and makes it a little awkward to add other event types.

9 years agosim: Ensure GDB interrupts the simulation at an instruction boundary.
Gabe Black [Fri, 5 Dec 2014 09:51:49 +0000 (01:51 -0800)]
sim: Ensure GDB interrupts the simulation at an instruction boundary.

Use the comInstEventQueue to ensure GDB interrupts the simulation at an
instruction boundary and not in the middle of a macroop, memory access, etc.

9 years agocpu: Only check for PC events on instruction boundaries.
Gabe Black [Fri, 5 Dec 2014 09:47:35 +0000 (01:47 -0800)]
cpu: Only check for PC events on instruction boundaries.

Only the instruction address is actually checked, so there's no need to check
repeatedly while we're working through the microops of a macroop and that's
not changing.

9 years agomisc: Make the GDB register cache accessible in various sized chunks.
Gabe Black [Fri, 5 Dec 2014 09:44:24 +0000 (01:44 -0800)]
misc: Make the GDB register cache accessible in various sized chunks.

Not all ISAs have 64 bit sized registers, so it's not always very convenient
to access the GDB register cache in 64 bit sized chunks. This change makes it
accessible in 8, 16, 32, or 64 bit chunks. The MIPS and ARM implementations
were working around that limitation by bundling and unbundling 32 bit values
into 64 bit values. That code has been removed.

9 years agoconfig: Add two options for setting the kernel command line.
Gabe Black [Fri, 5 Dec 2014 00:42:07 +0000 (16:42 -0800)]
config: Add two options for setting the kernel command line.

Both options accept template which will, through python string formatting,
have "mem", "disk", and "script" values substituted in from the mdesc.
Additional values can be used on a case by case basis by passing them as
keyword arguments to the fillInCmdLine function. That makes it possible to
have specialized parameters for a particular ISA, for instance.

The first option lets you specify the template directly, and the other lets
you specify a file which has the template in it.

9 years agox86: Rework opcode parsing to support 3 byte opcodes properly.
Gabe Black [Thu, 4 Dec 2014 23:53:54 +0000 (15:53 -0800)]
x86: Rework opcode parsing to support 3 byte opcodes properly.

Instead of counting the number of opcode bytes in an instruction and recording
each byte before the actual opcode, we can represent the path we took to get to
the actual opcode byte by using a type code. That has a couple of advantages.
First, we can disambiguate the properties of opcodes of the same length which
have different properties. Second, it reduces the amount of data stored in an
ExtMachInst, making them slightly easier/faster to create and process. This
also adds some flexibility as far as how different types of opcodes are
handled, which might come in handy if we decide to support VEX or XOP
instructions.

This change also adds tables to support properly decoding 3 byte opcodes.
Before we would fall off the end of some arrays, on top of the ambiguity
described above.

This change doesn't measureably affect performance on the twolf benchmark.

--HG--
rename : src/arch/x86/isa/decoder/three_byte_opcodes.isa => src/arch/x86/isa/decoder/three_byte_0f38_opcodes.isa
rename : src/arch/x86/isa/decoder/three_byte_opcodes.isa => src/arch/x86/isa/decoder/three_byte_0f3a_opcodes.isa

9 years agoarch: Allow named constants as decode case values.
Gabe Black [Thu, 4 Dec 2014 23:52:48 +0000 (15:52 -0800)]
arch: Allow named constants as decode case values.

The values in a "bitfield" or in an ExtMachInst structure member may not be a
literal value, it might select from an arbitrary collection of options. Instead
of using the raw value of those constants in the decoder, it's easier to tell
what's going on if they can be referred to as a symbolic constant/enum.

To support that, the ISA description language is extended slightly so that in
addition to integer literals, the case value for decode blobs can also be a
string literal. It's up to the ISA author to ensure that the string evaluates
to a legal constant value when interpretted as C++.

9 years agoconfig: ruby: mi protocol: correct master slave setting for dma
Nilay Vaish [Thu, 4 Dec 2014 14:59:44 +0000 (08:59 -0600)]
config: ruby: mi protocol: correct master slave setting for dma
In the MI protocol, the master slave connection between the dma controller
and network was being set incorrectly.  This patch corrects it.

9 years agox86: Clean up style in process.cc.
Gabe Black [Wed, 3 Dec 2014 06:01:51 +0000 (22:01 -0800)]
x86: Clean up style in process.cc.

9 years agosim: Make it possible to override the breakpoint length check.
Gabe Black [Wed, 3 Dec 2014 11:27:19 +0000 (03:27 -0800)]
sim: Make it possible to override the breakpoint length check.

The check which makes sure the length of the breakpoint being written is the
same as a MachInst is only correct on fixed instruction width ISAs. Instead of
incorrectly applying that check to all ISAs, this change makes that the
default check and lets ISA specific GDB classes override it.

9 years agoconfig: Get rid of some extra spaces around default arguments.
Gabe Black [Wed, 3 Dec 2014 11:11:00 +0000 (03:11 -0800)]
config: Get rid of some extra spaces around default arguments.

9 years agoide: Accept the IDLE (0xe3) ATA command.
Gabe Black [Wed, 3 Dec 2014 11:07:35 +0000 (03:07 -0800)]
ide: Accept the IDLE (0xe3) ATA command.

This command is supposed to set up a timer which will put the drive into a
standby mode if it isn't sent a command within a given time out. Since most of
the timeouts are generally significantly longer than a simulation would run
anyway, and we don't have an implementation for standby mode to begin with,
we can accept the command, do nothing, and report success.

9 years agodev: Support translating left and right ALT keys.
Gabe Black [Wed, 3 Dec 2014 11:06:03 +0000 (03:06 -0800)]
dev: Support translating left and right ALT keys.

This is used primarily for VNC.

9 years agostats: Bump stats for fixes, mostly TLB and WriteInvalidate
Andreas Hansson [Tue, 2 Dec 2014 11:08:25 +0000 (06:08 -0500)]
stats: Bump stats for fixes, mostly TLB and WriteInvalidate

9 years agoscons: Ensure dictionary iteration is sorted by key
Andreas Hansson [Tue, 2 Dec 2014 11:08:22 +0000 (06:08 -0500)]
scons: Ensure dictionary iteration is sorted by key

This patch adds sorting based on the SimObject name or parameter name
for all situations where we iterate over dictionaries. This should
ensure a deterministic and consistent order across the host systems
and hopefully avoid regression results differing across python
versions.

9 years agomem: Support WriteInvalidate (again)
Curtis Dunham [Tue, 2 Dec 2014 11:08:19 +0000 (06:08 -0500)]
mem: Support WriteInvalidate (again)

This patch takes a clean-slate approach to providing WriteInvalidate
(write streaming, full cache line writes without first reading)
support.

Unlike the prior attempt, which took an aggressive approach of directly
writing into the cache before handling the coherence actions, this
approach follows the existing cache flows as closely as possible.

9 years agomem: Remove WriteInvalidate support
Curtis Dunham [Tue, 2 Dec 2014 11:08:17 +0000 (06:08 -0500)]
mem: Remove WriteInvalidate support

Prepare for a different implementation following in the next patch

9 years agocpu: Fix retries on barrier/store in Minor's store buffer
Andrew Bardsley [Tue, 2 Dec 2014 11:08:15 +0000 (06:08 -0500)]
cpu: Fix retries on barrier/store in Minor's store buffer

This patch fixes a case where a store in Minor's store buffer never
leaves the store buffer as it is pre-maturely counted as having been
issued, leading to the store buffer idling.

LSQ::StoreBuffer::numUnissuedAccesses should count the number of accesses
either in memory, or still in the store buffer after being completed.

For stores which are also barriers, the store will stay in the store
buffer for a cycle after it is completed and will be cleaned up by the
barrier clearing code (to ensure that barriers are completed in-order).
To acheive this, numUnissuedAccesses is not decremented when a store-barrier
is issued to memory, but when its barrier effect is cleared.

Without this patch, the correct behaviour happens when a memory transaction
is immediately accepted, but not if it needs a retry.

9 years agocpu: Fix memoryIssueLimit checking in Minor
Andrew Bardsley [Tue, 2 Dec 2014 11:08:13 +0000 (06:08 -0500)]
cpu: Fix memoryIssueLimit checking in Minor

This patch fixes the checking of the number of memory instructions issued
per cycles in the Minor CPU.

9 years agoarm: Fix TLB ignoring faults when table walking
Andrew Bardsley [Tue, 2 Dec 2014 11:08:11 +0000 (06:08 -0500)]
arm: Fix TLB ignoring faults when table walking

This patch fixes a case where the Minor CPU can deadlock due to the lack
of a response to TLB request because of a bug in fault handling in the ARM
table walker.

TableWalker::processWalkWrapper is the scheduler-called wrapper which
handles deferred walks which calls to TableWalker::wait cannot immediately
process.  The handling of faults generated by processWalk{AArch64,LPAE,}
calls in those two functions is is different.  processWalkWrapper ignores
fault returns from processWalk... which can lead to ::finish not being
called on a translation.

This fix provides fault handling in processWalkWrapper similar to that
found in the leaf functions which BaseTLB::Translation::finish.

9 years agoconfig: Fix to SystemC example's event handling
Andrew Bardsley [Tue, 2 Dec 2014 11:08:09 +0000 (06:08 -0500)]
config: Fix to SystemC example's event handling

This patch fixes checkpoint restore in the SystemC hosting example by handling
early PollEvent events correctly before any EventQueue events are posted.

The SystemC event queue handler (SCEventQueue) reports an error if the event
loop is entered with no Events posted.  It is possible for this to happen
after instantiate due to PollEvent events.  This patch separates out
`external' events into a different handler in sc_module.cc to prevent the
error from occurring.

This fix also improves the event handling of asynchronous events by:

    1) Making asynchronous events 'catch up' gem5 time to SystemC
        time to avoid the appearance that events have been lost
        while servicing an asynchronous event that schedules an
        event loop exit event

    2) Add an in_simulate data member to Module to allow the event
        loop to check whether events should be processed or deferred
        until the next time Module::simulate is entered

    3) Cancel pending events around the entry/exit of the event loop
        in Module::simulate

    4) Moving the state initialisation of the example entirely into
        run to correct a problem with early events in checkpoint
        restore.

It is still possible to schedule asynchronous events (and talk PollQueue
actions) while simulate is not running.  This behaviour may stil cause
some problems.

9 years agoconfig: SystemC Gem5Control top level additions
Andrew Bardsley [Tue, 2 Dec 2014 11:08:06 +0000 (06:08 -0500)]
config: SystemC Gem5Control top level additions

This patch cleans up a few style issues and adds a few capabilities to the
SystemC top level 'Gem5Control/Gem5System' mechanism.  These include:

    1) A space to store/retrieve a version string for a model
    2) A mechanism for registering functions to be called at the end of
        elaboration to perform simulation setup tasks in SystemC
    3) Adding setGDBRemotePort to the Gem5Control
    4) Changing the sc_set_time_resolution behaviour to instead check that
        the SystemC time resolution is already acceptable

9 years agostats: Bump stats for o3 LSQ changes
Andreas Hansson [Tue, 2 Dec 2014 11:08:05 +0000 (06:08 -0500)]
stats: Bump stats for o3 LSQ changes

9 years agocpu, o3: Ignored invalidate causing same-address load reordering
Marco Elver [Tue, 2 Dec 2014 11:08:03 +0000 (06:08 -0500)]
cpu, o3: Ignored invalidate causing same-address load reordering

In case the memory subsystem sends a combined response with invalidate
(e.g.  ReadRespWithInvalidate), we cannot ignore the invalidate part
of the response.

If we were to ignore the invalidate part, under certain circumstances
this effectively leads to reordering of loads to the same address
which is not permitted under any memory consistency model implemented
in gem5.

Consider the case where a later load's address is computed before an
earlier load in program order, and is therefore sent to the memory
subsystem first. At some point the earlier load's address is computed
and in doing so correctly marks the later load as a
possibleLoadViolation. In the meantime some other node writes and
sends invalidations to all other nodes. The invalidation races with
the later load's ReadResp, and arrives before ReadResp and is
deferred.  Upon receipt of the ReadResp, the response is changed to
ReadRespWithInvalidate, and sent to the CPU. If we ignore the
invalidate part of the packet, we let the later load read the old
value of the address.  Eventually the earlier load's ReadResp arrives,
but with new data. As there was no invalidate snoop (sunk into the
ReadRespWithInvalidate), and if we did not process the invalidate of
the ReadRespWithInvalidate, we obtain a load reordering.

A similar scenario can be constructed where the earlier load's address
is computed after ReadRespWithInvalidate arrives for the younger
load. In this case hitExternalSnoop needs to be set to true on the
ReadRespWithInvalidate, so that upon knowing the address of the
earlier load, checkViolations will cause the later load to be
squashed.

Finally we must account for the case where both loads are sent to the
memory subsystem (reordered), a snoop invalidate arrives and correctly
sets the later loads fault to ReExec. However, before the CPU
processes the fault, the later load's ReadResp arrives and the
writeback discards the outstanding fault. We must add a check to
ensure that we do not skip any unprocessed faults.

9 years agocpu: Always mask the snoop address when performing lock check
Andreas Hansson [Tue, 2 Dec 2014 11:08:00 +0000 (06:08 -0500)]
cpu: Always mask the snoop address when performing lock check

Ensure the snoop address check is always using a cache-block aligned
address. This patch updates Alpha and Mips to match the other ISAs.

9 years agocpu: Move packet deallocation to recvTimingResp in the O3 CPU
Stephan Diestelhorst [Tue, 2 Dec 2014 11:07:58 +0000 (06:07 -0500)]
cpu: Move packet deallocation to recvTimingResp in the O3 CPU

Move the packet deallocations in the O3 CPU so that the completeDataAccess
deals only with the LSQ specific parts and the generic recvTimingResp frees the
packet in all other cases.

9 years agomem: Relax packet src/dest check and shift onus to crossbar
Andreas Hansson [Tue, 2 Dec 2014 11:07:56 +0000 (06:07 -0500)]
mem: Relax packet src/dest check and shift onus to crossbar

This patch allows objects to get the src/dest of a packet even if it
is not set to a valid port id. This simplifies (ab)using the bridge as
a buffer and latency adapter in situations where the neighbouring
MemObjects are not crossbars.

The checks that were done in the packet are now shifted to the
crossbar where the fields are used to index into the port
arrays. Thus, the carrier of the information is not burdened with
checking, and the crossbar can check not only that the destination is
set, but also that the port index is within limits.

9 years agomem: Clean up packet data allocation
Andreas Hansson [Tue, 2 Dec 2014 11:07:54 +0000 (06:07 -0500)]
mem: Clean up packet data allocation

This patch attempts to make the rules for data allocation in the
packet explicit, understandable, and easy to verify. The constructor
that copies a packet is extended with an additional flag "alloc_data"
to enable the call site to explicitly say whether the newly created
packet is short-lived (a zero-time snoop), or has an unknown life-time
and therefore should allocate its own data (or copy a static pointer
in the case of static data).

The tricky case is the static data. In essence this is a
copy-avoidance scheme where the original source of the request (DMA,
CPU etc) does not ask the memory system to return data as part of the
packet, but instead provides a pointer, and then the memory system
carries this pointer around, and copies the appropriate data to the
location itself. Thus any derived packet actually never copies any
data. As the original source does not copy any data from the response
packet when arriving back at the source, we must maintain the copy of
the original pointer to not break the system. We might want to revisit
this one day and pay the price for a few extra memcpy invocations.

All in all this patch should make it easier to grok what is going on
in the memory system and how data is actually copied (or not).

9 years agomem: Cleanup Packet::checkFunctional and hasData usage
Andreas Hansson [Tue, 2 Dec 2014 11:07:52 +0000 (06:07 -0500)]
mem: Cleanup Packet::checkFunctional and hasData usage

This patch cleans up the use of hasData and checkFunctional in the
packet. The hasData function is unfortunately suggesting that it
checks if the packet has a valid data pointer, when it does in fact
only check if the specific packet type is specified to have a data
payload. The confusion led to a bug in checkFunctional. The latter
function is also tidied up to avoid name overloading.

9 years agomem: Make the requests carried by packets const
Andreas Hansson [Tue, 2 Dec 2014 11:07:50 +0000 (06:07 -0500)]
mem: Make the requests carried by packets const

This adds a basic level of sanity checking to the packet by ensuring
that a request is not modified once the packet is created. The only
issue that had to be worked around is the relaying of
software-prefetches in the cache. The specific situation is now solved
by first copying the request, and then creating a new packet
accordingly.

9 years agomem: Make Request getters const
Andreas Hansson [Tue, 2 Dec 2014 11:07:48 +0000 (06:07 -0500)]
mem: Make Request getters const

This patch tidies up the Request class, making all getters const. The
odd one out is incAccessDepth which is called by the memory system as
packets carry the request around. This is also const to enable the
packet to hold on to a const Request.