qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [6453] x86: Issue reset on triple faults (Jan Kiszka)
@ 2009-01-26 19:54 Anthony Liguori
  2009-01-27 10:15 ` Kevin Wolf
  0 siblings, 1 reply; 7+ messages in thread
From: Anthony Liguori @ 2009-01-26 19:54 UTC (permalink / raw)
  To: qemu-devel

Revision: 6453
          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6453
Author:   aliguori
Date:     2009-01-26 19:54:36 +0000 (Mon, 26 Jan 2009)

Log Message:
-----------
x86: Issue reset on triple faults (Jan Kiszka)

As discussed a few times on this list: A triple fault causes a system
reset on x86, and some guests make use of this (e.g. 386BSD). To keep
the chance of tracing unexpected resets, log them if CPU_LOG_RESET is
set.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

Modified Paths:
--------------
    trunk/target-i386/op_helper.c

Modified: trunk/target-i386/op_helper.c
===================================================================
--- trunk/target-i386/op_helper.c	2009-01-26 19:54:31 UTC (rev 6452)
+++ trunk/target-i386/op_helper.c	2009-01-26 19:54:36 UTC (rev 6453)
@@ -1251,6 +1251,9 @@
     }
 }
 
+/* This should come from sysemu.h - if we could include it here... */
+void qemu_system_reset_request(void);
+
 /*
  * Check nested exceptions and change to double or triple fault if
  * needed. It should only be called, if this is not an interrupt.
@@ -1267,9 +1270,19 @@
     qemu_log_mask(CPU_LOG_INT, "check_exception old: 0x%x new 0x%x\n",
                 env->old_exception, intno);
 
-    if (env->old_exception == EXCP08_DBLE)
-        cpu_abort(env, "triple fault");
+#if !defined(CONFIG_USER_ONLY)
+    if (env->old_exception == EXCP08_DBLE) {
+        if (env->hflags & HF_SVMI_MASK)
+            helper_vmexit(SVM_EXIT_SHUTDOWN, 0); /* does not return */
 
+        if (loglevel & CPU_LOG_RESET)
+            fprintf(logfile, "Triple fault\n");
+
+        qemu_system_reset_request();
+        return EXCP_HLT;
+    }
+#endif
+
     if ((first_contributory && second_contributory)
         || (env->old_exception == EXCP0E_PAGE &&
             (second_contributory || (intno == EXCP0E_PAGE)))) {

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [6453] x86: Issue reset on triple faults (Jan Kiszka)
  2009-01-26 19:54 [Qemu-devel] [6453] x86: Issue reset on triple faults (Jan Kiszka) Anthony Liguori
@ 2009-01-27 10:15 ` Kevin Wolf
  2009-01-27 10:24   ` Jan Kiszka
  0 siblings, 1 reply; 7+ messages in thread
From: Kevin Wolf @ 2009-01-27 10:15 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: qemu-devel

Anthony Liguori schrieb:
> Revision: 6453
>           http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6453
> Author:   aliguori
> Date:     2009-01-26 19:54:36 +0000 (Mon, 26 Jan 2009)
> 
> Log Message:
> -----------
> x86: Issue reset on triple faults (Jan Kiszka)
> 
> As discussed a few times on this list: A triple fault causes a system
> reset on x86, and some guests make use of this (e.g. 386BSD). To keep
> the chance of tracing unexpected resets, log them if CPU_LOG_RESET is
> set.
> 
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
> 
> Modified Paths:
> --------------
>     trunk/target-i386/op_helper.c
> 
> Modified: trunk/target-i386/op_helper.c
> ===================================================================
> --- trunk/target-i386/op_helper.c	2009-01-26 19:54:31 UTC (rev 6452)
> +++ trunk/target-i386/op_helper.c	2009-01-26 19:54:36 UTC (rev 6453)
> @@ -1251,6 +1251,9 @@
>      }
>  }
>  
> +/* This should come from sysemu.h - if we could include it here... */
> +void qemu_system_reset_request(void);
> +
>  /*
>   * Check nested exceptions and change to double or triple fault if
>   * needed. It should only be called, if this is not an interrupt.
> @@ -1267,9 +1270,19 @@
>      qemu_log_mask(CPU_LOG_INT, "check_exception old: 0x%x new 0x%x\n",
>                  env->old_exception, intno);
>  
> -    if (env->old_exception == EXCP08_DBLE)
> -        cpu_abort(env, "triple fault");
> +#if !defined(CONFIG_USER_ONLY)
> +    if (env->old_exception == EXCP08_DBLE) {
> +        if (env->hflags & HF_SVMI_MASK)
> +            helper_vmexit(SVM_EXIT_SHUTDOWN, 0); /* does not return */
>  
> +        if (loglevel & CPU_LOG_RESET)
> +            fprintf(logfile, "Triple fault\n");

I think this one should use the new logging macros as well.

Kevin

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [6453] x86: Issue reset on triple faults (Jan Kiszka)
  2009-01-27 10:15 ` Kevin Wolf
