Skip to contentSkip to conversation

selftest: intel_pstate: More accurate error message and also a debug support message from aperf.c

PATCH In review Jeffrin Jose T 2 participants 2 messages May 14, 2018 – May 15, 2018 Kselftest

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftest: intel_pstate: More accurate error message and also a debug support message from aperf.c

Fix for aperf.c to produce the path of the file which is in mention during error report.CONFIG_X86_MSR=m support requirement is also mentioned.

---
 tools/testing/selftests/intel_pstate/aperf.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
tools/testing/selftests/intel_pstate/aperf.c +3 -1
index d21edea9c560..da98c1673f08 100644
@@ -41,7 +41,9 @@ int main(int argc, char **argv) {
 	fd = open(msr_file_name, O_RDONLY);
 
 	if (fd == -1) {
-		perror("Failed to open");
+		printf("Failed to open /dev/cpu/%d/msr:", cpu);
+		printf(" No such file or directory:");
+		printf(" Make sure CONFIG_X86_MSR=m support is Enabled\n");
 		return 1;
 	}
 
Signature · 1 line
2.17.0
maintainer
#1 lore raw
Quoted 13 lines · Jeffrin Jose T

Fix for aperf.c to produce the path of the file which is in mention during error report.CONFIG_X86_MSR=m support requirement is also mentioned.

Signed-off-by Jeffrin Jose T <jeffrin at rajagiritech.edu.in>
---
 tools/testing/selftests/intel_pstate/aperf.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
tools/testing/selftests/intel_pstate/aperf.c +0 -0
index d21edea9c560..da98c1673f08 100644

tools/testing/selftests/intel_pstate/aperf.c int main(int argc, char **argv) { · line 44

Quoted 4 lines
tools/testing/selftests/intel_pstate/aperf.c +0 -1
@@ -41,7 +41,9 @@ int main(int argc, char **argv) {
 	fd = open(msr_file_name, O_RDONLY);
 
 	if (fd == -1) {
-		perror("Failed to open")> +		printf("Failed to open /dev/cpu/%d/msr:", cpu);

Why are you deleting perror() and add a printf() for the error message perror() printf()?

Why not collapse these messages into one and use strerror() to include the error string?

tools/testing/selftests/intel_pstate/aperf.c int main(int argc, char **argv) { · line 44

Quoted 1 line
tools/testing/selftests/intel_pstate/aperf.c +1 -0
+		printf(" No such file or directory:")

Not necessarily. open(0 could fail due to insufficient permissions. That is why using strerror() or perror() is the correct way so the real error message gets printed.

tools/testing/selftests/intel_pstate/aperf.c int main(int argc, char **argv) { · line 46

Quoted 1 line
tools/testing/selftests/intel_pstate/aperf.c +1 -0
+		printf(" Make sure CONFIG_X86_MSR=m support is Enabled\n");

Might not be the real reason why the opeN() failed.

tools/testing/selftests/intel_pstate/aperf.c int main(int argc, char **argv) { · line 48

Quoted 2 lines
tools/testing/selftests/intel_pstate/aperf.c +0 -0
 		return 1;
 	}

The return should be KSFT_SKIP instead of 1

Quoted 2 lines

thanks,
-- Shuah
--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html