From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: zhenwei pi <pizhenwei@bytedance.com>,
pbonzini@redhat.com, peter.maydell@linaro.org
Cc: mtosatti@redhat.com, armbru@redhat.com, qemu-devel@nongnu.org
Subject: Re: [PATCH v2 1/3] target-i386: seperate MCIP & MCE_MASK error reason
Date: Tue, 22 Sep 2020 12:23:30 +0200 [thread overview]
Message-ID: <dd556664-4419-28d6-e975-6e67724e9c2c@redhat.com> (raw)
In-Reply-To: <20200922095630.394893-2-pizhenwei@bytedance.com>
On 9/22/20 11:56 AM, zhenwei pi wrote:
> Previously we can only get a simple string "Triple fault" in qemu
> log. Add detailed message for the two reasons to describe why qemu
> has to reset the guest.
>
> Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
> ---
> target/i386/helper.c | 25 ++++++++++++++++++-------
> 1 file changed, 18 insertions(+), 7 deletions(-)
>
> diff --git a/target/i386/helper.c b/target/i386/helper.c
> index 70be53e2c3..0c7fd32491 100644
> --- a/target/i386/helper.c
> +++ b/target/i386/helper.c
> @@ -857,6 +857,8 @@ static void do_inject_x86_mce(CPUState *cs, run_on_cpu_data data)
> X86CPU *cpu = X86_CPU(cs);
> CPUX86State *cenv = &cpu->env;
> uint64_t *banks = cenv->mce_banks + 4 * params->bank;
> + char msg[64];
The preferred for is now to use 'g_autofree char *msg = NULL'
here and g_strdup_printf() instead of snprintf().
> + bool need_reset = false;
>
> cpu_synchronize_state(cs);
>
> @@ -894,16 +896,25 @@ static void do_inject_x86_mce(CPUState *cs, run_on_cpu_data data)
> return;
> }
>
> - if ((cenv->mcg_status & MCG_STATUS_MCIP) ||
> - !(cenv->cr[4] & CR4_MCE_MASK)) {
> - monitor_printf(params->mon,
> - "CPU %d: Previous MCE still in progress, raising"
> - " triple fault\n",
> - cs->cpu_index);
> - qemu_log_mask(CPU_LOG_RESET, "Triple fault\n");
> + if (cenv->mcg_status & MCG_STATUS_MCIP) {
> + need_reset = true;
> + snprintf(msg, sizeof(msg), "CPU %d: Previous MCE still in progress,"
> + " raising triple fault", cs->cpu_index);
> + }
> +
> + if (!(cenv->cr[4] & CR4_MCE_MASK)) {
> + need_reset = true;
> + snprintf(msg, sizeof(msg), "CPU %d: MCE capability is not enabled,"
> + " raising triple fault", cs->cpu_index);
> + }
> +
> + if (need_reset) {
> + monitor_printf(params->mon, "%s", msg);
> + qemu_log_mask(CPU_LOG_RESET, "%s\n", msg);
> qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
> return;
> }
> +
> if (banks[1] & MCI_STATUS_VAL) {
> params->status |= MCI_STATUS_OVER;
> }
>
next prev parent reply other threads:[~2020-09-22 10:24 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-22 9:56 [PATCH v2 0/3] add MEMORY_FAILURE event zhenwei pi
2020-09-22 9:56 ` [PATCH v2 1/3] target-i386: seperate MCIP & MCE_MASK error reason zhenwei pi
2020-09-22 10:23 ` Philippe Mathieu-Daudé [this message]
2020-09-22 9:56 ` [PATCH v2 2/3] qapi/run-state.json: introduce memory failure event zhenwei pi
2020-09-22 9:56 ` [PATCH v2 3/3] target-i386: post memory failure event to uplayer zhenwei pi
2020-09-22 10:30 ` Philippe Mathieu-Daudé
2020-09-23 3:12 ` [External] " zhenwei pi
2020-09-22 15:40 ` [PATCH v2 0/3] add MEMORY_FAILURE event no-reply
2020-09-28 12:01 ` PING: " zhenwei pi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=dd556664-4419-28d6-e975-6e67724e9c2c@redhat.com \
--to=philmd@redhat.com \
--cc=armbru@redhat.com \
--cc=mtosatti@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=pizhenwei@bytedance.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).