@ 2009-01-27 10:24   ` Jan Kiszka
  2009-01-27 10:33     ` Kevin Wolf
  0 siblings, 1 reply; 7+ messages in thread
From: Jan Kiszka @ 2009-01-27 10:24 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: qemu-devel

Kevin Wolf wrote:
> Anthony Liguori schrieb:
>> Revision: 6453
>>           http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6453
>> Author:   aliguori
>> Date:     2009-01-26 19:54:36 +0000 (Mon, 26 Jan 2009)
>>
>> Log Message:
>> -----------
>> x86: Issue reset on triple faults (Jan Kiszka)
>>
>> As discussed a few times on this list: A triple fault causes a system
>> reset on x86, and some guests make use of this (e.g. 386BSD). To keep
>> the chance of tracing unexpected resets, log them if CPU_LOG_RESET is
>> set.
>>
>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
>>
>> Modified Paths:
>> --------------
>>     trunk/target-i386/op_helper.c
>>
>> Modified: trunk/target-i386/op_helper.c
>> ===================================================================
>> --- trunk/target-i386/op_helper.c	2009-01-26 19:54:31 UTC (rev 6452)
>> +++ trunk/target-i386/op_helper.c	2009-01-26 19:54:36 UTC (rev 6453)
>> @@ -1251,6 +1251,9 @@
>>      }
>>  }
>>  
>> +/* This should come from sysemu.h - if we could include it here... */
>> +void qemu_system_reset_request(void);
>> +
>>  /*
>>   * Check nested exceptions and change to double or triple fault if
>>   * needed. It should only be called, if this is not an interrupt.
>> @@ -1267,9 +1270,19 @@
>>      qemu_log_mask(CPU_LOG_INT, "check_exception old: 0x%x new 0x%x\n",
>>                  env->old_exception, intno);
>>  
>> -    if (env->old_exception == EXCP08_DBLE)
>> -        cpu_abort(env, "triple fault");
>> +#if !defined(CONFIG_USER_ONLY)
>> +    if (env->old_exception == EXCP08_DBLE) {
>> +        if (env->hflags & HF_SVMI_MASK)
>> +            helper_vmexit(SVM_EXIT_SHUTDOWN, 0); /* does not return */
>>  
>> +        if (loglevel & CPU_LOG_RESET)
>> +            fprintf(logfile, "Triple fault\n");
> 
> I think this one should use the new logging macros as well.

Or in other words:

--------->

Use new logging API.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>

diff --git a/target-i386/op_helper.c b/target-i386/op_helper.c
index 8cf3bb2..edf569e 100644
--- a/target-i386/op_helper.c
+++ b/target-i386/op_helper.c
@@ -1275,7 +1275,7 @@ static int check_exception(int intno, int *error_code)
         if (env->hflags & HF_SVMI_MASK)
             helper_vmexit(SVM_EXIT_SHUTDOWN, 0); /* does not return */
 
