From: Nicholas Piggin <npiggin@gmail.com>
To: qemu-ppc@nongnu.org
Cc: "Aravinda Prasad" <arawinda.p@gmail.com>,
"Alexey Kardashevskiy" <aik@ozlabs.ru>,
qemu-devel@nongnu.org, "Nicholas Piggin" <npiggin@gmail.com>,
"Greg Kurz" <groug@kaod.org>, "Cédric Le Goater" <clg@fr.ibm.com>,
"Ganesh Goudar" <ganeshgr@linux.ibm.com>,
"David Gibson" <david@gibson.dropbear.id.au>
Subject: [PATCH 2/5] ppc/spapr: Improve FWNMI machine check delivery corner case comments
Date: Tue, 17 Mar 2020 15:02:12 +1000 [thread overview]
Message-ID: <20200317050215.159334-3-npiggin@gmail.com> (raw)
In-Reply-To: <20200317050215.159334-1-npiggin@gmail.com>
Some of the conditions are not as clearly documented as they could be.
Also the non-FWNMI case does not need a large comment.
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
hw/ppc/spapr_events.c | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/hw/ppc/spapr_events.c b/hw/ppc/spapr_events.c
index 323fcef4aa..05337f0671 100644
--- a/hw/ppc/spapr_events.c
+++ b/hw/ppc/spapr_events.c
@@ -834,17 +834,13 @@ void spapr_mce_req_event(PowerPCCPU *cpu, bool recovered)
Error *local_err = NULL;
if (spapr->fwnmi_machine_check_addr == -1) {
- /*
- * This implies that we have hit a machine check either when the
- * guest has not registered FWNMI (i.e., "ibm,nmi-register" not
- * called) or between system reset and "ibm,nmi-register".
- * Fall back to the old machine check behavior in such cases.
- */
+ /* Non-FWNMI case, deliver it like an architected CPU interrupt. */
cs->exception_index = POWERPC_EXCP_MCHECK;
ppc_cpu_do_interrupt(cs);
return;
}
+ /* Wait for FWNMI interlock. */
while (spapr->fwnmi_machine_check_interlock != -1) {
/*
* Check whether the same CPU got machine check error
@@ -856,8 +852,13 @@ void spapr_mce_req_event(PowerPCCPU *cpu, bool recovered)
return;
}
qemu_cond_wait_iothread(&spapr->fwnmi_machine_check_interlock_cond);
- /* Meanwhile if the system is reset, then just return */
if (spapr->fwnmi_machine_check_addr == -1) {
+ /*
+ * If the machine was reset while waiting for the interlock,
+ * abort the delivery. The machine check applies to a context
+ * that no longer exists, so it wouldn't make sense to deliver
+ * it now.
+ */
return;
}
}
@@ -868,7 +869,9 @@ void spapr_mce_req_event(PowerPCCPU *cpu, bool recovered)
* We don't want to abort so we let the migration to continue.
* In a rare case, the machine check handler will run on the target.
* Though this is not preferable, it is better than aborting
- * the migration or killing the VM.
+ * the migration or killing the VM. It is okay to call
+ * migrate_del_blocker on a blocker that was not added (which the
+ * nmi-interlock handler would do when it's called after this).
*/
warn_report("Received a fwnmi while migration was in progress");
}
--
2.23.0
next prev parent reply other threads:[~2020-03-17 5:04 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-17 5:02 [PATCH 0/5] FWNMI follow up patches Nicholas Piggin
2020-03-17 5:02 ` [PATCH 1/5] ppc/spapr: KVM FWNMI should not be enabled until guest requests it Nicholas Piggin
2020-03-17 11:02 ` Greg Kurz
2020-03-19 2:27 ` Nicholas Piggin
2020-03-17 5:02 ` Nicholas Piggin [this message]
2020-03-17 12:16 ` [PATCH 2/5] ppc/spapr: Improve FWNMI machine check delivery corner case comments Greg Kurz
2020-03-17 5:02 ` [PATCH 3/5] ppc/spapr: Add FWNMI machine check delivery warnings Nicholas Piggin
2020-03-17 12:20 ` Greg Kurz
2020-03-19 2:28 ` Nicholas Piggin
2020-03-17 5:02 ` [PATCH 4/5] ppc/spapr: Don't kill the guest if a recovered FWNMI machine check delivery fails Nicholas Piggin
2020-03-17 16:57 ` Greg Kurz
2020-03-19 2:29 ` Nicholas Piggin
2020-03-17 5:02 ` [PATCH 5/5] target/ppc: Implement simple monitor mce injection Nicholas Piggin
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=20200317050215.159334-3-npiggin@gmail.com \
--to=npiggin@gmail.com \
--cc=aik@ozlabs.ru \
--cc=arawinda.p@gmail.com \
--cc=clg@fr.ibm.com \
--cc=david@gibson.dropbear.id.au \
--cc=ganeshgr@linux.ibm.com \
--cc=groug@kaod.org \
--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).