From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LSaKE-0002pW-No for qemu-devel@nongnu.org; Thu, 29 Jan 2009 12:05:10 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LSaKD-0002o0-0R for qemu-devel@nongnu.org; Thu, 29 Jan 2009 12:05:10 -0500 Received: from [199.232.76.173] (port=59373 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LSaKC-0002nq-Q3 for qemu-devel@nongnu.org; Thu, 29 Jan 2009 12:05:08 -0500 Received: from ey-out-1920.google.com ([74.125.78.150]:21632) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LSaKC-00067s-70 for qemu-devel@nongnu.org; Thu, 29 Jan 2009 12:05:08 -0500 Received: by ey-out-1920.google.com with SMTP id 5so2035eyb.46 for ; Thu, 29 Jan 2009 09:05:06 -0800 (PST) Message-ID: <4981E1B1.6070008@codemonkey.ws> Date: Thu, 29 Jan 2009 11:04:49 -0600 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [6453] x86: Issue reset on triple faults (Jan Kiszka) References: <497EDEC2.8020805@suse.de> <497EE0DF.9050102@siemens.com> <497EE312.5090406@suse.de> <497EE274.3040400@siemens.com> In-Reply-To: <497EE274.3040400@siemens.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jan Kiszka Cc: Kevin Wolf , qemu-devel@nongnu.org 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 >>>>> Signed-off-by: Anthony Liguori >>>>> >>>>> 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 >>> >>> 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 > 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; >