-        if (loglevel & CPU_LOG_RESET)
+        if (qemu_loglevel_mask(CPU_LOG_RESET))
             fprintf(logfile, "Triple fault\n");
 
         qemu_system_reset_request();

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [6453] x86: Issue reset on triple faults (Jan Kiszka)
  2009-01-27 10:33     ` Kevin Wolf
@ 2009-01-27 10:31       ` Jan Kiszka
  2009-01-29 17:04         ` Anthony Liguori
  0 siblings, 1 reply; 7+ messages in thread
From: Jan Kiszka @ 2009-01-27 10:31 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: qemu-devel

Kevin Wolf wrote:
> Jan Kiszka schrieb:
>> Kevin Wolf wrote:
>>> Anthony Liguori schrieb:
>>>> Revision: 6453
>>>>           http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6453
>>>> Author:   aliguori
>>>> Date:     2009-01-26 19:54:36 +0000 (Mon, 26 Jan 2009)
>>>>
>>>> Log Message:
>>>> -----------
>>>> x86: Issue reset on triple faults (Jan Kiszka)
>>>>
>>>> As discussed a few times on this list: A triple fault causes a system
>>>> reset on x86, and some guests make use of this (e.g. 386BSD). To keep
>>>> the chance of tracing unexpected resets, log them if CPU_LOG_RESET is
>>>> set.
>>>>
>>>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>>>> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
>>>>
>>>> Modified Paths:
>>>> --------------
>>>>     trunk/target-i386/op_helper.c
>>>>
>>>> Modified: trunk/target-i386/op_helper.c
>>>> ===================================================================
>>>> --- trunk/target-i386/op_helper.c	2009-01-26 19:54:31 UTC (rev 6452)
>>>> +++ trunk/target-i386/op_helper.c	2009-01-26 19:54:36 UTC (rev 6453)
>>>> @@ -1251,6 +1251,9 @@
>>>>      }
>>>>  }
>>>>  
>>>> +/* This should come from sysemu.h - if we could include it here... */
>>>> +void qemu_system_reset_request(void);
>>>> +
>>>>  /*
>>>>   * Check nested exceptions and change to double or triple fault if
>>>>   * needed. It should only be called, if this is not an interrupt.
>>>> @@ -1267,9 +1270,19 @@
>>>>      qemu_log_mask(CPU_LOG_INT, "check_exception old: 0x%x new 0x%x\n",
>>>>                  env->old_exception, intno);
>>>>  
>>>> -    if (env->old_exception == EXCP08_DBLE)
>>>> -        cpu_abort(env, "triple fault");
>>>> +#if !defined(CONFIG_USER_ONLY)
>>>> +    if (env->old_exception == EXCP08_DBLE) {
>>>> +        if (env->hflags & HF_SVMI_MASK)
>>>> +            helper_vmexit(SVM_EXIT_SHUTDOWN, 0); /* does not return */
>>>>  
>>>> +        if (loglevel & CPU_LOG_RESET)
>>>> +            fprintf(logfile, "Triple fault\n");
>>> I think this one should use the new logging macros as well.
>> Or in other words:
>>
>> --------->
>>
>> Use new logging API.
>>
>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>>
>> diff --git a/target-i386/op_helper.c b/target-i386/op_helper.c
>> index 8cf3bb2..edf569e 100644
>> --- a/target-i386/op_helper.c
>> +++ b/target-i386/op_helper.c
>> @@ -1275,7 +1275,7 @@ static int check_exception(int intno, int *error_code)
>>          if (env->hflags & HF_SVMI_MASK)
>>              helper_vmexit(SVM_EXIT_SHUTDOWN, 0); /* does not return */
>>  
>> -        if (loglevel & CPU_LOG_RESET)
>> +        if (qemu_loglevel_mask(CPU_LOG_RESET))
>>              fprintf(logfile, "Triple fault\n");
>>  
>>          qemu_system_reset_request();
> 
> Well, no. There's still a fprintf on logfile. ;-)
> 
> qemu_log_mask(CPU_LOG_RESET, "Triple fault\n") should do the right thing.
> 

Use new logging API.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>

diff --git a/target-i386/op_helper.c b/target-i386/op_helper.c
index 8cf3bb2..9e73b1e 100644
--- a/target-i386/op_helper.c
+++ b/target-i386/op_helper.c
@@ -1275,8 +1275,7 @@ static int check_exception(int intno, int *error_code)
         if (env->hflags & HF_SVMI_MASK)
             helper_vmexit(SVM_EXIT_SHUTDOWN, 0); /* does not return */
 
-        if (loglevel & CPU_LOG_RESET)
-            fprintf(logfile, "Triple fault\n");
+        qemu_log_mask(CPU_LOG_RESET, "Triple fault\n");
 
         qemu_system_reset_request();
         return EXCP_HLT;

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [6453] x86: Issue reset on triple faults (Jan Kiszka)
  2009-01-27 10:24   ` Jan Kiszka
