diff mbox

kvm: print suberror on all internal errors

Message ID 1390324291-9847-1-git-send-email-rkrcmar@redhat.com
State New
Headers show

Commit Message

Radim Krčmář Jan. 21, 2014, 5:11 p.m. UTC
KVM introduced internal error exit reason and suberror at the same time,
and later extended it with internal error data.
QEMU does not report suberror on hosts between these two events because
we check for the extension. (half a year in 2009, but it is misleading)

Fix by removing KVM_CAP_INTERNAL_ERROR_DATA condition on printf.

(partially improved by bb44e0d12df70 and ba4047cf848a3 in the past)

Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
---
 kvm-all.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

Laszlo Ersek Jan. 21, 2014, 5:20 p.m. UTC | #1
On 01/21/14 18:11, Radim Krčmář wrote:
> KVM introduced internal error exit reason and suberror at the same time,
> and later extended it with internal error data.
> QEMU does not report suberror on hosts between these two events because
> we check for the extension. (half a year in 2009, but it is misleading)
> 
> Fix by removing KVM_CAP_INTERNAL_ERROR_DATA condition on printf.
> 
> (partially improved by bb44e0d12df70 and ba4047cf848a3 in the past)
> 
> Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
> ---
>  kvm-all.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/kvm-all.c b/kvm-all.c
> index 0bfb060..0a91d8e 100644
> --- a/kvm-all.c
> +++ b/kvm-all.c
> @@ -1539,17 +1539,16 @@ static void kvm_handle_io(uint16_t port, void *data, int direction, int size,
>  
>  static int kvm_handle_internal_error(CPUState *cpu, struct kvm_run *run)
>  {
> -    fprintf(stderr, "KVM internal error.");
> +    fprintf(stderr, "KVM internal error. Suberror: %d\n",
> +            run->internal.suberror);
> +
>      if (kvm_check_extension(kvm_state, KVM_CAP_INTERNAL_ERROR_DATA)) {
>          int i;
>  
> -        fprintf(stderr, " Suberror: %d\n", run->internal.suberror);
>          for (i = 0; i < run->internal.ndata; ++i) {
>              fprintf(stderr, "extra data[%d]: %"PRIx64"\n",
>                      i, (uint64_t)run->internal.data[i]);
>          }
> -    } else {
> -        fprintf(stderr, "\n");
>      }
>      if (run->internal.suberror == KVM_INTERNAL_ERROR_EMULATION) {
>          fprintf(stderr, "emulation failure\n");
> 

Based on earlier discussion

Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Paolo Bonzini Jan. 22, 2014, 1:03 p.m. UTC | #2
Il 21/01/2014 18:11, Radim Krčmář ha scritto:
> KVM introduced internal error exit reason and suberror at the same time,
> and later extended it with internal error data.
> QEMU does not report suberror on hosts between these two events because
> we check for the extension. (half a year in 2009, but it is misleading)
>
> Fix by removing KVM_CAP_INTERNAL_ERROR_DATA condition on printf.
>
> (partially improved by bb44e0d12df70 and ba4047cf848a3 in the past)
>
> Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
> ---
>  kvm-all.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/kvm-all.c b/kvm-all.c
> index 0bfb060..0a91d8e 100644
> --- a/kvm-all.c
> +++ b/kvm-all.c
> @@ -1539,17 +1539,16 @@ static void kvm_handle_io(uint16_t port, void *data, int direction, int size,
>
>  static int kvm_handle_internal_error(CPUState *cpu, struct kvm_run *run)
>  {
> -    fprintf(stderr, "KVM internal error.");
> +    fprintf(stderr, "KVM internal error. Suberror: %d\n",
> +            run->internal.suberror);
> +
>      if (kvm_check_extension(kvm_state, KVM_CAP_INTERNAL_ERROR_DATA)) {
>          int i;
>
> -        fprintf(stderr, " Suberror: %d\n", run->internal.suberror);
>          for (i = 0; i < run->internal.ndata; ++i) {
>              fprintf(stderr, "extra data[%d]: %"PRIx64"\n",
>                      i, (uint64_t)run->internal.data[i]);
>          }
> -    } else {
> -        fprintf(stderr, "\n");
>      }
>      if (run->internal.suberror == KVM_INTERNAL_ERROR_EMULATION) {
>          fprintf(stderr, "emulation failure\n");
>

Applied to uq/master, thanks (please remember uq/master in the subject 
line in the future).

Paolo
diff mbox

Patch

diff --git a/kvm-all.c b/kvm-all.c
index 0bfb060..0a91d8e 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -1539,17 +1539,16 @@  static void kvm_handle_io(uint16_t port, void *data, int direction, int size,
 
 static int kvm_handle_internal_error(CPUState *cpu, struct kvm_run *run)
 {
-    fprintf(stderr, "KVM internal error.");
+    fprintf(stderr, "KVM internal error. Suberror: %d\n",
+            run->internal.suberror);
+
     if (kvm_check_extension(kvm_state, KVM_CAP_INTERNAL_ERROR_DATA)) {
         int i;
 
-        fprintf(stderr, " Suberror: %d\n", run->internal.suberror);
         for (i = 0; i < run->internal.ndata; ++i) {
             fprintf(stderr, "extra data[%d]: %"PRIx64"\n",
                     i, (uint64_t)run->internal.data[i]);
         }
-    } else {
-        fprintf(stderr, "\n");
     }
     if (run->internal.suberror == KVM_INTERNAL_ERROR_EMULATION) {
         fprintf(stderr, "emulation failure\n");