configs: Use the same address ranges for dir and mem_ctrls

In Ruby, for every directory we create one memory controller for every
range in the memory ranges. Previously the memory controllers and the
directories created their address ranges independently and as a result
a mismatch was possible. In fact, we assinged an interleaved address
range with hasing for the memory controllers while the corresponding
directories would be assigned the same interleaved address range
without hashing.

This change uses the address range of the memory controllers to
populate the list of address ranges for the corresponding directory
and avoid bugs due to code duplication.

Change-Id: I1e321c81a254199e5aaa9f3b81f4a4642c60a67a
Reviewed-on: https://gem5-review.googlesource.com/12318
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>
This commit is contained in:
Nikos Nikoleris
2018-08-30 10:26:31 +01:00
parent bbedc39561
commit 3d4a78bec0
8 changed files with 20 additions and 29 deletions

View File

@@ -91,6 +91,14 @@ def setup_memory_controllers(system, ruby, dir_cntrls, options):
mem_ctrls = []
crossbars = []
if options.numa_high_bit:
dir_bits = int(math.log(options.num_dirs, 2))
intlv_size = 2 ** (options.numa_high_bit - dir_bits + 1)
else:
# if the numa_bit is not specified, set the directory bits as the
# lowest bits above the block offset bits
intlv_size = options.cacheline_size
# Sets bits to be used for interleaving. Creates memory controllers
# attached to a directory controller. A separate controller is created
# for each address range as the abstract memory can handle only one
@@ -102,15 +110,17 @@ def setup_memory_controllers(system, ruby, dir_cntrls, options):
crossbars.append(crossbar)
dir_cntrl.memory = crossbar.slave
dir_ranges = []
for r in system.mem_ranges:
mem_ctrl = MemConfig.create_mem_ctrl(
MemConfig.get(options.mem_type), r, index, options.num_dirs,
int(math.log(options.num_dirs, 2)), options.cacheline_size)
int(math.log(options.num_dirs, 2)), intlv_size)
if options.access_backing_store:
mem_ctrl.kvm_map=False
mem_ctrls.append(mem_ctrl)
dir_ranges.append(mem_ctrl.range)
if crossbar != None:
mem_ctrl.port = crossbar.master
@@ -118,6 +128,7 @@ def setup_memory_controllers(system, ruby, dir_cntrls, options):
mem_ctrl.port = dir_cntrl.memory
index += 1
dir_cntrl.addr_ranges = dir_ranges
system.mem_ctrls = mem_ctrls
@@ -199,33 +210,13 @@ def create_system(options, full_system, system, piobus = None, dma_ports = [],
ruby.phys_mem = SimpleMemory(range=system.mem_ranges[0],
in_addr_map=False)
def create_directories(options, mem_ranges, bootmem, ruby_system,
system):
def create_directories(options, bootmem, ruby_system, system):
dir_cntrl_nodes = []
if options.numa_high_bit:
numa_bit = options.numa_high_bit
else:
# if the numa_bit is not specified, set the directory bits as the
# lowest bits above the block offset bits, and the numa_bit as the
# highest of those directory bits
dir_bits = int(math.log(options.num_dirs, 2))
block_size_bits = int(math.log(options.cacheline_size, 2))
numa_bit = block_size_bits + dir_bits - 1
for i in xrange(options.num_dirs):
dir_ranges = []
for r in mem_ranges:
addr_range = m5.objects.AddrRange(r.start, size = r.size(),
intlvHighBit = numa_bit,
intlvBits = dir_bits,
intlvMatch = i)
dir_ranges.append(addr_range)
dir_cntrl = Directory_Controller()
dir_cntrl.version = i
dir_cntrl.directory = RubyDirectoryMemory()
dir_cntrl.ruby_system = ruby_system
dir_cntrl.addr_ranges = dir_ranges
exec("ruby_system.dir_cntrl%d = dir_cntrl" % i)
dir_cntrl_nodes.append(dir_cntrl)