Commit a947f0f8 authored by Stefano Stabellini's avatar Stefano Stabellini

xen: do not set xenstored_ready before xenbus_probe on hvm

Register_xenstore_notifier should guarantee that the caller gets
notified even if xenstore is already up.
Therefore we revert "do not notify callers from
register_xenstore_notifier" and set xenstored_read at the right time for
PV on HVM guests too.
In fact in case of PV on HVM guests xenstored is ready only after the
platform pci driver has completed the initialization, so do not set
xenstored_ready before the call to xenbus_probe().

This patch fixes a shutdown_event watcher registration bug that causes
"xm shutdown" not to work properly.
Signed-off-by: default avatarStefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: default avatarJeremy Fitzhardinge <jeremy@goop.org>
parent 899611ee
...@@ -755,6 +755,9 @@ int register_xenstore_notifier(struct notifier_block *nb) ...@@ -755,6 +755,9 @@ int register_xenstore_notifier(struct notifier_block *nb)
{ {
int ret = 0; int ret = 0;
if (xenstored_ready > 0)
ret = nb->notifier_call(nb, 0, NULL);
else
blocking_notifier_chain_register(&xenstore_chain, nb); blocking_notifier_chain_register(&xenstore_chain, nb);
return ret; return ret;
...@@ -769,7 +772,7 @@ EXPORT_SYMBOL_GPL(unregister_xenstore_notifier); ...@@ -769,7 +772,7 @@ EXPORT_SYMBOL_GPL(unregister_xenstore_notifier);
void xenbus_probe(struct work_struct *unused) void xenbus_probe(struct work_struct *unused)
{ {
BUG_ON((xenstored_ready <= 0)); xenstored_ready = 1;
/* Enumerate devices in xenstore and watch for changes. */ /* Enumerate devices in xenstore and watch for changes. */
xenbus_probe_devices(&xenbus_frontend); xenbus_probe_devices(&xenbus_frontend);
...@@ -835,9 +838,9 @@ static int __init xenbus_init(void) ...@@ -835,9 +838,9 @@ static int __init xenbus_init(void)
xen_store_evtchn = xen_start_info->store_evtchn; xen_store_evtchn = xen_start_info->store_evtchn;
xen_store_mfn = xen_start_info->store_mfn; xen_store_mfn = xen_start_info->store_mfn;
xen_store_interface = mfn_to_virt(xen_store_mfn); xen_store_interface = mfn_to_virt(xen_store_mfn);
}
xenstored_ready = 1; xenstored_ready = 1;
} }
}
/* Initialize the interface to xenstore. */ /* Initialize the interface to xenstore. */
err = xs_init(); err = xs_init();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment