From: Cornelia Huck <cornelia.huck@de.ibm.com>
To: qemu-devel@nongnu.org
Cc: Cornelia Huck <cornelia.huck@de.ibm.com>,
borntraeger@de.ibm.com, jfrei@linux.vnet.ibm.com, agraf@suse.de,
Thomas Huth <thuth@linux.vnet.ibm.com>
Subject: [Qemu-devel] [PATCH 04/10] s390x/kvm: Log unmanageable external interruptions
Date: Tue, 3 Jun 2014 16:07:59 +0200 [thread overview]
Message-ID: <1401804485-14801-5-git-send-email-cornelia.huck@de.ibm.com> (raw)
In-Reply-To: <1401804485-14801-1-git-send-email-cornelia.huck@de.ibm.com>
From: Thomas Huth <thuth@linux.vnet.ibm.com>
Interception code 0x14 only drops to userspace when an unmanageable
external interruption interception occured (e.g. if the External New
PSW does not disable external interruptions). Instead of bailing out
via the default handler, it is better to inform the user with a
proper error message that also includes the bad PSW, and to stop
the affected CPU with a panic event instead.
Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
target-s390x/kvm.c | 35 +++++++++++++++++++++++++++++------
1 file changed, 29 insertions(+), 6 deletions(-)
diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c
index 0a2a205..be703bd 100644
--- a/target-s390x/kvm.c
+++ b/target-s390x/kvm.c
@@ -83,6 +83,7 @@
#define DIAG_KVM_BREAKPOINT 0x501
#define ICPT_INSTRUCTION 0x04
+#define ICPT_EXT_INT 0x14
#define ICPT_WAITPSW 0x1c
#define ICPT_SOFT_INTERCEPT 0x24
#define ICPT_CPU_STOP 0x28
@@ -930,6 +931,28 @@ static bool is_special_wait_psw(CPUState *cs)
return cs->kvm_run->psw_addr == 0xfffUL;
}
+static void guest_panicked(void)
+{
+ QObject *data;
+
+ data = qobject_from_jsonf("{ 'action': %s }", "pause");
+ monitor_protocol_event(QEVENT_GUEST_PANICKED, data);
+ qobject_decref(data);
+
+ vm_stop(RUN_STATE_GUEST_PANICKED);
+}
+
+static void unmanageable_intercept(S390CPU *cpu, const char *str, int pswoffset)
+{
+ CPUState *cs = CPU(cpu);
+
+ error_report("Unmanageable %s! CPU%i new PSW: 0x%016lx:%016lx",
+ str, cs->cpu_index, ldq_phys(cs->as, cpu->env.psa + pswoffset),
+ ldq_phys(cs->as, cpu->env.psa + pswoffset + 8));
+ s390_del_running_cpu(cpu);
+ guest_panicked();
+}
+
static int handle_intercept(S390CPU *cpu)
{
CPUState *cs = CPU(cpu);
@@ -943,18 +966,18 @@ static int handle_intercept(S390CPU *cpu)
case ICPT_INSTRUCTION:
r = handle_instruction(cpu, run);
break;
+ case ICPT_EXT_INT:
+ unmanageable_intercept(cpu, "external interrupt",
+ offsetof(LowCore, external_new_psw));
+ r = EXCP_HALTED;
+ break;
case ICPT_WAITPSW:
/* disabled wait, since enabled wait is handled in kernel */
if (s390_del_running_cpu(cpu) == 0) {
if (is_special_wait_psw(cs)) {
qemu_system_shutdown_request();
} else {
- QObject *data;
-
- data = qobject_from_jsonf("{ 'action': %s }", "pause");
- monitor_protocol_event(QEVENT_GUEST_PANICKED, data);
- qobject_decref(data);
- vm_stop(RUN_STATE_GUEST_PANICKED);
+ guest_panicked();
}
}
r = EXCP_HALTED;
--
1.7.9.5
next prev parent reply other threads:[~2014-06-03 14:08 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-03 14:07 [Qemu-devel] [PATCH 00/10] pending s390 patches Cornelia Huck
2014-06-03 14:07 ` [Qemu-devel] [PATCH 01/10] s390x/css: handle emw correctly for tsch Cornelia Huck
2014-06-03 14:07 ` [Qemu-devel] [PATCH 02/10] s390x/kvm: make flic play well with old kernels Cornelia Huck
2014-06-03 14:07 ` [Qemu-devel] [PATCH 03/10] s390x/kvm: enable/reset cmma via vm attributes Cornelia Huck
2014-06-03 14:07 ` Cornelia Huck [this message]
2014-06-03 14:08 ` [Qemu-devel] [PATCH 05/10] s390x/kvm: Log unmanageable program interruptions Cornelia Huck
2014-06-03 14:08 ` [Qemu-devel] [PATCH 06/10] s390/virtio-ccw: migration support Cornelia Huck
2014-06-03 14:08 ` [Qemu-devel] [PATCH 07/10] s390x: consolidate floating interrupts Cornelia Huck
2014-06-03 14:08 ` [Qemu-devel] [PATCH 08/10] s390x/kvm: add alternative injection interface Cornelia Huck
2014-06-03 14:08 ` [Qemu-devel] [PATCH 09/10] s390x: cleanup interrupt injection Cornelia Huck
2014-06-03 14:08 ` [Qemu-devel] [PATCH 10/10] s390x/kvm: inject via flic Cornelia Huck
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=1401804485-14801-5-git-send-email-cornelia.huck@de.ibm.com \
--to=cornelia.huck@de.ibm.com \
--cc=agraf@suse.de \
--cc=borntraeger@de.ibm.com \
--cc=jfrei@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=thuth@linux.vnet.ibm.com \
/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).