Skip to contentSkip to conversation

: QMP: Introduce inject-nmi command

PATCH In review Luiz Capitulino 4 participants 18 messages Apr 29, 2011 – May 27, 2011

lore
Share & tools
lore
#0 lore raw

cover : QMP: Introduce inject-nmi command

This series introduces the inject-nmi command for QMP, which sends an NMI to _all_ guest's CPUs.

Also note that this series changes the human monitor nmi command to use the QMP implementation, which means that it now has a DIFFERENT behavior. Please, check patch 3/3 for details.

#1 lore raw

PATCH 1/3 QMP: QError: New QERR_UNSUPPORTED

From: Lai Jiangshan <[email protected]>

New QERR_UNSUPPORTED for unsupported commands or requests.

---
 qerror.c |    4 ++++
 qerror.h |    3 +++
 2 files changed, 7 insertions(+), 0 deletions(-)
qerror.c +4 -0
index 4855604..4f3b7ca 100644
@@ -201,6 +201,10 @@ static const QErrorStringTable qerror_table[] = {
         .desc      = "An undefined error has ocurred",
     },
     {
+        .error_fmt = QERR_UNSUPPORTED,
+        .desc      = "this feature or command is not currently supported",
+    },
+    {
         .error_fmt = QERR_UNKNOWN_BLOCK_FORMAT_FEATURE,
         .desc      = "'%(device)' uses a %(format) feature which is not "
                      "supported by this qemu version: %(feature)",
qerror.h +3 -0
index df61d2c..582b5ef 100644
@@ -165,6 +165,9 @@ QError *qobject_to_qerror(const QObject *obj);
 #define QERR_UNDEFINED_ERROR \
     "{ 'class': 'UndefinedError', 'data': {} }"
 
+#define QERR_UNSUPPORTED \
+    "{ 'class': 'Unsupported', 'data': {} }"
+
 #define QERR_UNKNOWN_BLOCK_FORMAT_FEATURE \
     "{ 'class': 'UnknownBlockFormatFeature', 'data': { 'device': %s, 'format': %s, 'feature': %s } }"
 
Signature · 1 line
1.7.5.GIT
#2 lore raw

PATCH 2/3 QMP: add inject-nmi qmp command

In reply to Luiz Capitulino

From: Lai Jiangshan <[email protected]>

inject-nmi command injects an NMI on all CPUs of guest. It is only supported for x86 guest currently, it will returns "Unsupported" error for non-x86 guest.

---
 monitor.c       |   17 +++++++++++++++++
 qmp-commands.hx |   27 +++++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 0 deletions(-)
monitor.c +17 -0
index 5f3bc72..455a528 100644
@@ -2555,6 +2555,23 @@ static void do_inject_nmi(Monitor *mon, const QDict *qdict)
             break;
         }
 }
+
+static int do_inject_nmi_all(Monitor *mon, const QDict *qdict, QObject **ret_data)
+{
+    CPUState *env;
+
+    for (env = first_cpu; env != NULL; env = env->next_cpu) {
+        cpu_interrupt(env, CPU_INTERRUPT_NMI);
+    }
+
+    return 0;
+}
+#else
+static int do_inject_nmi_all(Monitor *mon, const QDict *qdict, QObject **ret_data)
+{
+    qerror_report(QERR_UNSUPPORTED);
+    return -1;
+}
 #endif
 
 static void do_info_status_print(Monitor *mon, const QObject *data)
qmp-commands.hx +27 -0
index fbd98ee..1058c38 100644
@@ -430,6 +430,33 @@ Example:
 EQMP
 
     {
+        .name       = "inject-nmi",
+        .args_type  = "",
+        .params     = "",
+        .help       = "",
+        .user_print = monitor_user_noop,
+        .mhandler.cmd_new = do_inject_nmi_all,
+    },
+
+SQMP
+inject-nmi
+----------
+
+Inject an NMI on guest's CPUs.
+
+Arguments: None.
+
+Example:
+
+-> { "execute": "inject-nmi" }
+<- { "return": {} }
+
+Note: inject-nmi is only supported for x86 guest currently, it will
+      returns "Unsupported" error for non-x86 guest.
+
+EQMP
+
+    {
         .name       = "migrate",
         .args_type  = "detach:-d,blk:-b,inc:-i,uri:s",
         .params     = "[-d] [-b] [-i] uri",
Signature · 1 line
1.7.5.GIT
#3 lore raw

PATCH 3/3 HMP: Use QMP inject nmi implementation

In reply to Luiz Capitulino

This **CHANGES** the human monitor "nmi" command behavior.

Currently it accepts an CPU argument which, when provided, will send the NMI to the specified CPU. This feature is of discussable value though and HMP shouldn't have more features than QMP, so let's use QMP's instead (it's also simpler).

---
 hmp-commands.hx |    9 +++++----
 monitor.c       |   16 ++--------------
 qmp-commands.hx |    2 +-
 3 files changed, 8 insertions(+), 19 deletions(-)
hmp-commands.hx +5 -4
index 834e6a8..6ad8806 100644
@@ -740,10 +740,11 @@ ETEXI
 #if defined(TARGET_I386)
     {
         .name       = "nmi",
-        .args_type  = "cpu_index:i",
-        .params     = "cpu",
-        .help       = "inject an NMI on the given CPU",
-        .mhandler.cmd = do_inject_nmi,
+        .args_type  = "",
+        .params     = "",
+        .help       = "inject an NMI on all guest's CPUs",
+        .user_print = monitor_user_noop,
+        .mhandler.cmd_new = do_inject_nmi,
     },
 #endif
 STEXI
