[PATCH v3] virt: kvm: arm: vgic: Process the failure case when kvm_register_device_ops() fails

2014-12-01 Thread Chen Gang
kvm_register_device_ops() may fail, so need process the related failure case. Since it is related with neither vgic_arch_setup() nor on_each_cpu(), can move it before them, then simplify the related failure processing code. Signed-off-by: Chen Gang gang.chen.5...@gmail.com --- virt/kvm/arm

Re: [PATCH] kvm: arm: vgic: Let one looping code instead of two looping code

2014-11-30 Thread Chen Gang
On 11/30/2014 06:07 PM, Christoffer Dall wrote: On Sun, Nov 30, 2014 at 12:18:04PM +0800, Chen Gang wrote: Use one looping instead of two, so can let code more simpler and get a little better performance. Signed-off-by: Chen Gang gang.chen.5...@gmail.com Performance? Please

Re: [PATCH] kvm: arm: vgic: Let one looping code instead of two looping code

2014-11-30 Thread Chen Gang
On 11/30/14 19:08, Christoffer Dall wrote: On Mon, Dec 01, 2014 at 10:04:32PM +0800, Chen Gang wrote: On 11/30/2014 06:07 PM, Christoffer Dall wrote: On Sun, Nov 30, 2014 at 12:18:04PM +0800, Chen Gang wrote: Use one looping instead of two, so can let code more simpler and get a little better

Re: [PATCH v2] virt: kvm: arm: vgic: Process the failure case when kvm_register_device_ops() fails

2014-11-29 Thread Chen Gang
Hello maintainers: Is this discussion OK? If necessary, I shall send patch v3 according to your taste. Thanks. On 11/15/14 00:30, Chen Gang wrote: According to your taste, we need improve 2 contents below: On 11/14/2014 11:55 PM, Marc Zyngier wrote: No. This is completely overdesigned

[PATCH] kvm: arm: vgic: Let one looping code instead of two looping code

2014-11-29 Thread Chen Gang
Use one looping instead of two, so can let code more simpler and get a little better performance. Signed-off-by: Chen Gang gang.chen.5...@gmail.com --- virt/kvm/arm/vgic.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c index cf23c13..eb1a51b

Re: [PATCH] virt: kvm: arm: vgic: Process the failure case when kvm_register_device_ops() fails

2014-11-14 Thread Chen Gang
On 11/13/2014 11:30 PM, Marc Zyngier wrote: On 13/11/14 15:04, Chen Gang wrote: When kvm_register_device_ops() fails, also need call free_percpu_irq() just like others have down within kvm_vgic_hyp_init(). Signed-off-by: Chen Gang gang.chen.5...@gmail.com --- virt/kvm/arm/vgic.c | 10

Re: [PATCH] virt: kvm: arm: vgic: Process the failure case when kvm_register_device_ops() fails

2014-11-14 Thread Chen Gang
On 11/13/2014 11:30 PM, Marc Zyngier wrote: On 13/11/14 15:04, Chen Gang wrote: When kvm_register_device_ops() fails, also need call free_percpu_irq() just like others have down within kvm_vgic_hyp_init(). Signed-off-by: Chen Gang gang.chen.5...@gmail.com --- virt/kvm/arm/vgic.c | 10

Re: [PATCH] virt: kvm: arm: vgic: Process the failure case when kvm_register_device_ops() fails

2014-11-14 Thread Chen Gang
On 11/14/2014 10:09 PM, Marc Zyngier wrote: On 14/11/14 14:05, Chen Gang wrote: On 11/13/2014 11:30 PM, Marc Zyngier wrote: On 13/11/14 15:04, Chen Gang wrote: When kvm_register_device_ops() fails, also need call free_percpu_irq() just like others have down within kvm_vgic_hyp_init

[PATCH v2] virt: kvm: arm: vgic: Process the failure case when kvm_register_device_ops() fails

2014-11-14 Thread Chen Gang
When kvm_register_device_ops() fails, need disable_percpu_irq(), need vgic_arch_unsetup(), need __unregister_cpu_notifier(), and also need free_percpu_irq(). At present, there is no vgic_arch_unsetup(), so add it for resetting '__vgic_sr_vectors'. Signed-off-by: Chen Gang gang.chen.5

Re: [PATCH] virt: kvm: arm: vgic: Process the failure case when kvm_register_device_ops() fails

