[6453] x86: Issue reset on triple faults (Jan Kiszka)
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.
Modified Paths:
--------------
trunk/target-i386/op_helper.c
Modified: trunk/target-i386/op_helper.c
===================================================================
target-i386/op_helper.c +15 -2
@@ -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 )))) {
Quoted 38 lines · Anthony Liguori
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_RESETis set.Signed-off-by Jan Kiszka <[email protected]>Signed-off-by Anthony Liguori <[email protected]>Modified Paths:
--------------trunk/target-i386/op_helper.cModified:
trunk/target-i386/op_helper.c
===================================================================target-i386/op_helper.c +3
-0@@ -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);
target-i386/op_helper.c line 1279
Quoted 10 lines
target-i386/op_helper.c +6
-2-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
Quoted 47 lines · Kevin Wolf
Quoted 46 lines · Anthony Liguori
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_RESETis set.Signed-off-by Jan Kiszka <[email protected]>Signed-off-by Anthony Liguori <[email protected]>Modified Paths:
--------------trunk/target-i386/op_helper.cModified:
trunk/target-i386/op_helper.c
===================================================================target-i386/op_helper.c +7
-2@@ -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 */
Quoted 4 lines
target-i386/op_helper.c line 1279
Quoted 2 lines
target-i386/op_helper.c +2
-0+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.
target-i386/op_helper.c +1 -1
@@ -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 ();
Quoted 65 lines · Jan Kiszka
Quoted 47 lines · Kevin Wolf
Quoted 46 lines · Anthony Liguori
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_RESETis set.Signed-off-by Jan Kiszka <[email protected]>Signed-off-by Anthony Liguori <[email protected]>Modified Paths:
--------------trunk/target-i386/op_helper.cModified:
trunk/target-i386/op_helper.c
===================================================================target-i386/op_helper.c +7
-2@@ -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 */ Quoted 3 lines
target-i386/op_helper.c line 1279
Quoted 2 lines
target-i386/op_helper.c +2
-0+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 <[email protected]>target-i386/op_helper.c +0
-0
target-i386/op_helper.c static int check_exception(int intno, int *error_code) · line 1281
Quoted 8 lines
target-i386/op_helper.c +1
-1@@ -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
Quoted 72 lines · Kevin Wolf
Quoted 71 lines · Jan Kiszka
Quoted 47 lines · Kevin Wolf
Quoted 46 lines · Anthony Liguori
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_RESETis set.Signed-off-by Jan Kiszka <[email protected]>Signed-off-by Anthony Liguori <[email protected]>Modified Paths:
--------------trunk/target-i386/op_helper.cModified:
trunk/target-i386/op_helper.c
===================================================================target-i386/op_helper.c +7
-2@@ -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 */ Quoted 3 lines
target-i386/op_helper.c line 1279
Quoted 2 lines
target-i386/op_helper.c +2
-0+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 <[email protected]>target-i386/op_helper.c +1
-1@@ -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" );
Quoted 6 lines
target-i386/op_helper.c static int check_exception(int intno, int *error_code) · line 1281
Quoted 1 line
target-i386/op_helper.c +0
-0qemu_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.
target-i386/op_helper.c +1 -2
@@ -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 ;
Anthony Liguori
AppliedQuoted 83 lines · Jan Kiszka
Quoted 81 lines · Kevin Wolf
Quoted 69 lines · Jan Kiszka
Quoted 48 lines · Kevin Wolf
Quoted 46 lines · Anthony Liguori
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_RESETis set.Signed-off-by Jan Kiszka <[email protected]>Signed-off-by Anthony Liguori <[email protected]>Modified Paths:
--------------trunk/target-i386/op_helper.cModified:
trunk/target-i386/op_helper.c
===================================================================target-i386/op_helper.c +7
-2@@ -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 */ Quoted 5 lines
target-i386/op_helper.c line 1280
Quoted 3 lines
target-i386/op_helper.c +2
-0+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 <[email protected]>target-i386/op_helper.c +0
-0target-i386/op_helper.c static int check_exception(int intno, int *error_code) · line 1281
Quoted 8 lines
target-i386/op_helper.c +1
-1@@ -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. ;-)
Quoted 8 lines
Quoted 3 lines
qemu_log_mask(CPU_LOG_RESET, "Triple fault\n")should do the right thing.Use new logging API.
Signed-off-by Jan Kiszka <[email protected]>
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
Quoted 15 lines
target-i386/op_helper.c +1
-2@@ -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 ;
Quoted 98 lines · Anthony Liguori
Quoted 97 lines · Jan Kiszka
Quoted 84 lines · Kevin Wolf
Quoted 82 lines · Jan Kiszka
Quoted 54 lines · Kevin Wolf
Quoted 52 lines · Anthony Liguori
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_RESETis set.Signed-off-by Jan Kiszka <[email protected]>Signed-off-by Anthony Liguori <[email protected]>Modified Paths:
--------------trunk/target-i386/op_helper.cModified:
trunk/target-i386/op_helper.c
===================================================================
---trunk/target-i386/op_helper.c2009-01-26 19:54:31 UTC (rev
6452)
+++trunk/target-i386/op_helper.c2009-01-26 19:54:36 UTC (rev
6453)(quoted diff) +1
-0@@ -1251,6 +1251,9 @@ } } +/* This should come from sysemu.h - if we could include ithere... */
(quoted diff) +6
-2+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 notreturn */
Quoted 5 lines
Review
Quoted 3 lines
(quoted diff) +2
-0+ 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 <[email protected]>target-i386/op_helper.c +1
-1@@ -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" );Quoted 8 lines
Quoted 2 lines
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.
Quoted 8 lines
Quoted 2 lines
Signed-off-by Jan Kiszka <[email protected]>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
Signature · 2 lines
Siemens AG, Corporate Technology, CT SE 2 Corporate Competence Center Embedded Linux