monitor.c +2 -14
index 455a528..1ba98b0 100644
@@ -2544,19 +2544,7 @@ static void do_wav_capture(Monitor *mon, const QDict *qdict)
 #endif
 
 #if defined(TARGET_I386)
-static void do_inject_nmi(Monitor *mon, const QDict *qdict)
-{
-    CPUState *env;
-    int cpu_index = qdict_get_int(qdict, "cpu_index");
-
-    for (env = first_cpu; env != NULL; env = env->next_cpu)
-        if (env->cpu_index == cpu_index) {
-            cpu_interrupt(env, CPU_INTERRUPT_NMI);
-            break;
-        }
-}
-
-static int do_inject_nmi_all(Monitor *mon, const QDict *qdict, QObject **ret_data)
+static int do_inject_nmi(Monitor *mon, const QDict *qdict, QObject **ret_data)
 {
     CPUState *env;
 
@@ -2567,7 +2555,7 @@ static int do_inject_nmi_all(Monitor *mon, const QDict *qdict, QObject **ret_dat
     return 0;
 }
 #else
-static int do_inject_nmi_all(Monitor *mon, const QDict *qdict, QObject **ret_data)
+static int do_inject_nmi(Monitor *mon, const QDict *qdict, QObject **ret_data)
 {
     qerror_report(QERR_UNSUPPORTED);
     return -1;
qmp-commands.hx +1 -1
index 1058c38..1957730 100644
@@ -435,7 +435,7 @@ EQMP
         .params     = "",
         .help       = "",
         .user_print = monitor_user_noop,
-        .mhandler.cmd_new = do_inject_nmi_all,
+        .mhandler.cmd_new = do_inject_nmi,
     },
 
 SQMP
Signature · 1 line
1.7.5.GIT
#4 lore raw
In reply to Luiz Capitulino
Quoted 6 lines · Luiz Capitulino

This series introduces the inject-nmi command for QMP, which sends an NMI to _all_ guest's CPUs.

Also note that this series changes the human monitor nmi command to use the QMP implementation, which means that it now has a DIFFERENT behavior. Please, check patch 3/3 for details.

As discussed earlier, please change the QMP version for future expandability so that instead of single command 'inject-nmi', 'inject' takes parameter 'nmi'. HMP command 'nmi' can remain for now, but 'inject' should be added.

#5 lore raw
Quoted 4 lines · On Sat, 30 Apr 2011 09:33:15 +0300 Blue Swirl <[email protected]> wrote:
Quoted 3 lines · Luiz Capitulino

This series introduces the inject-nmi command for QMP, which sends an NMI to _all_ guest's CPUs.

Quoted 8 lines
Quoted 3 lines

Also note that this series changes the human monitor nmi command to use the QMP implementation, which means that it now has a DIFFERENT behavior. Please, check patch 3/3 for details.

As discussed earlier, please change the QMP version for future expandability so that instead of single command 'inject-nmi', 'inject' takes parameter 'nmi'. HMP command 'nmi' can remain for now, but 'inject' should be added.

I'm not sure I agree with this, because we risky overloading 'inject' the same way we did with the 'change' command.

What's 'inject' supposed to do in the future?

#6 lore raw
Quoted 16 lines · Luiz Capitulino
Quoted 4 lines · On Sat, 30 Apr 2011 09:33:15 +0300 Blue Swirl <[email protected]> wrote:
Quoted 3 lines · Luiz Capitulino

This series introduces the inject-nmi command for QMP, which sends an NMI to _all_ guest's CPUs.

Quoted 8 lines
Quoted 3 lines

Also note that this series changes the human monitor nmi command to use the QMP implementation, which means that it now has a DIFFERENT behavior. Please, check patch 3/3 for details.

As discussed earlier, please change the QMP version for future expandability so that instead of single command 'inject-nmi', 'inject' takes parameter 'nmi'. HMP command 'nmi' can remain for now, but 'inject' should be added.

Quoted 4 lines

I'm not sure I agree with this, because we risky overloading 'inject' the same way we did with the 'change' command.

What's 'inject' supposed to do in the future?

Inject other IRQs, for example inject nmi could become an alias to something like
inject /apic@fee00000:l1int
which would be a shorthand for
raise /apic@fee00000:l1int
lower /apic@fee00000:l1int

I think we only need a registration framework for IRQs and other signals.

#7 lore raw
Quoted 22 lines · Blue Swirl
Quoted 16 lines · Luiz Capitulino
Quoted 4 lines · On Sat, 30 Apr 2011 09:33:15 +0300 Blue Swirl <[email protected]> wrote:
Quoted 3 lines · Luiz Capitulino

This series introduces the inject-nmi command for QMP, which sends an NMI to _all_ guest's CPUs.

Quoted 8 lines
Quoted 3 lines

Also note that this series changes the human monitor nmi command to use the QMP implementation, which means that it now has a DIFFERENT behavior. Please, check patch 3/3 for details.

As discussed earlier, please change the QMP version for future expandability so that instead of single command 'inject-nmi', 'inject' takes parameter 'nmi'. HMP command 'nmi' can remain for now, but 'inject' should be added.

Quoted 4 lines

I'm not sure I agree with this, because we risky overloading 'inject' the same way we did with the 'change' command.

What's 'inject' supposed to do in the future?

Quoted 8 lines

Inject other IRQs, for example inject nmi could become an alias to something like
inject /apic@fee00000:l1int
which would be a shorthand for
raise /apic@fee00000:l1int
lower /apic@fee00000:l1int

I think we only need a registration framework for IRQs and other signals.

Yes, we could use nicer infrastructure for modeling IRQs. No, we shouldn't reject Lai's work because it doesn't get us there. Perfect is the enemy of good.

Pick one:

1. We take inject-nmi now. Should we get a more general inject command like the one you envisage later, we can deprecate inject-nmi, and remove it after a suitable grace time. Big deal. We get the special problem solved now, without really compromising future solutions for the general problem.

2. We reject inject-nmi now. The itch Lai tries to scratch remains unscratched until we get a more general inject command.

2a. Rejection "motivates" Lai to solve the general problem[*]. Or maybe it motivates somebody else. We get the general problem solved sooner. And maybe I get a pony for my birthday, too.

2b. The general problem remains unsolved along with the special problem. We get nothing.

[*] He's been trying to give us NMI injection via QMP for five months, so what's a few months more to him.

#8 lore raw
Quoted 37 lines · On Fri, 06 May 2011 11:08:08 +0200 Markus Armbruster <[email protected]> wrote:
Quoted 22 lines · Blue Swirl
Quoted 16 lines · Luiz Capitulino
Quoted 4 lines · On Sat, 30 Apr 2011 09:33:15 +0300 Blue Swirl <[email protected]> wrote:
Quoted 3 lines · Luiz Capitulino

This series introduces the inject-nmi command for QMP, which sends an NMI to _all_ guest's CPUs.

Quoted 8 lines
Quoted 3 lines

Also note that this series changes the human monitor nmi command to use the QMP implementation, which means that it now has a DIFFERENT behavior. Please, check patch 3/3 for details.

As discussed earlier, please change the QMP version for future expandability so that instead of single command 'inject-nmi', 'inject' takes parameter 'nmi'. HMP command 'nmi' can remain for now, but 'inject' should be added.

Quoted 4 lines

I'm not sure I agree with this, because we risky overloading 'inject' the same way we did with the 'change' command.

What's 'inject' supposed to do in the future?

Quoted 8 lines

Inject other IRQs, for example inject nmi could become an alias to something like
inject /apic@fee00000:l1int
which would be a shorthand for
raise /apic@fee00000:l1int
lower /apic@fee00000:l1int

I think we only need a registration framework for IRQs and other signals.

Yes, we could use nicer infrastructure for modeling IRQs. No, we shouldn't reject Lai's work because it doesn't get us there. Perfect is the enemy of good.

Quoted 7 lines

Pick one:

1. We take inject-nmi now. Should we get a more general inject command like the one you envisage later, we can deprecate inject-nmi, and remove it after a suitable grace time. Big deal. We get the special problem solved now, without really compromising future solutions for the general problem.

We don't even need to drop it, we just call the new one 'inject' or something like it and we're set (internally we could re-write 'inject-nmi' to use 'inject' in the future).

Quoted 14 lines

2. We reject inject-nmi now. The itch Lai tries to scratch remains unscratched until we get a more general inject command.

2a. Rejection "motivates" Lai to solve the general problem[*]. Or maybe it motivates somebody else. We get the general problem solved sooner. And maybe I get a pony for my birthday, too.

2b. The general problem remains unsolved along with the special problem. We get nothing.

[*] He's been trying to give us NMI injection via QMP for five months, so what's a few months more to him.

#9 lore raw
In reply to Markus Armbruster
Quoted 48 lines · Markus Armbruster
Quoted 22 lines · Blue Swirl
Quoted 16 lines · Luiz Capitulino
Quoted 4 lines · On Sat, 30 Apr 2011 09:33:15 +0300 Blue Swirl <[email protected]> wrote:
Quoted 3 lines · Luiz Capitulino

This series introduces the inject-nmi command for QMP, which sends an NMI to _all_ guest's CPUs.

Quoted 8 lines
Quoted 3 lines

Also note that this series changes the human monitor nmi command to use the QMP implementation, which means that it now has a DIFFERENT behavior. Please, check patch 3/3 for details.

As discussed earlier, please change the QMP version for future expandability so that instead of single command 'inject-nmi', 'inject' takes parameter 'nmi'. HMP command 'nmi' can remain for now, but 'inject' should be added.

Quoted 4 lines

I'm not sure I agree with this, because we risky overloading 'inject' the same way we did with the 'change' command.

What's 'inject' supposed to do in the future?

Quoted 8 lines

Inject other IRQs, for example inject nmi could become an alias to something like
inject /apic@fee00000:l1int
which would be a shorthand for
raise /apic@fee00000:l1int
lower /apic@fee00000:l1int

I think we only need a registration framework for IRQs and other signals.

Yes, we could use nicer infrastructure for modeling IRQs.  No, we shouldn't reject Lai's work because it doesn't get us there.  Perfect is the enemy of good.

Pick one:

1. We take inject-nmi now.  Should we get a more general inject command like the one you envisage later, we can deprecate inject-nmi, and remove it after a suitable grace time.  Big deal.  We get the special problem solved now, without really compromising future solutions for the general problem.

2. We reject inject-nmi now.  The itch Lai tries to scratch remains unscratched until we get a more general inject command.

Quoted 6 lines

2a. Rejection "motivates" Lai to solve the general problem[*].  Or maybe it motivates somebody else.  We get the general problem solved sooner. And maybe I get a pony for my birthday, too.

2b. The general problem remains unsolved along with the special problem. We get nothing.

2c. Don't add full generic IRQ registration and aliases just now but handle 'inject' with only 'nmi'. That way we introduce no legacy baggage to the syntax.

#10 lore raw
Quoted 53 lines · On Fri, 6 May 2011 18:36:31 +0300 Blue Swirl <[email protected]> wrote:
Quoted 52 lines · Markus Armbruster
Quoted 22 lines · Blue Swirl
Quoted 16 lines · Luiz Capitulino
Quoted 4 lines · On Sat, 30 Apr 2011 09:33:15 +0300 Blue Swirl <[email protected]> wrote:
Quoted 3 lines · Luiz Capitulino

This series introduces the inject-nmi command for QMP, which sends an NMI to _all_ guest's CPUs.

Quoted 8 lines
Quoted 3 lines

Also note that this series changes the human monitor nmi command to use the QMP implementation, which means that it now has a DIFFERENT behavior. Please, check patch 3/3 for details.

As discussed earlier, please change the QMP version for future expandability so that instead of single command 'inject-nmi', 'inject' takes parameter 'nmi'. HMP command 'nmi' can remain for now, but 'inject' should be added.

Quoted 4 lines

I'm not sure I agree with this, because we risky overloading 'inject' the same way we did with the 'change' command.

What's 'inject' supposed to do in the future?

Quoted 8 lines

Inject other IRQs, for example inject nmi could become an alias to something like
inject /apic@fee00000:l1int
which would be a shorthand for
raise /apic@fee00000:l1int
lower /apic@fee00000:l1int

I think we only need a registration framework for IRQs and other signals.

Yes, we could use nicer infrastructure for modeling IRQs.  No, we shouldn't reject Lai's work because it doesn't get us there.  Perfect is the enemy of good.

Pick one:

1. We take inject-nmi now.  Should we get a more general inject command like the one you envisage later, we can deprecate inject-nmi, and remove it after a suitable grace time.  Big deal.  We get the special problem solved now, without really compromising future solutions for the general problem.

2. We reject inject-nmi now.  The itch Lai tries to scratch remains unscratched until we get a more general inject command.

2a. Rejection "motivates" Lai to solve the general problem[*].  Or maybe it motivates somebody else.  We get the general problem solved sooner. And maybe I get a pony for my birthday, too.

Quoted 6 lines
Quoted 2 lines

2b. The general problem remains unsolved along with the special problem. We get nothing.

2c. Don't add full generic IRQ registration and aliases just now but handle 'inject' with only 'nmi'. That way we introduce no legacy baggage to the syntax.

Can you give an example on how this is supposed to look like?

#11 lore raw
Quoted 56 lines · Luiz Capitulino
Quoted 53 lines · On Fri, 6 May 2011 18:36:31 +0300 Blue Swirl <[email protected]> wrote:
Quoted 52 lines · Markus Armbruster
Quoted 22 lines · Blue Swirl
Quoted 16 lines · Luiz Capitulino
Quoted 4 lines · On Sat, 30 Apr 2011 09:33:15 +0300 Blue Swirl <[email protected]> wrote:
Quoted 3 lines · Luiz Capitulino

This series introduces the inject-nmi command for QMP, which sends an NMI to _all_ guest's CPUs.

Quoted 8 lines
Quoted 3 lines

Also note that this series changes the human monitor nmi command to use the QMP implementation, which means that it now has a DIFFERENT behavior. Please, check patch 3/3 for details.

As discussed earlier, please change the QMP version for future expandability so that instead of single command 'inject-nmi', 'inject' takes parameter 'nmi'. HMP command 'nmi' can remain for now, but 'inject' should be added.

Quoted 4 lines

I'm not sure I agree with this, because we risky overloading 'inject' the same way we did with the 'change' command.

What's 'inject' supposed to do in the future?

Quoted 8 lines

Inject other IRQs, for example inject nmi could become an alias to something like
inject /apic@fee00000:l1int
which would be a shorthand for
raise /apic@fee00000:l1int
lower /apic@fee00000:l1int

I think we only need a registration framework for IRQs and other signals.

Yes, we could use nicer infrastructure for modeling IRQs.  No, we shouldn't reject Lai's work because it doesn't get us there.  Perfect is the enemy of good.

Pick one:

1. We take inject-nmi now.  Should we get a more general inject command like the one you envisage later, we can deprecate inject-nmi, and remove it after a suitable grace time.  Big deal.  We get the special problem solved now, without really compromising future solutions for the general problem.

2. We reject inject-nmi now.  The itch Lai tries to scratch remains unscratched until we get a more general inject command.

2a. Rejection "motivates" Lai to solve the general problem[*].  Or maybe it motivates somebody else.  We get the general problem solved sooner. And maybe I get a pony for my birthday, too.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

2b. The general problem remains unsolved along with the special problem. We get nothing.

2c. Don't add full generic IRQ registration and aliases just now but handle 'inject' with only 'nmi'. That way we introduce no legacy baggage to the syntax.

Can you give an example on how this is supposed to look like?

No reply. When you demand a redesign to generalize a simple feature to something only you envisage, please explain what exactly you want. Documentation to stick into qmp-commands.hx would be a start. Here's the baseline from Luiz, for your editing convenience.

inject-nmi
----------

Inject an NMI on guest's CPUs.

Arguments: None.

Example:

-> { "execute": "inject-nmi" }
<- { "return": {} }

Note: inject-nmi is only supported for x86 guest currently, it will
returns "Unsupported" error for non-x86 guest.

#12 lore raw
Quoted 80 lines · Markus Armbruster
Quoted 56 lines · Luiz Capitulino
Quoted 53 lines · On Fri, 6 May 2011 18:36:31 +0300 Blue Swirl <[email protected]> wrote:
Quoted 52 lines · Markus Armbruster
Quoted 22 lines · Blue Swirl
Quoted 16 lines · Luiz Capitulino
Quoted 4 lines · On Sat, 30 Apr 2011 09:33:15 +0300 Blue Swirl <[email protected]> wrote:
Quoted 3 lines · Luiz Capitulino

This series introduces the inject-nmi command for QMP, which sends an NMI to _all_ guest's CPUs.

Quoted 8 lines
Quoted 3 lines

Also note that this series changes the human monitor nmi command to use the QMP implementation, which means that it now has a DIFFERENT behavior. Please, check patch 3/3 for details.

As discussed earlier, please change the QMP version for future expandability so that instead of single command 'inject-nmi', 'inject' takes parameter 'nmi'. HMP command 'nmi' can remain for now, but 'inject' should be added.

Quoted 4 lines

I'm not sure I agree with this, because we risky overloading 'inject' the same way we did with the 'change' command.

What's 'inject' supposed to do in the future?

Quoted 8 lines

Inject other IRQs, for example inject nmi could become an alias to something like
inject /apic@fee00000:l1int
which would be a shorthand for
raise /apic@fee00000:l1int
lower /apic@fee00000:l1int

I think we only need a registration framework for IRQs and other signals.

Yes, we could use nicer infrastructure for modeling IRQs.  No, we shouldn't reject Lai's work because it doesn't get us there.  Perfect is the enemy of good.

Pick one:

1. We take inject-nmi now.  Should we get a more general inject command like the one you envisage later, we can deprecate inject-nmi, and remove it after a suitable grace time.  Big deal.  We get the special problem solved now, without really compromising future solutions for the general problem.

2. We reject inject-nmi now.  The itch Lai tries to scratch remains unscratched until we get a more general inject command.

2a. Rejection "motivates" Lai to solve the general problem[*].  Or maybe it motivates somebody else.  We get the general problem solved sooner. And maybe I get a pony for my birthday, too.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

2b. The general problem remains unsolved along with the special problem. We get nothing.

2c. Don't add full generic IRQ registration and aliases just now but handle 'inject' with only 'nmi'. That way we introduce no legacy baggage to the syntax.

Can you give an example on how this is supposed to look like?

No reply.  When you demand a redesign to generalize a simple feature to something only you envisage, please explain what exactly you want. Documentation to stick into qmp-commands.hx would be a start.  Here's the baseline from Luiz, for your editing convenience.

inject-nmi
----------

Inject an NMI on guest's CPUs.

Arguments: None.

Quoted 7 lines

Example:

-> { "execute": "inject-nmi" }
<- { "return": {} }

Note: inject-nmi is only supported for x86 guest currently, it will returns "Unsupported" error for non-x86 guest.

I think I explained it many times, but let's try again.

inject
----------

Inject a signal on guest machine.

Arguments: signal name.

Example:

-> { "execute": "inject",
"arguments": { "signal": "nmi" } }
<- { "return": {} }

-> { "execute": "inject",
"arguments": { "signal": "/apic@fee00000:l1int" } } <- { "return": {} }

Note: the set of signals supported depends on the CPU architecture and board type, unknown or unsupported names will
return "Unsupported" error.

#13 lore raw
Quoted 100 lines · On Thu, 26 May 2011 22:23:10 +0300 Blue Swirl <[email protected]> wrote:
Quoted 80 lines · Markus Armbruster
Quoted 56 lines · Luiz Capitulino
Quoted 53 lines · On Fri, 6 May 2011 18:36:31 +0300 Blue Swirl <[email protected]> wrote:
Quoted 52 lines · Markus Armbruster
Quoted 22 lines · Blue Swirl
Quoted 16 lines · Luiz Capitulino
Quoted 4 lines · On Sat, 30 Apr 2011 09:33:15 +0300 Blue Swirl <[email protected]> wrote:
Quoted 3 lines · Luiz Capitulino

This series introduces the inject-nmi command for QMP, which sends an NMI to _all_ guest's CPUs.

Quoted 8 lines
Quoted 3 lines

Also note that this series changes the human monitor nmi command to use the QMP implementation, which means that it now has a DIFFERENT behavior. Please, check patch 3/3 for details.

As discussed earlier, please change the QMP version for future expandability so that instead of single command 'inject-nmi', 'inject' takes parameter 'nmi'. HMP command 'nmi' can remain for now, but 'inject' should be added.

Quoted 4 lines

I'm not sure I agree with this, because we risky overloading 'inject' the same way we did with the 'change' command.

What's 'inject' supposed to do in the future?

Quoted 8 lines

Inject other IRQs, for example inject nmi could become an alias to something like
inject /apic@fee00000:l1int
which would be a shorthand for
raise /apic@fee00000:l1int
lower /apic@fee00000:l1int

I think we only need a registration framework for IRQs and other signals.

Yes, we could use nicer infrastructure for modeling IRQs.  No, we shouldn't reject Lai's work because it doesn't get us there.  Perfect is the enemy of good.

Pick one:

1. We take inject-nmi now.  Should we get a more general inject command like the one you envisage later, we can deprecate inject-nmi, and remove it after a suitable grace time.  Big deal.  We get the special problem solved now, without really compromising future solutions for the general problem.

2. We reject inject-nmi now.  The itch Lai tries to scratch remains unscratched until we get a more general inject command.

2a. Rejection "motivates" Lai to solve the general problem[*].  Or maybe it motivates somebody else.  We get the general problem solved sooner. And maybe I get a pony for my birthday, too.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

2b. The general problem remains unsolved along with the special problem. We get nothing.

2c. Don't add full generic IRQ registration and aliases just now but handle 'inject' with only 'nmi'. That way we introduce no legacy baggage to the syntax.

Can you give an example on how this is supposed to look like?

No reply.  When you demand a redesign to generalize a simple feature to something only you envisage, please explain what exactly you want. Documentation to stick into qmp-commands.hx would be a start.  Here's the baseline from Luiz, for your editing convenience.

inject-nmi
----------

Inject an NMI on guest's CPUs.

Arguments: None.

Quoted 7 lines

Example:

-> { "execute": "inject-nmi" }
<- { "return": {} }

Note: inject-nmi is only supported for x86 guest currently, it will returns "Unsupported" error for non-x86 guest.

I think I explained it many times, but let's try again.

inject
----------

Inject a signal on guest machine.

Arguments: signal name.

Example:

Quoted 7 lines

-> { "execute": "inject",
"arguments": { "signal": "nmi" } }
<- { "return": {} }

-> { "execute": "inject",
"arguments": { "signal": "/apic@fee00000:l1int" } } <- { "return": {} }

Shouldn't this be broken into device and signal (or pin) arguments?

Quoted 3 lines

Note: the set of signals supported depends on the CPU architecture and board type, unknown or unsupported names will
return "Unsupported" error.

Unsuported error != bad usage error.

#14 lore raw
Quoted 107 lines · Luiz Capitulino
Quoted 104 lines · On Thu, 26 May 2011 22:23:10 +0300 Blue Swirl<[email protected]> wrote:
Quoted 80 lines · Markus Armbruster
Quoted 56 lines · Luiz Capitulino
Quoted 53 lines · On Fri, 6 May 2011 18:36:31 +0300 Blue Swirl<[email protected]> wrote:
Quoted 52 lines · Markus Armbruster
Quoted 22 lines · Blue Swirl
Quoted 16 lines · Luiz Capitulino
Quoted 4 lines · On Sat, 30 Apr 2011 09:33:15 +0300 Blue Swirl<[email protected]> wrote:
Quoted 3 lines · Luiz Capitulino

This series introduces the inject-nmi command for QMP, which sends an NMI to _all_ guest's CPUs.

Quoted 8 lines
Quoted 3 lines

Also note that this series changes the human monitor nmi command to use the QMP implementation, which means that it now has a DIFFERENT behavior. Please, check patch 3/3 for details.

As discussed earlier, please change the QMP version for future expandability so that instead of single command 'inject-nmi', 'inject' takes parameter 'nmi'. HMP command 'nmi' can remain for now, but 'inject' should be added.

Quoted 4 lines

I'm not sure I agree with this, because we risky overloading 'inject' the same way we did with the 'change' command.

What's 'inject' supposed to do in the future?

Quoted 8 lines

Inject other IRQs, for example inject nmi could become an alias to something like
inject /apic@fee00000:l1int
which would be a shorthand for
raise /apic@fee00000:l1int
lower /apic@fee00000:l1int

I think we only need a registration framework for IRQs and other signals.

Yes, we could use nicer infrastructure for modeling IRQs. No, we shouldn't reject Lai's work because it doesn't get us there. Perfect is the enemy of good.

Pick one:

1. We take inject-nmi now. Should we get a more general inject command like the one you envisage later, we can deprecate inject-nmi, and remove it after a suitable grace time. Big deal. We get the special problem solved now, without really compromising future solutions for the general problem.

2. We reject inject-nmi now. The itch Lai tries to scratch remains unscratched until we get a more general inject command.

2a. Rejection "motivates" Lai to solve the general problem[*]. Or maybe it motivates somebody else. We get the general problem solved sooner. And maybe I get a pony for my birthday, too.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

2b. The general problem remains unsolved along with the special problem. We get nothing.

2c. Don't add full generic IRQ registration and aliases just now but handle 'inject' with only 'nmi'. That way we introduce no legacy baggage to the syntax.

Can you give an example on how this is supposed to look like?

No reply. When you demand a redesign to generalize a simple feature to something only you envisage, please explain what exactly you want. Documentation to stick into qmp-commands.hx would be a start. Here's the baseline from Luiz, for your editing convenience.

inject-nmi
----------

Inject an NMI on guest's CPUs.

Arguments: None.

Quoted 7 lines

Example:

-> { "execute": "inject-nmi" }
<- { "return": {} }

Note: inject-nmi is only supported for x86 guest currently, it will
returns "Unsupported" error for non-x86 guest.

I think I explained it many times, but let's try again.

inject
----------

Inject a signal on guest machine.

Arguments: signal name.

Example:

-> { "execute": "inject",
"arguments": { "signal": "nmi" } }
<- { "return": {} }

Quoted 5 lines
Quoted 3 lines

-> { "execute": "inject",
"arguments": { "signal": "/apic@fee00000:l1int" } } <- { "return": {} }

Shouldn't this be broken into device and signal (or pin) arguments?

I dislike this approach strongly.

Overloading verbs to have multiple meanings is a bad thing for QMP. It means less type safety. Think of a C interface:

inject_nmi() <- good
inject_nim() <- compile error

inject("nmi") <- good
inject("nim") <- runtime error

Not to mention that "inject" doesn't mean "raise and then lower a pin".
Inject means insert or put in.

I'm not opposed to being able to have a way to raise/lower a qemu_irq, but (a) that's orthogonal to this operation (b) we should design that interface properly. b means that we should be able to enumerate pins, raise and lower pins, and pulse pins.

Regards,

Anthony Liguori

Quoted 6 lines
Quoted 3 lines

Note: the set of signals supported depends on the CPU architecture and board type, unknown or unsupported names will
return "Unsupported" error.

Unsuported error != bad usage error.

#15 lore raw
Quoted 126 lines · On Fri, 27 May 2011 09:55:05 -0500 Anthony Liguori <[email protected]>…
Quoted 107 lines · Luiz Capitulino
Quoted 104 lines · On Thu, 26 May 2011 22:23:10 +0300 Blue Swirl<[email protected]> wrote:
Quoted 80 lines · Markus Armbruster
Quoted 56 lines · Luiz Capitulino
Quoted 53 lines · On Fri, 6 May 2011 18:36:31 +0300 Blue Swirl<[email protected]> wrote:
Quoted 52 lines · Markus Armbruster
Quoted 22 lines · Blue Swirl
Quoted 16 lines · Luiz Capitulino
Quoted 4 lines · On Sat, 30 Apr 2011 09:33:15 +0300 Blue Swirl<[email protected]> wrote:
Quoted 3 lines · Luiz Capitulino

This series introduces the inject-nmi command for QMP, which sends an NMI to _all_ guest's CPUs.

Quoted 8 lines
Quoted 3 lines

Also note that this series changes the human monitor nmi command to use the QMP implementation, which means that it now has a DIFFERENT behavior. Please, check patch 3/3 for details.

As discussed earlier, please change the QMP version for future expandability so that instead of single command 'inject-nmi', 'inject' takes parameter 'nmi'. HMP command 'nmi' can remain for now, but 'inject' should be added.

Quoted 4 lines

I'm not sure I agree with this, because we risky overloading 'inject' the same way we did with the 'change' command.

What's 'inject' supposed to do in the future?

Quoted 8 lines

Inject other IRQs, for example inject nmi could become an alias to something like
inject /apic@fee00000:l1int
which would be a shorthand for
raise /apic@fee00000:l1int
lower /apic@fee00000:l1int

I think we only need a registration framework for IRQs and other signals.

Yes, we could use nicer infrastructure for modeling IRQs. No, we shouldn't reject Lai's work because it doesn't get us there. Perfect is the enemy of good.

Pick one:

1. We take inject-nmi now. Should we get a more general inject command like the one you envisage later, we can deprecate inject-nmi, and remove it after a suitable grace time. Big deal. We get the special problem solved now, without really compromising future solutions for the general problem.

2. We reject inject-nmi now. The itch Lai tries to scratch remains unscratched until we get a more general inject command.

2a. Rejection "motivates" Lai to solve the general problem[*]. Or maybe it motivates somebody else. We get the general problem solved sooner. And maybe I get a pony for my birthday, too.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

2b. The general problem remains unsolved along with the special problem. We get nothing.

2c. Don't add full generic IRQ registration and aliases just now but handle 'inject' with only 'nmi'. That way we introduce no legacy baggage to the syntax.

Can you give an example on how this is supposed to look like?

No reply. When you demand a redesign to generalize a simple feature to something only you envisage, please explain what exactly you want. Documentation to stick into qmp-commands.hx would be a start. Here's the baseline from Luiz, for your editing convenience.

inject-nmi
----------

Inject an NMI on guest's CPUs.

Arguments: None.

Quoted 7 lines

Example:

-> { "execute": "inject-nmi" }
<- { "return": {} }

Note: inject-nmi is only supported for x86 guest currently, it will
returns "Unsupported" error for non-x86 guest.

I think I explained it many times, but let's try again.

inject
----------

Inject a signal on guest machine.

Arguments: signal name.

Example:

-> { "execute": "inject",
"arguments": { "signal": "nmi" } }
<- { "return": {} }

Quoted 5 lines
Quoted 3 lines

-> { "execute": "inject",
"arguments": { "signal": "/apic@fee00000:l1int" } } <- { "return": {} }

Shouldn't this be broken into device and signal (or pin) arguments?

I dislike this approach strongly.

Overloading verbs to have multiple meanings is a bad thing for QMP. It means less type safety. Think of a C interface:

inject_nmi() <- good
inject_nim() <- compile error

inject("nmi") <- good
inject("nim") <- runtime error

Quoted 7 lines

Not to mention that "inject" doesn't mean "raise and then lower a pin".
Inject means insert or put in.

I'm not opposed to being able to have a way to raise/lower a qemu_irq, but (a) that's orthogonal to this operation (b) we should design that interface properly. b means that we should be able to enumerate pins, raise and lower pins, and pulse pins.

So, would you be in favor of merging the current series as it stands currently and design this new interface as a new command?

Quoted 12 lines

Regards,

Anthony Liguori

Quoted 6 lines
Quoted 3 lines

Note: the set of signals supported depends on the CPU architecture and board type, unknown or unsupported names will
return "Unsupported" error.

Unsuported error != bad usage error.

#16 lore raw
Quoted 8 lines · Luiz Capitulino
Quoted 5 lines · On Fri, 27 May 2011 09:55:05 -0500 Anthony Liguori <[email protected]>…
Quoted 4 lines · Luiz Capitulino
Quoted 1 line · On Thu, 26 May 2011 22:23:10 +0300 Blue Swirl<[email protected]> wrote:

I think I explained it many times, but let's try again.

Thanks!

Quoted 23 lines
Quoted 23 lines
Quoted 14 lines
Quoted 14 lines

inject
----------

Inject a signal on guest machine.

Arguments: signal name.

Example:

-> { "execute": "inject",
"arguments": { "signal": "nmi" } }
<- { "return": {} }

Quoted 5 lines
Quoted 3 lines

-> { "execute": "inject",
"arguments": { "signal": "/apic@fee00000:l1int" } } <- { "return": {} }

Shouldn't this be broken into device and signal (or pin) arguments?

I dislike this approach strongly.

Quoted 8 lines
Quoted 8 lines

Overloading verbs to have multiple meanings is a bad thing for QMP. It means less type safety. Think of a C interface:

inject_nmi() <- good
inject_nim() <- compile error

inject("nmi") <- good
inject("nim") <- runtime error

Not sure how much mileage we'll get out of static typing in QMP, but overloading commands for dissimilar tasks is bad taste. One ugly bastard like "change" is enough. Thus, this "inject" command should always be limited to irq-like operands.

Quoted 2 lines
Quoted 2 lines

Not to mention that "inject" doesn't mean "raise and then lower a pin".
Inject means insert or put in.

Yes. Like "inject a fault".

Quoted 4 lines
Quoted 4 lines

I'm not opposed to being able to have a way to raise/lower a qemu_irq, but (a) that's orthogonal to this operation (b) we should design that interface properly. b means that we should be able to enumerate pins, raise and lower pins, and pulse pins.

Once qdev models pins nicely, a command to manipulate them shouldn't be hard.

Quoted 2 lines

So, would you be in favor of merging the current series as it stands currently and design this new interface as a new command?

I recommend to commit the sucker already. It's simple, and it solves a problem that's relevant enough for Lai to pursue it for *months*, and starting over now is just not worth it.

[...]

#17 lore raw
In reply to Anthony Liguori
Quoted 140 lines · Anthony Liguori
Quoted 130 lines · Luiz Capitulino
Quoted 126 lines · On Thu, 26 May 2011 22:23:10 +0300 Blue Swirl<[email protected]>  wrote:
Quoted 101 lines · Markus Armbruster
Quoted 79 lines · Luiz Capitulino
Quoted 76 lines · On Fri, 6 May 2011 18:36:31 +0300 Blue Swirl<[email protected]>  wrote:
Quoted 73 lines · Markus Armbruster
Quoted 38 lines · Blue Swirl
Quoted 23 lines · Luiz Capitulino
Quoted 13 lines · On Sat, 30 Apr 2011 09:33:15 +0300 Blue Swirl<[email protected]>  wrote:
Quoted 10 lines · Luiz Capitulino

This series introduces the inject-nmi command for QMP, which sends an
NMI to _all_ guest's CPUs.

Also note that this series changes the human monitor nmi command to use
the QMP implementation, which means that it now has a DIFFERENT behavior.
Please, check patch 3/3 for details.

Quoted 5 lines

As discussed earlier, please change the QMP version for future expandability so that instead of single command 'inject-nmi', 'inject'
takes parameter 'nmi'. HMP command 'nmi' can remain for now, but 'inject' should be added.

Quoted 5 lines

I'm not sure I agree with this, because we risky overloading 'inject' the
same way we did with the 'change' command.

What's 'inject' supposed to do in the future?

Inject other IRQs, for example inject nmi could become an alias to something like
inject /apic@fee00000:l1int
which would be a shorthand for
raise /apic@fee00000:l1int
lower /apic@fee00000:l1int

Quoted 2 lines

I think we only need a registration framework for IRQs and other signals.

Yes, we could use nicer infrastructure for modeling IRQs.  No, we shouldn't reject Lai's work because it doesn't get us there.  Perfect is
the enemy of good.

Pick one:

1. We take inject-nmi now.  Should we get a more general inject command
like the one you envisage later, we can deprecate inject-nmi, and remove
it after a suitable grace time.  Big deal.  We get the special problem
solved now, without really compromising future solutions for the general
problem.

2. We reject inject-nmi now.  The itch Lai tries to scratch remains unscratched until we get a more general inject command.

2a. Rejection "motivates" Lai to solve the general problem[*].  Or maybe
it motivates somebody else.  We get the general problem solved sooner.
And maybe I get a pony for my birthday, too.

2b. The general problem remains unsolved along with the special problem.
We get nothing.

Quoted 5 lines
Quoted 3 lines

2c. Don't add full generic IRQ registration and aliases just now but handle 'inject' with only 'nmi'. That way we introduce no legacy baggage to the syntax.

Can you give an example on how this is supposed to look like?

No reply.  When you demand a redesign to generalize a simple feature to something only you envisage, please explain what exactly you want. Documentation to stick into qmp-commands.hx would be a start.  Here's the baseline from Luiz, for your editing convenience.

inject-nmi
----------

Inject an NMI on guest's CPUs.

Arguments: None.

Quoted 7 lines

Example:

->  { "execute": "inject-nmi" }
<- { "return": {} }

Note: inject-nmi is only supported for x86 guest currently, it will returns "Unsupported" error for non-x86 guest.

I think I explained it many times, but let's try again.

inject
----------

Inject a signal on guest machine.

Arguments: signal name.

Example:

->  { "execute": "inject",
"arguments": { "signal": "nmi" } }
<- { "return": {} }

Quoted 5 lines
Quoted 3 lines

->  { "execute": "inject",
"arguments": { "signal": "/apic@fee00000:l1int" } } <- { "return": {} }

Shouldn't this be broken into device and signal (or pin) arguments?

I dislike this approach strongly.

Quoted 8 lines

Overloading verbs to have multiple meanings is a bad thing for QMP.  It means less type safety.  Think of a C interface:

inject_nmi() <- good
inject_nim() <- compile error

inject("nmi") <- good
inject("nim") <- runtime error

But we don't have change_floppy, change_ide1-cd0 etc. Why should there be a special command in this case?

Quoted 7 lines

Not to mention that "inject" doesn't mean "raise and then lower a pin". Inject means insert or put in.

I'm not opposed to being able to have a way to raise/lower a qemu_irq, but
(a) that's orthogonal to this operation (b) we should design that interface properly.  b means that we should be able to enumerate pins, raise and lower pins, and pulse pins.

OK.

pulse
----------

Pulse a signal on guest machine.

Arguments: signal name.

Example:

-> { "execute": "pulse",
"arguments": { "signal": "nmi" } }
<- { "return": {} }

-> { "execute": "inject",
"arguments": { "signal": "/apic@fee00000:l1int" } } <- { "return": {} }

Note: the set of signals supported depends on the CPU architecture and board type, unknown or unsupported names will
return "Unsupported" error.

The second example could be implemented when the pin registration is in place. For NMI, some specific hack could be introduced at this point which could be replaced later by adding convenience names for common signals. That way the interface would remain stable.