All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] Default CPU for NMI injection (QMP and IPMI)
@ 2016-09-21 20:20 Eduardo Habkost
  2016-09-21 20:38 ` Corey Minyard
  0 siblings, 1 reply; 7+ messages in thread
From: Eduardo Habkost @ 2016-09-21 20:20 UTC (permalink / raw)
  To: qemu-devel
  Cc: Corey Minyard, Alexey Kardashevskiy, Alexander Graf, Bandan Das

Hi,

I was looking at the monitor code handling the "current CPU", and
noticed that qmp_inject_nmi() looks suspicious: it is a QMP
command, but uses monitor_get_cpu_index().

In addition to the "inject-nmi" QMP command, qmp_inject_nmi() is
used at:
* hmp_inject_nmi()
* ipmi_do_hw_op() (IPMI_SEND_NMI operation)

This confused me, so I would like to know:

1) What exactly "default CPU" is supposed to mean in the
   "inject-nmi" QMP command documentation?
2) To which CPU(s) are NMIs supposed to be sent when triggered by
   IPMI messages? I don't know how to test the IPMI code, but it
   looks like it will crash if QEMU runs without any monitor.

-- 
Eduardo

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] Default CPU for NMI injection (QMP and IPMI)
  2016-09-21 20:20 [Qemu-devel] Default CPU for NMI injection (QMP and IPMI) Eduardo Habkost
@ 2016-09-21 20:38 ` Corey Minyard
  2016-09-22 18:42   ` Eduardo Habkost
  0 siblings, 1 reply; 7+ messages in thread
From: Corey Minyard @ 2016-09-21 20:38 UTC (permalink / raw)
  To: Eduardo Habkost, qemu-devel
  Cc: Alexey Kardashevskiy, Alexander Graf, Bandan Das

On 09/21/2016 03:20 PM, Eduardo Habkost wrote:
> Hi,
>
> I was looking at the monitor code handling the "current CPU", and
> noticed that qmp_inject_nmi() looks suspicious: it is a QMP
> command, but uses monitor_get_cpu_index().
>
> In addition to the "inject-nmi" QMP command, qmp_inject_nmi() is
> used at:
> * hmp_inject_nmi()
> * ipmi_do_hw_op() (IPMI_SEND_NMI operation)
>
> This confused me, so I would like to know:
>
> 1) What exactly "default CPU" is supposed to mean in the
>     "inject-nmi" QMP command documentation?
> 2) To which CPU(s) are NMIs supposed to be sent when triggered by
>     IPMI messages? I don't know how to test the IPMI code, but it
>     looks like it will crash if QEMU runs without any monitor.
>
It doesn't matter which CPU it goes to.

I haven't tested without a monitor, so I'm not sure.  Does
another interface into the NMI code need to be added?

-corey

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] Default CPU for NMI injection (QMP and IPMI)
  2016-09-21 20:38 ` Corey Minyard
@ 2016-09-22 18:42   ` Eduardo Habkost
  2016-09-22 19:49     ` Corey Minyard
  0 siblings, 1 reply; 7+ messages in thread
From: Eduardo Habkost @ 2016-09-22 18:42 UTC (permalink / raw)
  To: Corey Minyard
  Cc: qemu-devel, Alexey Kardashevskiy, Alexander Graf, Bandan Das

On Wed, Sep 21, 2016 at 03:38:25PM -0500, Corey Minyard wrote:
> On 09/21/2016 03:20 PM, Eduardo Habkost wrote:
> > Hi,
> > 
> > I was looking at the monitor code handling the "current CPU", and
> > noticed that qmp_inject_nmi() looks suspicious: it is a QMP
> > command, but uses monitor_get_cpu_index().
> > 
> > In addition to the "inject-nmi" QMP command, qmp_inject_nmi() is
> > used at:
> > * hmp_inject_nmi()
> > * ipmi_do_hw_op() (IPMI_SEND_NMI operation)
> > 
> > This confused me, so I would like to know:
> > 
> > 1) What exactly "default CPU" is supposed to mean in the
> >     "inject-nmi" QMP command documentation?
> > 2) To which CPU(s) are NMIs supposed to be sent when triggered by
> >     IPMI messages? I don't know how to test the IPMI code, but it
> >     looks like it will crash if QEMU runs without any monitor.
> > 
> It doesn't matter which CPU it goes to.

OK, so in the case of IPMI we can make it send the NMI to the
first CPU.

