All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/5] umr: Add support for "--ppt-read"
@ 2022-03-27 10:42 Luben Tuikov
  2022-03-27 10:42 ` [PATCH 2/5] umr: Reorg and print the message on ppt-read Luben Tuikov
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Luben Tuikov @ 2022-03-27 10:42 UTC (permalink / raw)
  To: amd-gfx; +Cc: Tom StDenis, Jinzhou . Su, Luben Tuikov

Add support for "--ppt-read" to fall in line with the way rest of the
command line options are formatted. The old "--ppt_read" is still
supported.

Cc: Tom StDenis <tom.stdenis@amd.com>
Cc: Jinzhou.Su <Jinzhou.Su@amd.com>
Signed-off-by: Luben Tuikov <luben.tuikov@amd.com>
---
 src/app/main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/app/main.c b/src/app/main.c
index 2f9d6aadd7ff46..62ea2f42145f60 100644
--- a/src/app/main.c
+++ b/src/app/main.c
@@ -848,7 +848,9 @@ int main(int argc, char **argv)
 			umr_set_clock_performance(asic, "auto");
 			if (umr_check_clock_performance(asic, clockperformance, sizeof(clockperformance)) != 0)
 				printf("power_dpm_force_performance_level: %s", clockperformance);
-		} else if (!strcmp(argv[i], "--ppt_read") || !strcmp(argv[i], "-pptr")) {
+		} else if (!strcmp(argv[i], "--ppt-read") ||
+			   !strcmp(argv[i], "--ppt_read") ||
+			   !strcmp(argv[i], "-pptr")) {
 			if (!asic)
 				asic = get_asic();
 			if (i + 1 < argc) {

base-commit: decd91d8eae42d63eda4f6b7c97159b9cc343c26
-- 
2.35.1.607.gf01e51a7cf


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/5] umr: Reorg and print the message on ppt-read
  2022-03-27 10:42 [PATCH 1/5] umr: Add support for "--ppt-read" Luben Tuikov
@ 2022-03-27 10:42 ` Luben Tuikov
  2022-03-27 10:42 ` [PATCH 3/5] umr: Add command line support for "--gpu-metrics" Luben Tuikov
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Luben Tuikov @ 2022-03-27 10:42 UTC (permalink / raw)
  To: amd-gfx; +Cc: Tom StDenis, Jinzhou . Su, Luben Tuikov

Reorganize the logic and actually print the error message when the ASIC
doesn't support the power-play table feature.

Cc: Tom StDenis <tom.stdenis@amd.com>
Cc: Jinzhou.Su <Jinzhou.Su@amd.com>
Signed-off-by: Luben Tuikov <luben.tuikov@amd.com>
---
 src/app/pp_table.c | 29 +++++++++++++++++------------
 1 file changed, 17 insertions(+), 12 deletions(-)

diff --git a/src/app/pp_table.c b/src/app/pp_table.c
index 9ab42a9ae2296c..33c2d01e897ef3 100644
--- a/src/app/pp_table.c
+++ b/src/app/pp_table.c
@@ -20,27 +20,32 @@
  * OTHER DEALINGS IN THE SOFTWARE.
  *
  */
+
+#include <errno.h>
 #include "umrapp.h"
 #include "smu_pptable_navi10.h"
 
-int umr_print_pp_table(struct umr_asic *asic, const char* param)
+int umr_print_pp_table(struct umr_asic *asic, const char *param)
 {
-	FILE* fp;
-	int ret = -1;
+	FILE *fp;
+	int res;
 	char name[256];
 
 	snprintf(name, sizeof(name)-1, \
-		"/sys/class/drm/card%d/device/pp_table", asic->instance);
+		 "/sys/class/drm/card%d/device/pp_table", asic->instance);
 	fp = fopen(name, "r");
-	if (fp) {
-		if (strcmp(asic->asicname, "navi10") == 0 || strcmp(asic->asicname, "navi14") == 0) {
-			ret = umr_navi10_pptable_print(param, fp);
-		}
-		fclose(fp);
+	if (!fp) {
+		asic->err_msg("fopen: %s: %d\n", strerror(errno), errno);
+		return -errno;
+	}
+	if (strcmp(asic->asicname, "navi10") == 0 ||
+	    strcmp(asic->asicname, "navi14") == 0) {
+		res = umr_navi10_pptable_print(param, fp);
 	} else {
-		printf("Powerplay table feature only support on Navi10/Navi14 now.");
-		return -1;
+		asic->err_msg("The powerplay table feature is currently supported only on Navi10/Navi14.\n");
+		res = -1;
 	}
+	fclose(fp);
 
-	return ret;
+	return res;
 }
-- 
2.35.1.607.gf01e51a7cf


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/5] umr: Add command line support for "--gpu-metrics"
  2022-03-27 10:42 [PATCH 1/5] umr: Add support for "--ppt-read" Luben Tuikov
  2022-03-27 10:42 ` [PATCH 2/5] umr: Reorg and print the message on ppt-read Luben Tuikov
