예제 #1
0
int
pqos_mon_start_pid(const pid_t pid,
                   const enum pqos_mon_event event,
                   void *context,
                   struct pqos_mon_data *group)
{
    /**
     * Check params
     */
    if (group == NULL || event == 0 || pid < 0)
        return PQOS_RETVAL_PARAM;
#ifdef PQOS_NO_PID_API
    UNUSED_PARAM(context);
    LOG_ERROR("PID monitoring API not built\n");
    return PQOS_RETVAL_ERROR;
#else
    int ret = PQOS_RETVAL_OK;

    _pqos_api_lock();
    ret = _pqos_check_init(1);
    if (ret != PQOS_RETVAL_OK) {
        _pqos_api_unlock();
        return ret;
    }
    group->event = event;
    group->pid = pid;
    group->context = context;

    ret = pqos_pid_start(group);
    _pqos_api_unlock();

    return ret;
#endif /* PQOS_NO_PID_API */
}
예제 #2
0
파일: api.c 프로젝트: 01org/intel-cmt-cat
int
pqos_mba_get(const unsigned socket,
             const unsigned max_num_cos,
             unsigned *num_cos,
             struct pqos_mba *mba_tab)
{
	int ret;

	if (num_cos == NULL || mba_tab == NULL || max_num_cos == 0)
		return PQOS_RETVAL_PARAM;

	_pqos_api_lock();

        ret = _pqos_check_init(1);
        if (ret != PQOS_RETVAL_OK) {
                _pqos_api_unlock();
                return ret;
        }

        if (m_interface == PQOS_INTER_MSR)
                ret = hw_mba_get(socket, max_num_cos, num_cos, mba_tab);
        else {
#ifdef __linux__
                ret = os_mba_get(socket, max_num_cos, num_cos, mba_tab);
#else
                LOG_INFO("OS interface not supported!\n");
                ret = PQOS_RETVAL_RESOURCE;
#endif
        }

	_pqos_api_unlock();

	return ret;
}
예제 #3
0
파일: api.c 프로젝트: 01org/intel-cmt-cat
int
pqos_l2ca_get(const unsigned l2id,
              const unsigned max_num_ca,
              unsigned *num_ca,
              struct pqos_l2ca *ca)
{
	int ret;

	if (num_ca == NULL || ca == NULL || max_num_ca == 0)
		return PQOS_RETVAL_PARAM;

	_pqos_api_lock();

	ret = _pqos_check_init(1);
	if (ret != PQOS_RETVAL_OK) {
		_pqos_api_unlock();
		return ret;
	}

	if (m_interface == PQOS_INTER_MSR)
		ret = hw_l2ca_get(l2id, max_num_ca, num_ca, ca);
	else {
#ifdef __linux__
		ret = os_l2ca_get(l2id, max_num_ca, num_ca, ca);
#else
                LOG_INFO("OS interface not supported!\n");
                ret = PQOS_RETVAL_RESOURCE;
#endif
        }
	_pqos_api_unlock();

	return ret;
}
예제 #4
0
파일: api.c 프로젝트: 01org/intel-cmt-cat
int
pqos_l2ca_get_min_cbm_bits(unsigned *min_cbm_bits)
{
	int ret;

	if (min_cbm_bits == NULL)
		return PQOS_RETVAL_PARAM;

	_pqos_api_lock();

	ret = _pqos_check_init(1);
	if (ret != PQOS_RETVAL_OK) {
		_pqos_api_unlock();
		return ret;
	}

	if (m_interface == PQOS_INTER_MSR)
                ret = hw_l2ca_get_min_cbm_bits(min_cbm_bits);
	else {
#ifdef __linux__
		ret = os_l2ca_get_min_cbm_bits(min_cbm_bits);
#else
                LOG_INFO("OS interface not supported!\n");
                ret = PQOS_RETVAL_RESOURCE;
#endif
	}

	_pqos_api_unlock();

	return ret;
}
예제 #5
0
파일: api.c 프로젝트: 01org/intel-cmt-cat
/*
 * =======================================
 * Allocation Technology
 * =======================================
 */
