示例#1
0
def mba_delay_check(mba_delay_list, feature, mba_str, max_mask_str):

    (res_info, rdt_res_clos_max,
     clos_max_mask_list) = board_cfg_lib.clos_info_parser(
         common.BOARD_INFO_FILE)
    if not board_cfg_lib.is_rdt_enabled() or "MBA" not in res_info:
        return

    clos_max = board_cfg_lib.get_common_clos_max()
    mba_delay_settings_len = len(mba_delay_list)
    if clos_max != mba_delay_settings_len:
        key = 'hv,{},{},{}'.format(feature, mba_str, max_mask_str)
        ERR_LIST[
            key] = "Number of MBA delay entries should be equal to MAX_MBA_CLOS_NUM_ENTRIES={}".format(
                clos_max)
        return

    mba_idx = res_info.index("MBA")
    mba_delay_str = clos_max_mask_list[mba_idx].strip('"').strip("'")
    mba_delay = common.num2int(mba_delay_str)
    for val_str in mba_delay_list:
        if empty_check(val_str, feature, mba_str, max_mask_str):
            return
        value = common.num2int(val_str)
        if value > mba_delay:
            key = 'hv,{},{},{}'.format(feature, mba_str, max_mask_str)
            ERR_LIST[key] = "{} should be in range[0,{}]".format(
                max_mask_str, mba_delay_str)
            return
def vcpu_clos_check(cpus_per_vm, clos_per_vm, prime_item, item):

    if not board_cfg_lib.is_rdt_enabled():
        return

    common_clos_max = board_cfg_lib.get_common_clos_max()

    for vm_i, vcpus in cpus_per_vm.items():
        clos_per_vm_len = 0
        if vm_i in clos_per_vm:
            clos_per_vm_len = len(clos_per_vm[vm_i])

        if clos_per_vm_len != len(vcpus):
            key = "vm:id={},{},{}".format(vm_i, prime_item, item)
            ERR_LIST[
                key] = "'vcpu_clos' number should be equal 'pcpu_id' number for VM{}".format(
                    vm_i)
            return

        if board_cfg_lib.is_cdp_enabled() and common_clos_max != 0:
            for clos_val in clos_per_vm[vm_i]:
                if not clos_val or clos_val == None:
                    key = "vm:id={},{},{}".format(vm_i, prime_item, item)
                    ERR_LIST[key] = "'vcpu_clos' should be not None"
                    return

                if int(clos_val) >= common_clos_max:
                    key = "vm:id={},{},{}".format(vm_i, prime_item, item)
                    ERR_LIST[
                        key] = "CDP_ENABLED=y, the clos value should not be greater than {} for VM{}".format(
                            common_clos_max - 1, vm_i)
                    return
示例#3
0
def cat_max_mask_check(cat_mask_list, feature, cat_str, max_mask_str):

    (res_info, rdt_res_clos_max, clos_max_mask_list) = board_cfg_lib.clos_info_parser(common.BOARD_INFO_FILE)
    if not board_cfg_lib.is_rdt_enabled() or ("L2" not in res_info and "L3" not in res_info):
        return

    if board_cfg_lib.is_cdp_enabled():
        clos_max_set_entry = 2 * board_cfg_lib.get_common_clos_max()
    else:
        clos_max_set_entry = board_cfg_lib.get_common_clos_max()

    cat_max_mask_settings_len = len(cat_mask_list)
    if clos_max_set_entry != cat_max_mask_settings_len:
        key = 'hv,{},{},{}'.format(feature, cat_str, max_mask_str)
        ERR_LIST[key] = "Number of Cache mask entries should be equal to MAX_CACHE_CLOS_NUM_ENTRIES={}".format(clos_max_set_entry)
        return

    clos_max_mask_str = clos_max_mask_list[0].strip('"').strip("'")
    clos_max_mask = common.num2int(clos_max_mask_str)
    for val_str in cat_mask_list:
        if empty_check(val_str, feature, cat_str, max_mask_str):
            return
        value = common.num2int(val_str)
        if value < 0 or value > clos_max_mask:
            key = 'hv,{},{},{}'.format(feature, cat_str, max_mask_str)
            ERR_LIST[key] = "{} should be in range[0,{}]".format(max_mask_str, clos_max_mask_str)
            return

        if not is_contiguous_bit_set(value):
            key = 'hv,{},{},{}'.format(feature, cat_str, max_mask_str)
            ERR_LIST[key] = "CLOS_MASK {} should be contiguous bit set.".format(max_mask_str, clos_max_mask_str)
            return