qemu,qmp: convert do_inject_nmi() to QObject, QError
PATCH v3 1/1 qemu,qmp: convert do_inject_nmi() to QObject, QError
Convert do_inject_nmi() to QObject, QError, we need to use it(via libvirt).
changed from v1
Add document.
Add error handling when the cpu index is invalid.
changed from v2
use QERR_INVALID_PARAMETER_VALUE as Markus suggest.
---
hmp-commands.hx +2 -1
@@ -724,7 +724,8 @@ ETEXI .args_type = "cpu_index:i", .params = "cpu", .help = "inject an NMI on the given CPU", - .mhandler.cmd = do_inject_nmi, + .user_print = monitor_user_noop, + .mhandler.cmd_new = do_inject_nmi, }, #endif STEXI
monitor.c +6 -2
@@ -2119,7 +2119,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) +static int do_inject_nmi (Monitor *mon,const QDict *qdict,QObject **ret_data) {CPUState *env;int cpu_index =qdict_get_int (qdict,"cpu_index" );
@@ -2127,8 +2127,12 @@ static void do_inject_nmi(Monitor *mon, const QDict *qdict)for (env = first_cpu; env !=NULL ; env = env->next_cpu)if (env->cpu_index == cpu_index) {cpu_interrupt (env,CPU_INTERRUPT_NMI ); -break ; +return 0 ; } + +qerror_report (QERR_INVALID_PARAMETER_VALUE ,"cpu_index" , +"a CPU number" ); + return -1; }#endif
qmp-commands.hx +27 -0
@@ -429,6 +429,33 @@ Example: EQMP +#if defined(TARGET_I386) + { + .name = "inject_nmi", + .args_type = "cpu_index:i", + .params = "cpu", + .help = "inject an NMI on the given CPU", + .user_print = monitor_user_noop, + .mhandler.cmd_new = do_inject_nmi, + }, +#endif +SQMP +inject_nmi +---------- + +Inject an NMI on the given CPU (x86 only). + +Arguments: + +- "cpu_index": the index of the CPU to be injected NMI (json-int) + +Example: + +-> { "execute": "inject_nmi", "arguments": { "cpu_index": 0 } } +<- { "return": {} } + +EQMP + { .name = "migrate", .args_type = "detach:-d,blk:-b,inc:-i,uri:s",
Re: [Qemu-devel] [PATCH v3] qemu, qmp: convert do_inject_nmi() to QObject, QError
Quoted 10 lines · Lai Jiangshan
Convert
do_inject_nmi()to QObject, QError, we need to use it(via libvirt).changed from v1
Add document.
Add error handling when the cpu index is invalid.changed from v2
useQERR_INVALID_PARAMETER_VALUEas Markus suggest.Signed-off-by Lai Jiangshan <[email protected]>
A note on commit messages:
The commit message should describe the current version of the patch. Don't repeat the subject line in the body.
Patch history is very useful for review, but usually uninteresting once the patch is committed. Thus, it's best to put it after the "---" separator.
Subsystem tags in the subject line are helpful. But "qemu" doesn't provide any information there :)
Regarding the patch:
The conversion looks good.
The new QMP command is called "inject_nmi", while the existing human monitor command is called "nmi". Luiz asked for this name change. I don't mind. But should we rename the human monitor command for consistency?
Regardless, the differing command name is worth mentioning in the commit message.
Quoted 70 lines · On Wed, 15 Dec 2010 17:49:27 +0800 Lai Jiangshan <[email protected]> wrote:
Convert
do_inject_nmi()to QObject, QError, we need to use it(via libvirt).changed from v1
Add document.
Add error handling when the cpu index is invalid.changed from v2
useQERR_INVALID_PARAMETER_VALUEas Markus suggest.Signed-off-by Lai Jiangshan <[email protected]>---
hmp-commands.hx +2
-1@@ -724,7 +724,8 @@ ETEXI .args_type = "cpu_index:i", .params = "cpu", .help = "inject an NMI on the given CPU", - .mhandler.cmd = do_inject_nmi, + .user_print = monitor_user_noop, + .mhandler.cmd_new = do_inject_nmi, }, #endif STEXImonitor.c +6
-2@@ -2119,7 +2119,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) +static int do_inject_nmi (Monitor *mon,const QDict *qdict,QObject **ret_data) {CPUState *env;int cpu_index =qdict_get_int (qdict,"cpu_index" );@@ -2127,8 +2127,12 @@ static void do_inject_nmi(Monitor *mon, const QDict *qdict)for (env = first_cpu; env !=NULL ; env = env->next_cpu)if (env->cpu_index == cpu_index) {cpu_interrupt (env,CPU_INTERRUPT_NMI ); -break ; +return 0 ; } + +qerror_report (QERR_INVALID_PARAMETER_VALUE ,"cpu_index" , +"a CPU number" ); + return -1; }#endif qmp-commands.hx +9
-0@@ -429,6 +429,33 @@ Example: EQMP +#if defined(TARGET_I386) + { + .name = "inject_nmi", + .args_type = "cpu_index:i", + .params = "cpu", + .help = "inject an NMI on the given CPU", + .user_print = monitor_user_noop, + .mhandler.cmd_new = do_inject_nmi, + },
qmp-commands.hx Example: · line 450
Quoted 10 lines
qmp-commands.hx +10
-0+#endif +SQMP +inject_nmi +---------- + +Inject an NMI on the given CPU (x86 only). + +Arguments: + +- "cpu_index": the index of the CPU to be injected NMI (json-int)
Please, use cpu-index, that's what we're using for the human-monitor-command.
Avi, Anthony, can you please ACK this new command?
Quoted 12 lines
qmp-commands.hx +8
-0+ +Example: + +-> { "execute": "inject_nmi", "arguments": { "cpu_index": 0 } } +<- { "return": {} } + +EQMP + { .name = "migrate", .args_type = "detach:-d,blk:-b,inc:-i,uri:s",
Re: [Qemu-devel] [PATCH v3] qemu, qmp: convert do_inject_nmi() to QObject, QError
In reply to Markus ArmbrusterQuoted 26 lines · On Wed, 15 Dec 2010 11:49:23 +0100 Markus Armbruster <[email protected]> wrote:
Quoted 10 lines · Lai Jiangshan
Convert
do_inject_nmi()to QObject, QError, we need to use it(via libvirt).changed from v1
Add document.
Add error handling when the cpu index is invalid.changed from v2
useQERR_INVALID_PARAMETER_VALUEas Markus suggest.Signed-off-by Lai Jiangshan <[email protected]>A note on commit messages:
The commit message should describe the current version of the patch. Don't repeat the subject line in the body.
Patch history is very useful for review, but usually uninteresting once the patch is committed. Thus, it's best to put it after the "---" separator.
Subsystem tags in the subject line are helpful. But "qemu" doesn't provide any information there :)
Quoted 8 lines
Regarding the patch:
The conversion looks good.
The new QMP command is called "
inject_nmi", while the existing human monitor command is called "nmi". Luiz asked for this name change. I don't mind. But should we rename the human monitor command for consistency?
I don't think so, we don't need (and maybe don't even want) naming parity between QMP and HMP. Remember that one of our mistakes was to couple the two.
Also, Avi asked for more descriptive names in QMP and I agree with him, I would even be in favor of calling it inject-non-maskable-interrupt.
Quoted 3 lines
Regardless, the differing command name is worth mentioning in the commit message.
Quoted 84 lines · Luiz Capitulino
Quoted 69 lines · On Wed, 15 Dec 2010 17:49:27 +0800 Lai Jiangshan<[email protected]> wrote:
Convert
do_inject_nmi()to QObject, QError, we need to use it(via libvirt).changed from v1
Add document.
Add error handling when the cpu index is invalid.changed from v2
useQERR_INVALID_PARAMETER_VALUEas Markus suggest.Signed-off-by Lai Jiangshan<[email protected]>---
diff --git a/hmp-commands.hx b/hmp-commands.hx
index 23024ba..f86d9fe 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -724,7 +724,8 @@ ETEXI.args_type = "cpu_index:i", .params = "cpu", .help = "inject an NMI on the given CPU", - .mhandler.cmd = do_inject_nmi, + .user_print = monitor_user_noop, + .mhandler.cmd_new = do_inject_nmi, },#endif
STEXI
diff --gita/monitor.cb/monitor.c
index ec31eac..3e33a96 100644
---a/monitor.c
+++b/monitor.c
@@ -2119,7 +2119,7 @@ static voiddo_wav_capture(Monitor *mon, const QDict *qdict)
#endif#if
defined(TARGET_I386)
-static voiddo_inject_nmi(Monitor *mon, const QDict *qdict)+static intdo_inject_nmi(Monitor *mon, const QDict *qdict, QObject **ret_data){ CPUState *env; int cpu_index = qdict_get_int(qdict, "cpu_index"); @@ -2127,8 +2127,12 @@ static void do_inject_nmi(Monitor *mon, const QDict *qdict) for (env = first_cpu; env != NULL; env = env->next_cpu) if (env->cpu_index == cpu_index) { cpu_interrupt(env, CPU_INTERRUPT_NMI); - break; + return 0; }+
+ qerror_report(QERR_INVALID_PARAMETER_VALUE, "cpu_index",
+ "a CPU number");
+ return -1;
}
#endifdiff --git a/qmp-commands.hx b/qmp-commands.hx
index e5f157f..fcb6bf2 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -429,6 +429,33 @@ Example:EQMP
+#if
defined(TARGET_I386)
+ {+ .name = "inject_nmi", + .args_type = "cpu_index:i", + .params = "cpu", + .help = "inject an NMI on the given CPU", + .user_print = monitor_user_noop, + .mhandler.cmd_new = do_inject_nmi,Quoted 11 lines
+ },
+#endif
+SQMP
+inject_nmi
+----------
+
+Inject an NMI on the given CPU (x86 only).
+
+Arguments:
+
+- "cpu_index": the index of the CPU to be injected NMI (json-int)
Quoted 4 lines
Please, use cpu-index, that's what we're using for the human-monitor-command.
Avi, Anthony, can you please ACK this new command?
I'd like to see cpu-index made optional; if not present, nmi all cpus (that's what the nmi button on many machines does, or at least I think that's what it does).
Signature · 1 line
error compiling committee.c: too many arguments to function
Quoted 85 lines · On Wed, 15 Dec 2010 19:18:32 +0200 Avi Kivity <[email protected]> wrote:
Quoted 84 lines · Luiz Capitulino
Quoted 80 lines · On Wed, 15 Dec 2010 17:49:27 +0800 Lai Jiangshan<[email protected]> wrote:
Convert
do_inject_nmi()to QObject, QError, we need to use it(via libvirt).changed from v1
Add document.
Add error handling when the cpu index is invalid.changed from v2
useQERR_INVALID_PARAMETER_VALUEas Markus suggest.Signed-off-by Lai Jiangshan<[email protected]>---
diff --git a/hmp-commands.hx b/hmp-commands.hx
index 23024ba..f86d9fe 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -724,7 +724,8 @@ ETEXI.args_type = "cpu_index:i", .params = "cpu", .help = "inject an NMI on the given CPU", - .mhandler.cmd = do_inject_nmi, + .user_print = monitor_user_noop, + .mhandler.cmd_new = do_inject_nmi, },#endif
STEXI
diff --gita/monitor.cb/monitor.c
index ec31eac..3e33a96 100644
---a/monitor.c
+++b/monitor.c
@@ -2119,7 +2119,7 @@ static voiddo_wav_capture(Monitor *mon, const QDict *qdict)
#endif#if
defined(TARGET_I386)
-static voiddo_inject_nmi(Monitor *mon, const QDict *qdict)+static intdo_inject_nmi(Monitor *mon, const QDict *qdict, QObject **ret_data){ CPUState *env; int cpu_index = qdict_get_int(qdict, "cpu_index"); @@ -2127,8 +2127,12 @@ static void do_inject_nmi(Monitor *mon, const QDict *qdict) for (env = first_cpu; env != NULL; env = env->next_cpu) if (env->cpu_index == cpu_index) { cpu_interrupt(env, CPU_INTERRUPT_NMI); - break; + return 0; }+
+ qerror_report(QERR_INVALID_PARAMETER_VALUE, "cpu_index",
+ "a CPU number");
+ return -1;
}
#endifdiff --git a/qmp-commands.hx b/qmp-commands.hx
index e5f157f..fcb6bf2 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -429,6 +429,33 @@ Example:EQMP
+#if
defined(TARGET_I386)
+ {+ .name = "inject_nmi", + .args_type = "cpu_index:i", + .params = "cpu", + .help = "inject an NMI on the given CPU", + .user_print = monitor_user_noop, + .mhandler.cmd_new = do_inject_nmi,+ },
+#endif
+SQMP
+inject_nmi
+----------
+
+Inject an NMI on the given CPU (x86 only).
+
+Arguments:
+
+- "cpu_index": the index of the CPU to be injected NMI (json-int)
Quoted 8 lines
Quoted 4 lines
Please, use cpu-index, that's what we're using for the human-monitor-command.
Avi, Anthony, can you please ACK this new command?
I'd like to see cpu-index made optional; if not present, nmi all cpus (that's what the nmi button on many machines does, or at least I think that's what it does).
Looks like a GUI feature to me, _might_ turn out to be an undesirable side effect to client writers. I guess I prefer a to-all-cpus argument.
Re: [Qemu-devel] [PATCH v3] qemu, qmp: convert do_inject_nmi() to QObject, QError
In reply to Luiz CapitulinoQuoted 33 lines · Luiz Capitulino
Quoted 30 lines · On Wed, 15 Dec 2010 11:49:23 +0100 Markus Armbruster <[email protected]> wrote:
Quoted 10 lines · Lai Jiangshan
Convert
do_inject_nmi()to QObject, QError, we need to use it(via libvirt).changed from v1
Add document.
Add error handling when the cpu index is invalid.changed from v2
useQERR_INVALID_PARAMETER_VALUEas Markus suggest.Signed-off-by Lai Jiangshan <[email protected]>A note on commit messages:
The commit message should describe the current version of the patch. Don't repeat the subject line in the body.
Patch history is very useful for review, but usually uninteresting once the patch is committed. Thus, it's best to put it after the "---" separator.
Subsystem tags in the subject line are helpful. But "qemu" doesn't provide any information there :)
Regarding the patch:
The conversion looks good.
Quoted 7 lines
Quoted 4 lines
The new QMP command is called "
inject_nmi", while the existing human monitor command is called "nmi". Luiz asked for this name change. I don't mind. But should we rename the human monitor command for consistency?I don't think so, we don't need (and maybe don't even want) naming parity between QMP and HMP. Remember that one of our mistakes was to couple the two.
Human "nmi" and QMP "inject_nmi" are identical commands, aren't they? Giving the same things the same name isn't coupling :)
The mistake that matters here was adopting existing human commands for QMP uncritically.
Quoted 2 lines
Also, Avi asked for more descriptive names in QMP and I agree with him, I would even be in favor of calling it inject-non-maskable-interrupt.
I like inject_nmi better than nmi. inject-non-maskable-interrupt is too long even for QMP.
Quoted 2 lines
Quoted 2 lines
Regardless, the differing command name is worth mentioning in the commit message.
Quoted 90 lines · Luiz Capitulino
Quoted 87 lines · On Wed, 15 Dec 2010 19:18:32 +0200 Avi Kivity <[email protected]> wrote:
Quoted 86 lines · Luiz Capitulino
Quoted 69 lines · On Wed, 15 Dec 2010 17:49:27 +0800 Lai Jiangshan<[email protected]> wrote:
Convert
do_inject_nmi()to QObject, QError, we need to use it(via libvirt).changed from v1
Add document.
Add error handling when the cpu index is invalid.changed from v2
useQERR_INVALID_PARAMETER_VALUEas Markus suggest.Signed-off-by Lai Jiangshan<[email protected]>---
diff --git a/hmp-commands.hx b/hmp-commands.hx
index 23024ba..f86d9fe 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -724,7 +724,8 @@ ETEXI.args_type = "cpu_index:i", .params = "cpu", .help = "inject an NMI on the given CPU", - .mhandler.cmd = do_inject_nmi, + .user_print = monitor_user_noop, + .mhandler.cmd_new = do_inject_nmi, },#endif
STEXI
diff --gita/monitor.cb/monitor.c
index ec31eac..3e33a96 100644
---a/monitor.c
+++b/monitor.c
@@ -2119,7 +2119,7 @@ static voiddo_wav_capture(Monitor *mon, const QDict *qdict)
#endif#if
defined(TARGET_I386)
-static voiddo_inject_nmi(Monitor *mon, const QDict *qdict)+static intdo_inject_nmi(Monitor *mon, const QDict *qdict, QObject **ret_data){ CPUState *env; int cpu_index = qdict_get_int(qdict, "cpu_index"); @@ -2127,8 +2127,12 @@ static void do_inject_nmi(Monitor *mon, const QDict *qdict) for (env = first_cpu; env != NULL; env = env->next_cpu) if (env->cpu_index == cpu_index) { cpu_interrupt(env, CPU_INTERRUPT_NMI); - break; + return 0; }+
+ qerror_report(QERR_INVALID_PARAMETER_VALUE, "cpu_index",
+ "a CPU number");
+ return -1;
}
#endifdiff --git a/qmp-commands.hx b/qmp-commands.hx
index e5f157f..fcb6bf2 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -429,6 +429,33 @@ Example:EQMP
+#if
defined(TARGET_I386)
+ {+ .name = "inject_nmi", + .args_type = "cpu_index:i", + .params = "cpu", + .help = "inject an NMI on the given CPU", + .user_print = monitor_user_noop, + .mhandler.cmd_new = do_inject_nmi,Quoted 11 lines
+ },
+#endif
+SQMP
+inject_nmi
+----------
+
+Inject an NMI on the given CPU (x86 only).
+
+Arguments:
+
+- "cpu_index": the index of the CPU to be injected NMI (json-int)Please, use cpu-index, that's what we're using for the human-monitor-command.
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Avi, Anthony, can you please ACK this new command?
I'd like to see cpu-index made optional; if not present, nmi all cpus (that's what the nmi button on many machines does, or at least I think that's what it does).
Looks like a GUI feature to me,
Really? Can't see how you can build "NMI to all CPUs" from "NMI this CPU". Or am I misunderstanding you?
Quoted 2 lines
_might_ turn out to be an undesirable
side effect to client writers.
They seem to be coping fine with optional arguments elsewhere.
Quoted 1 line
I guess I prefer a to-all-cpus argument.
How would that look like? "cpu-index": "all"?
I find "optional json-int" a simpler schema than "either a json-int or the json-string "all".
Re: [Qemu-devel] [PATCH v3] qemu, qmp: convert do_inject_nmi() to QObject, QError
In reply to Markus ArmbrusterQuoted 40 lines · On Wed, 15 Dec 2010 18:39:07 +0100 Markus Armbruster <[email protected]> wrote:
Quoted 38 lines · Luiz Capitulino
Quoted 34 lines · On Wed, 15 Dec 2010 11:49:23 +0100 Markus Armbruster <[email protected]> wrote:
Quoted 10 lines · Lai Jiangshan
Convert
do_inject_nmi()to QObject, QError, we need to use it(via libvirt).changed from v1
Add document.
Add error handling when the cpu index is invalid.changed from v2
useQERR_INVALID_PARAMETER_VALUEas Markus suggest.Signed-off-by Lai Jiangshan <[email protected]>A note on commit messages:
The commit message should describe the current version of the patch. Don't repeat the subject line in the body.
Patch history is very useful for review, but usually uninteresting once the patch is committed. Thus, it's best to put it after the "---" separator.
Subsystem tags in the subject line are helpful. But "qemu" doesn't provide any information there :)
Regarding the patch:
The conversion looks good.
The new QMP command is called "
inject_nmi", while the existing human monitor command is called "nmi". Luiz asked for this name change. I don't mind. But should we rename the human monitor command for consistency?
Quoted 4 lines
Quoted 2 lines
I don't think so, we don't need (and maybe don't even want) naming parity between QMP and HMP. Remember that one of our mistakes was to couple the two.
Human "nmi" and QMP "
inject_nmi" are identical commands, aren't they?
At this point in time yes, but they might not be in the near future. Assuming they might be different is the safest thing to do.
That's true for all existing commands.
Quoted 1 line
Giving the same things the same name isn't coupling :)
Expecting them to be the same in the future is.
Quoted 2 lines
The mistake that matters here was adopting existing human commands for QMP uncritically.
That's the protocol visible mistake, yes.
Quoted 5 lines
Quoted 2 lines
Also, Avi asked for more descriptive names in QMP and I agree with him, I would even be in favor of calling it inject-non-maskable-interrupt.
I like
inject_nmibetter than nmi. inject-non-maskable-interrupt is too long even for QMP.
It's not supposed to be typed that much, but I'm not that strong about that.
nitpick: I think we should be consistent in the use of "_" or "-", eg. we
should pick inject-nmi or inject_nmi?
Quoted 4 lines
Quoted 3 lines
Quoted 3 lines
Regardless, the differing command name is worth mentioning in the commit message.
Quoted 95 lines · On Wed, 15 Dec 2010 18:45:09 +0100 Markus Armbruster <[email protected]> wrote:
Quoted 93 lines · Luiz Capitulino
Quoted 90 lines · On Wed, 15 Dec 2010 19:18:32 +0200 Avi Kivity <[email protected]> wrote:
Quoted 88 lines · Luiz Capitulino
Quoted 69 lines · On Wed, 15 Dec 2010 17:49:27 +0800 Lai Jiangshan<[email protected]> wrote:
Convert
do_inject_nmi()to QObject, QError, we need to use it(via libvirt).changed from v1
Add document.
Add error handling when the cpu index is invalid.changed from v2
useQERR_INVALID_PARAMETER_VALUEas Markus suggest.Signed-off-by Lai Jiangshan<[email protected]>---
diff --git a/hmp-commands.hx b/hmp-commands.hx
index 23024ba..f86d9fe 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -724,7 +724,8 @@ ETEXI.args_type = "cpu_index:i", .params = "cpu", .help = "inject an NMI on the given CPU", - .mhandler.cmd = do_inject_nmi, + .user_print = monitor_user_noop, + .mhandler.cmd_new = do_inject_nmi, },#endif
STEXI
diff --gita/monitor.cb/monitor.c
index ec31eac..3e33a96 100644
---a/monitor.c
+++b/monitor.c
@@ -2119,7 +2119,7 @@ static voiddo_wav_capture(Monitor *mon, const QDict *qdict)
#endif#if
defined(TARGET_I386)
-static voiddo_inject_nmi(Monitor *mon, const QDict *qdict)+static intdo_inject_nmi(Monitor *mon, const QDict *qdict, QObject **ret_data){ CPUState *env; int cpu_index = qdict_get_int(qdict, "cpu_index"); @@ -2127,8 +2127,12 @@ static void do_inject_nmi(Monitor *mon, const QDict *qdict) for (env = first_cpu; env != NULL; env = env->next_cpu) if (env->cpu_index == cpu_index) { cpu_interrupt(env, CPU_INTERRUPT_NMI); - break; + return 0; }+
+ qerror_report(QERR_INVALID_PARAMETER_VALUE, "cpu_index",
+ "a CPU number");
+ return -1;
}
#endifdiff --git a/qmp-commands.hx b/qmp-commands.hx
index e5f157f..fcb6bf2 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -429,6 +429,33 @@ Example:EQMP
+#if
defined(TARGET_I386)
+ {+ .name = "inject_nmi", + .args_type = "cpu_index:i", + .params = "cpu", + .help = "inject an NMI on the given CPU", + .user_print = monitor_user_noop, + .mhandler.cmd_new = do_inject_nmi,Quoted 11 lines
+ },
+#endif
+SQMP
+inject_nmi
+----------
+
+Inject an NMI on the given CPU (x86 only).
+
+Arguments:
+
+- "cpu_index": the index of the CPU to be injected NMI (json-int)Please, use cpu-index, that's what we're using for the human-monitor-command.
Avi, Anthony, can you please ACK this new command?
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
I'd like to see cpu-index made optional; if not present, nmi all cpus (that's what the nmi button on many machines does, or at least I think that's what it does).
Looks like a GUI feature to me,
Really? Can't see how you can build "NMI to all CPUs" from "NMI this CPU". Or am I misunderstanding you?
I guess so. Avi referred to 'nmi button on many machines', I assumed he meant a virtual machine GUI, am I wrong?
Quoted 4 lines
Quoted 2 lines
_might_ turn out to be an undesirable
side effect to client writers.They seem to be coping fine with optional arguments elsewhere.
Which we might want to review.
Quoted 3 lines
Quoted 1 line
I guess I prefer a to-all-cpus argument.
How would that look like? "cpu-index": "all"?
Like this:
{ "execute": "inject-nmi", "arguments": { "to-all-cpus": true } }
But this looks like an optimization to me, because it's also easy to do:
for cpu in query-cpus; do
inject-nmi cpu
Unless we want to do this in an "atomic" way, due to side effects I'm not aware about.
Quoted 3 lines
I find "optional json-int" a simpler schema than "either a json-int or the json-string "all".
Quoted 8 lines · Luiz Capitulino
Quoted 5 lines
Quoted 2 lines
Looks like a GUI feature to me,
Really? Can't see how you can build "NMI to all CPUs" from "NMI this CPU". Or am I misunderstanding you?
I guess so. Avi referred to 'nmi button on many machines', I assumed he meant a virtual machine GUI, am I wrong?
I meant a real machine's GUI (it's a physical button you can press with your finger, if you have thin fingers).
Signature · 1 line
error compiling committee.c: too many arguments to function
Re: [Qemu-devel] Re: [PATCH v3] qemu, qmp: convert do_inject_nmi() to QObject, QError
In reply to Luiz CapitulinoQuoted 7 lines · Luiz Capitulino
Quoted 4 lines · On Wed, 15 Dec 2010 18:45:09 +0100 Markus Armbruster <[email protected]> wrote:
Quoted 2 lines · Luiz Capitulino
On Wed, 15 Dec 2010 19:18:32 +0200
Avi Kivity <[email protected]> wrote:
[...]
Quoted 27 lines
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
I'd like to see cpu-index made optional; if not present, nmi all cpus (that's what the nmi button on many machines does, or at least I think that's what it does).
Looks like a GUI feature to me,
Really? Can't see how you can build "NMI to all CPUs" from "NMI this CPU". Or am I misunderstanding you?
I guess so. Avi referred to 'nmi button on many machines', I assumed he meant a virtual machine GUI, am I wrong?
Quoted 4 lines
Quoted 2 lines
_might_ turn out to be an undesirable
side effect to client writers.They seem to be coping fine with optional arguments elsewhere.
Which we might want to review.
Quoted 3 lines
Quoted 1 line
I guess I prefer a to-all-cpus argument.
How would that look like? "cpu-index": "all"?
Like this:
{ "execute": "inject-nmi", "arguments": { "to-all-cpus": true } }
Quoted 7 lines
But this looks like an optimization to me, because it's also easy to do:
for cpu in query-cpus; do
inject-nmi cpuUnless we want to do this in an "atomic" way, due to side effects I'm not aware about.
I'd expect a physical NMI button to interrupt all CPUs simultaneously (modulo wire length).
[...]
Quoted 4 lines · On Thu, 16 Dec 2010 11:03:38 +0200 Avi Kivity <[email protected]> wrote:
Quoted 3 lines · Luiz Capitulino
Quoted 3 lines
Quoted 2 lines
Looks like a GUI feature to me,
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Really? Can't see how you can build "NMI to all CPUs" from "NMI this CPU". Or am I misunderstanding you?
I guess so. Avi referred to 'nmi button on many machines', I assumed he meant a virtual machine GUI, am I wrong?
I meant a real machine's GUI (it's a physical button you can press with your finger, if you have thin fingers).
Ok, I didn't know that, but I had another idea: the command could accept either a single cpu index or a list:
{ "execute": "inject-nmi", "arguments": { "cpus": 2 } }
{ "execute": "inject-nmi", "arguments": { "cpus": [1, 2, 3, 4] } }
This has the feature of injecting the nmi in just some cpus, although I'm not sure this is going to be desired/useful.
If we agree on this we'll have to wait because the monitor doesn't currently support "hybrid" arguments.
Quoted 8 lines · Luiz Capitulino
Ok, I didn't know that, but I had another idea: the command could accept either a single cpu index or a list:
{ "execute": "inject-nmi", "arguments": { "cpus": 2 } } { "execute": "inject-nmi", "arguments": { "cpus": [1, 2, 3, 4] } }
Quoted 5 lines
This has the feature of injecting the nmi in just some cpus, although I'm not sure this is going to be desired/useful.
If we agree on this we'll have to wait because the monitor doesn't currently support "hybrid" arguments.
I hope it never does. They're hard to support in old-school statically typed languages.
Signature · 1 line
error compiling committee.c: too many arguments to function
Quoted 9 lines · On Thu, 16 Dec 2010 12:51:14 +0200 Avi Kivity <[email protected]> wrote:
Quoted 8 lines · Luiz Capitulino
Ok, I didn't know that, but I had another idea: the command could accept either a single cpu index or a list:
{ "execute": "inject-nmi", "arguments": { "cpus": 2 } } { "execute": "inject-nmi", "arguments": { "cpus": [1, 2, 3, 4] } }
Quoted 8 lines
Quoted 5 lines
This has the feature of injecting the nmi in just some cpus, although I'm not sure this is going to be desired/useful.
If we agree on this we'll have to wait because the monitor doesn't currently support "hybrid" arguments.
I hope it never does. They're hard to support in old-school statically typed languages.
We could accept only a list then.
Re: [Qemu-devel] Re: [PATCH v3] qemu, qmp: convert do_inject_nmi() to QObject, QError
In reply to Luiz CapitulinoQuoted 20 lines · Luiz Capitulino
Quoted 4 lines · On Thu, 16 Dec 2010 11:03:38 +0200 Avi Kivity <[email protected]> wrote:
Quoted 3 lines · Luiz Capitulino
Quoted 3 lines
Quoted 2 lines
Looks like a GUI feature to me,
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Really? Can't see how you can build "NMI to all CPUs" from "NMI this CPU". Or am I misunderstanding you?
I guess so. Avi referred to 'nmi button on many machines', I assumed he meant a virtual machine GUI, am I wrong?
I meant a real machine's GUI (it's a physical button you can press with your finger, if you have thin fingers).
Ok, I didn't know that, but I had another idea: the command could accept either a single cpu index or a list:
Quoted 6 lines
{ "execute": "inject-nmi", "arguments": { "cpus": 2 } }
{ "execute": "inject-nmi", "arguments": { "cpus": [1, 2, 3, 4] } }
This has the feature of injecting the nmi in just some cpus, although I'm not sure this is going to be desired/useful.
Use case for NMI-ing a subset of the CPUs?
Heck, use case for anything else but "NMI all"?
Quoted 2 lines
If we agree on this we'll have to wait because the monitor doesn't currently support "hybrid" arguments.
Let's keep the schema simple.
Re: [Qemu-devel] Re: [PATCH v3] qemu, qmp: convert do_inject_nmi() to QObject, QError
Quoted 7 lines · Markus Armbruster
Quoted 3 lines
This has the feature of injecting the nmi in just some cpus, although I'm not sure this is going to be desired/useful.
Use case for NMI-ing a subset of the CPUs?
Heck, use case for anything else but "NMI all"?
Exactly.
Signature · 1 line
error compiling committee.c: too many arguments to function
Re: [Qemu-devel] Re: [PATCH v3] qemu, qmp: convert do_inject_nmi() to QObject, QError
Quoted 10 lines · On Thu, 16 Dec 2010 14:50:08 +0200 Avi Kivity <[email protected]> wrote:
Quoted 7 lines · Markus Armbruster
Quoted 3 lines
This has the feature of injecting the nmi in just some cpus, although I'm not sure this is going to be desired/useful.
Use case for NMI-ing a subset of the CPUs?
Heck, use case for anything else but "NMI all"?
Exactly.
Then I think the to-all-cpus argument is better.
Re: [Qemu-devel] Re: [PATCH v3] qemu, qmp: convert do_inject_nmi() to QObject, QError
Quoted 8 lines · Luiz Capitulino
Quoted 5 lines · On Thu, 16 Dec 2010 14:50:08 +0200 Avi Kivity<[email protected]> wrote:
Quoted 4 lines · Markus Armbruster
Quoted 3 lines
This has the feature of injecting the nmi in just some cpus, although I'm not sure this is going to be desired/useful.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Use case for NMI-ing a subset of the CPUs?
Heck, use case for anything else but "NMI all"?
Exactly.
Then I think the to-all-cpus argument is better.
Why have an argument at all? Always nmi to all cpus.
Signature · 1 line
error compiling committee.c: too many arguments to function
Re: [Qemu-devel] Re: [PATCH v3] qemu, qmp: convert do_inject_nmi() to QObject, QError
Quoted 11 lines · On Thu, 16 Dec 2010 15:11:50 +0200 Avi Kivity <[email protected]> wrote:
Quoted 10 lines · Luiz Capitulino
Quoted 7 lines · On Thu, 16 Dec 2010 14:50:08 +0200 Avi Kivity<[email protected]> wrote:
Quoted 6 lines · Markus Armbruster
Quoted 3 lines
This has the feature of injecting the nmi in just some cpus, although I'm not sure this is going to be desired/useful.
Use case for NMI-ing a subset of the CPUs?
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Heck, use case for anything else but "NMI all"?
Exactly.
Then I think the to-all-cpus argument is better.
Why have an argument at all? Always nmi to all cpus.
That's possible too.
Re: [Qemu-devel] Re: [PATCH v3] qemu, qmp: convert do_inject_nmi() to QObject, QError
Quoted 5 lines · Luiz Capitulino
Quoted 2 lines · On Thu, 16 Dec 2010 15:11:50 +0200 Avi Kivity <[email protected]> wrote:
Why have an argument at all? Always nmi to all cpus.
I think Avi's suggest is better, and I will use "inject-nmi" (without cpu-index argument) to send NMI to all cpus, like physical GUI. If some one want to send NMI to a set of cpus, he can use "inject-nmi" multiple times.
I also like "cpu-index", so I have to add another patch for coverting current "cpu_index" to "cpu-index".
Thanks,
Lai
Re: [Qemu-devel] Re: [PATCH v3] qemu, qmp: convert do_inject_nmi() to QObject, QError
Quoted 11 lines · On Fri, 17 Dec 2010 14:20:15 +0800 Lai Jiangshan <[email protected]> wrote:
Quoted 5 lines · Luiz Capitulino
Quoted 2 lines · On Thu, 16 Dec 2010 15:11:50 +0200 Avi Kivity <[email protected]> wrote:
Why have an argument at all? Always nmi to all cpus.
I think Avi's suggest is better, and I will use "inject-nmi" (without cpu-index argument) to send NMI to all cpus, like physical GUI. If some one want to send NMI to a set of cpus, he can use "inject-nmi" multiple times.
His suggestion is to drop _all_ arguments, right Avi?
This will simplify things, but you'll need a small refactoring to keep the human monitor behavior (which accepts a cpu index).
Quoted 6 lines
I also like "cpu-index", so I have to add another patch for coverting current "
cpu_index" to "cpu-index".Thanks,
Lai
Re: [Qemu-devel] Re: [PATCH v3] qemu, qmp: convert do_inject_nmi() to QObject, QError
Quoted 7 lines · Luiz Capitulino
Quoted 5 lines
I think Avi's suggest is better, and I will use "inject-nmi" (without cpu-index argument) to send NMI to all cpus, like physical GUI. If some one want to send NMI to a set of cpus, he can use "inject-nmi" multiple times.
His suggestion is to drop _all_ arguments, right Avi?
Yes.
Signature · 2 lines
I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain.
Re: [Qemu-devel] Re: [PATCH v3] qemu, qmp: convert do_inject_nmi() to QObject, QError
Quoted 11 lines · Avi Kivity
Quoted 7 lines · Luiz Capitulino
Quoted 5 lines
I think Avi's suggest is better, and I will use "inject-nmi" (without cpu-index argument) to send NMI to all cpus, like physical GUI. If some one want to send NMI to a set of cpus, he can use "inject-nmi" multiple times.
His suggestion is to drop _all_ arguments, right Avi?
Yes.
We don't need to drop the cpu-index argument,
the upstream tools(libvirt etc.) can just issue "inject-nmi" command without any argument when need.
Reasons to keep this argument
1) Useful for kernel developer or debuger sending NMI to a special CPU.
2) Share the code with nmi of hmp version. Share the way how to use these two commands.(hmp version and qmp version)
Re: [Qemu-devel] Re: [PATCH v3] qemu, qmp: convert do_inject_nmi() to QObject, QError
Quoted 13 lines · On Mon, 20 Dec 2010 14:09:05 +0800 Lai Jiangshan <[email protected]> wrote:
Quoted 11 lines · Avi Kivity
Quoted 7 lines · Luiz Capitulino
Quoted 5 lines
I think Avi's suggest is better, and I will use "inject-nmi" (without cpu-index argument) to send NMI to all cpus, like physical GUI. If some one want to send NMI to a set of cpus, he can use "inject-nmi" multiple times.
His suggestion is to drop _all_ arguments, right Avi?
Yes.
Quoted 6 lines
We don't need to drop the cpu-index argument,
the upstream tools(libvirt etc.) can just issue "inject-nmi" command without any argument when need.Reasons to keep this argument
1) Useful for kernel developer or debuger sending NMI to a special CPU.
Ok.
Quoted 2 lines
2) Share the code with nmi of hmp version. Share the way how to use these two commands.(hmp version and qmp version)
This is bad. As a general rule, we shouldn't tweak QMP interfaces with the intention of sharing code with HMP or anything like that.
Anyway, I buy your first argument, although I'm not a kernel developer so I'm just trusting your use case.