[PATCH] tests,kvm: print the reason of failure

Masatake YAMATO yamato at redhat.com
Thu May 23 03:17:17 UTC 2019


* tests/ioctl_kvm_run_common.c (run_kvm): Print
hardware_entry_failure_reason field of kvm_run
when KVM_RUN is failed with KVM_EXIT_FAIL_ENTRY.

Signed-off-by: Masatake YAMATO <yamato at redhat.com>
---
 tests/ioctl_kvm_run_common.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tests/ioctl_kvm_run_common.c b/tests/ioctl_kvm_run_common.c
index 26e72cec..9490c214 100644
--- a/tests/ioctl_kvm_run_common.c
+++ b/tests/ioctl_kvm_run_common.c
@@ -35,6 +35,7 @@
  &&(defined __x86_64__ || defined __i386__)
 
 # include <fcntl.h>
+# include <inttypes.h>
 # include <stdint.h>
 # include <stdio.h>
 # include <stdlib.h>
@@ -238,6 +239,10 @@ run_kvm(const int vcpu_fd, struct kvm_run *const run, const size_t mmap_size,
 					   run->mmio.data[4], run->mmio.data[5],
 					   run->mmio.data[6], run->mmio.data[7],
 					   run->mmio.len, run->mmio.is_write);
+		case KVM_EXIT_FAIL_ENTRY:
+			error_msg_and_fail("Got an unexpected FAIL_ENTRY exit:"
+					   " hardware_entry_failure_reason: %" PRIu64 "",
+					   run->fail_entry.hardware_entry_failure_reason);
 
 		default:
 			error_msg_and_fail("exit_reason = %#x",
-- 
2.17.2



More information about the Strace-devel mailing list