From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K0dxl-0005sq-V8 for qemu-devel@nongnu.org; Mon, 26 May 2008 10:46:14 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K0dxk-0005r0-2Q for qemu-devel@nongnu.org; Mon, 26 May 2008 10:46:13 -0400 Received: from [199.232.76.173] (port=54839 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K0dxj-0005qi-LB for qemu-devel@nongnu.org; Mon, 26 May 2008 10:46:11 -0400 Received: from lizzard.sbs.de ([194.138.37.39]:20093) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1K0dxi-00060y-24 for qemu-devel@nongnu.org; Mon, 26 May 2008 10:46:10 -0400 Received: from mail1.sbs.de (localhost [127.0.0.1]) by lizzard.sbs.de (8.12.11.20060308/8.12.11) with ESMTP id m4QEk6f7024770 for ; Mon, 26 May 2008 16:46:06 +0200 Received: from [139.25.109.167] (mchn012c.mchp.siemens.de [139.25.109.167] (may be forged)) by mail1.sbs.de (8.12.11.20060308/8.12.11) with ESMTP id m4QEk5w9025353 for ; Mon, 26 May 2008 16:46:06 +0200 Message-ID: <483ACD2C.5090004@siemens.com> Date: Mon, 26 May 2008 16:46:04 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <47EE86E0.4070703@reactos.org> <9C7667CB-2CF0-4AC0-843B-6EF442196CAC@csgraf.de> <47F0B445.4030806@suse.de> <4804D254.5040301@siemens.com> <4805F4B0.5020802@siemens.com> <4806009E.8060407@suse.de> <48060ACC.2020309@siemens.com> <48060E28.7000606@suse.de> <480613D3.3080509@suse.de> <4808AAD3.5080405@codemonkey.ws> <480C803D.7050100@suse.de> In-Reply-To: <480C803D.7050100@suse.de> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH] x86: Reboot CPU on triple fault - Version 6 Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org To pick this up again, as the problem is still unfixed: Kevin Wolf wrote: > Anthony Liguori schrieb: >>> Index: dyngen-exec.h >>> =================================================================== >>> --- dyngen-exec.h (Revision 4215) >>> +++ dyngen-exec.h (Arbeitskopie) >>> @@ -86,6 +86,7 @@ >>> extern int fprintf(FILE *, const char *, ...); >>> extern int fputs(const char *, FILE *); >>> extern int printf(const char *, ...); >>> +extern FILE *stderr; >>> >> This is unnecessary. > > Right. I'll fix this with the next version. To accelerate this "a bit" ;), I attached a refreshed version of your patch. > >>> + >>> + qemu_system_reset_request(); >>> >> This isn't the right function to use here. If we supported ACPI >> shutdown, this would generate an ACPI shutdown request. You probably >> want to just do: >> >> cpu_interrupt(env, CPU_INTERRUPT_EXIT); > > Your suggestion doesn't work for me either. qemu keeps hanging producing > lots of triple faults, but there is no CPU reset. Is there even a > function to correctly request a CPU reset only? Directly calling > cpu_reset doesn't work here. IMHO, qemu_system_reset_request is the right way to raise a system-wide hard reset. I actually don't see any relation to ACPI at this lowest level. Jan --- cpu-all.h | 1 + exec.c | 2 ++ target-i386/helper.c | 18 ++++++++++++++++-- target-i386/helper2.c | 5 +++++ 4 files changed, 24 insertions(+), 2 deletions(-) Index: b/exec.c =================================================================== --- a/exec.c +++ b/exec.c @@ -1302,6 +1302,8 @@ CPULogItem cpu_log_items[] = { #ifdef TARGET_I386 { CPU_LOG_PCALL, "pcall", "show protected mode far calls/returns/exceptions" }, + { CPU_LOG_RESET, "cpu_reset", + "show CPU state before CPU resets" }, #endif #ifdef DEBUG_IOPORT { CPU_LOG_IOPORT, "ioport", Index: b/target-i386/helper.c =================================================================== --- a/target-i386/helper.c +++ b/target-i386/helper.c @@ -1261,6 +1261,9 @@ void do_interrupt(int intno, int is_int, } } +/* 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. @@ -1278,8 +1281,19 @@ static int check_exception(int intno, in fprintf(logfile, "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 (env->old_exception == EXCP08_DBLE) { + if(env->intercept & INTERCEPT_SVM_MASK) { + /* most probably the virtual machine should not + be shut down but rather caught by the VMM */ + vmexit(SVM_EXIT_SHUTDOWN, 0); + } + + if (loglevel & CPU_LOG_RESET) + fprintf(logfile, "Triple fault\n"); + + qemu_system_reset_request(); + return EXCP_HLT; + } if ((first_contributory && second_contributory) || (env->old_exception == EXCP0E_PAGE && Index: b/target-i386/helper2.c =================================================================== --- a/target-i386/helper2.c +++ b/target-i386/helper2.c @@ -363,6 +363,11 @@ void cpu_reset(CPUX86State *env) { int i; + if (loglevel & CPU_LOG_RESET) { + fprintf(logfile, "CPU Reset (CPU %d)\n", env->cpu_index); + cpu_dump_state(env, logfile, fprintf, X86_DUMP_FPU | X86_DUMP_CCOP); + } + memset(env, 0, offsetof(CPUX86State, breakpoints)); tlb_flush(env, 1); Index: b/cpu-all.h =================================================================== --- a/cpu-all.h +++ b/cpu-all.h @@ -824,6 +824,7 @@ target_phys_addr_t cpu_get_phys_page_deb #define CPU_LOG_PCALL (1 << 6) #define CPU_LOG_IOPORT (1 << 7) #define CPU_LOG_TB_CPU (1 << 8) +#define CPU_LOG_RESET (1 << 9) /* define log items */ typedef struct CPULogItem {