@ 2009-01-27 10:33     ` Kevin Wolf
  2009-01-27 10:31       ` Jan Kiszka
  0 siblings, 1 reply; 7+ messages in thread
From: Kevin Wolf @ 2009-01-27 10:33 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: qemu-devel

Jan Kiszka schrieb:
> Kevin Wolf wrote:
>> Anthony Liguori schrieb:
>>> Revision: 6453
>>>           http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6453
>>> Author:   aliguori
>>> Date:     2009-01-26 19:54:36 +0000 (Mon, 26 Jan 2009)
>>>
>>> Log Message:
>>> -----------
>>> x86: Issue reset on triple faults (Jan Kiszka)
>>>
>>> As discussed a few times on this list: A triple fault causes a system
>>> reset on x86, and some guests make use of this (e.g. 386BSD). To keep
>>> the chance of tracing unexpected resets, log them if CPU_LOG_RESET is
>>> set.
>>>
>>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>>> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
>>>
>>> Modified Paths:
>>> --------------
>>>     trunk/target-i386/op_helper.c
>>>
>>> Modified: trunk/target-i386/op_helper.c
>>> ===================================================================
>>> --- trunk/target-i386/op_helper.c	2009-01-26 19:54:31 UTC (rev 6452)
>>> +++ trunk/target-i386/op_helper.c	2009-01-26 19:54:36 UTC (rev 6453)
>>> @@ -1251,6 +1251,9 @@
>>>      }
>>>  }
>>>  
>>> +/* This should come from sysemu.h - if we could include it here... */
>>> +void qemu_system_reset_request(void);
>>> +
>>>  /*
>>>   * Check nested exceptions and change to double or triple fault if
>>>   * needed. It should only be called, if this is not an interrupt.
>>> @@ -1267,9 +1270,19 @@
>>>      qemu_log_mask(CPU_LOG_INT, "check_exception old: 0x%x new 0x%x\n",
>>>                  env->old_exception, intno);
>>>  
>>> -    if (env->old_exception == EXCP08_DBLE)
>>> -        cpu_abort(env, "triple fault");
>>> +#if !defined(CONFIG_USER_ONLY)
>>> +    if (env->old_exception == EXCP08_DBLE) {
>>> +        if (env->hflags & HF_SVMI_MASK)
>>> +            helper_vmexit(SVM_EXIT_SHUTDOWN, 0); /* does not return */
>>>  
>>> +        if (loglevel & CPU_LOG_RESET)
>>> +            fprintf(logfile, "Triple fault\n");
>> I think this one should use the new logging macros as well.
> 
> Or in other words:
> 
> --------->
> 
> Use new logging API.
> 
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> 
> diff --git a/target-i386/op_helper.c b/target-i386/op_helper.c
> index 8cf3bb2..edf569e 100644
> --- a/target-i386/op_helper.c
> +++ b/target-i386/op_helper.c
> @@ -1275,7 +1275,7 @@ static int check_exception(int intno, int *error_code)
>          if (env->hflags & HF_SVMI_MASK)
>              helper_vmexit(SVM_EXIT_SHUTDOWN, 0); /* does not return */
>  
> -        if (loglevel & CPU_LOG_RESET)
> +        if (qemu_loglevel_mask(CPU_LOG_RESET))
>              fprintf(logfile, "Triple fault\n");
>  
>          qemu_system_reset_request();

