Граф коммитов

504 Коммитов

Автор SHA1 Сообщение Дата
Hao Zhou 230b5bcee3 Merge amd-staging into amd-master 20230323
Signed-off-by: Hao Zhou <Hao.Zhou@amd.com>
Change-Id: I2155fa727d4a2a46cbeca3e65f6ae2d9c31c91a5
2023-03-23 17:11:34 +08:00
AravindanC 778f3b7fdc SWDEV-351540 - ASAN packaging for rocm_smi_lib
Change-Id: Iab354d02d261a0270a3d118b825835fc6f021c15
2023-03-20 13:14:53 -07:00
Charis Poag f44d1ea8bc [SWDEV-387906] Fix rocm-smi initialize crash
Fix was needed due to hwmon updates.
Several voltage sensors (ex. vddgfx/vddnb)
are unsupported or not applicable
to upcoming hardware. This was not the case
for previous hardware sensors, resulting in
the rocm-smi crash observed.

Change-Id: Ib8593e10811638def26fc7a1eda29309e328db09
Signed-off-by: Charis Poag <Charis.Poag@amd.com>
2023-03-17 15:04:34 -05:00
Hao Zhou 74c96dbbff Merge amd-staging into amd-master 20230317
Signed-off-by: Hao Zhou <Hao.Zhou@amd.com>
Change-Id: Iad8075d8aae2e0577dd6a36ce789d4f07741a448
2023-03-17 11:20:57 +08:00
Bill(Shuzhou) Liu 1b7eb4e1f4 Fix cppcheck static analysis report warning
Fix some warning from static anaysis tool.

Change-Id: I7e8c2f5d6f79aff5fdcad81b1fd832900f213c47
2023-03-13 09:27:19 -05:00
Ranjith Ramakrishnan 14b86107a7 SWDEV-366831 - Compile time flag to switch between #warning and #error message
Using backward compatibility paths will provide an #error message. Compile time option added to enable/disable the #error message.
Disabling the same will provide a #warning message

Change-Id: Ib49633501aa6eb6d97158b1ecfc47de6f18fba85
2023-03-10 08:56:45 -08:00
Hao Zhou 68ca36e43c Merge amd-staging into amd-master 20230307
Signed-off-by: Hao Zhou <Hao.Zhou@amd.com>
Change-Id: Iec37aa680c552f98eca97279e0b7d99475a7795e
2023-03-07 10:00:44 +08:00
Bill(Shuzhou) Liu 710649ab66 Filter out the GPUs not assigned to a container in showpid
The process ids of other container are still visible in the sysfs file,
filter it out to prevent crash.

Change-Id: I665912cd09c606804186aff8cba5c24f5e58ded7
2023-03-06 11:05:02 -06:00
Charis Poag c252ecccd1 [SWDEV-335697 + SWDEV-342812] Fix NPS & Compute tests
Updates:
    * Fixed rsmi_dev_compute_partition_get
      & rsmi_dev_nps_mode_get to properly check
      for invalid arguments
    * Updated compute partition & NPS mode tests
      - Now properly confirms the invalid
        argument is seen
      - Spacing for multiple devices is added
        to better see distinction between
        separate device's tests (for verbose output)
      - Changed expect to assert calls, so errors
        are observed faster for test failures
      - Fixed multiple device testing where a
        variable should have been unset, but
        having multiple devices caused it to
        set
      - Updated multiple device testing to iterate
        accross all devices (previously returned,
        instead of continuing checking support
        after RSMI_STATUS_NOT_SUPPORTED detected)
      - Fixed a few spelling errors & verbose output

Change-Id: Ieba9e5b46763c6cd880fbf27fcdf58be8ecbc683
Signed-off-by: Charis Poag <Charis.Poag@amd.com>
2023-03-02 13:24:38 -06:00
Hao Zhou c189126be6 Merge amd-staging into amd-master 20230302
Signed-off-by: Hao Zhou <Hao.Zhou@amd.com>
Change-Id: I17c723b907c988754d2da5d04092c1d435e29cc1
2023-03-02 14:13:00 +08:00
Bill(Shuzhou) Liu fcb6afa289 mem_use_pct uninitialized error
Initialize mem_use_pct if the memory info is not available.

