[Qemu-devel] [PATCH 4/6] qemu,qmp: QError: New QERR_TOO_MANY_KEYS

2010-12-09 Thread Lai Jiangshan
Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com --- diff --git a/qerror.c b/qerror.c index a7ef758..fd66d2a 100644 --- a/qerror.c +++ b/qerror.c @@ -197,6 +197,10 @@ static const QErrorStringTable qerror_table[] = { .desc = Too many open files, }, { +.error_fmt

[Qemu-devel] [PATCH 5/6] qemu,qmp: QError: New QERR_UNKNOWN_KEY

2010-12-09 Thread Lai Jiangshan
Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com --- diff --git a/qerror.c b/qerror.c index fd66d2a..07b4cfc 100644 --- a/qerror.c +++ b/qerror.c @@ -205,6 +205,10 @@ static const QErrorStringTable qerror_table[] = { .desc = An undefined error has ocurred

[Qemu-devel] [PATCH 2/6] qemu, qmp: convert do_inject_nmi() to QObject

2010-12-09 Thread Lai Jiangshan
Convert do_inject_nmi() to QObject, we need to use it(via libvirt). It is trivial, as it never fails, doesn't have output nor return any data. Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com --- diff --git a/hmp-commands.hx b/hmp-commands.hx index 7a49b74..2e6b034 100644 --- a/hmp

[Qemu-devel] [PATCH 1/6] qemu, kvm: Enable NMI support for user space irqchip

2010-12-09 Thread Lai Jiangshan
Make use of the new KVM_NMI IOCTL to send NMIs into the KVM guest if the user space APIC emulation or some other source raised them. Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com --- diff --git a/target-i386/kvm.c b/target-i386/kvm.c index 7dfc357..c4ebe28 100644 --- a/target-i386/kvm.c

[Qemu-devel] [PATCH 3/6] qumu,qmp: QError: New QERR_INVALID_KEY

2010-12-09 Thread Lai Jiangshan
Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com --- diff --git a/qerror.c b/qerror.c index ac2cdaf..a7ef758 100644 --- a/qerror.c +++ b/qerror.c @@ -117,6 +117,10 @@ static const QErrorStringTable qerror_table[] = { .desc = Invalid block format '%(name

[Qemu-devel] [PATCH v2 2/2] qemu, qmp: convert do_inject_nmi() to QObject, QError

2010-12-09 Thread 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. Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com --- diff --git a/hmp-commands.hx b/hmp-commands.hx index 23024ba..f86d9fe 100644

[Qemu-devel] [PATCH v2 1/2] QError: new QERR_INVALID_CPU_INDEX

2010-12-09 Thread Lai Jiangshan
Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com --- diff --git a/qerror.c b/qerror.c index ac2cdaf..f59fb58 100644 --- a/qerror.c +++ b/qerror.c @@ -117,6 +117,10 @@ static const QErrorStringTable qerror_table[] = { .desc = Invalid block format '%(name

[Qemu-devel] [PATCH V2] qemu, kvm: Enable user space NMI injection for kvm guest

2010-12-09 Thread Lai Jiangshan
Make use of the new KVM_NMI IOCTL to send NMIs into the KVM guest if the user space raised them. (example: qemu monitor's nmi command) Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com --- diff --git a/configure b/configure index 2917874..f6f9362 100755 --- a/configure +++ b/configure @@ -1646,6

[Qemu-devel] Re: [PATCH 1/6] qemu, kvm: Enable NMI support for user space irqchip

2010-12-10 Thread Lai Jiangshan
On 12/09/2010 03:25 PM, Jan Kiszka wrote: Am 09.12.2010 07:58, Lai Jiangshan wrote: Make use of the new KVM_NMI IOCTL to send NMIs into the KVM guest if the user space APIC emulation or some other source raised them. In that light, the subject is not absolutely correct

[Qemu-devel] Re: [PATCH V2] qemu, kvm: Enable user space NMI injection for kvm guest

2010-12-13 Thread Lai Jiangshan
On 12/10/2010 04:41 PM, Jan Kiszka wrote: Am 10.12.2010 08:42, Lai Jiangshan wrote: Make use of the new KVM_NMI IOCTL to send NMIs into the KVM guest if the user space raised them. (example: qemu monitor's nmi command) Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com --- diff --git

[Qemu-devel] [PATCH v3] qemu, qmp: convert do_inject_nmi() to QObject, QError

2010-12-15 Thread 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 use QERR_INVALID_PARAMETER_VALUE as Markus suggest. Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com --- diff --git

Re: [Qemu-devel] Re: [PATCH v3] qemu, qmp: convert do_inject_nmi() to QObject, QError

2010-12-16 Thread Lai Jiangshan
On 12/16/2010 09:17 PM, Luiz Capitulino wrote: On Thu, 16 Dec 2010 15:11:50 +0200 Avi Kivity a...@redhat.com 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

[Qemu-devel] Re: [PATCH V2] qemu, kvm: Enable user space NMI injection for kvm guest

2010-12-19 Thread Lai Jiangshan
On 12/10/2010 04:41 PM, Jan Kiszka wrote: Am 10.12.2010 08:42, Lai Jiangshan wrote: Make use of the new KVM_NMI IOCTL to send NMIs into the KVM guest if the user space raised them. (example: qemu monitor's nmi command) Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com --- diff --git

Re: [Qemu-devel] Re: [PATCH v3] qemu, qmp: convert do_inject_nmi() to QObject, QError

2010-12-19 Thread Lai Jiangshan
On 12/17/2010 11:25 PM, Avi Kivity wrote: On 12/17/2010 01:22 PM, Luiz Capitulino wrote: 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

[Qemu-devel] [PATCH 2/3] nmi: make cpu-index argument optional

2010-12-19 Thread Lai Jiangshan
When the argument cpu-index is not given, then nmi command will inject NMI on all CPUs. This simulate the nmi button on physical machine. Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com --- diff --git a/hmp-commands.hx b/hmp-commands.hx index 8de7aa3..d8fe4c0 100644 --- a/hmp-commands.hx

[Qemu-devel] [PATCH 1/3] nmi: convert cpu_index to cpu-index

2010-12-19 Thread Lai Jiangshan
cpu-index is better name. Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com --- diff --git a/hmp-commands.hx b/hmp-commands.hx index 4befbe2..8de7aa3 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -721,7 +721,7 @@ ETEXI #if defined(TARGET_I386) { .name = nmi

[Qemu-devel] [PATCH V4 3/3] qmp, nmi: convert do_inject_nmi() to QObject, QError

2010-12-19 Thread Lai Jiangshan
Make we can inject NMI via qemu-monitor-protocol. We use inject-nmi for the qmp command name, the meaning is clearer. When cpu-index is found invalid in runtime, it will report QERR_INVALID_PARAMETER_VALUE. Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com --- diff --git a/hmp-commands.hx b/hmp

Re: [Qemu-devel] [PATCH 1/3] nmi: convert cpu_index to cpu-index

2010-12-20 Thread Lai Jiangshan
On 12/21/2010 01:00 AM, Markus Armbruster wrote: Lai Jiangshan la...@cn.fujitsu.com writes: cpu-index is better name. Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com --- diff --git a/hmp-commands.hx b/hmp-commands.hx index 4befbe2..8de7aa3 100644 --- a/hmp-commands.hx +++ b/hmp

Re: [Qemu-devel] [PATCH 2/3] nmi: make cpu-index argument optional

2010-12-20 Thread Lai Jiangshan
On 12/21/2010 12:58 AM, Markus Armbruster wrote: Lai Jiangshan la...@cn.fujitsu.com writes: When the argument cpu-index is not given, then nmi command will inject NMI on all CPUs. This simulate the nmi button on physical machine. Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com

[Qemu-devel] [PATCH V5 1/4] nmi: convert cpu_index to cpu-index

2011-01-10 Thread Lai Jiangshan
cpu-index is better name. Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com --- diff --git a/hmp-commands.hx b/hmp-commands.hx index df134f8..99b96a8 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -721,7 +721,7 @@ ETEXI #if defined(TARGET_I386) { .name = nmi

[Qemu-devel] [PATCH V5 4/4] nmi: report error(QError) when the cpu-index is invalid

2011-01-10 Thread Lai Jiangshan
When cpu-index is found invalid in runtime, it will report QERR_INVALID_PARAMETER_VALUE. Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com --- diff --git a/monitor.c b/monitor.c index 1bee840..7402c0f 100644 --- a/monitor.c +++ b/monitor.c @@ -2535,6 +2535,7 @@ static int do_inject_nmi(Monitor

[Qemu-devel] [PATCH V5 3/4] qmp, nmi: convert do_inject_nmi() to QObject

2011-01-10 Thread Lai Jiangshan
Make we can inject NMI via qemu-monitor-protocol. We use inject-nmi for the qmp command name, the meaning is clearer. Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com --- diff --git a/hmp-commands.hx b/hmp-commands.hx index a49fcd4..4db413d 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx

[Qemu-devel] [PATCH V5 2/4] nmi: make cpu-index argument optional

2011-01-10 Thread Lai Jiangshan
When the argument cpu-index is not given, then nmi command will inject NMI on all CPUs. This simulate the nmi button on physical machine. Thanks to Markus Armbruster for correcting the logic detecting cpu-index is given or not. Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com --- diff --git

[Qemu-devel] [PATCH V6 2/4] nmi: make cpu-index argument optional

2011-01-27 Thread Lai Jiangshan
-index is given or not. Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com --- diff --git a/hmp-commands.hx b/hmp-commands.hx index e43ac7c..ec1a4db 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -721,9 +721,10 @@ ETEXI #if defined(TARGET_I386) { .name = nmi

[Qemu-devel] [PATCH V6 1/4] nmi: convert cpu_index to cpu-index

2011-01-27 Thread Lai Jiangshan
cpu-index which uses hyphen is better name. Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com --- diff --git a/hmp-commands.hx b/hmp-commands.hx index 5d4cb9e..e43ac7c 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -721,7 +721,7 @@ ETEXI #if defined(TARGET_I386) { .name

[Qemu-devel] [PATCH V6 3/4] qmp, nmi: convert do_inject_nmi() to QObject

2011-01-27 Thread Lai Jiangshan
Make we can inject NMI via qemu-monitor-protocol. We use inject-nmi for the qmp command name, the meaning is clearer. Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com --- diff --git a/hmp-commands.hx b/hmp-commands.hx index ec1a4db..e763bf9 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx

[Qemu-devel] [PATCH V6 4/4] nmi: report error(QError) when the cpu-index is invalid

2011-01-27 Thread Lai Jiangshan
When cpu-index is found invalid in runtime, it will report QERR_INVALID_PARAMETER_VALUE. Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com --- diff --git a/monitor.c b/monitor.c index 1b1c0ba..82935f0 100644 --- a/monitor.c +++ b/monitor.c @@ -2563,6 +2563,7 @@ static int do_inject_nmi(Monitor

[Qemu-devel] Re: [PATCH V6 1/4] nmi: convert cpu_index to cpu-index

2011-02-08 Thread Lai Jiangshan
On 02/01/2011 09:29 PM, Luiz Capitulino wrote: On Thu, 27 Jan 2011 16:20:27 +0800 Lai Jiangshan la...@cn.fujitsu.com wrote: cpu-index which uses hyphen is better name. Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com It looks ok from a quick pass, but I can't apply it on current master

[Qemu-devel] [PATCH V6 4/4 resend] nmi: report error(QError) when the cpu-index is invalid

2011-02-14 Thread Lai Jiangshan
When cpu-index is found invalid in runtime, it will report QERR_INVALID_PARAMETER_VALUE. Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com --- diff --git a/monitor.c b/monitor.c index 1b1c0ba..82935f0 100644 --- a/monitor.c +++ b/monitor.c @@ -2563,6 +2563,7 @@ static int do_inject_nmi(Monitor

[Qemu-devel] [PATCH V6 1/4 resend] nmi: convert cpu_index to cpu-index

2011-02-14 Thread Lai Jiangshan
cpu-index which uses hyphen is better name. Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com --- diff --git a/hmp-commands.hx b/hmp-commands.hx index 5d4cb9e..e43ac7c 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -721,7 +721,7 @@ ETEXI #if defined(TARGET_I386) { .name

[Qemu-devel] [PATCH V6 2/4 resend] nmi: make cpu-index argument optional

2011-02-14 Thread Lai Jiangshan
-index is given or not. Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com --- diff --git a/hmp-commands.hx b/hmp-commands.hx index e43ac7c..ec1a4db 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -721,9 +721,10 @@ ETEXI #if defined(TARGET_I386) { .name = nmi

[Qemu-devel] [PATCH V6 3/4 resend] qmp, nmi: convert do_inject_nmi() to QObject

2011-02-14 Thread Lai Jiangshan
Make we can inject NMI via qemu-monitor-protocol. We use inject-nmi for the qmp command name, the meaning is clearer. Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com --- diff --git a/hmp-commands.hx b/hmp-commands.hx index b2c6cd6..6d3e7d2 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx

[Qemu-devel] Re: [PATCH V6 1/4] nmi: convert cpu_index to cpu-index

2011-02-14 Thread Lai Jiangshan
On 02/09/2011 07:48 PM, Luiz Capitulino wrote: You should use Anthony's tree: git://git.qemu.org/qemu.git Done, thank you for your concern and patience. see my sent emails: [PATCH V6 1/4 resend] [PATCH V6 2/4 resend] [PATCH V6 3/4 resend] [PATCH V6 4/4 resend] Thanks again. Lai

[Qemu-devel] Re: [PATCH V6 1/4 resend] nmi: convert cpu_index to cpu-index

2011-02-20 Thread Lai Jiangshan
Hi, Luiz Capitulino Any problem? Thanks, Lai On 02/14/2011 06:09 PM, Lai Jiangshan wrote: cpu-index which uses hyphen is better name. Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com --- diff --git a/hmp-commands.hx b/hmp-commands.hx index 5d4cb9e..e43ac7c 100644 --- a/hmp-commands.hx

[Qemu-devel] [PATCH 0/2 V7] add inject-nmi qmp command

2011-03-07 Thread Lai Jiangshan
From: Lai Jiangshan la...@cn.fujitsu.com Date: Mon, 7 Mar 2011 17:08:46 +0800 Subject: [PATCH 0/2 V7] qemu,qmp: add inject-nmi qmp command The new qmp command inject-nmi is different from the hmp monitor command nmi. The first one injects an NMI on all CPUs, and the second one injects an NMI

[Qemu-devel] [PATCH 1/2] qemu,qmp: QError: New QERR_UNSUPPORTED

2011-03-07 Thread Lai Jiangshan
From: Lai Jiangshan la...@cn.fujitsu.com Date: Mon, 7 Mar 2011 17:05:04 +0800 Subject: [PATCH 1/2] qemu,qmp: QError: New QERR_UNSUPPORTED New QERR_UNSUPPORTED for unsupported commands or requests. --- qerror.h |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/qerror.h b

[Qemu-devel] [PATCH 2/2 V7] qemu,qmp: add inject-nmi qmp command

2011-03-07 Thread Lai Jiangshan
From: Lai Jiangshan la...@cn.fujitsu.com Date: Mon, 7 Mar 2011 17:05:15 +0800 Subject: [PATCH 2/2] qemu,qmp: add inject-nmi qmp command 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

[Qemu-devel] [PATCH 2/2] cleanup, save a syscall

2012-01-12 Thread Lai Jiangshan
Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com --- main-loop.c |4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/main-loop.c b/main-loop.c index 60e9748..692381c 100644 --- a/main-loop.c +++ b/main-loop.c @@ -142,14 +142,12 @@ static int qemu_signal_init(void

[Qemu-devel] [PATCH 1/2] cleanup, Remove duplicated code

2012-01-12 Thread Lai Jiangshan
These two blocks of code are exactly the same, remove one. Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com --- cpus.c |8 1 files changed, 0 insertions(+), 8 deletions(-) diff --git a/cpus.c b/cpus.c index 857f96f..f45a438 100644 --- a/cpus.c +++ b/cpus.c @@ -565,14 +565,6

Re: [Qemu-devel] [PATCH 1/1 V5 tuning] kernel/kvm: introduce KVM_SET_LINT1 and fix improper nmi emulation

2011-10-16 Thread Lai Jiangshan
On 10/14/2011 08:07 PM, Jan Kiszka wrote: On 2011-10-14 13:59, Sasha Levin wrote: On Fri, 2011-10-14 at 17:51 +0800, Lai Jiangshan wrote: Currently, NMI interrupt is blindly sent to all the vCPUs when NMI button event happens. This doesn't properly emulate real hardware on which NMI button

Re: [Qemu-devel] [PATCH 1/1 V5] kernel/kvm: introduce KVM_SET_LINT1 and fix improper nmi emulation

2011-10-17 Thread Lai Jiangshan
On 10/16/2011 05:39 PM, Avi Kivity wrote: On 10/14/2011 11:03 AM, Lai Jiangshan wrote: Currently, NMI interrupt is blindly sent to all the vCPUs when NMI button event happens. This doesn't properly emulate real hardware on which NMI button event triggers LINT1. Because of this, NMI is sent

Re: [Qemu-devel] [PATCH 1/1 V5] kernel/kvm: introduce KVM_SET_LINT1 and fix improper nmi emulation

2011-10-17 Thread Lai Jiangshan
On 10/16/2011 05:39 PM, Avi Kivity wrote: On 10/14/2011 11:03 AM, Lai Jiangshan wrote: Currently, NMI interrupt is blindly sent to all the vCPUs when NMI button event happens. This doesn't properly emulate real hardware on which NMI button event triggers LINT1. Because of this, NMI is sent

[Qemu-devel] [PATCH 1/1 V6] qemu-kvm: fix improper nmi emulation

2011-10-17 Thread Lai Jiangshan
On 10/17/2011 05:49 PM, Avi Kivity wrote: On 10/17/2011 11:40 AM, Lai Jiangshan wrote: LINT1 may have been programmed as a level -triggered interrupt instead of edge triggered (NMI or interrupt). We can use the ioctl argument for the level (and pressing the NMI button needs to pulse

Re: [Qemu-devel] [PATCH 1/1 V6] qemu-kvm: fix improper nmi emulation

2011-10-19 Thread Lai Jiangshan
On 10/19/2011 03:41 AM, Jan Kiszka wrote: On 2011-10-17 18:00, Lai Jiangshan wrote: On 10/17/2011 05:49 PM, Avi Kivity wrote: On 10/17/2011 11:40 AM, Lai Jiangshan wrote: LINT1 may have been programmed as a level -triggered interrupt instead of edge triggered (NMI or interrupt). We can use

[Qemu-devel] [PATCH 1/1 V6] qemu: fix improper nmi emulation

2011-10-19 Thread Lai Jiangshan
for qemu.git From: Lai Jiangshan la...@cn.fujitsu.com Currently, NMI interrupt is blindly sent to all the vCPUs when NMI button event happens. This doesn't properly emulate real hardware on which NMI button event triggers LINT1. Because of this, NMI is sent to the processor even when LINT1

Re: [Qemu-devel] [PATCH 1/1 V6] qemu-kvm: fix improper nmi emulation

2011-10-19 Thread Lai Jiangshan
On 10/19/2011 05:29 PM, Avi Kivity wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 10/18/2011 09:41 PM, Jan Kiszka wrote: Looks OK to me. Same here. Who will merge it? Thanks, Lai - -- I have a truly marvellous patch that fixes the bug which this signature is too

[Qemu-devel] [BUG] qemu-kvm: memory_region_add_subregion_common: Assertion `!subregion-parent' failed.

2011-10-25 Thread Lai Jiangshan
This bug is triggered for my Windows XP guest, but not for my linux guests. The gdb result shows that a vga.vram memoryregion is added twice. libvirt log --- 2011-10-25 16:18:58.117: starting up LC_ALL=C PATH=/sbin:/usr/sbin:/bin:/usr/bin QEMU_AUDIO_DRV=none

[Qemu-devel] [PATCH 1/1 V6 resent ] qemu-kvm: fix improper nmi emulation

2011-10-25 Thread Lai Jiangshan
) approach. It only changes the user space site, the kernel site is not touched. It is changed from previous v4 patch, fixed problems found by Jan. end previous discussions From: Lai Jiangshan la...@cn.fujitsu.com Currently, NMI interrupt is blindly sent to all the vCPUs

[Qemu-devel] [PATCH] qemu: Fix inject-nmi

2011-09-22 Thread Lai Jiangshan
From: KAMEZAWA Hiroyuki kamezawa.hir...@jp.fujitsu.com Subject: [PATCH] Fix inject-nmi Now, inject-nmi sends NMI to all cpus...but this doesn't emulate pc hardware 'NMI button', which triggers LINT1. So, now, LINT1 mask is ignored by inject-nmi and NMIs are sent to all cpus without checking

Re: [Qemu-devel] [PATCH] qemu: Fix inject-nmi

2011-09-23 Thread Lai Jiangshan
On 09/22/2011 10:51 PM, Jan Kiszka wrote: On 2011-09-22 11:50, Lai Jiangshan wrote: From: KAMEZAWA Hiroyuki kamezawa.hir...@jp.fujitsu.com Subject: [PATCH] Fix inject-nmi Now, inject-nmi sends NMI to all cpus...but this doesn't emulate pc hardware 'NMI button', which triggers LINT1. So

[Qemu-devel] [PATCH] qemu-kvm: fix improper nmi emulation (was: Re: [PATCH] qemu: Fix inject-nmi)

2011-10-10 Thread Lai Jiangshan
interrupt. - When in-kernel irqchip is enabled, send nmi event to kernel as the current code does. LINT1 should be emulated in kernel. Signed-off-by: Kenji Kaneshige kaneshige.ke...@jp.fujitsu.com Tested-by: Lai Jiangshan la...@cn.fujitsu.com --- hw/apic.c | 16 hw/apic.h |1

[Qemu-devel] [PATCH 1/2] seabios: Add Local APIC NMI Structure to ACPI MADT (was: Re: [PATCH] qemu: Fix inject-nmi)

2011-10-10 Thread Lai Jiangshan
From: Kenji Kaneshige kaneshige.ke...@jp.fujitsu.com ACPI NMI Structure describes LINT pin (LINT0 or LINT1) information to which NMI is connected, and it is needed by OS to initialize local APIC. Signed-off-by: Kenji Kaneshige kaneshige.ke...@jp.fujitsu.com Reviewed-by: Lai Jiangshan la

[Qemu-devel] [PATCH 2/2] seabios: fix mptable nmi entry (was: Re: [PATCH] qemu: Fix inject-nmi)

2011-10-10 Thread Lai Jiangshan
the CPUs' LINT1. Signed-off-by: Kenji Kaneshige kaneshige.ke...@jp.fujitsu.com Reviewed-by: Lai Jiangshan la...@cn.fujitsu.com --- src/mptable.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Index: seabios/src/mptable.c

[Qemu-devel] [PATCH] kernel/kvm: fix improper nmi emulation (was: Re: [PATCH] qemu: Fix inject-nmi)

2011-10-10 Thread Lai Jiangshan
...@jp.fujitsu.com Tested-by: Lai Jiangshan la...@cn.fujitsu.com --- arch/x86/kvm/irq.h |1 + arch/x86/kvm/lapic.c |8 arch/x86/kvm/x86.c | 14 -- 3 files changed, 13 insertions(+), 10 deletions(-) Index: linux/arch/x86/kvm/irq.h

Re: [Qemu-devel] [PATCH] qemu: Fix inject-nmi

2011-10-10 Thread Lai Jiangshan
On 09/26/2011 04:21 PM, Avi Kivity wrote: On 09/25/2011 08:22 PM, Jan Kiszka wrote: On 2011-09-25 16:07, Avi Kivity wrote: On 09/23/2011 12:31 PM, Lai Jiangshan wrote: Moreover: wrong indention. You know that this won't work for qemu-kvm with in-kernel irqchip? You

[Qemu-devel] [PATCH 1/1 V2] kernel/kvm: fix improper nmi emulation

2011-10-11 Thread Lai Jiangshan
Add KVM_CAP_USER_NMI Signed-off-by: Kenji Kaneshige kaneshige.ke...@jp.fujitsu.com Tested-by: Lai Jiangshan la...@cn.fujitsu.com --- Documentation/virtual/kvm/api.txt | 20 arch/x86/kvm/irq.h|1 + arch/x86/kvm/lapic.c |7 +++ arch

[Qemu-devel] [PATCH 1/2 V2] qemu-kvm: Synchronize kernel headers

2011-10-11 Thread Lai Jiangshan
Synchronize newest kernel headers which have KVM_CAP_IRQCHIP_LAPIC_NMI by ./scripts/update-linux-headers.sh Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com --- linux-headers/asm|1 + linux-headers/asm-powerpc/kvm.h | 19 +-- linux-headers/asm

[Qemu-devel] [PATCH 2/2 V2] qemu-kvm: fix improper nmi emulation

2011-10-11 Thread Lai Jiangshan
interrupt. - When in-kernel irqchip is enabled, send nmi event to kernel as the current code does. LINT1 should be emulated in kernel. (laijs) changed from v1: use KVM_CAP_LAPIC_NMI adjust the pic_deliver_nmi() API Signed-off-by: Kenji Kaneshige kaneshige.ke...@jp.fujitsu.com Tested-by: Lai

Re: [Qemu-devel] [PATCH 2/2 V2] qemu-kvm: fix improper nmi emulation

2011-10-13 Thread Lai Jiangshan
As explained in some other mail, we could then emulate the missing kernel feature by reading out the current in-kernel APIC state, testing if LINT1 is unmasked, and then delivering the NMI directly. Only the thread of the VCPU can safely get the in-kernel LAPIC states, so this approach

[Qemu-devel] [PATCH 1/1 V3] qemu-kvm: fix improper nmi emulation

2011-10-13 Thread Lai Jiangshan
interrupt. - When in-kernel irqchip is enabled, send nmi event to kernel as the current code does. LINT1 should be emulated in kernel. Signed-off-by: Kenji Kaneshige kaneshige.ke...@jp.fujitsu.com Tested-by: Lai Jiangshan la...@cn.fujitsu.com --- hw/apic.c | 11 +++ hw/apic.h |1

[Qemu-devel] [PATCH 1/1 V3] kernel/kvm: fix improper nmi emulation

2011-10-13 Thread Lai Jiangshan
-by: Kenji Kaneshige kaneshige.ke...@jp.fujitsu.com Tested-by: Lai Jiangshan la...@cn.fujitsu.com --- Documentation/virtual/kvm/api.txt | 18 ++ arch/x86/kvm/irq.h|1 + arch/x86/kvm/lapic.c |7 +++ arch/x86/kvm/x86.c|5

[Qemu-devel] [PATCH 1/1 V4] qemu-kvm: fix improper nmi emulation

2011-10-14 Thread Lai Jiangshan
On 10/14/2011 01:53 PM, Jan Kiszka wrote: On 2011-10-14 02:53, Lai Jiangshan wrote: As explained in some other mail, we could then emulate the missing kernel feature by reading out the current in-kernel APIC state, testing if LINT1 is unmasked, and then delivering the NMI directly. Only

Re: [Qemu-devel] [PATCH 1/1 V4] qemu-kvm: fix improper nmi emulation

2011-10-14 Thread Lai Jiangshan
On 10/14/2011 02:49 PM, Jan Kiszka wrote: On 2011-10-14 08:36, Lai Jiangshan wrote: On 10/14/2011 01:53 PM, Jan Kiszka wrote: On 2011-10-14 02:53, Lai Jiangshan wrote: As explained in some other mail, we could then emulate the missing kernel feature by reading out the current in-kernel APIC

[Qemu-devel] [PATCH 1/2 V5] qemu-kvm: Synchronize kernel headers

2011-10-14 Thread Lai Jiangshan
Synchronize newest kernel headers which have KVM_CAP_SET_LINT1 and KVM_SET_LINT1 by ./scripts/update-linux-headers.sh Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com --- linux-headers/asm-powerpc/kvm.h | 19 +-- linux-headers/asm-x86/kvm.h |1 + linux

[Qemu-devel] [PATCH 1/1 V5] kernel/kvm: introduce KVM_SET_LINT1 and fix improper nmi emulation

2011-10-14 Thread Lai Jiangshan
that kdump initiated by NMI sometimes doesn't work on KVM, because kdump assumes NMI is masked on CPUs other than CPU0. With this patch, we introduce introduce KVM_SET_LINT1, and we can use KVM_SET_LINT1 to correctly emulate NMI button without change the old KVM_NMI behavior. Signed-off-by: Lai

[Qemu-devel] [PATCH 2/2 V5] qemu-kvm: fix improper nmi emulation

2011-10-14 Thread Lai Jiangshan
in-kernel irqchip is enabled, get the in-kernel LAPIC states and test the APIC_LVT_MASKED, if LINT1 is unmasked, and then delivering the NMI directly. - otherwise, userland lapic emulates NMI button and inject NMI if it is unmasked. Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com Reported

Re: [Qemu-devel] [PATCH 1/1 V5] kernel/kvm: introduce KVM_SET_LINT1 and fix improper nmi emulation

2011-10-14 Thread Lai Jiangshan
On 10/14/2011 05:07 PM, Jan Kiszka wrote: On 2011-10-14 11:03, Lai Jiangshan wrote: Currently, NMI interrupt is blindly sent to all the vCPUs when NMI button event happens. This doesn't properly emulate real hardware on which NMI button event triggers LINT1. Because of this, NMI is sent

[Qemu-devel] [PATCH 1/1 V5 tuning] kernel/kvm: introduce KVM_SET_LINT1 and fix improper nmi emulation

2011-10-14 Thread Lai Jiangshan
that kdump initiated by NMI sometimes doesn't work on KVM, because kdump assumes NMI is masked on CPUs other than CPU0. With this patch, we introduce introduce KVM_SET_LINT1, and we can use KVM_SET_LINT1 to correctly emulate NMI button without change the old KVM_NMI behavior. Signed-off-by: Lai

[Qemu-devel] [PATCH 1/2 V5 tuning] qemu-kvm: Synchronize kernel headers

2011-10-14 Thread Lai Jiangshan
Synchronize newest kernel headers which have KVM_CAP_SET_LINT1 and KVM_SET_LINT1 by ./scripts/update-linux-headers.sh Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com --- linux-headers/asm-powerpc/kvm.h | 19 +-- linux-headers/asm-x86/kvm_para.h | 14

Re: [Qemu-devel] [PATCH 2/2 V7] qemu, qmp: add inject-nmi qmp command

2011-04-19 Thread Lai Jiangshan
On 04/20/2011 09:53 AM, Lai Jiangshan wrote: On 04/04/2011 09:09 PM, Anthony Liguori wrote: On 04/04/2011 07:19 AM, Markus Armbruster wrote: [Note cc: Anthony] Daniel P. Berrangeberra...@redhat.com writes: On Mon, Mar 07, 2011 at 05:46:28PM +0800, Lai Jiangshan wrote: From: Lai

Re: [Qemu-devel] [PATCH 2/2 V7] qemu, qmp: add inject-nmi qmp command

2011-04-19 Thread Lai Jiangshan
On 04/04/2011 09:09 PM, Anthony Liguori wrote: On 04/04/2011 07:19 AM, Markus Armbruster wrote: [Note cc: Anthony] Daniel P. Berrangeberra...@redhat.com writes: On Mon, Mar 07, 2011 at 05:46:28PM +0800, Lai Jiangshan wrote: From: Lai Jiangshanla...@cn.fujitsu.com Date: Mon, 7 Mar 2011 17

[Qemu-devel] [RFC PATCH 0/3 V8] QAPI: add inject-nmi qmp command

2011-04-20 Thread Lai Jiangshan
box. Lai Jiangshan (3): QError: Introduce QERR_UNSUPPORTED qapi,nmi: add inject-nmi qmp command qapi-hmp: Convert HMP nmi to use QMP hmp-commands.hx | 18 -- hmp.c| 12 hmp.h|1 + monitor.c| 14 -- qapi

[Qemu-devel] [RFC PATCH 1/3 V8] QError: Introduce QERR_UNSUPPORTED

2011-04-20 Thread Lai Jiangshan
New QERR_UNSUPPORTED for unsupported commands or requests. Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com --- qerror.c |4 qerror.h |3 +++ 2 files changed, 7 insertions(+), 0 deletions(-) diff --git a/qerror.c b/qerror.c index c76257f..bafe520 100644 --- a/qerror.c +++ b

[Qemu-devel] [RFC PATCH 3/3 V8] qapi-hmp: Convert HMP nmi to use QMP

2011-04-20 Thread Lai Jiangshan
Convert the name of HMP nmi to inject-nmi, and use QMP inject-nmi. The behavier is also changed, it injects NMI to all CPUs of the guest. When the guest is non-x86, it reports Unsupported error. Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com --- hmp-commands.hx | 18

[Qemu-devel] [RFC PATCH 2/3 V8] qapi, nmi: add inject-nmi qmp command

2011-04-20 Thread Lai Jiangshan
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. Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com --- qapi-schema.json | 12 qmp.c| 17 + 2

Re: [Qemu-devel] [RFC PATCH 0/3 V8] QAPI: add inject-nmi qmp command

2011-04-20 Thread Lai Jiangshan
Hi, Anthony Liguori Any suggestion? Although all command line interfaces will be converted to to use QMP interfaces in 0.16, I hope inject-nmi come into QAPI earlier, 0.15. Thanks, Lai

Re: [Qemu-devel] [RFC PATCH 0/3 V8] QAPI: add inject-nmi qmp command

2011-04-26 Thread Lai Jiangshan
On 04/26/2011 09:29 PM, Anthony Liguori wrote: On 04/26/2011 08:26 AM, Luiz Capitulino wrote: On Thu, 21 Apr 2011 11:23:54 +0800 Lai Jiangshanla...@cn.fujitsu.com wrote: Hi, Anthony Liguori Any suggestion? Although all command line interfaces will be converted to to use QMP interfaces

[Qemu-devel] [PATCH 0/2 V9] hmp,qmp: add inject-nmi

2011-04-27 Thread Lai Jiangshan
Adds new QERR_UNSUPPORTED, converts nmi to inject-nmi and make it supports qmp. Lai Jiangshan (2): qemu,qmp: QError: New QERR_UNSUPPORTED qmp,inject-nmi: convert do_inject_nmi() to QObject hmp-commands.hx | 21 +++-- monitor.c | 20 +--- qerror.c

[Qemu-devel] [PATCH 1/2 V9] qemu, qmp: QError: New QERR_UNSUPPORTED

2011-04-27 Thread Lai Jiangshan
New QERR_UNSUPPORTED for unsupported commands or requests. Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com --- qerror.c |4 qerror.h |3 +++ 2 files changed, 7 insertions(+), 0 deletions(-) diff --git a/qerror.c b/qerror.c index 4855604..f905887 100644 --- a/qerror.c +++ b

[Qemu-devel] [PATCH 2/2 V9] qmp, inject-nmi: convert do_inject_nmi() to QObject

2011-04-27 Thread Lai Jiangshan
Unsupported error for non-x86 guest. This error and this behavior are described in the comments. Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com --- hmp-commands.hx | 21 +++-- monitor.c | 20 +--- qmp-commands.hx | 29 + 3

[Qemu-devel] [PATCH] use: fix bit test

2012-04-02 Thread Lai Jiangshan
use instead of the wrong Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com --- diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c index 73b0c7f..89c2406 100644 --- a/hw/usb/hcd-xhci.c +++ b/hw/usb/hcd-xhci.c @@ -502,7 +502,7 @@ static void xhci_irq_update(XHCIState *xhci) int level = 0

Re: [Qemu-devel] [PATCH] use: fix bit test

2012-04-02 Thread Lai Jiangshan
On 04/02/2012 05:50 PM, Andreas Färber wrote: Am 02.04.2012 08:35, schrieb Lai Jiangshan: use instead of the wrong Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com Patch looks okay but the subject should probably be fixed to say usb: when applying. :) Thank you!! Hi, Gerd, Does

[Qemu-devel] [PATCH 02/10] coroutine: rename unlock_bh_queue to co_runnable_queue

2012-04-03 Thread Lai Jiangshan
It stands for runnable Coroutines. Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com --- qemu-coroutine-lock.c | 18 +- 1 files changed, 9 insertions(+), 9 deletions(-) diff --git a/qemu-coroutine-lock.c b/qemu-coroutine-lock.c index 26ad76b..10e8dbb 100644 --- a/qemu

[Qemu-devel] [PATCH 10/10] coroutine: add qemu_coroutine_run() wrapper

2012-04-03 Thread Lai Jiangshan
Wrapper for qemu_coroutine_create()+qemu_coroutine_enter() Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com --- block.c | 28 +++- hw/9pfs/virtio-9p.c |4 +--- nbd.c |2 +- qemu-coroutine.h| 12 qemu-io.c

[Qemu-devel] [PATCH 04/10] coroutine: init co_runnable_bh during boot

2012-04-03 Thread Lai Jiangshan
use __attribute__((constructor)) to do the initialization. Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com --- qemu-coroutine-lock.c |9 + 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/qemu-coroutine-lock.c b/qemu-coroutine-lock.c index 90141cd..7c29bc4 100644

[Qemu-devel] [PATCH 07/10] coroutine: split qemu-coroutine-lock.c

2012-04-03 Thread Lai Jiangshan
queues are not just internal things for locks, split them. Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com --- Makefile.objs |2 +- qemu-coroutine-lock.c | 49 +-- qemu-coroutine-queue.c | 76 trace

[Qemu-devel] [PATCH 08/10] coroutine: process the coroutines woken by child when child yield

2012-04-03 Thread Lai Jiangshan
If the child wake up someone, process them. It would the child complete its works if woken coroutine release the locks that the child needs. It may help for the cache, if the child wake up some someone, they are probably accessing the same data. Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com

[Qemu-devel] [PATCH 09/10] coroutine: schedule timeout coroutine instead process it directly

2012-04-03 Thread Lai Jiangshan
Avoid a timer callback spends too much time. Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com --- qemu-coroutine-sleep.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/qemu-coroutine-sleep.c b/qemu-coroutine-sleep.c index fd65274..df9254a 100644 --- a/qemu-coroutine

[Qemu-devel] [PATCH 01/10] coroutine: use qemu_coroutine_switch() directly

2012-04-03 Thread Lai Jiangshan
When qemu_coroutine_switch() in the qemu_coroutine_yield() returns, It must be someone calls qemu_coroutine_enter() for it, so the @to is active, the tests in coroutine_swap() are unneeded, so we use qemu_coroutine_switch() directly in qemu_coroutine_yield(). Signed-off-by: Lai Jiangshan la

[Qemu-devel] [PATCH 06/10] coroutine: move runnale coroutine code to qemu-coroutine.c

2012-04-03 Thread Lai Jiangshan
runnable coroutine queue is the core mangement of the coroutine. Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com --- qemu-coroutine-lock.c | 27 --- qemu-coroutine.c | 27 +++ qemu-coroutine.h |7 +++ trace-events

[Qemu-devel] [PATCH 03/10] coroutine: rename qemu_co_queue_next_bh() to qemu_co_process_runnable()

2012-04-03 Thread Lai Jiangshan
Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com --- qemu-coroutine-lock.c |6 +++--- trace-events |2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/qemu-coroutine-lock.c b/qemu-coroutine-lock.c index 10e8dbb..90141cd 100644 --- a/qemu-coroutine-lock.c +++ b

[Qemu-devel] [PATCH 05/10] coroutine: add qemu_co_runnable_schedule()

2012-04-03 Thread Lai Jiangshan
split qemu_co_queue_next() as two parts: the first part is dequeuing next from the wait queue. the second part is schedule it to the runnable queue(qemu_co_runnable_schedule()) Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com --- qemu-coroutine-lock.c |9 +++-- 1 files changed, 7

[Qemu-devel] [PATCH 1/2 V2] coroutine: init unlock_bh during boot

2012-04-06 Thread Lai Jiangshan
use __attribute__((constructor)) to do the initialization. Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com Reviewed-by: Paolo Bonzini pbonz...@redhat.com --- qemu-coroutine-lock.c |9 + 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/qemu-coroutine-lock.c b/qemu

[Qemu-devel] [PATCH 2/2 V2] coroutine: add qemu_coroutine_run() wrapper

2012-04-06 Thread Lai Jiangshan
Wrapper for qemu_coroutine_create()+qemu_coroutine_enter() Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com Reviewed-by: Paolo Bonzini pbonz...@redhat.com --- block.c | 28 +++- hw/9pfs/virtio-9p.c |4 +--- nbd.c |2 +- qemu

Re: [Qemu-devel] [PATCH 2/7] Convert pc cpu to qdev

2012-03-13 Thread Lai Jiangshan
On 02/16/2012 08:51 PM, Anthony Liguori wrote: On 02/16/2012 06:01 AM, Jan Kiszka wrote: On 2012-02-16 00:16, Igor Mammedov wrote: +static ICCBusDeviceInfo cpu_device_info = { +.qdev.name = cpu-pc, +.qdev.size = sizeof(CPUPC), +.qdev.reset = cpu_device_reset, +.init =

Re: [Qemu-devel] [PATCH V2] add migration capability to bypass the shared memory

2016-08-11 Thread Lai Jiangshan
Note, the old local migration patchset: https://lists.gnu.org/archive/html/qemu-devel/2013-12/msg00073.html this patch can be considered as a new local migration implementation, but with more restrictions (the memory must set shared when boot the qemu)

Re: [Qemu-devel] [PATCH V2] add migration capability to bypass the shared memory

2016-08-11 Thread Lai Jiangshan
On Thu, Aug 11, 2016 at 3:11 PM, Li, Liang Z wrote: >> >> >> >> I might have missed something, could you tell me more? >> >> >> >> void bitmap_set(unsigned long *map, long start, long nr); I think the >> >> @start and @nr are both the number of the bits. >> >> >> >> thanks,

[Qemu-devel] [PATCH V2] add migration capability to bypass the shared memory

2016-08-09 Thread Lai Jiangshan
another post copy migration method, but it is possible when some crazy man need it. Changed from v1: fix style Signed-off-by: Lai Jiangshan <jiangshan...@gmail.com> --- exec.c| 5 + include/exec/cpu-common.h | 1 + include/migration/migration.h | 1 + mig

Re: [Qemu-devel] [PATCH] add migration capability to bypass the shared memory

2016-08-09 Thread Lai Jiangshan
On Wed, Aug 10, 2016 at 3:12 AM, Dr. David Alan Gilbert <dgilb...@redhat.com> wrote: > * Lai Jiangshan (jiangshan...@gmail.com) wrote: >> The feature vm-template makes the containers(VMs) can >> be started in 130ms and save 80M memory for every >> container(VM). S

Re: [Qemu-devel] [PATCH V2] add migration capability to bypass the shared memory

2016-08-09 Thread Lai Jiangshan
On Wed, Aug 10, 2016 at 10:22 AM, Li, Liang Z wrote: > Hi Jiangshan, > > Glad to see your patch. It's a simple implementation which could provide very > useful functions. > >> +static void migration_bitmap_init(unsigned long *bitmap) { >> +RAMBlock *block; >> + >> +

  1   2   >