qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: qemu-devel@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [PATCH for-2.10 v2] kvm: Print MSR information if KVM_{GET, SET}_MSRS failed
Date: Thu, 9 Mar 2017 20:08:00 +0000	[thread overview]
Message-ID: <20170309200759.GP2480@work-vm> (raw)
In-Reply-To: <20170309194634.28457-1-ehabkost@redhat.com>

* Eduardo Habkost (ehabkost@redhat.com) wrote:
> When a KVM_{GET,SET}_MSRS ioctl() fails, it is difficult to find
> out which MSR caused the problem. Print an error message for
> debugging, before we trigger the (ret == cpu->kvm_msr_buf->nmsrs)
> assert.
> 
> Suggested-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>

Thanks!

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

I'd actually suggest it for 2.9; it's only added debug output.

Dave

> ---
> Changes v1 -> v2:
> * Print error message on KVM_GET_MSRS too
>   * Suggested-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> ---
>  target/i386/kvm.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/target/i386/kvm.c b/target/i386/kvm.c
> index 887a81268f..705e971a63 100644
> --- a/target/i386/kvm.c
> +++ b/target/i386/kvm.c
> @@ -1807,6 +1807,12 @@ static int kvm_put_msrs(X86CPU *cpu, int level)
>          return ret;
>      }
>  
> +    if (ret < cpu->kvm_msr_buf->nmsrs) {
> +        struct kvm_msr_entry *e = &cpu->kvm_msr_buf->entries[ret];
> +        error_report("error: failed to set MSR 0x%" PRIx32 " to 0x%" PRIx64,
> +                     (uint32_t)e->index, (uint64_t)e->data);
> +    }
> +
>      assert(ret == cpu->kvm_msr_buf->nmsrs);
>      return 0;
>  }
> @@ -2172,6 +2178,12 @@ static int kvm_get_msrs(X86CPU *cpu)
>          return ret;
>      }
>  
> +    if (ret < cpu->kvm_msr_buf->nmsrs) {
> +        struct kvm_msr_entry *e = &cpu->kvm_msr_buf->entries[ret];
> +        error_report("error: failed to get MSR 0x%" PRIx32,
> +                     (uint32_t)e->index);
> +    }
> +
>      assert(ret == cpu->kvm_msr_buf->nmsrs);
>      /*
>       * MTRR masks: Each mask consists of 5 parts
> -- 
> 2.11.0.259.g40922b1
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

  reply	other threads:[~2017-03-09 20:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-09 19:46 [Qemu-devel] [PATCH for-2.10 v2] kvm: Print MSR information if KVM_{GET, SET}_MSRS failed Eduardo Habkost
2017-03-09 20:08 ` Dr. David Alan Gilbert [this message]
2017-03-09 20:26   ` [Qemu-devel] [PATCH for-2.9? " Eduardo Habkost
2017-03-10  8:29     ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170309200759.GP2480@work-vm \
    --to=dgilbert@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).