int
pqos_alloc_assoc_set(const unsigned lcore,
                     const unsigned class_id)
{
	int ret;

	_pqos_api_lock();

        ret = _pqos_check_init(1);
        if (ret != PQOS_RETVAL_OK) {
                _pqos_api_unlock();
                return ret;
        }

	if (m_interface == PQOS_INTER_MSR)
		ret = hw_alloc_assoc_set(lcore, class_id);
	else {
#ifdef __linux__
		ret = os_alloc_assoc_set(lcore, class_id);
#else
                LOG_INFO("OS interface not supported!\n");
                ret = PQOS_RETVAL_RESOURCE;
#endif
        }
	_pqos_api_unlock();

	return ret;
}
예제 #6
0
파일: api.c 프로젝트: 01org/intel-cmt-cat
int
pqos_mon_stop(struct pqos_mon_data *group)
{
        int ret;

        if (group == NULL)
                return PQOS_RETVAL_PARAM;

        if (group->valid != GROUP_VALID_MARKER)
                return PQOS_RETVAL_PARAM;

        _pqos_api_lock();

        ret = _pqos_check_init(1);
        if (ret != PQOS_RETVAL_OK) {
                _pqos_api_unlock();
                return ret;
        }

        if (m_interface == PQOS_INTER_MSR)
                ret = hw_mon_stop(group);
        else {
#ifdef __linux__
                ret = os_mon_stop(group);
#else
                LOG_INFO("OS interface not supported!\n");
                ret = PQOS_RETVAL_RESOURCE;
#endif
        }
        _pqos_api_unlock();

        return ret;
}
예제 #7
0
파일: api.c 프로젝트: 01org/intel-cmt-cat
int
pqos_alloc_release(const unsigned *core_array,
                   const unsigned core_num)
{
	int ret;

        if (core_num == 0 || core_array == NULL)
                return PQOS_RETVAL_PARAM;

	_pqos_api_lock();

        ret = _pqos_check_init(1);
        if (ret != PQOS_RETVAL_OK) {
                _pqos_api_unlock();
                return ret;
        }

        if (m_interface == PQOS_INTER_MSR)
                ret = hw_alloc_release(core_array, core_num);
        else {
#ifdef __linux__
                ret = os_alloc_release(core_array, core_num);
#else
                LOG_INFO("OS interface not supported!\n");
                ret = PQOS_RETVAL_RESOURCE;
#endif
        }
	_pqos_api_unlock();

	return ret;
}
예제 #8
0
파일: api.c 프로젝트: 01org/intel-cmt-cat
int
pqos_alloc_release_pid(const pid_t *task_array,
                       const unsigned task_num)
{
        int ret;

        if (task_array == NULL || task_num == 0)
                return PQOS_RETVAL_PARAM;

	_pqos_api_lock();

        ret = _pqos_check_init(1);
        if (ret != PQOS_RETVAL_OK) {
                _pqos_api_unlock();
                return ret;
        }

        if (m_interface != PQOS_INTER_OS &&
                m_interface != PQOS_INTER_OS_RESCTRL_MON) {
                LOG_ERROR("Incompatible interface "
                          "selected for task association!\n");
                _pqos_api_unlock();
                return PQOS_RETVAL_ERROR;
        }

#ifdef __linux__
        ret = os_alloc_release_pid(task_array, task_num);
#else
        LOG_INFO("OS interface not supported!\n");
        ret = PQOS_RETVAL_RESOURCE;
#endif
	_pqos_api_unlock();

	return ret;
}
예제 #9
0
파일: api.c 프로젝트: 01org/intel-cmt-cat
int
pqos_mon_start_pids(const unsigned num_pids,
                    const pid_t *pids,
                    const enum pqos_mon_event event,
                    void *context,
                    struct pqos_mon_data *group)
{
        int ret;