> I haven't tested without a monitor, so I'm not sure.  Does
> another interface into the NMI code need to be added?

There's another interface, already: nmi_monitor_handle() already
gets a cpu_index argument and doesn't depend on the monitor code.
We could change the IPMI code to call
nmi_monitor_handle(first_cpu->cpu_index) directly.

In the case of the inject-nmi QMP command, I need to understand
what "default CPU" is supposed to mean in the inject-nmi
documentation. Maybe it can be changed to use the first CPU, too
(that's probably the existing behavior because there's no way to
change cur_mon->mon_cpu in a QMP monitor).

-- 
Eduardo

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] Default CPU for NMI injection (QMP and IPMI)
  2016-09-22 18:42   ` Eduardo Habkost
@ 2016-09-22 19:49     ` Corey Minyard
  2016-09-23 19:49       ` Eduardo Habkost
  2016-09-27 20:51       ` Eduardo Habkost
  0 siblings, 2 replies; 7+ messages in thread
From: Corey Minyard @ 2016-09-22 19:49 UTC (permalink / raw)
  To: Eduardo Habkost
  Cc: qemu-devel, Alexey Kardashevskiy, Alexander Graf, Bandan Das

On 09/22/2016 01:42 PM, Eduardo Habkost wrote:
> On Wed, Sep 21, 2016 at 03:38:25PM -0500, Corey Minyard wrote:
>> On 09/21/2016 03:20 PM, Eduardo Habkost wrote:
>>> Hi,
>>>
>>> I was looking at the monitor code handling the "current CPU", and
>>> noticed that qmp_inject_nmi() looks suspicious: it is a QMP
>>> command, but uses monitor_get_cpu_index().
>>>
>>> In addition to the "inject-nmi" QMP command, qmp_inject_nmi() is
>>> used at:
>>> * hmp_inject_nmi()
>>> * ipmi_do_hw_op() (IPMI_SEND_NMI operation)
>>>
>>> This confused me, so I would like to know:
>>>
>>> 1) What exactly "default CPU" is supposed to mean in the
>>>      "inject-nmi" QMP command documentation?
>>> 2) To which CPU(s) are NMIs supposed to be sent when triggered by
>>>      IPMI messages? I don't know how to test the IPMI code, but it
>>>      looks like it will crash if QEMU runs without any monitor.
>>>
>> It doesn't matter which CPU it goes to.
> OK, so in the case of IPMI we can make it send the NMI to the
> first CPU.
>
>> I haven't tested without a monitor, so I'm not sure.  Does
>> another interface into the NMI code need to be added?
> There's another interface, already: nmi_monitor_handle() already
> gets a cpu_index argument and doesn't depend on the monitor code.
> We could change the IPMI code to call
> nmi_monitor_handle(first_cpu->cpu_index) directly.

Ok, I'll make a change for this, unless we decide to fix it
another way.

> In the case of the inject-nmi QMP command, I need to understand
> what "default CPU" is supposed to mean in the inject-nmi
> documentation. Maybe it can be changed to use the first CPU, too
> (that's probably the existing behavior because there's no way to
> change cur_mon->mon_cpu in a QMP monitor).
>
I looked through is a bit, and the only place I found it was used was
the x390 code.

If we remove the CPU index from this, then the IPMI device can
keep the same interface.

Thanks,

