mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] kvm tools: powerpc: Fix init order for xics
@ 2013-08-20  3:28 Michael Neuling
  2013-08-27 11:52 ` Pekka Enberg
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Neuling @ 2013-08-20  3:28 UTC (permalink / raw)
  To: penberg; +Cc: kvm, kvm-ppc, linux-kernel, michael, Ian Munsie

xics_init() assumes kvm->nrcpus is already setup.  kvm->nrcpus is setup
in kvm_cpu_init()

Unfortunately xics_init() and kvm_cpu_init() both use base_init().  So
depending on the order randomly determined by the compiler, xics_init()
may initialised see kvm->nrcpus as 0 and not setup any of the icp VCPU
pointers.  This manifests itself later in boot when trying to raise an
IRQ resulting in a null pointer deference/segv.

This moves xics_init() to use dev_base_init() to ensure it happens after
kvm_cpu_init().

Signed-off-by: Michael Neuling <mikey@neuling.org>

diff --git a/tools/kvm/powerpc/xics.c b/tools/kvm/powerpc/xics.c
index cf64a08..c1ef35b 100644
--- a/tools/kvm/powerpc/xics.c
+++ b/tools/kvm/powerpc/xics.c
@@ -505,7 +505,7 @@ static int xics_init(struct kvm *kvm)
 
 	return 0;
 }
-base_init(xics_init);
+dev_base_init(xics_init);
 
 
 void kvm__irq_line(struct kvm *kvm, int irq, int level)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-08-27 11:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-20  3:28 [PATCH] kvm tools: powerpc: Fix init order for xics Michael Neuling
2013-08-27 11:52 ` Pekka Enberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®