        if (num_pids == 0 || pids == NULL || group == NULL || event == 0)
                return PQOS_RETVAL_PARAM;

        if (group->valid == GROUP_VALID_MARKER)
                return PQOS_RETVAL_PARAM;

        if (m_interface != PQOS_INTER_OS &&
                m_interface != PQOS_INTER_OS_RESCTRL_MON) {
                LOG_ERROR("Incompatible interface "
                          "selected for task monitoring!\n");
                return PQOS_RETVAL_ERROR;
        }

        /**
         * Validate event parameter
         * - only combinations of events allowed
         * - do not allow non-PQoS events to be monitored on its own
         */
        if (event & (~(PQOS_MON_EVENT_L3_OCCUP | PQOS_MON_EVENT_LMEM_BW |
                       PQOS_MON_EVENT_TMEM_BW | PQOS_MON_EVENT_RMEM_BW |
                       PQOS_PERF_EVENT_IPC | PQOS_PERF_EVENT_LLC_MISS)))
                return PQOS_RETVAL_PARAM;

        if ((event & (PQOS_MON_EVENT_L3_OCCUP | PQOS_MON_EVENT_LMEM_BW |
                      PQOS_MON_EVENT_TMEM_BW | PQOS_MON_EVENT_RMEM_BW)) == 0 &&
            (event & (PQOS_PERF_EVENT_IPC | PQOS_PERF_EVENT_LLC_MISS)) != 0)
                return PQOS_RETVAL_PARAM;

        _pqos_api_lock();

        ret = _pqos_check_init(1);
        if (ret != PQOS_RETVAL_OK) {
                _pqos_api_unlock();
                return ret;
        }

#ifdef __linux__
        ret = os_mon_start_pids(num_pids, pids, event, context, group);
#else
        UNUSED_PARAM(context);
        LOG_INFO("OS interface not supported!\n");
        ret = PQOS_RETVAL_RESOURCE;
#endif

        if (ret == PQOS_RETVAL_OK)
                group->valid = GROUP_VALID_MARKER;

        _pqos_api_unlock();

        return ret;
}
예제 #10
0
파일: api.c 프로젝트: 01org/intel-cmt-cat
int
pqos_alloc_assoc_set_pid(const pid_t task,
                         const unsigned class_id)
{
        int ret;

	_pqos_api_lock();

        ret = _pqos_check_init(1);
        if (ret != PQOS_RETVAL_OK) {
                _pqos_api_unlock();
                return ret;
        }

        if (m_interface != PQOS_INTER_OS &&
                m_interface != PQOS_INTER_OS_RESCTRL_MON) {
                LOG_ERROR("Incompatible interface "
                          "selected for task association!\n");
                _pqos_api_unlock();
                return PQOS_RETVAL_ERROR;
        }

#ifdef __linux__
        ret = os_alloc_assoc_set_pid(task, class_id);
#else
        UNUSED_PARAM(task);
        UNUSED_PARAM(class_id);
        LOG_INFO("OS interface not supported!\n");
        ret = PQOS_RETVAL_RESOURCE;
#endif
	_pqos_api_unlock();

	return ret;

}
예제 #11
0
int
pqos_mon_assoc_get(const unsigned lcore,
                   pqos_rmid_t *rmid)
{
    int ret = PQOS_RETVAL_OK;
    unsigned cluster = 0;

    _pqos_api_lock();

    ret = mon_assoc_param_check(lcore, &cluster);
    if (ret != PQOS_RETVAL_OK) {
        _pqos_api_unlock();
        return ret;
    }

    if (rmid == NULL) {
        _pqos_api_unlock();
        return PQOS_RETVAL_PARAM;
    }

    ret = mon_assoc_get(lcore, rmid);

    _pqos_api_unlock();
    return ret;
}
예제 #12
0
파일: api.c 프로젝트: 01org/intel-cmt-cat
int
pqos_mon_reset(void)
{
        int ret;

        _pqos_api_lock();

        ret = _pqos_check_init(1);
        if (ret != PQOS_RETVAL_OK) {
                _pqos_api_unlock();
                return ret;
        }

        if (m_interface == PQOS_INTER_MSR)
                ret = hw_mon_reset();
        else {
#ifdef __linux__
                ret = os_mon_reset();
#else
                LOG_INFO("OS interface not supported!\n");
                ret = PQOS_RETVAL_RESOURCE;
#endif
        }

        _pqos_api_unlock();

        return ret;
}
예제 #13
0
파일: api.c 프로젝트: 01org/intel-cmt-cat
int
pqos_mon_assoc_get(const unsigned lcore,
                   pqos_rmid_t *rmid)
{
        int ret;

        _pqos_api_lock();

        ret = _pqos_check_init(1);
        if (ret != PQOS_RETVAL_OK) {
                _pqos_api_unlock();
                return ret;
        }

        if (m_interface == PQOS_INTER_MSR)
                ret = hw_mon_assoc_get(lcore, rmid);
        else {
                LOG_INFO("OS interface not supported!\n");
                ret = PQOS_RETVAL_RESOURCE;
        }

        _pqos_api_unlock();

        return ret;
}
예제 #14
0
파일: api.c 프로젝트: 01org/intel-cmt-cat
int
pqos_mon_start(const unsigned num_cores,
               const unsigned *cores,
               const enum pqos_mon_event event,
               void *context,
               struct pqos_mon_data *group)
{
        int ret;

