qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Christian Borntraeger <borntraeger@de.ibm.com>,
	Cornelia Huck <cohuck@redhat.com>
Cc: qemu-devel <qemu-devel@nongnu.org>,
	Alexander Graf <agraf@suse.de>, Thomas Huth <thuth@redhat.com>,
	Richard Henderson <rth@twiddle.net>,
	Jing Liu <liujbjl@linux.vnet.ibm.com>
Subject: Re: [Qemu-devel] [PATCH v2] s390x/cpu: expose the guest crash information
Date: Tue, 19 Sep 2017 15:06:21 +0200	[thread overview]
Message-ID: <dba8f914-b9f1-f942-0c57-4cfbadf08655@redhat.com> (raw)
In-Reply-To: <20170919074314.10350-1-borntraeger@de.ibm.com>


> +##
> +# @GuestPanicInformationS390:
> +#
> +# S390 specific guest panic information (PSW)
> +#
> +# Since: 2.11
> +##
> +{'struct': 'GuestPanicInformationS390',
> + 'data': { 'psw-mask': 'uint64',
> +           'psw-addr': 'uint64',
> +           'reason': 'str' } }

Wonder if we should rather use an enum for reason.

> diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
> index 74b3e4f..5b835fe 100644
> --- a/target/s390x/cpu.c
> +++ b/target/s390x/cpu.c
> @@ -35,6 +35,8 @@
>  #include "qemu/error-report.h"
>  #include "trace.h"
>  #include "qapi/visitor.h"
> +#include "qapi-visit.h"
> +#include "sysemu/hw_accel.h"
>  #include "exec/exec-all.h"
>  #ifndef CONFIG_USER_ONLY
>  #include "hw/hw.h"
> @@ -276,6 +278,58 @@ static void s390x_cpu_set_id(Object *obj, Visitor *v, const char *name,
>      cpu->id = value;
>  }
>  
[...]
> +static void unmanageable_intercept(S390CPU *cpu, int32_t reason, int pswoffset)
>  {
>      CPUState *cs = CPU(cpu);
> +    const char *str;
>  
> +    switch (reason) {
> +    case EXCP_CRASH_PGM:
> +        str = "program interrupt loop";
> +        break;
> +    case EXCP_CRASH_EXT:
> +        str = "external interrupt loop";
> +        break;
> +    case EXCP_CRASH_OPEREXC:
> +        str = "operation exception loop";
> +        break;
> +    default:
> +        str = "unknown crash reason";
> +        break;
> +    }
>      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_cpu_halt(cpu);
> -    qemu_system_guest_panicked(NULL);
> +    cs->exception_index = reason;

Hmmm, this might work for KVM but most probably in the current form not
for TCG. cpu_handle_exception() will most probably just clear it and
then exit to the main loop.

Most probably we would the need to reset the exception index after
returning from tcg_cpu_exec().


Apart from the TCG concerns, looks good to me.

-- 

Thanks,

David

  parent reply	other threads:[~2017-09-19 13:06 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-19  7:43 [Qemu-devel] [PATCH v2] s390x/cpu: expose the guest crash information Christian Borntraeger
2017-09-19 13:04 ` Eric Blake
2017-11-07 11:00   ` QingFeng Hao
2017-11-07 19:35     ` Eric Blake
2017-11-08  6:36       ` QingFeng Hao
2017-09-19 13:06 ` David Hildenbrand [this message]
2017-09-19 13:27   ` Christian Borntraeger
2017-09-19 13:14 ` David Hildenbrand
2017-09-19 13:56   ` Christian Borntraeger
2017-09-19 14:39     ` David Hildenbrand
2017-09-20  9:14 ` Cornelia Huck
2017-09-20 11:23   ` Christian Borntraeger
2017-09-20 14:34   ` Eric Blake

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=dba8f914-b9f1-f942-0c57-4cfbadf08655@redhat.com \
    --to=david@redhat.com \
    --cc=agraf@suse.de \
    --cc=borntraeger@de.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=liujbjl@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=thuth@redhat.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).