qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alexey Kardashevskiy <aik@ozlabs.ru>
To: Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Paolo Bonzini <pbonzini@redhat.com>,
	qemu-ppc@nongnu.org, qemu-devel@nongnu.org,
	Alexander Graf <agraf@suse.de>
Subject: Re: [Qemu-devel] [PATCH v5 1/4] cpus: Define callback for QEMU "nmi" command
Date: Wed, 11 Jun 2014 01:39:13 +1000	[thread overview]
Message-ID: <539726A1.2090807@ozlabs.ru> (raw)
In-Reply-To: <20140610134340.35a18fff.cornelia.huck@de.ibm.com>

On 06/10/2014 09:43 PM, Cornelia Huck wrote:
> On Tue, 10 Jun 2014 16:18:00 +1000
> Alexey Kardashevskiy <aik@ozlabs.ru> wrote:
> 
>> This introduces an NMI (Non Maskable Interrupt) nmi_monitor_handler()
>> callback to the CPU class. It is called from QMP's "nmi" command and
>> performs an action required to cause debug crash dump on in-kernel
>> debugger invocation. The callback returns Error**.
>>
>> This adds support for it in qmp_inject_nmi(). Since no architecture
>> supports it at the moment, there is no change in behaviour.
>>
>> This changes inject-nmi command description for HMP and QMP.
>>
>> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
>> ---
>> Changes:
>> v5:
>> * s/given guest's (CPU|VCPU)/default CPU/
>> * nmi_monitor_handler() now returns Error**
>>
>>
>> v4:
>> * s/\<nmi\>/nmi_monitor_handler/
>>
>> v3:
>> * actual nmi() enablement moved from last patch to first patch
>> * changed description for QMP command too
>> ---
>>  cpus.c            | 9 ++++++++-
>>  hmp-commands.hx   | 6 ++----
>>  include/qom/cpu.h | 1 +
>>  qapi-schema.json  | 4 ++--
>>  qmp-commands.hx   | 3 +--
>>  5 files changed, 14 insertions(+), 9 deletions(-)
>>
>> diff --git a/cpus.c b/cpus.c
>> index dd7ac13..b9d6602 100644
>> --- a/cpus.c
>> +++ b/cpus.c
>> @@ -1495,6 +1495,13 @@ void qmp_inject_nmi(Error **errp)
>>          }
>>      }
>>  #else
>> -    error_set(errp, QERR_UNSUPPORTED);
>> +    CPUState *cs = qemu_get_cpu(monitor_get_cpu_index());
>> +    CPUClass *cc = CPU_GET_CLASS(cs);
> 
> Just wondering: Is CPU_GET_CLASS(NULL) really safe?


I expect it to assert so it is kind of safe.


> 
>> +
>> +    if (cs && cc->nmi_monitor_handler) {
> 
> Or is cs == NULL simply not possible, and the code should check for
> cc != NULL here instead?

This is definitely a mistype, I meant "if (cc &&...)"



>> +        cc->nmi_monitor_handler(cs, errp);
>> +    } else {
>> +        error_set(errp, QERR_UNSUPPORTED);
>> +    }
>>  #endif
>>  }
> 


-- 
Alexey

  parent reply	other threads:[~2014-06-10 15:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-10  6:17 [Qemu-devel] [PATCH v5 0/4] cpus: Add generic "nmi" monitor command support Alexey Kardashevskiy
2014-06-10  6:18 ` [Qemu-devel] [PATCH v5 1/4] cpus: Define callback for QEMU "nmi" command Alexey Kardashevskiy
2014-06-10 11:43   ` Cornelia Huck
2014-06-10 11:45     ` Paolo Bonzini
2014-06-10 15:39     ` Alexey Kardashevskiy [this message]
2014-06-10  6:18 ` [Qemu-devel] [PATCH v5 2/4] target-s390x: Migrate to new nmi_monitor_handler() CPU callback Alexey Kardashevskiy
2014-06-10 11:48   ` Cornelia Huck
2014-06-10  6:18 ` [Qemu-devel] [PATCH v5 3/4] target-i386: " Alexey Kardashevskiy
2014-06-10  6:18 ` [Qemu-devel] [PATCH v5 4/4] target-ppc: Add support for " Alexey Kardashevskiy

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=539726A1.2090807@ozlabs.ru \
    --to=aik@ozlabs.ru \
    --cc=agraf@suse.de \
    --cc=cornelia.huck@de.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.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).