        if (group == NULL || cores == NULL || num_cores == 0 || event == 0)
                return PQOS_RETVAL_PARAM;

        if (group->valid == GROUP_VALID_MARKER)
                return PQOS_RETVAL_PARAM;

        /**
         * Validate event parameter
         * - only combinations of events allowed
         * - do not allow non-PQoS events to be monitored on its own
         */
        if (event & (~(PQOS_MON_EVENT_L3_OCCUP | PQOS_MON_EVENT_LMEM_BW |
                       PQOS_MON_EVENT_TMEM_BW | PQOS_MON_EVENT_RMEM_BW |
                       PQOS_PERF_EVENT_IPC | PQOS_PERF_EVENT_LLC_MISS)))
                return PQOS_RETVAL_PARAM;

        if ((event & (PQOS_MON_EVENT_L3_OCCUP | PQOS_MON_EVENT_LMEM_BW |
                      PQOS_MON_EVENT_TMEM_BW | PQOS_MON_EVENT_RMEM_BW)) == 0 &&
            (event & (PQOS_PERF_EVENT_IPC | PQOS_PERF_EVENT_LLC_MISS)) != 0)
                return PQOS_RETVAL_PARAM;

        _pqos_api_lock();

        ret = _pqos_check_init(1);
        if (ret != PQOS_RETVAL_OK) {
                _pqos_api_unlock();
                return ret;
        }

        if (m_interface == PQOS_INTER_MSR)
                ret = hw_mon_start(num_cores, cores, event, context, group);
        else {
#ifdef __linux__
                ret = os_mon_start(num_cores, cores, event, context, group);
#else
                LOG_INFO("OS interface not supported!\n");
                ret = PQOS_RETVAL_RESOURCE;
#endif
        }
        if (ret == PQOS_RETVAL_OK)
                group->valid = GROUP_VALID_MARKER;

        _pqos_api_unlock();