Well, no. There's still a fprintf on logfile. ;-)

qemu_log_mask(CPU_LOG_RESET, "Triple fault\n") should do the right thing.

Kevin

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [6453] x86: Issue reset on triple faults (Jan Kiszka)
  2009-01-27 10:31       ` Jan Kiszka
@ 2009-01-29 17:04         ` Anthony Liguori
  2009-01-29 17:21           ` Jan Kiszka
  0 siblings, 1 reply; 7+ messages in thread
From: Anthony Liguori @ 2009-01-29 17:04 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: Kevin Wolf, qemu-devel

Jan Kiszka wrote:
> Kevin Wolf wrote:
>   
>> Jan Kiszka schrieb:
>>     
>>> Kevin Wolf wrote:
>>>       
>>>> Anthony Liguori schrieb:
>>>>         
>>>>> Revision: 6453
>>>>>           http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6453
>>>>> Author:   aliguori
>>>>> Date:     2009-01-26 19:54:36 +0000 (Mon, 26 Jan 2009)
>>>>>
>>>>> Log Message:
>>>>> -----------
>>>>> x86: Issue reset on triple faults (Jan Kiszka)
>>>>>
>>>>> As discussed a few times on this list: A triple fault causes a system
>>>>> reset on x86, and some guests make use of this (e.g. 386BSD). To keep
>>>>> the chance of tracing unexpected resets, log them if CPU_LOG_RESET is
>>>>> set.
>>>>>
>>>>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>>>>> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
>>>>>
>>>>> Modified Paths:
>>>>> --------------
>>>>>     trunk/target-i386/op_helper.c
>>>>>
>>>>> Modified: trunk/target-i386/op_helper.c
>>>>> ===================================================================
>>>>> --- trunk/target-i386/op_helper.c	2009-01-26 19:54:31 UTC (rev 6452)
>>>>> +++ trunk/target-i386/op_helper.c	2009-01-26 19:54:36 UTC (rev 6453)
>>>>> @@ -1251,6 +1251,9 @@
>>>>>      }
>>>>>  }
>>>>>  
>>>>> +/* This should come from sysemu.h - if we could include it here... */
>>>>> +void qemu_system_reset_request(void);
>>>>> +
>>>>>  /*
>>>>>   * Check nested exceptions and change to double or triple fault if
>>>>>   * needed. It should only be called, if this is not an interrupt.
>>>>> @@ -1267,9 +1270,19 @@
>>>>>      qemu_log_mask(CPU_LOG_INT, "check_exception old: 0x%x new 0x%x\n",
>>>>>                  env->old_exception, intno);
>>>>>  
>>>>> -    if (env->old_exception == EXCP08_DBLE)
>>>>> -        cpu_abort(env, "triple fault");
>>>>> +#if !defined(CONFIG_USER_ONLY)
>>>>> +    if (env->old_exception == EXCP08_DBLE) {
>>>>> +        if (env->hflags & HF_SVMI_MASK)
>>>>> +            helper_vmexit(SVM_EXIT_SHUTDOWN, 0); /* does not return */
>>>>>  
>>>>> +        if (loglevel & CPU_LOG_RESET)
>>>>> +            fprintf(logfile, "Triple fault\n");
>>>>>           
>>>> I think this one should use the new logging macros as well.
>>>>         
>>> Or in other words:
>>>
>>> --------->
>>>
>>> Use new logging API.
>>>
>>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>>>
>>> diff --git a/target-i386/op_helper.c b/target-i386/op_helper.c
>>> index 8cf3bb2..edf569e 100644
>>> --- a/target-i386/op_helper.c
>>> +++ b/target-i386/op_helper.c
>>> @@ -1275,7 +1275,7 @@ static int check_exception(int intno, int *error_code)
>>>          if (env->hflags & HF_SVMI_MASK)
>>>              helper_vmexit(SVM_EXIT_SHUTDOWN, 0); /* does not return */
>>>  
>>> -        if (loglevel & CPU_LOG_RESET)
>>> +        if (qemu_loglevel_mask(CPU_LOG_RESET))
>>>              fprintf(logfile, "Triple fault\n");
>>>  
>>>          qemu_system_reset_request();
>>>       
>> Well, no. There's still a fprintf on logfile. ;-)
>>
>> qemu_log_mask(CPU_LOG_RESET, "Triple fault\n") should do the right thing.
>>
>>     
>
> Use new logging API.
>
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>   

Applied.  Thanks.

FWIW, it's easier for me to apply patches that have a [PATCH] in the 
subject.  Even if it's a reply to a thread, it's helpful to rewrite the 
subject.  Easier to apply == applied more quickly :-)

Regards,

Anthony Liguori

> diff --git a/target-i386/op_helper.c b/target-i386/op_helper.c
> index 8cf3bb2..9e73b1e 100644
> --- a/target-i386/op_helper.c
> +++ b/target-i386/op_helper.c
> @@ -1275,8 +1275,7 @@ static int check_exception(int intno, int *error_code)
>          if (env->hflags & HF_SVMI_MASK)
>              helper_vmexit(SVM_EXIT_SHUTDOWN, 0); /* does not return */
>  
> -        if (loglevel & CPU_LOG_RESET)
> -            fprintf(logfile, "Triple fault\n");
> +        qemu_log_mask(CPU_LOG_RESET, "Triple fault\n");
>  
>          qemu_system_reset_request();
>          return EXCP_HLT;
>   

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [6453] x86: Issue reset on triple faults (Jan Kiszka)
  2009-01-29 17:04         ` Anthony Liguori
@ 2009-01-29 17:21           ` Jan Kiszka
  0 siblings, 0 replies; 7+ messages in thread
From: Jan Kiszka @ 2009-01-29 17:21 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: Kevin Wolf, qemu-devel

Anthony Liguori wrote:
> Jan Kiszka wrote:
>> Kevin Wolf wrote:
>>  
>>> Jan Kiszka schrieb:
>>>    
>>>> Kevin Wolf wrote:
>>>>      
>>>>> Anthony Liguori schrieb:
>>>>>        
>>>>>> Revision: 6453
>>>>>>          
>>>>>> http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6453
>>>>>> Author:   aliguori
>>>>>> Date:     2009-01-26 19:54:36 +0000 (Mon, 26 Jan 2009)
>>>>>>
>>>>>> Log Message:
>>>>>> -----------
>>>>>> x86: Issue reset on triple faults (Jan Kiszka)
>>>>>>
>>>>>> As discussed a few times on this list: A triple fault causes a system
>>>>>> reset on x86, and some guests make use of this (e.g. 386BSD). To keep
>>>>>> the chance of tracing unexpected resets, log them if CPU_LOG_RESET is
>>>>>> set.
>>>>>>
>>>>>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>>>>>> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
>>>>>>
>>>>>> Modified Paths:
>>>>>> --------------
>>>>>>     trunk/target-i386/op_helper.c
>>>>>>
>>>>>> Modified: trunk/target-i386/op_helper.c
>>>>>> ===================================================================
>>>>>> --- trunk/target-i386/op_helper.c    2009-01-26 19:54:31 UTC (rev
>>>>>> 6452)
>>>>>> +++ trunk/target-i386/op_helper.c    2009-01-26 19:54:36 UTC (rev
>>>>>> 6453)
>>>>>> @@ -1251,6 +1251,9 @@
>>>>>>      }
>>>>>>  }
>>>>>>  
>>>>>> +/* This should come from sysemu.h - if we could include it
>>>>>> here... */
>>>>>> +void qemu_system_reset_request(void);
>>>>>> +
>>>>>>  /*
>>>>>>   * Check nested exceptions and change to double or triple fault if
>>>>>>   * needed. It should only be called, if this is not an interrupt.
>>>>>> @@ -1267,9 +1270,19 @@
>>>>>>      qemu_log_mask(CPU_LOG_INT, "check_exception old: 0x%x new
>>>>>> 0x%x\n",
>>>>>>                  env->old_exception, intno);
>>>>>>  
>>>>>> -    if (env->old_exception == EXCP08_DBLE)
>>>>>> -        cpu_abort(env, "triple fault");
>>>>>> +#if !defined(CONFIG_USER_ONLY)
>>>>>> +    if (env->old_exception == EXCP08_DBLE) {
>>>>>> +        if (env->hflags & HF_SVMI_MASK)
>>>>>> +            helper_vmexit(SVM_EXIT_SHUTDOWN, 0); /* does not
>>>>>> return */
>>>>>>  
>>>>>> +        if (loglevel & CPU_LOG_RESET)
>>>>>> +            fprintf(logfile, "Triple fault\n");
>>>>>>           
>>>>> I think this one should use the new logging macros as well.
>>>>>         
>>>> Or in other words:
>>>>
>>>> --------->
>>>>
>>>> Use new logging API.
>>>>
>>>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>>>>
>>>> diff --git a/target-i386/op_helper.c b/target-i386/op_helper.c
>>>> index 8cf3bb2..edf569e 100644
>>>> --- a/target-i386/op_helper.c
>>>> +++ b/target-i386/op_helper.c
>>>> @@ -1275,7 +1275,7 @@ static int check_exception(int intno, int
>>>> *error_code)
>>>>          if (env->hflags & HF_SVMI_MASK)
>>>>              helper_vmexit(SVM_EXIT_SHUTDOWN, 0); /* does not return */
>>>>  
>>>> -        if (loglevel & CPU_LOG_RESET)
>>>> +        if (qemu_loglevel_mask(CPU_LOG_RESET))
>>>>              fprintf(logfile, "Triple fault\n");
>>>>  
>>>>          qemu_system_reset_request();
>>>>       
>>> Well, no. There's still a fprintf on logfile. ;-)
>>>
>>> qemu_log_mask(CPU_LOG_RESET, "Triple fault\n") should do the right
>>> thing.
>>>
>>>     
>>
>> Use new logging API.
>>
>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>>   
> 
> Applied.  Thanks.
> 
> FWIW, it's easier for me to apply patches that have a [PATCH] in the
> subject.  Even if it's a reply to a thread, it's helpful to rewrite the
> subject.  Easier to apply == applied more quickly :-)

If it only were that easy... :)

Yeah, will follow this rule now for all patches.

Jan

-- 
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-01-29 17:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-26 19:54 [Qemu-devel] [6453] x86: Issue reset on triple faults (Jan Kiszka) Anthony Liguori
2009-01-27 10:15 ` Kevin Wolf
2009-01-27 10:24   ` Jan Kiszka
2009-01-27 10:33     ` Kevin Wolf
2009-01-27 10:31       ` Jan Kiszka
2009-01-29 17:04         ` Anthony Liguori
2009-01-29 17:21           ` Jan Kiszka

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).