@ 2022-03-27 10:42 ` Luben Tuikov
  2022-03-27 10:42 ` [PATCH 4/5] umr: Document new format command line options Luben Tuikov
  2022-03-27 10:42 ` [PATCH 5/5] umr: Completion: update new format options Luben Tuikov
  3 siblings, 0 replies; 6+ messages in thread
From: Luben Tuikov @ 2022-03-27 10:42 UTC (permalink / raw)
  To: amd-gfx; +Cc: Tom StDenis, Jinzhou . Su, Luben Tuikov

Add command line support for --gpu-metrics, to fall in line with the rest
of the command line arguments' format.

Cc: Tom StDenis <tom.stdenis@amd.com>
Cc: Jinzhou.Su <Jinzhou.Su@amd.com>
Signed-off-by: Luben Tuikov <luben.tuikov@amd.com>
---
 src/app/main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/app/main.c b/src/app/main.c
index 62ea2f42145f60..6cfbe09bea7b4d 100644
--- a/src/app/main.c
+++ b/src/app/main.c
@@ -861,7 +861,9 @@ int main(int argc, char **argv)
 				if (umr_print_pp_table(asic, NULL) != 0)
 					fprintf(stderr, "[ERROR]: can not print pp table info.\n");
 			}
-		} else if (!strcmp(argv[i], "--gpu_metrics") || !strcmp(argv[i], "-gm")) {
+		} else if (!strcmp(argv[i], "--gpu-metrics") ||
+			   !strcmp(argv[i], "--gpu_metrics") ||
+			   !strcmp(argv[i], "-gm")) {
 			if (!asic)
 				asic = get_asic();
 			if (umr_print_gpu_metrics(asic) != 0)
-- 
2.35.1.607.gf01e51a7cf


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/5] umr: Document new format command line options
  2022-03-27 10:42 [PATCH 1/5] umr: Add support for "--ppt-read" Luben Tuikov
  2022-03-27 10:42 ` [PATCH 2/5] umr: Reorg and print the message on ppt-read Luben Tuikov
  2022-03-27 10:42 ` [PATCH 3/5] umr: Add command line support for "--gpu-metrics" Luben Tuikov
@ 2022-03-27 10:42 ` Luben Tuikov
  2022-03-27 10:42 ` [PATCH 5/5] umr: Completion: update new format options Luben Tuikov
  3 siblings, 0 replies; 6+ messages in thread
From: Luben Tuikov @ 2022-03-27 10:42 UTC (permalink / raw)
  To: amd-gfx; +Cc: Tom StDenis, Jinzhou . Su, Luben Tuikov

Document new format command line options in the manual page: "--ppt-read"
and "--gpu-metrics". The old format using underscores is still supported in
the main app, in case it is used in scripts, and so on.

Cc: Tom StDenis <tom.stdenis@amd.com>
Cc: Jinzhou.Su <Jinzhou.Su@amd.com>
Signed-off-by: Luben Tuikov <luben.tuikov@amd.com>
---
 doc/umr.1 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/umr.1 b/doc/umr.1
index 62eea7db320b88..ad518e0fa7451d 100644
--- a/doc/umr.1
+++ b/doc/umr.1
@@ -288,11 +288,11 @@ Set power_dpm_force_performance_level to low.
 .IP "--clock-auto, -ca"
 Set power_dpm_force_performance_level to auto.
 
-.IP "--ppt_read, -pptr [ppt_field_name]"
+.IP "--ppt-read, -pptr [ppt_field_name]"
 Read powerplay table value and print it to stdout.  This command will print all the powerplay table
 information or the corresponding string in powerplay table.
 
-.IP "--gpu_metrics, -gm"
+.IP "--gpu-metrics, -gm"
 Print the GPU metrics table for the device.
 
 .SH "Notes"
-- 
2.35.1.607.gf01e51a7cf


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 5/5] umr: Completion: update new format options
  2022-03-27 10:42 [PATCH 1/5] umr: Add support for "--ppt-read" Luben Tuikov
                   ` (2 preceding siblings ...)
  2022-03-27 10:42 ` [PATCH 4/5] umr: Document new format command line options Luben Tuikov
@ 2022-03-27 10:42 ` Luben Tuikov
  2022-03-28 17:09   ` StDenis, Tom
  3 siblings, 1 reply; 6+ messages in thread
From: Luben Tuikov @ 2022-03-27 10:42 UTC (permalink / raw)
  To: amd-gfx; +Cc: Tom StDenis, Jinzhou . Su, Luben Tuikov

Update completion for "--ppt-read" and "--gpu-metrics".

Cc: Tom StDenis <tom.stdenis@amd.com>
Cc: Jinzhou.Su <Jinzhou.Su@amd.com>
Signed-off-by: Luben Tuikov <luben.tuikov@amd.com>
---
 scripts/umr-completion.bash | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/umr-completion.bash b/scripts/umr-completion.bash
index 0e1444357c82a9..bd0b61b2d38831 100644
--- a/scripts/umr-completion.bash
+++ b/scripts/umr-completion.bash
@@ -333,7 +333,7 @@ _umr_comp_ring_stream()
 
 _umr_completion()
 {
-    local ALL_LONG_ARGS=(--database-path --option --gpu --instance --force --pci --gfxoff --vm_partition --bank --sbank --cbank --config --enumerate --list-blocks --list-regs --dump-discovery-table --lookup --write --writebit --read --scan --logscan --top --waves --profiler --vm-decode --vm-read --vm-write --vm-write-word --vm-disasm --ring-stream --dump-ib --dump-ib-file --header-dump --power --clock-scan --clock-manual --clock-high --clock-low --clock-auto --ppt_read --gpu_metrics --power --vbios_info --test-log --test-harness --server --gui)
+    local ALL_LONG_ARGS=(--database-path --option --gpu --instance --force --pci --gfxoff --vm_partition --bank --sbank --cbank --config --enumerate --list-blocks --list-regs --dump-discovery-table --lookup --write --writebit --read --scan --logscan --top --waves --profiler --vm-decode --vm-read --vm-write --vm-write-word --vm-disasm --ring-stream --dump-ib --dump-ib-file --header-dump --power --clock-scan --clock-manual --clock-high --clock-low --clock-auto --ppt-read --gpu-metrics --power --vbios_info --test-log --test-harness --server --gui)
 
     local cur prev
 
-- 
2.35.1.607.gf01e51a7cf


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 5/5] umr: Completion: update new format options
  2022-03-27 10:42 ` [PATCH 5/5] umr: Completion: update new format options Luben Tuikov