2014-11-14 Thread Chen Gang
On 11/14/2014 10:53 PM, Marc Zyngier wrote: On 14/11/14 14:27, Chen Gang wrote: On 11/14/2014 10:09 PM, Marc Zyngier wrote: On 14/11/14 14:05, Chen Gang wrote: On 11/13/2014 11:30 PM, Marc Zyngier wrote: On 13/11/14 15:04, Chen Gang wrote: When kvm_register_device_ops() fails, also need call

Re: [PATCH v2] virt: kvm: arm: vgic: Process the failure case when kvm_register_device_ops() fails

2014-11-14 Thread Chen Gang
the exact same effect. Thanks, M. -- Chen Gang Open share and attitude like air water and life which God blessed -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo

[PATCH] virt: kvm: arm: vgic: Process the failure case when kvm_register_device_ops() fails

2014-11-13 Thread Chen Gang
When kvm_register_device_ops() fails, also need call free_percpu_irq() just like others have down within kvm_vgic_hyp_init(). Signed-off-by: Chen Gang gang.chen.5...@gmail.com --- virt/kvm/arm/vgic.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/virt/kvm/arm

[PATCH] virt: kvm: arm: vgic: Return failure code '-EBUSY' when mutex_trylock() fails

2014-11-12 Thread Chen Gang
variable 'vcpu_lock_idx'. Signed-off-by: Chen Gang gang.chen.5...@gmail.com --- virt/kvm/arm/vgic.c | 15 +++ 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c index 3aaca49..5846725 100644 --- a/virt/kvm/arm/vgic.c +++ b/virt/kvm/arm

Re: [PATCH] virt: kvm: arm: vgic: Return failure code '-EBUSY' when mutex_trylock() fails

2014-11-12 Thread Chen Gang
On 11/13/14 3:41, Christoffer Dall wrote: On Wed, Nov 12, 2014 at 11:04:23PM +0800, Chen Gang wrote: When mutex_trylock() fails, kvm_vgic_create() will not create 'vgic', so it need return failure code '-EBUSY' instead of '0' to let outside know about it. I already sent a patch

Re: [Qemu-trivial] [PATCH] target-ppc: kvm: Fix memory overflow issue about strncat()

2014-10-24 Thread Chen Gang
On 10/24/14 15:49, Michael Tokarev wrote: On 10/13/2014 06:47 PM, Alexander Graf wrote: On 13.10.14 16:36, Chen Gang wrote: strncat() will append additional '\0' to destination buffer, so need additional 1 byte for it, or may cause memory overflow, just like other area within QEMU have done

[PATCH v2] target-ppc: kvm: Fix memory overflow issue about strncat()

2014-10-15 Thread Chen Gang
strncat() will append additional '\0' to destination buffer, so need additional 1 byte for it, or may cause memory overflow, just like other area within QEMU have done. And can use g_strdup_printf() instead of strncat(), which may be more easier understanding. Signed-off-by: Chen Gang gang.chen

[PATCH] target-ppc: kvm: Fix memory overflow issue about strncat()

2014-10-13 Thread Chen Gang
strncat() will append additional '\0' to destination buffer, so need additional 1 byte for it, or may cause memory overflow, just like other area within QEMU have done. Signed-off-by: Chen Gang gang.chen.5...@gmail.com --- target-ppc/kvm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions

Re: [PATCH] target-ppc: kvm: Fix memory overflow issue about strncat()

2014-10-13 Thread Chen Gang
(buf, rb); +f = fopen(tmp, rb); +g_free(buf); if (!f) { return -1; } For me, it is really a personal taste, so if the maintainer feels the diff above is OK, I shall send patch v2 for it within 2 days. Thanks. -- Chen Gang Open, share, and attitude like air, water

Re: [PATCH] virt/kvm/assigned-dev.c: Set 'dev-irq_source_id' to '-1' after free it

2014-08-20 Thread Chen Gang
On 08/20/2014 08:01 AM, Chen Gang wrote: By the way, at present, I use Qemu as user mode program, is there common test with both Qemu and KVM/Xen? And is a PC enough for the common test? Oh, I find Qemu have make check just like gcc/binutils, so for each of my patch, next, shall run

Re: [PATCH] virt/kvm/assigned-dev.c: Set 'dev-irq_source_id' to '-1' after free it