        return ret;
}
예제 #15
0
파일: api.c 프로젝트: 01org/intel-cmt-cat
int
pqos_l3ca_set(const unsigned socket,
              const unsigned num_cos,
              const struct pqos_l3ca *ca)
{
	int ret;
	unsigned i;

	if (ca == NULL || num_cos == 0)
		return PQOS_RETVAL_PARAM;

	_pqos_api_lock();

        ret = _pqos_check_init(1);
        if (ret != PQOS_RETVAL_OK) {
                _pqos_api_unlock();
                return ret;
        }

	/**
	 * Check if class bitmasks are contiguous.
	 */
	for (i = 0; i < num_cos; i++) {
		int is_contig = 0;

		if (ca[i].cdp) {
			is_contig = is_contiguous(ca[i].u.s.data_mask) &&
				is_contiguous(ca[i].u.s.code_mask);
		} else
			is_contig = is_contiguous(ca[i].u.ways_mask);

		if (!is_contig) {
			LOG_ERROR("L3 COS%u bit mask is not contiguous!\n",
			          ca[i].class_id);
			_pqos_api_unlock();
			return PQOS_RETVAL_PARAM;
		}
	}

	if (m_interface == PQOS_INTER_MSR)
		ret = hw_l3ca_set(socket, num_cos, ca);
	else {
#ifdef __linux__
		ret = os_l3ca_set(socket, num_cos, ca);
#else
                LOG_INFO("OS interface not supported!\n");
                ret = PQOS_RETVAL_RESOURCE;
#endif
        }
	_pqos_api_unlock();

	return ret;
}
예제 #16
0
파일: api.c 프로젝트: 01org/intel-cmt-cat
int
pqos_alloc_reset(const enum pqos_cdp_config l3_cdp_cfg,
                 const enum pqos_cdp_config l2_cdp_cfg,
                 const enum pqos_mba_config mba_cfg)
{
        int ret;

        if (l3_cdp_cfg != PQOS_REQUIRE_CDP_ON &&
            l3_cdp_cfg != PQOS_REQUIRE_CDP_OFF &&
            l3_cdp_cfg != PQOS_REQUIRE_CDP_ANY) {
                LOG_ERROR("Unrecognized L3 CDP configuration setting %d!\n",
                          l3_cdp_cfg);
                return PQOS_RETVAL_PARAM;
        }

        if (l2_cdp_cfg != PQOS_REQUIRE_CDP_ON &&
            l2_cdp_cfg != PQOS_REQUIRE_CDP_OFF &&
            l2_cdp_cfg != PQOS_REQUIRE_CDP_ANY) {
                LOG_ERROR("Unrecognized L2 CDP configuration setting %d!\n",
                          l2_cdp_cfg);
                return PQOS_RETVAL_PARAM;
        }

        if (mba_cfg != PQOS_MBA_ANY &&
            mba_cfg != PQOS_MBA_DEFAULT &&
            mba_cfg != PQOS_MBA_CTRL) {
                LOG_ERROR("Unrecognized MBA configuration setting %d!\n",
                          mba_cfg);
                return PQOS_RETVAL_PARAM;
        }

        _pqos_api_lock();

        ret = _pqos_check_init(1);
        if (ret != PQOS_RETVAL_OK) {
                _pqos_api_unlock();
                return ret;
        }

        if (m_interface == PQOS_INTER_MSR)
                ret = hw_alloc_reset(l3_cdp_cfg, l2_cdp_cfg, mba_cfg);
        else {
#ifdef __linux__
                ret = os_alloc_reset(l3_cdp_cfg, l2_cdp_cfg, mba_cfg);
#else
                LOG_INFO("OS interface not supported!\n");
                ret = PQOS_RETVAL_RESOURCE;
#endif
        }
	_pqos_api_unlock();

	return ret;
}
예제 #17
0
int
pqos_mon_poll(struct pqos_mon_data **groups,
              const unsigned num_groups)
{
    int ret = PQOS_RETVAL_OK;
    unsigned i = 0;

    ASSERT(groups != NULL);
    ASSERT(num_groups > 0);
    if (groups == NULL || num_groups == 0 || *groups == NULL)
        return PQOS_RETVAL_PARAM;

    for (i = 0; i < num_groups; i++) {
        if (groups[i] == NULL)
            return PQOS_RETVAL_PARAM;
    }
    _pqos_api_lock();

    ret = _pqos_check_init(1);
    if (ret != PQOS_RETVAL_OK) {
        _pqos_api_unlock();
        return ret;
    }

    for (i = 0; i < num_groups; i++) {
        /**
             * If monitoring PID then read
             * counter values
             */
        if (groups[i]->pid > 0) {
#ifdef PQOS_NO_PID_API
            LOG_ERROR("PID monitoring API not built\n");
            _pqos_api_unlock();
            return PQOS_RETVAL_ERROR;
#else
            ret = pqos_pid_poll(groups[i]);
            if (ret != PQOS_RETVAL_OK)
                LOG_WARN("Failed to read event values "
                         "for PID %u!\n", groups[i]->pid);
#endif /* PQOS_NO_PID_API */
        } else {
            ret = pqos_core_poll(groups[i]);
            if (ret != PQOS_RETVAL_OK)
                LOG_WARN("Failed to read event on "
                         "core %u\n", groups[i]->cores[0]);
        }
    }

    _pqos_api_unlock();
    return PQOS_RETVAL_OK;
}
예제 #18
0
int
pqos_alloc_assoc_get(const unsigned lcore,
                     unsigned *class_id)
{
        const struct pqos_capability *l3_cap = NULL;
        const struct pqos_capability *l2_cap = NULL;
        int ret = PQOS_RETVAL_OK;
        const uint32_t reg = PQOS_MSR_ASSOC;
        uint64_t val = 0;

        _pqos_api_lock();

        ret = _pqos_check_init(1);
        if (ret != PQOS_RETVAL_OK) {
                _pqos_api_unlock();
                return ret;
        }

        if (class_id == NULL) {
                _pqos_api_unlock();
                return PQOS_RETVAL_PARAM;
        }

        ASSERT(m_cpu != NULL);
        ret = pqos_cpu_check_core(m_cpu, lcore);
        if (ret != PQOS_RETVAL_OK) {
                _pqos_api_unlock();
                return PQOS_RETVAL_PARAM;
        }

        ASSERT(m_cap != NULL);
        ret = pqos_cap_get_type(m_cap, PQOS_CAP_TYPE_L3CA, &l3_cap);
        if (ret != PQOS_RETVAL_OK && ret != PQOS_RETVAL_RESOURCE) {
                _pqos_api_unlock();
                return ret;
        }

        ret = pqos_cap_get_type(m_cap, PQOS_CAP_TYPE_L2CA, &l2_cap);
        if (ret != PQOS_RETVAL_OK && ret != PQOS_RETVAL_RESOURCE) {
                _pqos_api_unlock();
                return ret;
        }

        if (l2_cap == NULL && l3_cap == NULL) {
                /* no L2/L3 CAT detected */
                _pqos_api_unlock();
                return PQOS_RETVAL_RESOURCE;
        }

        if (msr_read(lcore, reg, &val) != MACHINE_RETVAL_OK) {
                _pqos_api_unlock();
                return PQOS_RETVAL_ERROR;
        }

        val >>= PQOS_MSR_ASSOC_QECOS_SHIFT;
        *class_id = (unsigned) val;

        _pqos_api_unlock();
        return PQOS_RETVAL_OK;
}
예제 #19
0
파일: api.c 프로젝트: 01org/intel-cmt-cat
int
pqos_mba_set(const unsigned socket,
             const unsigned num_cos,
             const struct pqos_mba *requested,
             struct pqos_mba *actual)
{
	int ret;
	unsigned i;

	if (requested == NULL || num_cos == 0)
		return PQOS_RETVAL_PARAM;

	/**
	 * Check if MBA rate is within allowed range
	 */
	for (i = 0; i < num_cos; i++)
		if (requested[i].ctrl == 0 &&
		    (requested[i].mb_max == 0 || requested[i].mb_max > 100)) {
			LOG_ERROR("MBA COS%u rate out of range (from 1-100)!\n",
			          requested[i].class_id);
			return PQOS_RETVAL_PARAM;
		}

	_pqos_api_lock();

        ret = _pqos_check_init(1);
        if (ret != PQOS_RETVAL_OK) {
                _pqos_api_unlock();
                return ret;
        }

        if (m_interface == PQOS_INTER_MSR)
                ret = hw_mba_set(socket, num_cos, requested, actual);
        else {
#ifdef __linux__
                ret = os_mba_set(socket, num_cos, requested, actual);
#else
                LOG_INFO("OS interface not supported!\n");
                ret = PQOS_RETVAL_RESOURCE;
#endif
        }

	_pqos_api_unlock();

	return ret;

}
예제 #20
0
int pqos_alloc_reset(const enum pqos_cdp_config l3_cdp_cfg)
{
	int ret;

	_pqos_api_lock();

        ret = _pqos_check_init(1);
        if (ret != PQOS_RETVAL_OK) {
                _pqos_api_unlock();
                return ret;
        }

	ret = hw_alloc_reset(l3_cdp_cfg);

	_pqos_api_unlock();

	return ret;
}
예제 #21
0
int pqos_alloc_assoc_get(const unsigned lcore,
                         unsigned *class_id)
{
	int ret;

	_pqos_api_lock();

        ret = _pqos_check_init(1);
        if (ret != PQOS_RETVAL_OK) {
                _pqos_api_unlock();
                return ret;
        }

	ret = hw_alloc_assoc_get(lcore, class_id);

	_pqos_api_unlock();

	return ret;
}
예제 #22
0
int pqos_alloc_release(const unsigned *core_array,
                       const unsigned core_num)
{
	int ret;

	_pqos_api_lock();

        ret = _pqos_check_init(1);
        if (ret != PQOS_RETVAL_OK) {
                _pqos_api_unlock();
                return ret;
        }

	ret = hw_alloc_release(core_array, core_num);

	_pqos_api_unlock();

	return ret;
}
예제 #23
0
int pqos_l2ca_set(const unsigned l2id,
                  const unsigned num_cos,
                  const struct pqos_l2ca *ca)
{
	int ret;

	_pqos_api_lock();

        ret = _pqos_check_init(1);
        if (ret != PQOS_RETVAL_OK) {
                _pqos_api_unlock();
                return ret;
        }

	ret = hw_l2ca_set(l2id, num_cos, ca);

	_pqos_api_unlock();

	return ret;
}
예제 #24
0
int pqos_alloc_assign(const unsigned technology,
                      const unsigned *core_array,
                      const unsigned core_num,
                      unsigned *class_id)
{
	int ret;

	_pqos_api_lock();

        ret = _pqos_check_init(1);
        if (ret != PQOS_RETVAL_OK) {
                _pqos_api_unlock();
                return ret;
        }

	ret = hw_alloc_assign(technology, core_array, core_num, class_id);

	_pqos_api_unlock();

	return ret;
}
예제 #25
0
int pqos_mba_get(const unsigned socket,
                 const unsigned max_num_cos,
                 unsigned *num_cos,
                 struct pqos_mba *mba_tab)
{
	int ret;

