Add rsmi_topo_get_numa_affinity()
Given a device index, return the corresponding NUMA node for the device. Also, add NUMA node tests to Sys Info Read test. Change-Id: I0df4937470e6362e6737ccea568d4b3e5890c91a
Bu işleme şunda yer alıyor:
@@ -1166,6 +1166,30 @@ rsmi_dev_pci_bandwidth_get(uint32_t dv_ind, rsmi_pcie_bandwidth_t *bandwidth);
|
||||
*/
|
||||
rsmi_status_t rsmi_dev_pci_id_get(uint32_t dv_ind, uint64_t *bdfid);
|
||||
|
||||
/**
|
||||
* @brief Get the NUMA node associated with a device
|
||||
*
|
||||
* @details Given a device index @p dv_ind and a pointer to a uint32_t @p
|
||||
* numa_node, this function will retrieve the NUMA node value associated
|
||||
* with device @p dv_ind and store the value at location pointed to by
|
||||
* @p numa_node.
|
||||
*
|
||||
* @param[in] dv_ind a device index
|
||||
*
|
||||
* @param[inout] numa_node pointer to location where NUMA node value will
|
||||
* be written.
|
||||
* If this parameter is nullptr, this function will return
|
||||
* ::RSMI_STATUS_INVALID_ARGS if the function is supported with the provided,
|
||||
* arguments and ::RSMI_STATUS_NOT_SUPPORTED if it is not supported with the
|
||||
* provided arguments.
|
||||
*
|
||||
* @retval ::RSMI_STATUS_SUCCESS call was successful
|
||||
* @retval ::RSMI_STATUS_NOT_SUPPORTED installed software or hardware does not
|
||||
* support this function with the given arguments
|
||||
* @retval ::RSMI_STATUS_INVALID_ARGS the provided arguments are not valid
|
||||
*/
|
||||
rsmi_status_t rsmi_topo_numa_affinity_get(uint32_t dv_ind, uint32_t *numa_node);
|
||||
|
||||
/**
|
||||
* @brief Get PCIe traffic information
|
||||
*
|
||||
|
||||
@@ -154,6 +154,7 @@ enum DevInfoTypes {
|
||||
kDevFwVersionVcn,
|
||||
kDevSerialNumber,
|
||||
kDevMemPageBad,
|
||||
kDevNumaNode
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -729,6 +729,22 @@ rsmi_dev_pci_id_get(uint32_t dv_ind, uint64_t *bdfid) {
|
||||
CATCH
|
||||
}
|
||||
|
||||
rsmi_status_t
|
||||
rsmi_topo_numa_affinity_get(uint32_t dv_ind, uint32_t *numa_node) {
|
||||
TRY
|
||||
rsmi_status_t ret;
|
||||
uint64_t val = 0;
|
||||
|
||||
CHK_SUPPORT_NAME_ONLY(numa_node)
|
||||
|
||||
DEVICE_MUTEX
|
||||
ret = get_dev_value_int(amd::smi::kDevNumaNode, dv_ind, &val);
|
||||
|
||||
*numa_node = static_cast<uint32_t>(val);
|
||||
return ret;
|
||||
CATCH
|
||||
}
|
||||
|
||||
static rsmi_status_t
|
||||
get_id(uint32_t dv_ind, amd::smi::DevInfoTypes typ, uint16_t *id) {
|
||||
TRY
|
||||
|
||||
@@ -108,6 +108,7 @@ static const char *kDevDFCountersAvailableFName = "df_cntr_avail";
|
||||
static const char *kDevMemBusyPercentFName = "mem_busy_percent";
|
||||
static const char *kDevXGMIErrorFName = "xgmi_error";
|
||||
static const char *kDevSerialNumberFName = "serial_number";
|
||||
static const char *kDevNumaNodeFName = "numa_node";
|
||||
|
||||
// Firmware version files
|
||||
static const char *kDevFwVersionAsdFName = "fw_version/asd_fw_version";
|
||||
@@ -266,6 +267,7 @@ static const std::map<DevInfoTypes, const char *> kDevAttribNameMap = {
|
||||
{kDevFwVersionVcn, kDevFwVersionVcnFName},
|
||||
{kDevSerialNumber, kDevSerialNumberFName},
|
||||
{kDevMemPageBad, kDevMemPageBadFName},
|
||||
{kDevNumaNode, kDevNumaNodeFName},
|
||||
};
|
||||
|
||||
static const std::map<rsmi_dev_perf_level, const char *> kDevPerfLvlMap = {
|
||||
@@ -373,6 +375,7 @@ static const std::map<const char *, dev_depends_t> kDevFuncDependsMap = {
|
||||
{"rsmi_dev_xgmi_error_status", {{kDevXGMIErrorFName}, {}}},
|
||||
{"rsmi_dev_xgmi_error_reset", {{kDevXGMIErrorFName}, {}}},
|
||||
{"rsmi_dev_memory_reserved_pages_get", {{kDevMemPageBadFName}, {}}},
|
||||
{"rsmi_topo_numa_affinity_get", {{kDevNumaNodeFName}, {}}},
|
||||
|
||||
// These functions with variants, but no sensors/units. (May or may not
|
||||
// have mandatory dependencies.)
|
||||
@@ -683,6 +686,7 @@ int Device::readDevInfo(DevInfoTypes type, uint64_t *val) {
|
||||
case kDevDFCountersAvailable:
|
||||
case kDevMemBusyPercent:
|
||||
case kDevXGMIError:
|
||||
case kDevNumaNode:
|
||||
ret = readDevInfoStr(type, &tempStr);
|
||||
RET_IF_NONZERO(ret);
|
||||
if (tempStr == "") {
|
||||
|
||||
@@ -89,6 +89,7 @@ void TestSysInfoRead::Close() {
|
||||
void TestSysInfoRead::Run(void) {
|
||||
rsmi_status_t err;
|
||||
uint64_t val_ui64;
|
||||
uint32_t val_ui32;
|
||||
char buffer[80];
|
||||
rsmi_version_t ver = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, nullptr};
|
||||
|
||||
@@ -135,6 +136,16 @@ void TestSysInfoRead::Run(void) {
|
||||
err = rsmi_dev_pci_id_get(i, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
|
||||
err = rsmi_topo_numa_affinity_get(i, &val_ui32);
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**NUMA NODE: 0x" << std::hex << val_ui32;
|
||||
std::cout << " (" << std::dec << val_ui32 << ")" << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_topo_numa_affinity_get(i, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
|
||||
err = rsmi_dev_unique_id_get(i, &val_ui64);
|
||||
if (err == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout <<
|
||||
|
||||
Yeni konuda referans
Bir kullanıcı engelle