diff mbox

Show registers and exit on unhandled errors

Message ID 1253531881-3847-1-git-send-email-m.gamal005@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Mohammed Gamal Sept. 21, 2009, 11:18 a.m. UTC
Signed-off-by: Mohammed Gamal <m.gamal005@gmail.com>
---
 qemu-kvm.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

Comments

Jan Kiszka Sept. 21, 2009, 11:29 a.m. UTC | #1
Mohammed Gamal wrote:
> Signed-off-by: Mohammed Gamal <m.gamal005@gmail.com>
> ---
>  qemu-kvm.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/qemu-kvm.c b/qemu-kvm.c
> index 0afdb56..c22c28a 100644
> --- a/qemu-kvm.c
> +++ b/qemu-kvm.c
> @@ -1015,6 +1015,8 @@ int kvm_run(kvm_vcpu_context_t vcpu, void *env)
>          switch (run->exit_reason) {
>          case KVM_EXIT_UNKNOWN:
>              r = handle_unhandled(run->hw.hardware_exit_reason);
> +            kvm_show_regs(vcpu);
> +            abort();
>              break;
>          case KVM_EXIT_FAIL_ENTRY:
>              r = handle_unhandled(run->fail_entry.hardware_entry_failure_reason);

Don't we currently suspend the VM on unknown exits? This is more useful
than aborting as it allows to
 - disassemble the problematic code
 - poke around in the RAM
 - look at other VCPUs
 - attach a debugger to qemu
 - ...

Jan
Mohammed Gamal Sept. 21, 2009, 11:31 a.m. UTC | #2
On Mon, Sep 21, 2009 at 1:29 PM, Jan Kiszka <jan.kiszka@siemens.com> wrote:
> Mohammed Gamal wrote:
>> Signed-off-by: Mohammed Gamal <m.gamal005@gmail.com>
>> ---
>>  qemu-kvm.c |    2 ++
>>  1 files changed, 2 insertions(+), 0 deletions(-)
>>
>> diff --git a/qemu-kvm.c b/qemu-kvm.c
>> index 0afdb56..c22c28a 100644
>> --- a/qemu-kvm.c
>> +++ b/qemu-kvm.c
>> @@ -1015,6 +1015,8 @@ int kvm_run(kvm_vcpu_context_t vcpu, void *env)
>>          switch (run->exit_reason) {
>>          case KVM_EXIT_UNKNOWN:
>>              r = handle_unhandled(run->hw.hardware_exit_reason);
>> +            kvm_show_regs(vcpu);
>> +            abort();
>>              break;
>>          case KVM_EXIT_FAIL_ENTRY:
>>              r = handle_unhandled(run->fail_entry.hardware_entry_failure_reason);
>
> Don't we currently suspend the VM on unknown exits? This is more useful
> than aborting as it allows to
>  - disassemble the problematic code
>  - poke around in the RAM
>  - look at other VCPUs
>  - attach a debugger to qemu
>  - ...
>

Good point. But at least we can still show registers, since that also
can give some diagnostic information, no?
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jan Kiszka Sept. 21, 2009, 11:42 a.m. UTC | #3
Mohammed Gamal wrote:
> On Mon, Sep 21, 2009 at 1:29 PM, Jan Kiszka <jan.kiszka@siemens.com> wrote:
>> Mohammed Gamal wrote:
>>> Signed-off-by: Mohammed Gamal <m.gamal005@gmail.com>
>>> ---
>>>  qemu-kvm.c |    2 ++
>>>  1 files changed, 2 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/qemu-kvm.c b/qemu-kvm.c
>>> index 0afdb56..c22c28a 100644
>>> --- a/qemu-kvm.c
>>> +++ b/qemu-kvm.c
>>> @@ -1015,6 +1015,8 @@ int kvm_run(kvm_vcpu_context_t vcpu, void *env)
>>>          switch (run->exit_reason) {
>>>          case KVM_EXIT_UNKNOWN:
>>>              r = handle_unhandled(run->hw.hardware_exit_reason);
>>> +            kvm_show_regs(vcpu);
>>> +            abort();
>>>              break;
>>>          case KVM_EXIT_FAIL_ENTRY:
>>>              r = handle_unhandled(run->fail_entry.hardware_entry_failure_reason);
>> Don't we currently suspend the VM on unknown exits? This is more useful
>> than aborting as it allows to
>>  - disassemble the problematic code
>>  - poke around in the RAM
>>  - look at other VCPUs
>>  - attach a debugger to qemu
>>  - ...
>>
> 
> Good point. But at least we can still show registers, since that also
> can give some diagnostic information, no?

No fundamental concerns. Just move the call into handle_unhandled.

And maybe some note like "kvm_run returned XX - VM stopped" in
kvm_cpu_exec() would clarify the situation a bit more.

Jan
Mohammed Gamal Sept. 21, 2009, 11:47 a.m. UTC | #4
On Mon, Sep 21, 2009 at 1:42 PM, Jan Kiszka <jan.kiszka@siemens.com> wrote:
> Mohammed Gamal wrote:
>> On Mon, Sep 21, 2009 at 1:29 PM, Jan Kiszka <jan.kiszka@siemens.com> wrote:
>>> Mohammed Gamal wrote:
>>>> Signed-off-by: Mohammed Gamal <m.gamal005@gmail.com>
>>>> ---
>>>>  qemu-kvm.c |    2 ++
>>>>  1 files changed, 2 insertions(+), 0 deletions(-)
>>>>
>>>> diff --git a/qemu-kvm.c b/qemu-kvm.c
>>>> index 0afdb56..c22c28a 100644
>>>> --- a/qemu-kvm.c
>>>> +++ b/qemu-kvm.c
>>>> @@ -1015,6 +1015,8 @@ int kvm_run(kvm_vcpu_context_t vcpu, void *env)
>>>>          switch (run->exit_reason) {
>>>>          case KVM_EXIT_UNKNOWN:
>>>>              r = handle_unhandled(run->hw.hardware_exit_reason);
>>>> +            kvm_show_regs(vcpu);
>>>> +            abort();
>>>>              break;
>>>>          case KVM_EXIT_FAIL_ENTRY:
>>>>              r = handle_unhandled(run->fail_entry.hardware_entry_failure_reason);
>>> Don't we currently suspend the VM on unknown exits? This is more useful
>>> than aborting as it allows to
>>>  - disassemble the problematic code
>>>  - poke around in the RAM
>>>  - look at other VCPUs
>>>  - attach a debugger to qemu
>>>  - ...
>>>
>>
>> Good point. But at least we can still show registers, since that also
>> can give some diagnostic information, no?
>
> No fundamental concerns. Just move the call into handle_unhandled.
>
> And maybe some note like "kvm_run returned XX - VM stopped" in
> kvm_cpu_exec() would clarify the situation a bit more.
>
> Jan

That's already the case if we don't exit.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Mohammed Gamal Sept. 21, 2009, 11:50 a.m. UTC | #5
>> Good point. But at least we can still show registers, since that also
>> can give some diagnostic information, no?
>
> No fundamental concerns. Just move the call into handle_unhandled.
>
handle_unhandled() doesn't get the vcpu passed to it, so it'd be
better we keep kvm_show_regs() at the caller.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Avi Kivity Sept. 21, 2009, 11:51 a.m. UTC | #6
On 09/21/2009 02:31 PM, Mohammed Gamal wrote:
>
>> Don't we currently suspend the VM on unknown exits? This is more useful
>> than aborting as it allows to
>>   - disassemble the problematic code
>>   - poke around in the RAM
>>   - look at other VCPUs
>>   - attach a debugger to qemu
>>   - ...
>>
>>      
> Good point. But at least we can still show registers, since that also
> can give some diagnostic information, no?
>    

There's 'info registers' for that.
diff mbox

Patch

diff --git a/qemu-kvm.c b/qemu-kvm.c
index 0afdb56..c22c28a 100644
--- a/qemu-kvm.c
+++ b/qemu-kvm.c
@@ -1015,6 +1015,8 @@  int kvm_run(kvm_vcpu_context_t vcpu, void *env)
         switch (run->exit_reason) {
         case KVM_EXIT_UNKNOWN:
             r = handle_unhandled(run->hw.hardware_exit_reason);
+            kvm_show_regs(vcpu);
+            abort();
             break;
         case KVM_EXIT_FAIL_ENTRY:
             r = handle_unhandled(run->fail_entry.hardware_entry_failure_reason);