	_pqos_api_lock();

        ret = _pqos_check_init(1);
        if (ret != PQOS_RETVAL_OK) {
                _pqos_api_unlock();
                return ret;
        }

	ret = hw_mba_get(socket, max_num_cos, num_cos, mba_tab);

	_pqos_api_unlock();

	return ret;
}
예제 #26
0
int pqos_l2ca_get(const unsigned l2id,
                  const unsigned max_num_ca,
                  unsigned *num_ca,
                  struct pqos_l2ca *ca)
{
	int ret;

	_pqos_api_lock();

        ret = _pqos_check_init(1);
        if (ret != PQOS_RETVAL_OK) {
                _pqos_api_unlock();
                return ret;
        }

	ret = hw_l2ca_get(l2id, max_num_ca, num_ca, ca);

	_pqos_api_unlock();

	return ret;
}
예제 #27
0
int pqos_mba_set(const unsigned socket,
                 const unsigned num_cos,
                 const struct pqos_mba *requested,
                 struct pqos_mba *actual)
{
	int ret;

	_pqos_api_lock();

        ret = _pqos_check_init(1);
        if (ret != PQOS_RETVAL_OK) {
                _pqos_api_unlock();
                return ret;
        }

	ret = hw_mba_set(socket, num_cos, requested, actual);