2014-08-19 Thread Chen Gang
Hello maintainers: Please help check this patch, when you have time. Thanks. On 08/08/2014 11:37 PM, Chen Gang wrote: As a generic function, deassign_guest_irq() assumes it can be called even if assign_guest_irq() is not be called successfully (which can be triggered by ioctl from user mode

Re: [PATCH] virt/kvm/assigned-dev.c: Set 'dev-irq_source_id' to '-1' after free it

2014-08-19 Thread Chen Gang
On 08/19/2014 11:49 PM, Paolo Bonzini wrote: Il 19/08/2014 17:44, Chen Gang ha scritto: Hello maintainers: Please help check this patch, when you have time. Hi, it's already on its way to 3.17-rc2, but I first have to run a bunch of tests. OK, thanks. Also can let me try the test

Re: [PATCH] virt/kvm/assigned-dev.c: Set 'dev-irq_source_id' to '-1' after free it

2014-08-19 Thread Chen Gang
By the way, at present, I use Qemu as user mode program, is there common test with both Qemu and KVM/Xen? And is a PC enough for the common test? Thanks. On 08/20/2014 07:58 AM, Chen Gang wrote: On 08/19/2014 11:49 PM, Paolo Bonzini wrote: Il 19/08/2014 17:44, Chen Gang ha scritto: Hello

[PATCH] virt/kvm/assigned-dev.c: Set 'dev-irq_source_id' to '-1' after free it

2014-08-08 Thread Chen Gang
', or deassign_guest_irq() may free it again. Signed-off-by: Chen Gang gang.chen.5...@gmail.com --- virt/kvm/assigned-dev.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/virt/kvm/assigned-dev.c b/virt/kvm/assigned-dev.c index bf06577..5819a27 100644 --- a/virt/kvm/assigned

Re: [PATCH] kvm-all: Use 'tmpcpu' instead of 'cpu' in sub-looping to avoid 'cpu' be NULL

2014-07-20 Thread Chen Gang
On 07/20/2014 03:29 PM, Jan Kiszka wrote: On 2014-07-19 03:21, Chen Gang wrote: If kvm_arch_remove_sw_breakpoint() in CPU_FOREACH() always be fail, it will let 'cpu' NULL. And the next kvm_arch_remove_sw_breakpoint() in QTAILQ_FOREACH_SAFE() will get NULL parameter for 'cpu

[PATCH] kvm-all: Use 'tmpcpu' instead of 'cpu' in sub-looping to avoid 'cpu' be NULL

2014-07-18 Thread Chen Gang
temporary variable for 'cpu' to avoid the case. Signed-off-by: Chen Gang gang.chen.5...@gmail.com --- kvm-all.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kvm-all.c b/kvm-all.c index 3ae30ee..1402f4f 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -2077,12 +2077,13 @@ void

Re: [PATCH] arch: powerpc: kvm: add signed type cast for comparation

2013-08-04 Thread Chen Gang
On 08/05/2013 12:34 PM, Paul Mackerras wrote: On Mon, Jul 22, 2013 at 02:32:35PM +0800, Chen Gang wrote: 'rmls' is 'unsigned long', lpcr_rmls() will return negative number when failure occurs, so it need a type cast for comparing. 'lpid' is 'unsigned long', kvmppc_alloc_lpid() return

Re: [PATCH] arch: powerpc: kvm: add signed type cast for comparation

2013-08-04 Thread Chen Gang
On 08/05/2013 12:34 PM, Paul Mackerras wrote: On Mon, Jul 22, 2013 at 02:32:35PM +0800, Chen Gang wrote: 'rmls' is 'unsigned long', lpcr_rmls() will return negative number when failure occurs, so it need a type cast for comparing. 'lpid' is 'unsigned long', kvmppc_alloc_lpid() return

Re: [PATCH] ARM64: include: asm: use 'int' instead of 'u32' for variable 'target' in kvm_host.h.

2013-07-30 Thread Chen Gang
On 07/30/2013 03:41 PM, Marc Zyngier wrote: On 30/07/13 04:49, Christoffer Dall wrote: On Mon, Jul 22, 2013 at 11:40:38AM +0800, Chen Gang wrote: 'target' will be set to '-1' in kvm_arch_vcpu_init(), and it need check 'target' whether less than zero or not in kvm_vcpu_initialized(). So need

Re: [PATCH] ARM(64): KVM: add signed type cast for comparation

2013-07-29 Thread Chen Gang
Hello Maintainers: Please help check the patch whether OK or not, when you have time. Thanks. On 07/22/2013 11:20 AM, Chen Gang wrote: 'len' is 'unsigned long' which is never less than zero. So need a related type cast for comparation. The related warning (when building ARM64

Re: [PATCH] ARM64: include: asm: use 'int' instead of 'u32' for variable 'target' in kvm_host.h.

2013-07-29 Thread Chen Gang
Hello Maintainers: Please help check the patch whether OK or not, when you have time. Thanks. On 07/22/2013 11:40 AM, Chen Gang wrote: 'target' will be set to '-1' in kvm_arch_vcpu_init(), and it need check 'target' whether less than zero or not in kvm_vcpu_initialized(). So need define

Re: [PATCH] arch: powerpc: kvm: add signed type cast for comparation

2013-07-29 Thread Chen Gang
Hello Maintainers: Please help check this patch whether OK or not, when you have time. Thanks. On 07/22/2013 02:32 PM, Chen Gang wrote: 'rmls' is 'unsigned long', lpcr_rmls() will return negative number when failure occurs, so it need a type cast for comparing. 'lpid' is 'unsigned long

Re: [PATCH] ARM(64): KVM: add signed type cast for comparation

2013-07-29 Thread Chen Gang
On 07/30/2013 11:45 AM, Christoffer Dall wrote: On Mon, Jul 22, 2013 at 11:20:12AM +0800, Chen Gang wrote: 'len' is 'unsigned long' which is never less than zero. So need a related type cast for comparation. The related warning (when building ARM64 with allmodconfig): arch/arm64/kvm

Re: [PATCH] arch: powerpc: kvm: add signed type cast for comparation

2013-07-29 Thread Chen Gang
Hello Maintainers: Please help check this patch whether OK or not, when you have time. Thanks. On 07/22/2013 02:32 PM, Chen Gang wrote: 'rmls' is 'unsigned long', lpcr_rmls() will return negative number when failure occurs, so it need a type cast for comparing. 'lpid' is 'unsigned long

[PATCH] arch: powerpc: kvm: add signed type cast for comparation

2013-07-22 Thread Chen Gang
'rmls' is 'unsigned long', lpcr_rmls() will return negative number when failure occurs, so it need a type cast for comparing. 'lpid' is 'unsigned long', kvmppc_alloc_lpid() return negative number when failure occurs, so it need a type cast for comparing. Signed-off-by: Chen Gang gang.c

[PATCH] arch: powerpc: kvm: add signed type cast for comparation

2013-07-22 Thread Chen Gang
'rmls' is 'unsigned long', lpcr_rmls() will return negative number when failure occurs, so it need a type cast for comparing. 'lpid' is 'unsigned long', kvmppc_alloc_lpid() return negative number when failure occurs, so it need a type cast for comparing. Signed-off-by: Chen Gang gang.c

[PATCH] ARM(64): KVM: add signed type cast for comparation

2013-07-21 Thread Chen Gang
] Signed-off-by: Chen Gang gang.c...@asianux.com --- arch/arm/kvm/mmio.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/arm/kvm/mmio.c b/arch/arm/kvm/mmio.c index b8e06b7..626dfc8 100644 --- a/arch/arm/kvm/mmio.c +++ b/arch/arm/kvm/mmio.c @@ -79,7 +79,7 @@ static int

[PATCH] ARM64: include: asm: use 'int' instead of 'u32' for variable 'target' in kvm_host.h.

2013-07-21 Thread Chen Gang
: comparison of unsigned expression = 0 is always true [-Wtype-limits] Signed-off-by: Chen Gang gang.c...@asianux.com --- arch/arm64/include/asm/kvm_host.h |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h

Re: [PATCH] arch/x86/kvm: beautify source code for __u32 irq which is never 0

2013-03-04 Thread Chen Gang
于 2013年02月27日 22:08, Gleb Natapov 写道: On Wed, Feb 27, 2013 at 11:33:25AM +0800, Chen Gang wrote: irp-irq is __u32 which is never 0. Signed-off-by: Chen Gang gang.c...@asianux.com Applied, thanks. thank you, too. :-) -- Chen Gang Asianux Corporation -- To unsubscribe from

[PATCH] arch/x86/kvm: beautify source code for __u32 irq which is never 0

2013-02-26 Thread Chen Gang
irp-irq is __u32 which is never 0. Signed-off-by: Chen Gang gang.c...@asianux.com --- arch/x86/kvm/x86.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index f71500a..811c5c9 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm