mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-24 22:42:53 +00:00
acrn-config: add MBA delay support in acrn config app
MBA_DELAY/CLOS_MASK show be exposed only if "MBA"/"L2" or "L3" existed in rdt resource supoorted in board xml; The default value of MBA_DELAY is 0; The numbers of MAB_DELAY/CLOS_MASK entries is determined by: If CDP is not enabled, the number of entries for CLOS_MASK and MBA_DELAY is the min of CLOS_MAX of all RDT resources; If CDP is enabled, divide the CLOS_MAX values for L3 and L2 resources by 2 and then find the min of all RDT resources to get common_clos_max, the number of entries for CLOS_MASK is common_clos_max*2, the number of entries for MBA_DELAY is comm_clos_max. Tracked-On: #4943 Signed-off-by: Shuang Zheng <shuang.zheng@intel.com> Reviewed-by: Vijay Dhanraj <vijay.dhanraj@intel.com>
This commit is contained in:
parent
6e2f8e2a03
commit
2c6fad00ee
@ -405,12 +405,14 @@ $().ready(function(){
|
||||
var id = $(this).attr('id');
|
||||
var value = $(this).val();
|
||||
update_vcpu_clos_option(id, value);
|
||||
update_rdt_clos_mask(id, value);
|
||||
});
|
||||
|
||||
$("select[ID$='FEATURES,RDT,CDP_ENABLED']").each(function(index, item) {
|
||||
var id = $(this).attr('id');
|
||||
var value = $(item).val();
|
||||
update_vcpu_clos_option(id, value);
|
||||
update_rdt_clos_mask(id, value);
|
||||
});
|
||||
|
||||
$(document).on('click', "button:contains('+')", function() {
|
||||
@ -565,6 +567,69 @@ function update_vcpu_clos_option(id, value) {
|
||||
}
|
||||
}
|
||||
|
||||
function update_rdt_clos_mask(id, value) {
|
||||
$.ajax({
|
||||
type : "POST",
|
||||
contentType: "application/json;charset=UTF-8",
|
||||
url : "../get_num_of_rdt_res_entries",
|
||||
data : JSON.stringify({'cdp_enabled': value}),
|
||||
success : function(result) {
|
||||
console.log(result);
|
||||
num_clos_mask = result.num_clos_mask;
|
||||
num_mba_delay = result.num_mba_delay;
|
||||
clos_mask_entries = [null];
|
||||
index = 0;
|
||||
$("input[ID$='hv,FEATURES,RDT,CLOS_MASK']").each(function(){
|
||||
index += 1;
|
||||
if(index<=num_clos_mask) {
|
||||
clos_mask_entries[0] = $(this).parent().parent();
|
||||
}
|
||||
if(index>num_clos_mask) {
|
||||
clos_mask_entries.push($(this).parent().parent());
|
||||
}
|
||||
});
|
||||
if(index<=num_clos_mask) {
|
||||
last_clos_mask_entry = clos_mask_entries[0];
|
||||
for(i=0; i<num_clos_mask-index; i++) {
|
||||
clos_mask_entry_added = last_clos_mask_entry.clone();
|
||||
clos_mask_entry_added.insertAfter(last_clos_mask_entry);
|
||||
}
|
||||
} else {
|
||||
for(i=clos_mask_entries.length-1; i>0; i--) {
|
||||
clos_mask_entries[i].remove();
|
||||
}
|
||||
}
|
||||
mba_delay_entries = [null];
|
||||
index = 0;
|
||||
$("input[ID$='hv,FEATURES,RDT,MBA_DELAY']").each(function(){
|
||||
index += 1;
|
||||
if(index<=num_mba_delay) {
|
||||
mba_delay_entries[0] = $(this).parent().parent();
|
||||
}
|
||||
if(index>num_mba_delay) {
|
||||
mba_delay_entries.push($(this).parent().parent());
|
||||
}
|
||||
});
|
||||
if(index<=num_mba_delay) {
|
||||
last_mba_delay_entry = mba_delay_entries[0];
|
||||
for(i=0; i<num_mba_delay-index; i++) {
|
||||
mba_delay_entry_added = last_mba_delay_entry.clone();
|
||||
mba_delay_entry_added.insertAfter(last_mba_delay_entry);
|
||||
}
|
||||
} else {
|
||||
for(i=mba_delay_entries.length-1; i>0; i--) {
|
||||
mba_delay_entries[i].remove();
|
||||
}
|
||||
}
|
||||
},
|
||||
error : function(e){
|
||||
console.log(e.status);
|
||||
console.log(e.responseText);
|
||||
alert(e.responseText);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function create_setting(type, default_name, name, mode){
|
||||
var board_info = $("text#board_type").text();
|
||||
if (board_info==null || board_info=='') {
|
||||
@ -663,7 +728,7 @@ function save_scenario(generator=null){
|
||||
$("input").each(function(){
|
||||
var id = $(this).attr('id');
|
||||
var value = $(this).val();
|
||||
if(id.indexOf('CLOS_MASK')>=0 ) {
|
||||
if(id.indexOf('CLOS_MASK')>=0 || id.indexOf('MBA_DELAY')>=0) {
|
||||
if(id in scenario_config) {
|
||||
scenario_config[id].push(value);
|
||||
} else {
|
||||
|
@ -233,7 +233,7 @@ the source files will be generated into default path and overwirte the previous
|
||||
</div>
|
||||
<p id="{{vm_type+','+elem.tag+','+sub_elem.tag+','+sub_elem_2.tag}}_err" class="col-sm-3"></p>
|
||||
</div>
|
||||
{% elif sub_elem_2.tag != 'CLOS_MASK' %}
|
||||
{% elif sub_elem_2.tag not in ['CLOS_MASK', 'MBA_DELAY'] %}
|
||||
<div class="form-group">
|
||||
<label class="col-sm-1 control-label" data-toggle="tooltip"
|
||||
title="{{elem.attrib['desc'] if 'desc' in elem.attrib else elem.tag}}">
|
||||
@ -271,7 +271,7 @@ the source files will be generated into default path and overwirte the previous
|
||||
{{sub_elem.tag}} {{sub_elem_2.tag}}</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="text" class="form-control"
|
||||
id="{{vm_type+','+elem.tag+','+sub_elem.tag+','+sub_elem_2.tag}}" value={{sub_elem_2.text}}></input>
|
||||
id="{{vm_type+','+elem.tag+','+sub_elem.tag+','+sub_elem_2.tag}}" value={{'' if sub_elem_2.text == None else sub_elem_2.text}}></input>
|
||||
</div>
|
||||
<p id="{{vm_type+','+elem.tag+','+sub_elem.tag+','+sub_elem_2.tag}}_err" class="col-sm-3"></p>
|
||||
</div>
|
||||
|
@ -473,13 +473,16 @@ def create_setting():
|
||||
if mode == 'create':
|
||||
# update RDT->CLOS_MASK according to board xml
|
||||
scenario_config.set_curr(create_name)
|
||||
rdt_clos_max = get_board_rdt_clos_max(board_info)
|
||||
elem_clos_max = scenario_config.get_curr_elem('hv', 'FEATURES', 'RDT', 'CLOS_MASK')
|
||||
if rdt_clos_max > 0:
|
||||
for i in range(rdt_clos_max - 1):
|
||||
scenario_config.clone_curr_elem(elem_clos_max, 'hv', 'FEATURES', 'RDT')
|
||||
else:
|
||||
scenario_config.delete_curr_elem('hv', 'FEATURES', 'RDT', 'CLOS_MASK')
|
||||
elem_mba_delay = scenario_config.get_curr_elem('hv', 'FEATURES', 'RDT', 'MBA_DELAY')
|
||||
scenario_config.delete_curr_elem('hv', 'FEATURES', 'RDT', 'CLOS_MASK')
|
||||
scenario_config.delete_curr_elem('hv', 'FEATURES', 'RDT', 'MBA_DELAY')
|
||||
cdp_enabled = scenario_config.get_curr_value('hv', 'FEATURES', 'RDT', 'CDP_ENABLED')
|
||||
(num_clos_mask, num_mba_delay) = get_num_of_rdt_res(board_info, cdp_enabled)
|
||||
for i in range(num_clos_mask):
|
||||
scenario_config.clone_curr_elem(elem_clos_max, 'hv', 'FEATURES', 'RDT')
|
||||
for i in range(num_mba_delay):
|
||||
scenario_config.clone_curr_elem(elem_mba_delay, 'hv', 'FEATURES', 'RDT')
|
||||
scenario_config.save(create_name)
|
||||
return {'status': 'success', 'setting': create_name, 'error_list': {}}
|
||||
|
||||
@ -623,20 +626,24 @@ def upload_board_info():
|
||||
copyfile(generic_file, new_file)
|
||||
xml_config = XmlConfig(os.path.join(current_app.config.get('CONFIG_PATH'),
|
||||
board_type))
|
||||
xml_config.set_curr(generic_name[:-4])
|
||||
xml_config.set_curr(generic_name.rsplit('.', 1)[0])
|
||||
xml_config.set_curr_attr('board', board_type)
|
||||
# update RDT->CLOS_MASK according to board xml
|
||||
xml_config_root = xml_config.get_curr_root()
|
||||
if 'board' in xml_config_root.attrib and 'scenario' in xml_config_root.attrib \
|
||||
and 'uos_launcher' not in xml_config_root.attrib:
|
||||
rdt_clos_max = get_board_rdt_clos_max(filename.rsplit('.', 1)[0])
|
||||
cdp_enabled = xml_config.get_curr_value('hv', 'FEATURES', 'RDT', 'CDP_ENABLED')
|
||||
(num_clos_mask, num_mba_delay) = \
|
||||
get_num_of_rdt_res(filename.rsplit('.', 1)[0], cdp_enabled)
|
||||
elem_clos_max = xml_config.get_curr_elem('hv', 'FEATURES', 'RDT', 'CLOS_MASK')
|
||||
if rdt_clos_max > 0:
|
||||
for i in range(rdt_clos_max-1):
|
||||
xml_config.clone_curr_elem(elem_clos_max, 'hv', 'FEATURES', 'RDT')
|
||||
else:
|
||||
xml_config.delete_curr_elem('hv', 'FEATURES', 'RDT', 'CLOS_MASK')
|
||||
xml_config.save(generic_name[:-4], user_defined=False)
|
||||
elem_mba_delay = xml_config.get_curr_elem('hv', 'FEATURES', 'RDT', 'MBA_DELAY')
|
||||
xml_config.delete_curr_elem('hv', 'FEATURES', 'RDT', 'CLOS_MASK')
|
||||
xml_config.delete_curr_elem('hv', 'FEATURES', 'RDT', 'MBA_DELAY')
|
||||
for i in range(num_clos_mask):
|
||||
xml_config.clone_curr_elem(elem_clos_max, 'hv', 'FEATURES', 'RDT')
|
||||
for i in range(num_mba_delay):
|
||||
xml_config.clone_curr_elem(elem_mba_delay, 'hv', 'FEATURES', 'RDT')
|
||||
xml_config.save(generic_name.rsplit('.', 1)[0], user_defined=False)
|
||||
|
||||
board_info = os.path.splitext(file.filename)[0]
|
||||
current_app.config.update(BOARD_INFO=board_info)
|
||||
@ -829,6 +836,19 @@ def get_post_launch_vms():
|
||||
return {'vm_list': vm_list}
|
||||
|
||||
|
||||
@CONFIG_APP.route('/get_num_of_rdt_res_entries', methods=['POST'])
|
||||
def get_num_of_rdt_res_entries():
|
||||
"""
|
||||
get the number of rdt res entries
|
||||
:return: the number of CLOS_MASK and MBA_DELAY entries
|
||||
"""
|
||||
data = request.json if request.method == "POST" else request.args
|
||||
cdp_enabled = data['cdp_enabled']
|
||||
board_info = current_app.config.get('BOARD_INFO')
|
||||
(num_clos_mask, num_mba_delay) = get_num_of_rdt_res(board_info, cdp_enabled)
|
||||
return {'num_clos_mask': num_clos_mask, 'num_mba_delay': num_mba_delay}
|
||||
|
||||
|
||||
def get_post_launch_vm_list(scenario_name):
|
||||
"""
|
||||
get post launch VM list
|
||||
@ -971,14 +991,53 @@ def get_board_info(board_info):
|
||||
return (bios_info, base_board_info)
|
||||
|
||||
|
||||
def get_board_rdt_clos_max(board_info):
|
||||
def get_num_of_rdt_res(board_file_name, cdp_enalbed):
|
||||
"""
|
||||
get board info type
|
||||
:param board_info: the board info file
|
||||
:return: the rdt clos max
|
||||
get the number of rdt res entries
|
||||
:param board_file_name: the file name of the board
|
||||
:param cdp_enalbed: cdp enalbed or not
|
||||
:return: the number of rdt res entries
|
||||
"""
|
||||
board_config = get_board_config(board_info)
|
||||
rdt_clos_max = 0
|
||||
dict_rdt_res_clos_max = get_board_rdt_res_clos_max(board_file_name)
|
||||
|
||||
num_clos_max = 0
|
||||
num_mba_delay = 0
|
||||
|
||||
if 'MBA' not in dict_rdt_res_clos_max.keys():
|
||||
num_mba_delay = 0
|
||||
if 'L2' not in dict_rdt_res_clos_max.keys() and 'L3' not in dict_rdt_res_clos_max.keys():
|
||||
num_clos_max = 0
|
||||
else:
|
||||
num_clos_max = min(dict_rdt_res_clos_max.values())
|
||||
else:
|
||||
if 'L2' not in dict_rdt_res_clos_max.keys() and 'L3' not in dict_rdt_res_clos_max.keys():
|
||||
num_clos_max = 0
|
||||
num_mba_delay = dict_rdt_res_clos_max['MBA']
|
||||
else:
|
||||
if cdp_enalbed is not None and cdp_enalbed.strip().lower() == 'y':
|
||||
for key in dict_rdt_res_clos_max.keys():
|
||||
if key not in ['MBA']:
|
||||
dict_rdt_res_clos_max[key] = int(dict_rdt_res_clos_max[key] / 2)
|
||||
common_clos_max = min(dict_rdt_res_clos_max.values())
|
||||
num_clos_max = common_clos_max * 2
|
||||
num_mba_delay = common_clos_max
|
||||
else:
|
||||
common_clos_max = min(dict_rdt_res_clos_max.values())
|
||||
num_clos_max = common_clos_max
|
||||
num_mba_delay = common_clos_max
|
||||
|
||||
return (num_clos_max, num_mba_delay)
|
||||
|
||||
|
||||
def get_board_rdt_res_clos_max(board_file_name):
|
||||
"""
|
||||
get rdt res clos max of the board
|
||||
:param board_file_name: the file name of the board
|
||||
:return: the rdt res clos max
|
||||
"""
|
||||
board_config = get_board_config(board_file_name)
|
||||
rdt_res_supported = []
|
||||
rdt_res_clos_max = []
|
||||
|
||||
if board_config is not None:
|
||||
board_info_root = board_config.get_curr_root()
|
||||
@ -987,14 +1046,29 @@ def get_board_rdt_clos_max(board_info):
|
||||
if item.tag == 'CLOS_INFO':
|
||||
for line in item.text.split('\n'):
|
||||
line = line.strip()
|
||||
if line.startswith('rdt resources supported'):
|
||||
try:
|
||||
rdt_res_supported = line.split(':')[1].split(',')
|
||||
except:
|
||||
pass
|
||||
if line.startswith('rdt resource clos max:'):
|
||||
try:
|
||||
rdt_clos_max = int(line.split(':')[1].strip())
|
||||
rdt_res_clos_max = line.split(':')[1].split(',')
|
||||
break
|
||||
except:
|
||||
pass
|
||||
|
||||
return rdt_clos_max
|
||||
if len(rdt_res_clos_max) < len(rdt_res_supported):
|
||||
for i in range(len(rdt_res_supported) - len(rdt_res_clos_max)):
|
||||
rdt_res_clos_max.append(0)
|
||||
dict_rdt_res_clos_max = {}
|
||||
for i in range(len(rdt_res_supported)):
|
||||
try:
|
||||
clos_max = int(rdt_res_clos_max[i].strip())
|
||||
except:
|
||||
clos_max = 0
|
||||
if clos_max > 0:
|
||||
dict_rdt_res_clos_max[rdt_res_supported[i].strip()] = clos_max
|
||||
return dict_rdt_res_clos_max
|
||||
|
||||
|
||||
def assign_vm_id(scenario_config):
|
||||
|
@ -18,6 +18,7 @@
|
||||
<RDT_ENABLED desc="Enable RDT">n</RDT_ENABLED>
|
||||
<CDP_ENABLED desc="CDP (Code and Data Prioritization). CDP is an extension of CAT.">n</CDP_ENABLED>
|
||||
<CLOS_MASK desc="Cache Capacity Bitmask"></CLOS_MASK>
|
||||
<MBA_DELAY desc="Memory Bandwidth Allocation delay value">0</MBA_DELAY>
|
||||
</RDT>
|
||||
<HYPERV_ENABLED desc="Enable Hyper-V enlightenment">y</HYPERV_ENABLED>
|
||||
<IOMMU_ENFORCE_SNP desc="IOMMU enforce snoop behavior of DMA operation.">n</IOMMU_ENFORCE_SNP>
|
||||
|
@ -18,6 +18,7 @@
|
||||
<RDT_ENABLED desc="Enable RDT">n</RDT_ENABLED>
|
||||
<CDP_ENABLED desc="CDP (Code and Data Prioritization). CDP is an extension of CAT.">n</CDP_ENABLED>
|
||||
<CLOS_MASK desc="Cache Capacity Bitmask"></CLOS_MASK>
|
||||
<MBA_DELAY desc="Memory Bandwidth Allocation delay value">0</MBA_DELAY>
|
||||
</RDT>
|
||||
<HYPERV_ENABLED desc="Enable Hyper-V enlightenment">y</HYPERV_ENABLED>
|
||||
<IOMMU_ENFORCE_SNP desc="IOMMU enforce snoop behavior of DMA operation.">n</IOMMU_ENFORCE_SNP>
|
||||
|
@ -18,6 +18,7 @@
|
||||
<RDT_ENABLED desc="Enable RDT">n</RDT_ENABLED>
|
||||
<CDP_ENABLED desc="CDP (Code and Data Prioritization). CDP is an extension of CAT.">n</CDP_ENABLED>
|
||||
<CLOS_MASK desc="Cache Capacity Bitmask"></CLOS_MASK>
|
||||
<MBA_DELAY desc="Memory Bandwidth Allocation delay value">0</MBA_DELAY>
|
||||
</RDT>
|
||||
<HYPERV_ENABLED desc="Enable Hyper-V enlightenment">y</HYPERV_ENABLED>
|
||||
<IOMMU_ENFORCE_SNP desc="IOMMU enforce snoop behavior of DMA operation.">n</IOMMU_ENFORCE_SNP>
|
||||
|
@ -18,6 +18,7 @@
|
||||
<RDT_ENABLED desc="Enable RDT">n</RDT_ENABLED>
|
||||
<CDP_ENABLED desc="CDP (Code and Data Prioritization). CDP is an extension of CAT.">n</CDP_ENABLED>
|
||||
<CLOS_MASK desc="Cache Capacity Bitmask"></CLOS_MASK>
|
||||
<MBA_DELAY desc="Memory Bandwidth Allocation delay value">0</MBA_DELAY>
|
||||
</RDT>
|
||||
<HYPERV_ENABLED desc="Enable Hyper-V enlightenment">y</HYPERV_ENABLED>
|
||||
<IOMMU_ENFORCE_SNP desc="IOMMU enforce snoop behavior of DMA operation.">n</IOMMU_ENFORCE_SNP>
|
||||
|
@ -18,6 +18,7 @@
|
||||
<RDT_ENABLED desc="Enable RDT">n</RDT_ENABLED>
|
||||
<CDP_ENABLED desc="CDP (Code and Data Prioritization). CDP is an extension of CAT.">n</CDP_ENABLED>
|
||||
<CLOS_MASK desc="Cache Capacity Bitmask"></CLOS_MASK>
|
||||
<MBA_DELAY desc="Memory Bandwidth Allocation delay value">0</MBA_DELAY>
|
||||
</RDT>
|
||||
<HYPERV_ENABLED desc="Enable Hyper-V enlightenment">y</HYPERV_ENABLED>
|
||||
<IOMMU_ENFORCE_SNP desc="IOMMU enforce snoop behavior of DMA operation.">n</IOMMU_ENFORCE_SNP>
|
||||
|
Loading…
Reference in New Issue
Block a user