arm, kvm: fix double lock on cpu_add_remove_lock
PATCH 1/1 arm, kvm: fix double lock on cpu_add_remove_lock
The patch of "arm, kvm: Fix CPU hotplug callback registration" in -next tree holds the lock before calling the two functions:
kvm_vgic_hyp_init() kvm_timer_hyp_init()
and both the two functions are calling register_cpu_notifier() to register cpu notifier, so cause double lock on cpu_add_remove_lock.
Considered that both two functions are only called inside kvm_arch_init() with holding cpu_add_remove_lock, so simply use __register_cpu_notifier() to fix the problem.
--- virt/kvm/arm/arch_timer.c | 2 +- virt/kvm/arm/vgic.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
virt/kvm/arm/arch_timer.c +1 -1
@@ -277,7 +277,7 @@ int kvm_timer_hyp_init(void) host_vtimer_irq = ppi; - err =register_cpu_notifier (&kvm_timer_cpu_nb); + err =__register_cpu_notifier (&kvm_timer_cpu_nb);if (err) {kvm_err ("Cannot register timer CPU notifier\n" ); goto out_free;
virt/kvm/arm/vgic.c +1 -1
@@ -1496,7 +1496,7 @@ int kvm_vgic_hyp_init(void) goto out; } - ret =register_cpu_notifier (&vgic_cpu_nb); + ret =__register_cpu_notifier (&vgic_cpu_nb);if (ret) {kvm_err ("Cannot register vgic CPU notifier\n" ); goto out_free_irq;
Signature · 1 line
1.7.9.5
Quoted 13 lines · Ming Lei
The patch of "arm, kvm: Fix CPU hotplug callback registration" in -next tree holds the lock before calling the two functions:
kvm_vgic_hyp_init() kvm_timer_hyp_init()and both the two functions are calling
register_cpu_notifier()to register cpu notifier, so cause double lock oncpu_add_remove_lock.Considered that both two functions are only called inside
kvm_arch_init()with holdingcpu_add_remove_lock, so simply use__register_cpu_notifier()to fix the problem.
Quoted 5 lines
Cc Paolo Bonzini <[email protected]>Cc Christoffer Dall <[email protected]>Cc Srivatsa S. Bhat <[email protected]>Cc Rafael J. Wysocki <[email protected]>Signed-off-by Ming Lei <[email protected]>
Sorry for missing that, and thank you for the fix!
Regards,
Srivatsa S. Bhat
Quoted 32 lines
--- virt/kvm/arm/arch_timer.c | 2 +- virt/kvm/arm/vgic.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)virt/kvm/arm/arch_timer.c +1
-1@@ -277,7 +277,7 @@ int kvm_timer_hyp_init(void) host_vtimer_irq = ppi; - err =register_cpu_notifier (&kvm_timer_cpu_nb); + err =__register_cpu_notifier (&kvm_timer_cpu_nb);if (err) {kvm_err ("Cannot register timer CPU notifier\n" ); goto out_free;virt/kvm/arm/vgic.c +1
-1@@ -1496,7 +1496,7 @@ int kvm_vgic_hyp_init(void) goto out; } - ret =register_cpu_notifier (&vgic_cpu_nb); + ret =__register_cpu_notifier (&vgic_cpu_nb);if (ret) {kvm_err ("Cannot register vgic CPU notifier\n" ); goto out_free_irq;
Rafael J. Wysocki
AppliedQuoted 20 lines · Srivatsa S. Bhat
Quoted 13 lines · Ming Lei
The patch of "arm, kvm: Fix CPU hotplug callback registration" in -next tree holds the lock before calling the two functions:
kvm_vgic_hyp_init() kvm_timer_hyp_init()and both the two functions are calling
register_cpu_notifier()to register cpu notifier, so cause double lock oncpu_add_remove_lock.Considered that both two functions are only called inside
kvm_arch_init()with holdingcpu_add_remove_lock, so simply use__register_cpu_notifier()to fix the problem.Quoted 5 lines
Cc Paolo Bonzini <[email protected]>Cc Christoffer Dall <[email protected]>Cc Srivatsa S. Bhat <[email protected]>Cc Rafael J. Wysocki <[email protected]>Signed-off-by Ming Lei <[email protected]>
Quoted 3 lines
Sorry for missing that, and thank you for the fix!
Reviewed-by Srivatsa S. Bhat <[email protected]>
Applied, thanks!
I'm going to include this into my next pull request.
Quoted 38 lines
Quoted 24 lines
--- virt/kvm/arm/arch_timer.c | 2 +- virt/kvm/arm/vgic.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)virt/kvm/arm/arch_timer.c +1
-1@@ -277,7 +277,7 @@ int kvm_timer_hyp_init(void) host_vtimer_irq = ppi; - err =register_cpu_notifier (&kvm_timer_cpu_nb); + err =__register_cpu_notifier (&kvm_timer_cpu_nb);if (err) {kvm_err ("Cannot register timer CPU notifier\n" ); goto out_free;virt/kvm/arm/vgic.c +0
-0virt/kvm/arm/vgic.c int kvm_vgic_hyp_init(void) · line 1502
Quoted 8 lines
virt/kvm/arm/vgic.c +1
-1@@ -1496,7 +1496,7 @@ int kvm_vgic_hyp_init(void) goto out; } - ret =register_cpu_notifier (&vgic_cpu_nb); + ret =__register_cpu_notifier (&vgic_cpu_nb);if (ret) {kvm_err ("Cannot register vgic CPU notifier\n" ); goto out_free_irq;--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Signature · 2 lines
I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.