Change-Id: Id8e285050149c51077356826c8f99719b473060d
2023-02-27 16:47:45 -06:00
Charis Poag 0d3558945b [SWDEV-335697] Add RSMI_STATUS_SETTING_UNAVAILABLE for dynamic partition
Updates:
    * Added RSMI_STATUS_SETTING_UNAVAILABLE for
      rsmi_dev_compute_partition_set - gives users
      better error output when attempting to set
      compute partition to values not listed in
      available_compute_partition SYSFS
    * Updated python --setcomputepartition to
      provide better output when receiving
      RSMI_STATUS_SETTING_UNAVAILABLE
    * Updated all test & example files to check for
      RSMI_STATUS_SETTING_UNAVAILABLE when doing
      rsmi_dev_compute_partition_set

Change-Id: Ida5d54880d9b9b6e4a0468cdb962fdc0c18d6257
Signed-off-by: Charis Poag <Charis.Poag@amd.com>
2023-02-27 11:17:44 -06:00
Bill(Shuzhou) Liu 55bc2e2072 Memory usage division by zero
The showAllConcise with division by zero error.

Change-Id: I469f1b9f268842cd51662be6f9036f555a8949b2
2023-02-24 10:12:36 -06:00
Hao Zhou d93a307f4b Merge amd-staging into amd-master 20230223
Signed-off-by: Hao Zhou <Hao.Zhou@amd.com>
Change-Id: If82fc6ac361e6ef5a68ae9dfe333dd8685a02fb5
2023-02-23 18:13:38 +08:00
Bill(Shuzhou) Liu b40933b895 Use Unified Changelog Template
The CHANGELOG.md is added to track changes.

Change-Id: I33547cb7f1596b4b8abf206aebdd664649d4d19f
2023-02-21 14:27:55 -06:00
Charis Poag 77c950a4bf [SWDEV-381630] Add reset partition functionality
Updates:
    * Added rsmi_dev_compute_partition_reset & rsmi_dev_nps_mode_reset
    * Added --resetcomputepartition and --resetnpsmode python smi calls
    * Added temp data files rocmsmi_boot_compute_partition_<device num>
      & rocmsmi_boot_nps_mode_partition_<device num>, writes UNKNOWN
      if data cannot be read or device does not support
    * Cleaned up NPS & compute API documentation
    * Added creation and reading of API temp files (used in reset
      functionality)
    * Cleaned up output of rocm_smi_example
    * Updated rocm_smi_example to check if running with sudo permission
      before executing write API calls (cleans up erroneous output)
    * Added template specialization for storing temp data, requires
      specific rsmi_type_t enums (restrics what data can be stored)
    * Added storage of temp data, if temp files do not exist
    * Updated google tests for NPS & compute to include reset API calls

Change-Id: I69895a466b97107617e6dbb355737b84499a76c9
Signed-off-by: Charis Poag <Charis.Poag@amd.com>
2023-02-17 12:55:08 -06:00
Hao Zhou 405dff6b64 Merge amd-staging into amd-master 20230216
Signed-off-by: Hao Zhou <Hao.Zhou@amd.com>
Change-Id: I1a439acaf0208f9bc68ac19753c1df98ea5387ee
2023-02-16 17:04:21 +08:00
Charis Poag 9ef376cd61 SWDEV-342812- Add NPS support
Updates:
    * Added rsmi_dev_nps_mode_set and rsmi_dev_nps_mode_get
    * Added ability to set multiple SYSFS files in debug build
    * Added ability to see user's env variables set for debug build
    * Added tests for rsmi_dev_nps_mode_set and rsmi_dev_nps_mode_get
    * Added ability to restart AMD GPU driver, used in nps_mode_set
    * Updated ROCm_SMI_Manual.pdf to include new APIs
    * Added progress bar for long running python_smi_tools, used
      in setting nps_mode if runs longer than .1 seconds

Change-Id: I6d61bedd28d7cba6aff432ad2d127ba741b7d15a
Signed-off-by: Charis Poag <Charis.Poag@amd.com>
2023-02-14 11:54:24 -06:00
Bill(Shuzhou) Liu ae10e842af rocm-smi --showxgmierr return error instead of error counter values
The rocm-smi pass wrong arguments

Change-Id: I3a3923abdd263d4af87f3ec90670bb16afa2ef9b
2023-02-13 16:36:24 -05:00
Bill(Shuzhou) Liu 00a6c78a51 Dispaly printable device name
Fallback to other methods if the device name in sysfs is not printable.