@ 2022-03-28 17:09   ` StDenis, Tom
  0 siblings, 0 replies; 6+ messages in thread
From: StDenis, Tom @ 2022-03-28 17:09 UTC (permalink / raw)
  To: Tuikov, Luben, amd-gfx; +Cc: Su, Jinzhou (Joe)

[AMD Official Use Only]

Thanks Luben, I've committed and pushed out these patches.

Cheers,
Tom

________________________________________
From: Tuikov, Luben <Luben.Tuikov@amd.com>
Sent: Sunday, March 27, 2022 06:42
To: amd-gfx@lists.freedesktop.org
Cc: Tuikov, Luben; StDenis, Tom; Su, Jinzhou (Joe)
Subject: [PATCH 5/5] umr: Completion: update new format options

Update completion for "--ppt-read" and "--gpu-metrics".

Cc: Tom StDenis <tom.stdenis@amd.com>
Cc: Jinzhou.Su <Jinzhou.Su@amd.com>
Signed-off-by: Luben Tuikov <luben.tuikov@amd.com>
---
 scripts/umr-completion.bash | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/umr-completion.bash b/scripts/umr-completion.bash
index 0e1444357c82a9..bd0b61b2d38831 100644
--- a/scripts/umr-completion.bash
+++ b/scripts/umr-completion.bash
@@ -333,7 +333,7 @@ _umr_comp_ring_stream()

 _umr_completion()
 {
-    local ALL_LONG_ARGS=(--database-path --option --gpu --instance --force --pci --gfxoff --vm_partition --bank --sbank --cbank --config --enumerate --list-blocks --list-regs --dump-discovery-table --lookup --write --writebit --read --scan --logscan --top --waves --profiler --vm-decode --vm-read --vm-write --vm-write-word --vm-disasm --ring-stream --dump-ib --dump-ib-file --header-dump --power --clock-scan --clock-manual --clock-high --clock-low --clock-auto --ppt_read --gpu_metrics --power --vbios_info --test-log --test-harness --server --gui)
+    local ALL_LONG_ARGS=(--database-path --option --gpu --instance --force --pci --gfxoff --vm_partition --bank --sbank --cbank --config --enumerate --list-blocks --list-regs --dump-discovery-table --lookup --write --writebit --read --scan --logscan --top --waves --profiler --vm-decode --vm-read --vm-write --vm-write-word --vm-disasm --ring-stream --dump-ib --dump-ib-file --header-dump --power --clock-scan --clock-manual --clock-high --clock-low --clock-auto --ppt-read --gpu-metrics --power --vbios_info --test-log --test-harness --server --gui)

     local cur prev

--
2.35.1.607.gf01e51a7cf


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-03-28 17:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-27 10:42 [PATCH 1/5] umr: Add support for "--ppt-read" Luben Tuikov
2022-03-27 10:42 ` [PATCH 2/5] umr: Reorg and print the message on ppt-read Luben Tuikov
2022-03-27 10:42 ` [PATCH 3/5] umr: Add command line support for "--gpu-metrics" Luben Tuikov
2022-03-27 10:42 ` [PATCH 4/5] umr: Document new format command line options Luben Tuikov
2022-03-27 10:42 ` [PATCH 5/5] umr: Completion: update new format options Luben Tuikov
2022-03-28 17:09   ` StDenis, Tom

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.