[PATCH 1/9] powerpc,kvm: fix imbalance srcu_read_[un]lock()

2013-03-15 Thread Lai Jiangshan
At the point of up_out label in kvmppc_hv_setup_htab_rma(), srcu read lock is still held. We have to release it before return. Signed-off-by: Lai Jiangshan Cc: Marcelo Tosatti Cc: Gleb Natapov Cc: Alexander Graf Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: kvm@vger.kernel.org Cc: kvm

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

2011-10-25 Thread Lai Jiangshan
doing (3). > > > > (note an additional issue with 3 is whether to make it a vm or vcpu > > ioctl - we've been assuming vcpu ioctl but it's not necessarily the best > > choice). > > It is the 2) approach. It only changes the user space site, the kernel site is

[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 /home/laijs/bin/qe

Re: [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 > si

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

2011-10-19 Thread Lai Jiangshan
hen upstream gains that support. I'm working on > a basic version an will incorporate the logic if your qemu patch is > already available. > > Jan > Patch for qemu.git From: Lai Jiangshan Currently, NMI interrupt is blindly sent to all the vCPUs when NMI button event hap

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

2011-10-18 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

[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 >&g

Re: [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 LINT

Re: [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 LINT

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 em

[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 --- linux-headers/asm-powerpc/kvm.h | 19 +-- linux-headers/asm-x86/kvm_para.h | 14 ++ linux-headers

[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-o

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. Be

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

2011-10-14 Thread Lai Jiangshan
rwise when 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 Reported-by: Kenji

[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 --- linux-headers/asm-powerpc/kvm.h | 19 +-- linux-headers/asm-x86/kvm.h |1 + linux-headers/asm-x86

[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-o

Re: [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

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

2011-10-13 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 L

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

2011-10-13 Thread Lai Jiangshan
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 Tested-by: Lai Jiangshan --- hw/apic.c | 11 +++ hw/apic.h |1 + monitor.c |6 +- 3 files changed, 17 insertions(+), 1 deletion

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

2011-10-13 Thread Lai Jiangshan
Tested-by: Lai Jiangshan --- Documentation/virtual/kvm/api.txt | 18 ++ arch/x86/kvm/irq.h|1 + arch/x86/kvm/lapic.c |7 +++ arch/x86/kvm/x86.c|5 - 4 files changed, 30 insertions(+), 1 deletions(-) diff --git a/Doc

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 approac

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

2011-10-11 Thread Lai Jiangshan
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 Tested-by: Lai Jiangshan --- hw/apic.c | 26

[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 --- linux-headers/asm|1 + linux-headers/asm-powerpc/kvm.h | 19 +-- linux-headers/asm-x86/kvm_para.h | 14

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

2011-10-11 Thread Lai Jiangshan
MI Signed-off-by: Kenji Kaneshige Tested-by: Lai Jiangshan --- Documentation/virtual/kvm/api.txt | 20 arch/x86/kvm/irq.h|1 + arch/x86/kvm/lapic.c |7 +++ arch/x86/kvm/x86.c| 12 include/l

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

2011-10-09 Thread Lai Jiangshan
Signed-off-by: Kenji Kaneshige Reviewed-by: Lai Jiangshan --- src/mptable.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Index: seabios/src/mptable.c === --- seabios.orig/src/mptable.c +++ seabios/src/mptable.c @

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

2011-10-09 Thread Lai Jiangshan
From: Kenji Kaneshige 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 Reviewed-by: Lai Jiangshan --- src/acpi.c | 22 -- 1 file changed, 20

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

2011-10-09 Thread Lai Jiangshan
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 Tested-by: Lai Jiangshan --- hw/apic.c | 16 hw/apic.h |1 + monitor.c |5 ++--- 3 files changed, 19 insertions(+), 3

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

2011-10-09 Thread Lai Jiangshan
NT1 on the processor. LINT1 is emulated in in-kernel irqchip. - When in-kernel irqchip is disabled, KVM_NMI ioctl is handled as a request of injecting NMI to the processor. This assumes LINT1 is already emulated in userland. Signed-off-by: Kenji Kaneshige Tested-by: Lai Jiangshan --- ar

Re: [PATCH] qemu: Fix inject-nmi

2011-10-09 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. >> >> > >> >> &

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 >> Subject: [PATCH] Fix inject-nmi >> >> Now, inject-nmi sends NMI to all cpus...but this doesn't emulate >> pc hardware 'NMI bu

[PATCH] qemu: Fix inject-nmi

2011-09-22 Thread Lai Jiangshan
From: KAMEZAWA Hiroyuki 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 LINT1 mask. Because Linux masks L

[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 --- 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/qerror.c @@ -206,6

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

2011-04-27 Thread Lai Jiangshan
r x86 guest currently, it will returns "Unsupported" error for non-x86 guest. This error and this behavior are described in the comments. Signed-off-by: Lai Jiangshan --- hmp-commands.hx | 21 +++-- monitor.c | 20 +--- qmp-commands.hx | 2

[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 +++-- mo

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 Jiangshan wrote: >> >>> >>> Hi, Anthony Liguori >>> >>> Any suggestion? >>> >&g

Re: [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 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majord...@vger.

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

2011-04-19 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 --- qapi-schema.json | 12 qmp.c| 17 + 2 files c

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

2011-04-19 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 --- hmp-commands.hx | 18 ---

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

2011-04-19 Thread Lai Jiangshan
New QERR_UNSUPPORTED for unsupported commands or requests. Signed-off-by: Lai Jiangshan --- 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/qerror.c @@ -213,6

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

2011-04-19 Thread Lai Jiangshan
" can't work in my 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|

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. Berrange" writes: >>> >>>> On Mon, Mar

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. Berrange" writes: >> >>> On Mon, Mar 07, 2011 at 05:46:28PM +0800, Lai Jiangshan wrote: >>>> Fro

[PATCH V2] qemu,qmp: add keydown and keyup command for qmp

2011-03-09 Thread Lai Jiangshan
t;keycode": 59 } } #press down f1 { "execute": "keyup", "arguments": { "keycode": 59 } }#release f1 { "execute": "keyup", "arguments": { "keycode": 56 } }#release alt { "execute": "keyup",

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

2011-03-07 Thread Lai Jiangshan
From: Lai Jiangshan 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. --- hmp-c

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

2011-03-07 Thread Lai Jiangshan
From: Lai Jiangshan 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/qerror.h index

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

2011-03-07 Thread Lai Jiangshan
From: Lai Jiangshan 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

Re: [PATCH] kvm: allow RO page when atomic && !write_fault

2011-02-22 Thread Lai Jiangshan
On 02/21/2011 05:47 PM, Gleb Natapov wrote: > On Mon, Feb 21, 2011 at 11:47:36AM +0800, Lai Jiangshan wrote: >> >> Atomic-able hva_to_pfn() patches and allow-read-only-page patches >> are merged almost the same time. But hva_to_pfn() does not handle >> these two issue

[PATCH] kvm: better readability of efer_reserved_bits

2011-02-20 Thread Lai Jiangshan
use EFER_SCE, EFER_LME and EFER_LMA instead of magic numbers. Signed-off-by: Lai Jiangshan --- diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index bcc0efc..9d1d3f2 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -81,9 +81,10 @@ * - enable LME and LMA per default on 64 bit

[PATCH] kvm: allow RO page when atomic && !write_fault

2011-02-20 Thread Lai Jiangshan
be better if we return the pfn of the read-only-page. Signed-off-by: Lai Jiangshan --- diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 1fa0d29..f49cfc0 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -1060,31 +1060,27 @@ static pfn_t hva_to_pfn(struct kvm *kvm, unsigned

Re: [PATCH] kvm,async_pf: add missing kvm_async_pf_hash_reset()

2011-02-20 Thread Lai Jiangshan
On 02/21/2011 11:21 AM, Lai Jiangshan wrote: > > The hash array of async gfns may still contain some left gfns after > kvm_clear_async_pf_completion_queue() called, need to clear them. > sorry. Signed-off-by: Lai Jiangshan > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kv

[PATCH] kvm,async_pf: add missing kvm_async_pf_hash_reset()

2011-02-20 Thread Lai Jiangshan
The hash array of async gfns may still contain some left gfns after kvm_clear_async_pf_completion_queue() called, need to clear them. diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 17af71d..dae2d15 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -525,8 +525,10 @@ int kvm_s

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 > --- > diff --git a/hmp-commands.hx b/hmp-commands.hx > index 5d4cb9e..e43ac7c 100644 >

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 --

[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 --- 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 *mon, const QDict

[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 --- diff --git a/hmp-commands.hx b/hmp-commands.hx index b2c6cd6..6d3e7d2 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -74

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

2011-02-14 Thread Lai Jiangshan
uster for correcting the logic detecting "cpu-index" is given or not. Signed-off-by: Lai Jiangshan --- 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) {

[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 --- 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

[PATCH] kvm: add the __noclone attribute

2011-02-10 Thread Lai Jiangshan
The changelog of 104f226 said "adds the __noclone attribute", but it was missing in its patch. I think it is still needed. Signed-off-by: Lai Jiangshan --- diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index bf89ec2..de99a4d 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86

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 wrote: > >> "cpu-index" which uses hyphen is better name. >> >> Signed-off-by: Lai Jiangshan > > It looks ok from a quick pass, but I can't ap

[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 --- 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 *mon, const QDict

[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 --- diff --git a/hmp-commands.hx b/hmp-commands.hx index ec1a4db..e763bf9 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -72

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

2011-01-27 Thread Lai Jiangshan
uster for correcting the logic detecting "cpu-index" is given or not. Signed-off-by: Lai Jiangshan --- 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) {

[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 --- 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

[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 J

[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 --- 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 *mon, const QDict

[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 --- diff --git a/hmp-commands.hx b/hmp-commands.hx index a49fcd4..4db413d 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -72

[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 --- 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",

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 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. >> >

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 writes: > >> "cpu-index" is better name. >> >> Signed-off-by: Lai Jiangshan >> --- >> diff --git a/hmp-commands.hx b/hmp-commands.hx >> index 4befbe2..8de7aa3 100644 >> -

[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 --- diff --git a/hmp-commands.hx b/hmp-command

[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 --- diff --git a/hmp-commands.hx b/hmp-commands.hx index 8de7aa3..d8fe4c0 100644 --- a/hmp-c

[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 --- 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",

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, >> >

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) >> >> Sign

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 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 G

[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 --- diff --git a/hmp-commands.hx b/hmp

[PATCH] kvm,x86: return true when user space query KVM_CAP_USER_NMI extension

2010-12-14 Thread Lai Jiangshan
userspace may check this extension in runtime. Signed-off-by: Lai Jiangshan --- diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index cdac9e5..3d6b9ec 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -1909,6 +1909,7 @@ int kvm_dev_ioctl_check_extension(long ext) case

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) >> >> Sign

[PATCH] qemu-kvm,cleanup: convert kvm_ioctl(KVM_CHECK_EXTENSION) to kvm_check_extension()

2010-12-09 Thread Lai Jiangshan
simple cleanup and use existed helper: kvm_check_extension(). Signed-off-by: Lai Jiangshan --- diff --git a/kvm-all.c b/kvm-all.c index cae24bb..35fc73c 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -678,7 +678,7 @@ int kvm_init(int smp_cpus) s->broken_set_mem_region = 1; #if

[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 --- diff --git a/configure b/configure index 2917874..f6f9362 100755 --- a/configure +++ b/configure @@ -1646,

[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 --- diff --git a/hmp-commands.hx b/hmp-commands.hx index 23024ba..f86d9fe 100644 --- a/hmp-commands.hx +++ b

[PATCH v2 1/2] QError: new QERR_INVALID_CPU_INDEX

2010-12-09 Thread Lai Jiangshan
Signed-off-by: Lai Jiangshan --- 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)'", }, {

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

2010-12-09 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 subjec

[PATCH 6/6] qemu,qmp: Convert do_sendkey() to QObject,QError

2010-12-08 Thread Lai Jiangshan
Convert do_sendkey() to QObject,QError, we need to use it.(via libvirt) It is a trivial conversion, carefully converted the error reports. Signed-off-by: Lai Jiangshan --- diff --git a/hmp-commands.hx b/hmp-commands.hx index 23024ba..7a49b74 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx

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

2010-12-08 Thread Lai Jiangshan
Signed-off-by: Lai Jiangshan --- 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", }, { +

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

2010-12-08 Thread Lai Jiangshan
Signed-off-by: Lai Jiangshan --- 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", }, { +

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

2010-12-08 Thread Lai Jiangshan
Signed-off-by: Lai Jiangshan --- 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)'", }, {

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

2010-12-08 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 --- diff --git a/hmp-commands.hx b/hmp-commands.hx index 7a49b74..2e6b034 100644 --- a/hmp-commands.hx +++

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

2010-12-08 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 --- diff --git a/target-i386/kvm.c b/target-i386/kvm.c index 7dfc357..c4ebe28 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c

[PATCH] kvm: make mmu_shrink() fit shrinker's requirement

2010-08-04 Thread Lai Jiangshan
mmu_shrink() should attempt to free @nr_to_scan entries. Signed-off-by: Lai Jiangshan --- diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 9c69725..1034373 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -3138,37 +3138,51 @@ static int mmu_shrink(struct shrinker *shrink

Re: [PATCH] kvm cleanup: Introduce sibling_pte and do cleanup for reverse map and parent_pte

2010-08-03 Thread Lai Jiangshan
On 08/03/2010 02:51 PM, Avi Kivity wrote: > On 08/03/2010 05:30 AM, Lai Jiangshan wrote: >> This patch is just a big cleanup. it reduces 220 lines of code. >> >> It introduces sibling_pte array for tracking identical sptes, so the >> identical sptes can be linked as a

[PATCH] kvm cleanup: Introduce sibling_pte and do cleanup for reverse map and parent_pte

2010-08-02 Thread Lai Jiangshan
u spin lock. (this feature is very helpful in future). 5) better readability. Signed-of-by: Lai Jiangshan Documentation/kvm/mmu.txt | 16 + arch/x86/include/asm/kvm_host.h | 16 - arch/x86/kvm/mmu.c | 343 +++- 3 files changed, 78 inserti

Re: [PATCH 5/6] kvm, x86: use ro page and don't copy shared page

2010-07-28 Thread Lai Jiangshan
On 07/17/2010 07:26 AM, Marcelo Tosatti wrote: > On Fri, Jul 16, 2010 at 10:19:36AM +0300, Gleb Natapov wrote: >> On Fri, Jul 16, 2010 at 10:13:07AM +0800, Lai Jiangshan wrote: >>> When page fault, we always call get_user_pages(write=1). >>> >>> Actually, we

Re: [PATCH 5/6] kvm, x86: use ro page and don't copy shared page

2010-07-28 Thread Lai Jiangshan
On 07/16/2010 03:19 PM, Gleb Natapov wrote: >> +/* get a current mapped page fast, and test whether the page is writable. */ >> +static struct page *get_user_page_and_protection(unsigned long addr, >> +int *writable) >> +{ >> +struct page *page[1]; >> + >> +if (__get_user_pages_fast(ad

[PATCH 5/6] kvm, x86: use ro page and don't copy shared page

2010-07-15 Thread Lai Jiangshan
them and may cause thrash. In this patch, if the page is RO for host VMM and it not write fault for guest, we will use RO page, otherwise we use a writable page. Signed-off-by: Lai Jiangshan --- diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 8ba9b0d..6382140 100644 --- a/arch/x8

[PATCH 6/6] kvm, faster and simpler version of get_user_page_and_protection()

2010-07-15 Thread Lai Jiangshan
a light weight version of get_user_page_and_protection() Signed-off-by: Lai Jiangshan --- diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index a34c785..d0e4f2f 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h @@ -618,6 +618,8

[PATCH 4/6] kvm: add host_writable parameter

2010-07-15 Thread Lai Jiangshan
add host_writable parameter for some functions, no functionality changed, prepare for using RO pages. Signed-off-by: Lai Jiangshan --- diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 0867ced..8ba9b0d 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -1861,7 +1861,7

[PATCH 3/6] kvm: rename gfn_to_pfn() etc.

2010-07-15 Thread Lai Jiangshan
gfn_to_pfn() does actually increase the reference of the page. But "gfn_to_pfn" is questionable, it misses this semantic. So we rename it to kvm_get_pfn_for_gfn() which make more sense. gfn_to_page() and hva_to_pfn() are also renamed. (no behavior changed) Signed-off-by: Lai

[PATCH 2/6] kvm, ept: remove the default write bit

2010-07-15 Thread Lai Jiangshan
When ept enabled, current code set shadow_base_present_pte including the write bit, thus all pte entries have writabe bit, and it means guest os can always write to any mapped page (even VMM maps RO pages for the guest.) we will use RO pages future, fix it. Signed-off-by: Lai Jiangshan --- diff

[PATCH 1/6] kvm: pass error code to handler

2010-07-15 Thread Lai Jiangshan
handle_ept_violation() does not pass error code to the handler tdp_page_fault(). It means tdp_page_fault() handles the page fault with ignoring the error code, It will not handle the page fault completely correctly, and may causes endless page fault. Signed-off-by: Lai Jiangshan --- diff --git

  1   2   >