Change-Id: I20b22950399d4a515d2688b955248a3de3c61d05
2023-02-10 11:32:46 -05:00
Ranjith Ramakrishnan 02141a7f1d SWDEV-366831 - File reorg backward compatibility message changed to #error
Change-Id: I3d3b220b31f42140eab5404df790a130d2c238c4
2023-02-08 14:25:16 -08:00
Hao Zhou c8aace17df Merge amd-staging into amd-master 20230203
Signed-off-by: Hao Zhou <Hao.Zhou@amd.com>
Change-Id: I0519fc50fbcb604bc548ce1883c9f57c9a3be250
2023-02-03 11:28:16 +08:00
Ori Messinger 56f9d6bfc0 ROCm SMI CLI: Fix --showproductname bug
This patch fixes a --showproductname bug, which is related to the
device's SKU. If a device with a VBIOS value that cannot be decoded
is used, that device's SKU cannot be parsed out of the VBIOS string.

Now, when the VBIOS value cannot be decoded, an error will be
printed instead of crashing with an 'UnboundLocalError' message.

Signed-off-by: Ori Messinger <Ori.Messinger@amd.com>
Change-Id: I680a182e94107e782235b8a2477ab165988f7703
2023-02-02 14:52:13 -05:00
Hao Zhou c4fd53f5b3 Merge amd-staging into amd-master 20230131
Signed-off-by: Hao Zhou <Hao.Zhou@amd.com>
Change-Id: I9c65e1f119f64e2a990e5e05e253e124f8a03f46
2023-01-31 09:47:47 +08:00
Harish Kasiviswanathan 142dcfa8f4 Don't depend on vbios_version sysfs file
On APU's vbios_version string might not be exposed. Relying on vendor ID
to detect AMDGPU is sufficient

Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Change-Id: I08ef4b4bc7491a40f318791803aeaf261f7fac25
2023-01-29 21:31:13 -05:00
Hao Zhou e24a2f9d73 Merge amd-staging into amd-master 20230130
Signed-off-by: Hao Zhou <Hao.Zhou@amd.com>
Change-Id: I80aa789bbf0915810d1f786c2eacc3e210755c59
2023-01-30 09:51:33 +08:00
Hao Zhou 0802602499 Merge amd-staging into amd-master 20230118
Signed-off-by: Hao Zhou <Hao.Zhou@amd.com>
Change-Id: I3672f4919d7636f2a9521f0364e65c0dda1c2b2b
2023-01-18 09:13:06 +08:00
Elena Sakhnovitch 2b449fe58d Measure api execution time
Add new test to measure api execution time.

Change-Id: I0ad10c822bad4a2ae04b5785173b4ff21996021d
2023-01-16 17:00:36 -05:00
Bill(Shuzhou) Liu 99034af009 Add missing string header for memcpy
Fix compile error: ‘memcpy’ was not declared

Change-Id: I54d1849a3a18901baac1e24986b82067eb2fd6b4
2023-01-16 12:11:10 -05:00
Charis Poag 4d7f3f2bc7 SWDEV-335697- Add support for dynamic partitioning
Original updates:
    * Added .gitignore to help with future commits
    * Updated/added copyrights on modified or added files
    * Updated rocm_smi.h/.cc
      - Added 3 new SMI API functions:
          rsmi_dev_compute_partition_set &
          rsmi_dev_compute_partition_get
      - Added helpful maps/enums used in
        new get/set compute_partition API calls
    * Updated rocm_smi.py
      - Added --showcomputepartition
      - Added --setcomputepartition
      - Fixed a few mistypes
    * Updated rsmiBindings.py - added helpful class/dict/list
    * Updated rocm_smi_example.cc
      - Added helpful MACRO to detect if api is not supported.
      - Added current_compute_partition set/get rocm lib calls
      - Added helpful macro to discover future RSMI errors
      - Commented out test_set_freq, was having permission issues
        on a Navi21
    * Updated rocm_smi_main.cc
      - Added helpful map to debug API calls, left in for future use
      - Added comment to better understand a non-class function returns
    * Added computepartition_read_write.cc/.h
      - Added get/set compute partition API test calls
      - Confirmed on devices that do not support the API calls, tests pass
    * Updated rocm_smi_test/main.cc
      - Calls new compute partition gtests

Added following updates from review feedback:
   * Updated rocm_smi.h/cc
       - Removed C++ API calls, adding support for both C/C++
         API calls could cause confusion and adds extra work for us
       - rsmi_dev_compute_partition_get -> Fixed an edge case where
         user gives a small buffer length size (smaller than data
         received), but does not receive the partial buffer back.
         google Tests are updated to reflect this find.
   * Updated rocm_smi_example.cc
       - Fixed test_set_freq, issue was that file was not writable.
         We now indicate this warning, so prior errors make sense.
       - General test code cleanup. Removed extra code,
         by creating loops for tests.
   * Updated rocm_smi_main.cc
     - Moved and got rid of an external reference to a map used
       for debugging RSMI enums, now is a const public reference.
   * Updated rocm_smi.py
     - Updated python code to identify NOT_SUPPORTED due to
       (currently) only a few GPU support the feature

Change-Id: I4a567acbb59d6771fb64df08d19175fe3604fd1b
2023-01-13 10:46:40 -05:00
Hao Zhou afa6e806e6 Merge amd-staging into amd-master 20230106
Signed-off-by: Hao Zhou <Hao.Zhou@amd.com>
Change-Id: Ie0c9c44a7fb39ecdcd56158d501c738ceb64096c
2023-01-06 13:05:17 +08:00
Ori Messinger 5c478e9eb9 ROCm SMI CLI: Fix --showproductname bugs
This patch fixes a couple of --showproductname bugs, both of which
are related to the device's SKU.
Previously if a device with a non-standard VBIOS name was used,
fetching that device's SKU wasn't working correctly.

A standard VBIOS name should follow the following pattern:
AAA-BBBBBB-CCC
Where the middle section "BBBBBB" between the hypens is the SKU.

Now, SKU can be correctly fetched even with a non-standard VBIOS
name, and return 'unkown' if SKU does not exist.

Signed-off-by: Ori Messinger <Ori.Messinger@amd.com>
Change-Id: I5899a859c6131c6048bb31a4305ddacbac3075a9
2023-01-05 11:53:04 -05:00
Hao Zhou cd31d17736 Merge amd-staging into amd-master 20221221
Signed-off-by: Hao Zhou <Hao.Zhou@amd.com>
Change-Id: I34a54bbf6a3b434f92fb5ca5abf699c61ab4a8a2
2022-12-21 09:03:03 +08:00
Ori Messinger 932feb6e49 ROCm SMI CLI: Add --showtempgraph Feature
The purpose of this patch is to add a new feature to the smi cli.
Use ./rocm-smi --showtempgraph to print a persistant bar graph for
each GPU's temperature.

The bar graphs refresh continuously to show current temps, and the
graphs change in a color gradient depending on the temperature.

Signed-off-by: Ori Messinger <Ori.Messinger@amd.com>
Change-Id: I98902b76c42cc7281420759f5ebe8c78f7785e66
2022-12-15 18:20:32 -05:00
Hao Zhou 34f4b63853 Merge amd-staging into amd-master 20221212
Signed-off-by: Hao Zhou <Hao.Zhou@amd.com>
Change-Id: I555da02f58185a9eca00954755c2bfd8e418e153
2022-12-12 16:25:01 +08:00
kent.russell@amd.com 248c6f79f4 rocm_smi.py: Fix order of CE and UE reporting
We append CE then UE, but in the table right after, it goes UE then CE.
Fix the order of the table, and add capitals for consistency

Change-Id: I208f37685508ab1e2ff83d3456620bbbf3a16268
2022-12-08 12:28:37 -05:00
Hao Zhou 3a5765fbcf Merge amd-staging into amd-master 20221124
Signed-off-by: Hao Zhou <Hao.Zhou@amd.com>
Change-Id: Iff6f3f5c66a33f703588b2afbf767777564c178b
2022-11-24 17:18:44 +08:00
Bill(Shuzhou) Liu 76b5528feb Remove the shared mutex if no process is using it
If the code is crashed and the mutex may be in bad status. The user
has to mannually remove it. The fix will remove the shared mutex
if no process is using it.

Change-Id: I18bf562f2e0a7de8b3f0cccf72d60950b0d9bb2d
2022-11-22 10:30:58 -05:00
Ranjith Ramakrishnan e7ed902fd6 SWDEV-366823 - Change pragma message to warning
File reorganization feature was implemented with backward compatibility
The backward compatibility support will be deprecated in future release.
Changed the #pragma message to #warning for a smooth transition

