RE: [PATCH v2 1/3] KVM: arm: Fix NULL pointer dereference if KVM is used without in-kernel irqchip

2015-07-19 Thread Pavel Fedin
 Hello!

 I'd appreciate a better commit log. Which patch broke it, why is that
 necessary.

 It was broken by 662d9715840aef44dcb573b0f9fab9e8319c868a.
 Actually, runtime detection was never implemented. The patch message just says 
that it can be done.
And in order to run KVM on my lame board i had to disable VGIC and VTIMER in 
kernel .config. The
actual breakage happened because without these definitions 
kvm_vgic_map_resources() was just a
do-nothing inline.

 vGIC can perfectly be emulated by userspace. And even generic timer can, with 
some tricks. So i
decided to restore this functionality.

Kind regards,
Pavel Fedin
Expert Engineer
Samsung Electronics Research center Russia


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


Re: [PATCH v2 1/3] KVM: arm: Fix NULL pointer dereference if KVM is used without in-kernel irqchip

2015-07-17 Thread Marc Zyngier
On 14/07/15 13:06, Pavel Fedin wrote:
 Makes qemu working again with kernel-irqchip=off option

I'd appreciate a better commit log. Which patch broke it, why is that
necessary.

 
 Signed-off-by: Pavel Fedin p.fe...@samsung.com
 ---
  arch/arm/kvm/arm.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c
 index d9631ec..5668c4e 100644
 --- a/arch/arm/kvm/arm.c
 +++ b/arch/arm/kvm/arm.c
 @@ -450,7 +450,7 @@ static int kvm_vcpu_first_run_init(struct kvm_vcpu *vcpu)
* Map the VGIC hardware resources before running a vcpu the first
* time on this VM.
*/
 - if (unlikely(!vgic_ready(kvm))) {
 + if (irqchip_in_kernel(kvm)  unlikely(!vgic_ready(kvm))) {

I think you should factor the irqchip_in_kernel() inside the unlikely
clause. Something like

bool vgic_needs_init = irqchip_in_kernel(kvm)  !vgic_ready(kvm);

if (unlikely(vfic_needs_init)) {
...
}

   ret = kvm_vgic_map_resources(kvm);
   if (ret)
   return ret;
 

Thanks,

M.
-- 
Jazz is not dead. It just smells funny...
--
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-info.html


[PATCH v2 1/3] KVM: arm: Fix NULL pointer dereference if KVM is used without in-kernel irqchip

2015-07-14 Thread Pavel Fedin
Makes qemu working again with kernel-irqchip=off option

Signed-off-by: Pavel Fedin p.fe...@samsung.com
---
 arch/arm/kvm/arm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c
index d9631ec..5668c4e 100644
--- a/arch/arm/kvm/arm.c
+++ b/arch/arm/kvm/arm.c
@@ -450,7 +450,7 @@ static int kvm_vcpu_first_run_init(struct kvm_vcpu *vcpu)
 * Map the VGIC hardware resources before running a vcpu the first
 * time on this VM.
 */
-   if (unlikely(!vgic_ready(kvm))) {
+   if (irqchip_in_kernel(kvm)  unlikely(!vgic_ready(kvm))) {
ret = kvm_vgic_map_resources(kvm);
if (ret)
return ret;
-- 
2.4.4

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