	_pqos_api_unlock();

	return ret;

}
예제 #28
0
파일: api.c 프로젝트: 01org/intel-cmt-cat
int
pqos_mon_poll(struct pqos_mon_data **groups,
              const unsigned num_groups)
{
        int ret;
        unsigned i;

        if (groups == NULL || num_groups == 0 || *groups == NULL)
                return PQOS_RETVAL_PARAM;

        for (i = 0; i < num_groups; i++) {
                if (groups[i] == NULL)
                        return PQOS_RETVAL_PARAM;
                if (groups[i]->valid != GROUP_VALID_MARKER)
                        return PQOS_RETVAL_PARAM;
        }

        _pqos_api_lock();

        ret = _pqos_check_init(1);
        if (ret != PQOS_RETVAL_OK) {
                _pqos_api_unlock();
                return ret;
        }

        if (m_interface == PQOS_INTER_MSR)
                ret = hw_mon_poll(groups, num_groups);
        else {
#ifdef __linux__
                ret = os_mon_poll(groups, num_groups);
#else
                LOG_INFO("OS interface not supported!\n");
                ret = PQOS_RETVAL_RESOURCE;
#endif
        }
        _pqos_api_unlock();

        return ret;
}
예제 #29
0
파일: api.c 프로젝트: 01org/intel-cmt-cat
int pqos_mon_remove_pids(const unsigned num_pids,
                         const pid_t *pids,
                         struct pqos_mon_data *group)
{
        int ret;

        if (num_pids == 0 || pids == NULL || group == NULL)
                return PQOS_RETVAL_PARAM;

        if (group->valid != GROUP_VALID_MARKER)
                return PQOS_RETVAL_PARAM;

        if (m_interface != PQOS_INTER_OS &&
                m_interface != PQOS_INTER_OS_RESCTRL_MON) {
                LOG_ERROR("Incompatible interface "
                          "selected for task monitoring!\n");
                return PQOS_RETVAL_ERROR;
        }

        _pqos_api_lock();

        ret = _pqos_check_init(1);
        if (ret != PQOS_RETVAL_OK) {
                _pqos_api_unlock();
                return ret;
        }

#ifdef __linux__
        ret = os_mon_remove_pids(num_pids, pids, group);
#else
        LOG_INFO("OS interface not supported!\n");
        ret = PQOS_RETVAL_RESOURCE;
#endif

        _pqos_api_unlock();

        return ret;
}
예제 #30
0
파일: api.c 프로젝트: 01org/intel-cmt-cat
int
pqos_alloc_assign(const unsigned technology,
                  const unsigned *core_array,
                  const unsigned core_num,
                  unsigned *class_id)
{
	int ret;
	const int l2_req = ((technology & (1 << PQOS_CAP_TYPE_L2CA)) != 0);
	const int l3_req = ((technology & (1 << PQOS_CAP_TYPE_L3CA)) != 0);
	const int mba_req = ((technology & (1 << PQOS_CAP_TYPE_MBA)) != 0);

        if (core_num == 0 || core_array == NULL || class_id == NULL ||
            !(l2_req || l3_req || mba_req))
                return PQOS_RETVAL_PARAM;

	_pqos_api_lock();

        ret = _pqos_check_init(1);
        if (ret != PQOS_RETVAL_OK) {
                _pqos_api_unlock();
                return ret;
        }
        if (m_interface == PQOS_INTER_MSR)
                ret = hw_alloc_assign(technology, core_array,
                        core_num, class_id);
        else {
#ifdef __linux__
                ret = os_alloc_assign(technology, core_array, core_num,
		                      class_id);
#else
                LOG_INFO("OS interface not supported!\n");
                ret = PQOS_RETVAL_RESOURCE;
#endif
        }
	_pqos_api_unlock();

        return ret;
}