Change-Id: I281ad17949435fee4b508a2a7e112b6fa3365838
2022-11-21 01:08:12 -08:00
Hao Zhou dcebccffb2 Merge amd-staging into amd-master 20221103
Signed-off-by: Hao Zhou <Hao.Zhou@amd.com>
Change-Id: I13896298d0d4dbdb079ce4cd1372d7a61cd5df6c
2022-11-03 14:27:32 +08:00
Sreekant Somasekharan e9e3ba541e [rocm_smi_kfd.cc] Handle return value from ReadSysfsStr function.
Return value from ReadSysfsStr function that reads cu_occupancy file
was not handled correctly. Modified the script to handle any fail conditions.

Change-Id: I3c71e0f6f288f196ed1f833e8709255c2b6e78ee
2022-10-31 12:20:06 -04:00
Hao Zhou b01855c4c5 Merge amd-staging into amd-master 20220929
Signed-off-by: Hao Zhou <Hao.Zhou@amd.com>
Change-Id: I7bdd77db1483022e54f2f0566c3c7d3c915c2729
2022-09-29 15:45:17 +08:00
Ranjith Ramakrishnan 9a650b1378 SWDEV-345870 - Correct install interface for new directory layout
Install interface should provide /opt/rocm-ver/include as the include path
Path /opt/rocm-ver/rocm_smi/include should be used only as  part of backward compatibility support

Change-Id: Idc1f663069356c6b1fbd492f45ef4637fc90e4eb
2022-09-13 10:48:21 -07:00
Hao Zhou 0f02a3a272 Merge amd-staging into amd-master 20220909
Signed-off-by: Hao Zhou <Hao.Zhou@amd.com>
Change-Id: Ic8bbdad24b0671f6b77543daa9656f5c3662c2c8
2022-09-09 09:26:33 +08:00
Alex Sierra 03fab6b2b6 Consider invalid peer link type during topology report
Invalid peer links are labeled as N/A during topology report creation.
This invalid link type could be triggered by having a configuration
with CPU XGMI iolinks and disable XGMI peer to peer access. This can
be done by setting the driver parameter 'use_xgmi_p2p = 0'.

Signed-off-by: Alex Sierra <Alex.Sierra@amd.com>
Change-Id: Ifb09a8f3266a3f07686615dfb45781d6cfe55e83
2022-09-06 13:47:32 -05:00
Alex Sierra 4658630d8d Avoid report PCIe peer devices with CPU XGMI iolinks
Devices with CPU XGMI iolink do not support PCIe peer access. Therefore,
they should not be reported as accessible links in the topology.

Signed-off-by: Alex Sierra <Alex.Sierra@amd.com>
Change-Id: I3ee51796945dc0966200dee03886510e8f1846b7
2022-09-02 09:18:30 -05:00
Hao Zhou 1efd6ee29c Merge amd-staging into amd-master 20220901
Signed-off-by: Hao Zhou <Hao.Zhou@amd.com>
Change-Id: Ic59465c248f96a74d20226810c9ae98360797e34
2022-09-01 09:54:40 +08:00
Ori Messinger dfd88b593f ROCm SMI CLI: Modify Column Header
The purpose of this patch is to modify the column header of the default
'./rocm-smi' command from 'Temp' to 'Temp (DieEdge)' for clarity.

Signed-off-by: Ori Messinger <Ori.Messinger@amd.com>
Change-Id: I127a9214be97a1185c3db010f1c9176d1f412ec9
2022-08-31 09:47:14 -04:00
Hao Zhou a5e286d250 Merge amd-staging into amd-master 20220826
Signed-off-by: Hao Zhou <Hao.Zhou@amd.com>
Change-Id: Ibef408e62669ec105571e605f333642cebc33112
2022-08-26 13:45:55 +08:00
Elena Sakhnovitch 8b2bc318eb [rocm_smi.py] bugfix for non-alphanum parce issue
--showdeviceid
Fix for false-positive  "FRU is corrupted" messages,
since str(sn).isalphanum() triggers on empty struct.

--showproductname
fix script termination on non-alphanum product name

Change-Id: I78d4998e156f9b0d9f45338bed2a0d30b789e220
2022-08-23 19:28:19 -04:00