cli: --cpu: add support for NUMA caches
This includes support for the following options: * numa.cell[0-9]*.cache[0-9]*.level * numa.cell[0-9]*.cache[0-9]*.associativity * numa.cell[0-9]*.cache[0-9]*.policy * numa.cell[0-9]*.cache[0-9]*.size.value * numa.cell[0-9]*.cache[0-9]*.size.unit * numa.cell[0-9]*.cache[0-9]*.line.value * numa.cell[0-9]*.cache[0-9]*.line.unit
This commit is contained in:
parent
42bb522f0d
commit
fbcb7539c3
|
@ -153,7 +153,12 @@
|
|||
<sibling id="1" value="10"/>
|
||||
</distances>
|
||||
</cell>
|
||||
<cell id="2" cpus="4" memory="256" memAccess="shared" discard="no" unit="KiB"/>
|
||||
<cell id="2" cpus="4" memory="256" memAccess="shared" discard="no" unit="KiB">
|
||||
<cache level="1" associativity="direct" policy="writeback">
|
||||
<size value="256" unit="KiB"/>
|
||||
<line value="256" unit="KiB"/>
|
||||
</cache>
|
||||
</cell>
|
||||
</numa>
|
||||
</cpu>
|
||||
<clock offset="utc">
|
||||
|
@ -426,7 +431,12 @@
|
|||
<sibling id="1" value="10"/>
|
||||
</distances>
|
||||
</cell>
|
||||
<cell id="2" cpus="4" memory="256" memAccess="shared" discard="no" unit="KiB"/>
|
||||
<cell id="2" cpus="4" memory="256" memAccess="shared" discard="no" unit="KiB">
|
||||
<cache level="1" associativity="direct" policy="writeback">
|
||||
<size value="256" unit="KiB"/>
|
||||
<line value="256" unit="KiB"/>
|
||||
</cache>
|
||||
</cell>
|
||||
</numa>
|
||||
</cpu>
|
||||
<clock offset="utc">
|
||||
|
|
|
@ -513,6 +513,8 @@ numa.cell2.id=2,numa.cell2.memory=256,numa.cell2.unit=KiB,numa.cell2.cpus=4,numa
|
|||
cell0.distances.sibling0.id=0,cell0.distances.sibling0.value=10,\
|
||||
cell0.distances.sibling1.id=1,cell0.distances.sibling1.value=21,\
|
||||
numa.cell1.distances.sibling0.id=0,numa.cell1.distances.sibling0.value=21,\
|
||||
numa.cell2.cache0.level=1,numa.cell2.cache0.associativity=direct,numa.cell2.cache0.policy=writeback,\
|
||||
numa.cell2.cache0.size.value=256,numa.cell2.cache0.size.unit=KiB,numa.cell2.cache0.line.value=256,numa.cell2.cache0.line.unit=KiB,\
|
||||
cell1.distances.sibling1.id=1,cell1.distances.sibling1.value=10,\
|
||||
cache.mode=emulate,cache.level=3
|
||||
--cputune shares=2048,period=1000000,quota=-1,global_period=1000000,global_quota=-1,emulator_period=1000000,emulator_quota=-1,iothread_period=1000000,iothread_quota=-1,\
|
||||
|
|
|
@ -2264,7 +2264,7 @@ class ParserCPU(VirtCLIParser):
|
|||
cb = self._make_find_inst_cb(cliarg, list_propname)
|
||||
return cb(*args, **kwargs)
|
||||
|
||||
def sibling_find_inst_cb(self, inst, *args, **kwargs):
|
||||
def cell_sibling_find_inst_cb(self, inst, *args, **kwargs):
|
||||
cell = self.cell_find_inst_cb(inst, *args, **kwargs)
|
||||
inst = cell
|
||||
|
||||
|
@ -2273,6 +2273,15 @@ class ParserCPU(VirtCLIParser):
|
|||
cb = self._make_find_inst_cb(cliarg, list_propname)
|
||||
return cb(inst, *args, **kwargs)
|
||||
|
||||
def cell_cache_find_inst_cb(self, inst, *args, **kwargs):
|
||||
cell = self.cell_find_inst_cb(inst, *args, **kwargs)
|
||||
inst = cell
|
||||
|
||||
cliarg = "cache" # cell[0-9]*.cache[0-9]*
|
||||
list_propname = "caches" # cell.caches
|
||||
cb = self._make_find_inst_cb(cliarg, list_propname)
|
||||
return cb(inst, *args, **kwargs)
|
||||
|
||||
def set_model_cb(self, inst, val, virtarg):
|
||||
if val == "host":
|
||||
val = inst.SPECIAL_MODE_HOST_MODEL
|
||||
|
@ -2342,9 +2351,24 @@ class ParserCPU(VirtCLIParser):
|
|||
find_inst_cb=cls.cell_find_inst_cb)
|
||||
|
||||
cls.add_arg("numa.cell[0-9]*.distances.sibling[0-9]*.id", "id",
|
||||
find_inst_cb=cls.sibling_find_inst_cb)
|
||||
find_inst_cb=cls.cell_sibling_find_inst_cb)
|
||||
cls.add_arg("numa.cell[0-9]*.distances.sibling[0-9]*.value", "value",
|
||||
find_inst_cb=cls.sibling_find_inst_cb)
|
||||
find_inst_cb=cls.cell_sibling_find_inst_cb)
|
||||
|
||||
cls.add_arg("numa.cell[0-9]*.cache[0-9]*.level", "level",
|
||||
find_inst_cb=cls.cell_cache_find_inst_cb)
|
||||
cls.add_arg("numa.cell[0-9]*.cache[0-9]*.associativity", "associativity",
|
||||
find_inst_cb=cls.cell_cache_find_inst_cb)
|
||||
cls.add_arg("numa.cell[0-9]*.cache[0-9]*.policy", "policy",
|
||||
find_inst_cb=cls.cell_cache_find_inst_cb)
|
||||
cls.add_arg("numa.cell[0-9]*.cache[0-9]*.size.value", "size_value",
|
||||
find_inst_cb=cls.cell_cache_find_inst_cb)
|
||||
cls.add_arg("numa.cell[0-9]*.cache[0-9]*.size.unit", "size_unit",
|
||||
find_inst_cb=cls.cell_cache_find_inst_cb)
|
||||
cls.add_arg("numa.cell[0-9]*.cache[0-9]*.line.value", "line_value",
|
||||
find_inst_cb=cls.cell_cache_find_inst_cb)
|
||||
cls.add_arg("numa.cell[0-9]*.cache[0-9]*.line.unit", "line_unit",
|
||||
find_inst_cb=cls.cell_cache_find_inst_cb)
|
||||
|
||||
|
||||
#####################
|
||||
|
|
|
@ -10,9 +10,10 @@ from ..xmlbuilder import XMLBuilder, XMLProperty, XMLChildProperty
|
|||
from .. import xmlutil
|
||||
|
||||
|
||||
class _CPUCellSibling(XMLBuilder):
|
||||
class _NUMACellSibling(XMLBuilder):
|
||||
"""
|
||||
Class for generating <distances> <sibling> nodes
|
||||
Class for generating <cpu><numa><cell><distances> child nodes <sibling>,
|
||||
describing the distances to other NUMA cells.
|
||||
"""
|
||||
XML_NAME = "sibling"
|
||||
_XML_PROP_ORDER = ["id", "value"]
|
||||
|
@ -21,9 +22,30 @@ class _CPUCellSibling(XMLBuilder):
|
|||
value = XMLProperty("./@value", is_int=True)
|
||||
|
||||
|
||||
class _CPUCell(XMLBuilder):
|
||||
class _NUMACellCache(XMLBuilder):
|
||||
"""
|
||||
Class for generating <cpu><numa> child <cell> XML
|
||||
Class for generating <cpu><numa><cell> child nodes <cache>, describing
|
||||
caches for NUMA cells.
|
||||
"""
|
||||
XML_NAME = "cache"
|
||||
_XML_PROP_ORDER = ["level", "associativity", "policy",
|
||||
"size_value", "size_unit", "line_value", "line_unit"]
|
||||
|
||||
level = XMLProperty("./@level", is_int=True)
|
||||
associativity = XMLProperty("./@associativity")
|
||||
policy = XMLProperty("./@policy")
|
||||
|
||||
size_value = XMLProperty("./size/@value", is_int=True)
|
||||
size_unit = XMLProperty("./size/@unit")
|
||||
|
||||
line_value = XMLProperty("./line/@value", is_int=True)
|
||||
line_unit = XMLProperty("./line/@unit")
|
||||
|
||||
|
||||
class _NUMACell(XMLBuilder):
|
||||
"""
|
||||
Class for generating <cpu><numa> child nodes <cell> XML, describing NUMA
|
||||
cells.
|
||||
"""
|
||||
XML_NAME = "cell"
|
||||
_XML_PROP_ORDER = ["id", "cpus", "memory", "memAccess", "discard"]
|
||||
|
@ -34,7 +56,8 @@ class _CPUCell(XMLBuilder):
|
|||
unit = XMLProperty("./@unit")
|
||||
memAccess = XMLProperty("./@memAccess")
|
||||
discard = XMLProperty("./@discard", is_yesno=True)
|
||||
siblings = XMLChildProperty(_CPUCellSibling, relative_xpath="./distances")
|
||||
siblings = XMLChildProperty(_NUMACellSibling, relative_xpath="./distances")
|
||||
caches = XMLChildProperty(_NUMACellCache)
|
||||
|
||||
|
||||
class _CPUCache(XMLBuilder):
|
||||
|
@ -204,7 +227,7 @@ class DomainCpu(XMLBuilder):
|
|||
feature.policy = policy
|
||||
features = XMLChildProperty(_CPUFeature)
|
||||
|
||||
cells = XMLChildProperty(_CPUCell, relative_xpath="./numa")
|
||||
cells = XMLChildProperty(_NUMACell, relative_xpath="./numa")
|
||||
cache = XMLChildProperty(_CPUCache, is_single=True)
|
||||
|
||||
def copy_host_cpu(self, guest):
|
||||
|
|
Loading…
Reference in New Issue