From: David Gibson <david@gibson.dropbear.id.au>
To: Ganesh Goudar <ganeshgr@linux.ibm.com>
Cc: mahesh@linux.vnet.ibm.com, qemu-ppc@nongnu.org,
qemu-devel@nongnu.org, npiggin@gmail.com
Subject: Re: [PATCH] target/ppc: Fix wrong interpretation of the disposition flag.
Date: Thu, 9 Apr 2020 10:13:15 +1000 [thread overview]
Message-ID: <20200409001315.GA2896@umbus.fritz.box> (raw)
In-Reply-To: <20200408170944.16003-1-ganeshgr@linux.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 4223 bytes --]
On Wed, Apr 08, 2020 at 10:39:44PM +0530, Ganesh Goudar wrote:
> Bitwise AND with kvm_run->flags to evaluate if we recovered from
> MCE or not is not correct, As disposition in kvm_run->flags is a
> two-bit integer value and not a bit map, So check for equality
> instead of bitwise AND.
>
> Without the fix qemu treats any unrecoverable mce error as recoverable
> and ends up in a mce loop inside the guest, Below are the MCE logs before
> and after the fix.
>
> Before fix:
>
> [ 66.775757] MCE: CPU0: Initiator CPU
> [ 66.775891] MCE: CPU0: Unknown
> [ 66.776587] MCE: CPU0: machine check (Harmless) Host UE Indeterminate [Recovered]
> [ 66.776857] MCE: CPU0: NIP: [c0080000000e00b8] mcetest_tlbie+0xb0/0x128 [mcetest_tlbie]
>
> After fix:
>
> [ 20.650577] CPU: 0 PID: 1415 Comm: insmod Tainted: G M O 5.6.0-fwnmi-arv+ #11
> [ 20.650618] NIP: c0080000023a00e8 LR: c0080000023a00d8 CTR: c000000000021fe0
> [ 20.650660] REGS: c0000001fffd3d70 TRAP: 0200 Tainted: G M O (5.6.0-fwnmi-arv+)
> [ 20.650708] MSR: 8000000002a0b033 <SF,VEC,VSX,EE,FP,ME,IR,DR,RI,LE> CR: 42000222 XER: 20040000
> [ 20.650758] CFAR: c00000000000b940 DAR: c0080000025e00e0 DSISR: 00000200 IRQMASK: 0
> [ 20.650758] GPR00: c0080000023a00d8 c0000001fddd79a0 c0080000023a8500 0000000000000039
> [ 20.650758] GPR04: 0000000000000001 0000000000000000 0000000000000000 0000000000000007
> [ 20.650758] GPR08: 0000000000000007 c0080000025e00e0 0000000000000000 00000000000000f7
> [ 20.650758] GPR12: 0000000000000000 c000000001900000 c00000000101f398 c0080000025c052f
> [ 20.650758] GPR16: 00000000000003a8 c0080000025c0000 c0000001fddd7d70 c0000000015b7940
> [ 20.650758] GPR20: 000000000000fff1 c000000000f72c28 c0080000025a0988 0000000000000000
> [ 20.650758] GPR24: 0000000000000100 c0080000023a05d0 c0000000001f1d70 0000000000000000
> [ 20.650758] GPR28: c0000001fde20000 c0000001fd02b2e0 c0080000023a0000 c0080000025e0000
> [ 20.651178] NIP [c0080000023a00e8] mcetest_tlbie+0xe8/0xf0 [mcetest_tlbie]
> [ 20.651220] LR [c0080000023a00d8] mcetest_tlbie+0xd8/0xf0 [mcetest_tlbie]
> [ 20.651262] Call Trace:
> [ 20.651280] [c0000001fddd79a0] [c0080000023a00d8] mcetest_tlbie+0xd8/0xf0 [mcetest_tlbie] (unreliable)
> [ 20.651340] [c0000001fddd7a10] [c00000000001091c] do_one_initcall+0x6c/0x2c0
> [ 20.651390] [c0000001fddd7af0] [c0000000001f7998] do_init_module+0x90/0x298
> [ 20.651433] [c0000001fddd7b80] [c0000000001f61a8] load_module+0x1f58/0x27a0
> [ 20.651476] [c0000001fddd7d40] [c0000000001f6c70] __do_sys_finit_module+0xe0/0x100
> [ 20.651526] [c0000001fddd7e20] [c00000000000b9d0] system_call+0x5c/0x68
> [ 20.651567] Instruction dump:
> [ 20.651594] e8410018 3c620000 e8638020 480000cd e8410018 3c620000 e8638028 480000bd
> [ 20.651646] e8410018 7be904e4 39400000 612900e0 <7d434a64> 4bffff74 3c4c0001 38428410
> [ 20.651699] ---[ end trace 4c40897f016b4340 ]---
> [ 20.653310]
> Bus error
> [ 20.655575] MCE: CPU0: machine check (Harmless) Host UE Indeterminate [Not recovered]
> [ 20.655575] MCE: CPU0: NIP: [c0080000023a00e8] mcetest_tlbie+0xe8/0xf0 [mcetest_tlbie]
> [ 20.655576] MCE: CPU0: Initiator CPU
> [ 20.655576] MCE: CPU0: Unknown
>
> Signed-off-by: Ganesh Goudar <ganeshgr@linux.ibm.com>
Applied to ppc-for-5.0, thanks.
> ---
> target/ppc/kvm.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
> index 03d0667e8f..2692f76130 100644
> --- a/target/ppc/kvm.c
> +++ b/target/ppc/kvm.c
> @@ -2816,11 +2816,11 @@ int kvm_arch_msi_data_to_gsi(uint32_t data)
> #if defined(TARGET_PPC64)
> int kvm_handle_nmi(PowerPCCPU *cpu, struct kvm_run *run)
> {
> - bool recovered = run->flags & KVM_RUN_PPC_NMI_DISP_FULLY_RECOV;
> + uint16_t flags = run->flags & KVM_RUN_PPC_NMI_DISP_MASK;
>
> cpu_synchronize_state(CPU(cpu));
>
> - spapr_mce_req_event(cpu, recovered);
> + spapr_mce_req_event(cpu, flags == KVM_RUN_PPC_NMI_DISP_FULLY_RECOV);
>
> return 0;
> }
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
prev parent reply other threads:[~2020-04-09 0:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-08 17:09 [PATCH] target/ppc: Fix wrong interpretation of the disposition flag Ganesh Goudar
2020-04-09 0:13 ` David Gibson [this message]
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=20200409001315.GA2896@umbus.fritz.box \
--to=david@gibson.dropbear.id.au \
--cc=ganeshgr@linux.ibm.com \
--cc=mahesh@linux.vnet.ibm.com \
--cc=npiggin@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@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).