-corey

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] Default CPU for NMI injection (QMP and IPMI)
  2016-09-22 19:49     ` Corey Minyard
@ 2016-09-23 19:49       ` Eduardo Habkost
  2016-09-27 20:51       ` Eduardo Habkost
  1 sibling, 0 replies; 7+ messages in thread
From: Eduardo Habkost @ 2016-09-23 19:49 UTC (permalink / raw)
  To: Corey Minyard
  Cc: qemu-devel, Alexey Kardashevskiy, Alexander Graf, Bandan Das

On Thu, Sep 22, 2016 at 02:49:35PM -0500, Corey Minyard wrote:
> On 09/22/2016 01:42 PM, Eduardo Habkost wrote:
[...]
> > In the case of the inject-nmi QMP command, I need to understand
> > what "default CPU" is supposed to mean in the inject-nmi
> > documentation. Maybe it can be changed to use the first CPU, too
> > (that's probably the existing behavior because there's no way to
> > change cur_mon->mon_cpu in a QMP monitor).
> > 
> I looked through is a bit, and the only place I found it was used was
> the x390 code.
> 
> If we remove the CPU index from this, then the IPMI device can
> keep the same interface.

Well, the existing behavior is to use the first CPU, so I will
just keep the existing behavior but remove the
monitor_get_cpu_index() call from qmp_inject_nmi(). Then the IPMI
code can stay the same.

-- 
Eduardo

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] Default CPU for NMI injection (QMP and IPMI)
  2016-09-22 19:49     ` Corey Minyard
  2016-09-23 19:49       ` Eduardo Habkost
@ 2016-09-27 20:51       ` Eduardo Habkost
  2016-09-27 21:05         ` Christian Borntraeger
  1 sibling, 1 reply; 7+ messages in thread
From: Eduardo Habkost @ 2016-09-27 20:51 UTC (permalink / raw)
  To: Corey Minyard
  Cc: Alexey Kardashevskiy, Bandan Das, qemu-devel, Alexander Graf,
	Cornelia Huck, Christian Borntraeger

On Thu, Sep 22, 2016 at 02:49:35PM -0500, Corey Minyard wrote:
> On 09/22/2016 01:42 PM, Eduardo Habkost wrote:
[...]
> > In the case of the inject-nmi QMP command, I need to understand
> > what "default CPU" is supposed to mean in the inject-nmi
> > documentation. Maybe it can be changed to use the first CPU, too
> > (that's probably the existing behavior because there's no way to
> > change cur_mon->mon_cpu in a QMP monitor).
> > 
> I looked through is a bit, and the only place I found it was used was
> the x390 code.

s390 maintainers: is the ability to send a NMI to a specific CPU
really used in s390? The only way to use it today is to use HMP,
so I guess no management interface really supports it.

s390-ccw is the only machine that uses the cpu_index parameter.
If we remove it, it will allow us to simplify the code.
Otherwise, we will need to extend the inject-nmi command to
accept a "cpu" parameter.

-- 
Eduardo

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] Default CPU for NMI injection (QMP and IPMI)
  2016-09-27 20:51       ` Eduardo Habkost
@ 2016-09-27 21:05         ` Christian Borntraeger
  0 siblings, 0 replies; 7+ messages in thread
From: Christian Borntraeger @ 2016-09-27 21:05 UTC (permalink / raw)
  To: Eduardo Habkost, Corey Minyard
  Cc: Alexey Kardashevskiy, Bandan Das, qemu-devel, Alexander Graf,
	Cornelia Huck

On 09/27/2016 10:51 PM, Eduardo Habkost wrote:
> On Thu, Sep 22, 2016 at 02:49:35PM -0500, Corey Minyard wrote:
>> On 09/22/2016 01:42 PM, Eduardo Habkost wrote:
> [...]
>>> In the case of the inject-nmi QMP command, I need to understand
>>> what "default CPU" is supposed to mean in the inject-nmi
>>> documentation. Maybe it can be changed to use the first CPU, too
>>> (that's probably the existing behavior because there's no way to
>>> change cur_mon->mon_cpu in a QMP monitor).
>>>
>> I looked through is a bit, and the only place I found it was used was
>> the x390 code.
> 
> s390 maintainers: is the ability to send a NMI to a specific CPU
> really used in s390? The only way to use it today is to use HMP,
> so I guess no management interface really supports it.
> 
> s390-ccw is the only machine that uses the cpu_index parameter.
> If we remove it, it will allow us to simplify the code.
> Otherwise, we will need to extend the inject-nmi command to
> accept a "cpu" parameter.
> 

Doing it always on the first CPU should be ok for Linux guests.
This is wired up to a PSW restart interrupt, which has the same
handler on all CPUs. Originally it was wired up on the real 
old irons as a button, so I assume from a historical perspective
it is ok to not be able to specify the cpu number. Under z/VM it is 
possible to specify the CPU though. I will try to find out
if there is a real use case for specifying the CPU.

Christian

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-09-27 21:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-21 20:20 [Qemu-devel] Default CPU for NMI injection (QMP and IPMI) Eduardo Habkost
2016-09-21 20:38 ` Corey Minyard
2016-09-22 18:42   ` Eduardo Habkost
2016-09-22 19:49     ` Corey Minyard
2016-09-23 19:49       ` Eduardo Habkost
2016-09-27 20:51       ` Eduardo Habkost
2016-09-27 21:05         ` Christian Borntraeger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.