[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Xen-devel] [PATCH] [vTPM] Timing issue when doing local migration + cleanup
When doing local migration, a timing-related problem occurred due to the
frontend switching to the Closed state, which could end up having
the .remove function being called after the backend has shut down. This
now fixes the problem by switching to the Closing state.
The other part of the patch cleans up freeing of memory.
Signed-off-by: Stefan Berger <stefanb@xxxxxxxxxx>
Index: root/xen-unstable.hg/linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c
===================================================================
--- root.orig/xen-unstable.hg/linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c
+++ root/xen-unstable.hg/linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c
@@ -416,7 +416,7 @@ static int tpmfront_suspend(struct xenbu
*/
interruptible_sleep_on_timeout(&tp->wait_q, 100);
}
- xenbus_switch_state(dev, XenbusStateClosed);
+ xenbus_switch_state(dev, XenbusStateClosing);
if (atomic_read(&tp->tx_busy)) {
/*
Index: root/xen-unstable.hg/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c
===================================================================
--- root.orig/xen-unstable.hg/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c
+++ root/xen-unstable.hg/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c
@@ -150,7 +150,7 @@ static void frontend_changed(struct xenb
break;
case XenbusStateClosing:
- xenbus_switch_state(dev, XenbusStateClosing);
+ be->tpmif->tpm_instance = -1;
break;
case XenbusStateClosed:
Index: root/xen-unstable.hg/linux-2.6-xen-sparse/drivers/xen/tpmback/common.h
===================================================================
--- root.orig/xen-unstable.hg/linux-2.6-xen-sparse/drivers/xen/tpmback/common.h
+++ root/xen-unstable.hg/linux-2.6-xen-sparse/drivers/xen/tpmback/common.h
@@ -45,8 +45,6 @@ typedef struct tpmif_st {
long int tpm_instance;
unsigned long mmap_vstart;
- struct work_struct work;
-
grant_handle_t shmem_handle;
grant_ref_t shmem_ref;
struct page *pagerange;
Index: root/xen-unstable.hg/linux-2.6-xen-sparse/drivers/xen/tpmback/interface.c
===================================================================
--- root.orig/xen-unstable.hg/linux-2.6-xen-sparse/drivers/xen/tpmback/interface.c
+++ root/xen-unstable.hg/linux-2.6-xen-sparse/drivers/xen/tpmback/interface.c
@@ -152,10 +152,8 @@ int tpmif_map(tpmif_t *tpmif, unsigned l
return 0;
}
-static void __tpmif_disconnect_complete(void *arg)
+void tpmif_disconnect_complete(tpmif_t *tpmif)
{
- tpmif_t *tpmif = (tpmif_t *) arg;
-
if (tpmif->irq)
unbind_from_irqhandler(tpmif->irq, tpmif);
@@ -167,12 +165,6 @@ static void __tpmif_disconnect_complete(
free_tpmif(tpmif);
}
-void tpmif_disconnect_complete(tpmif_t * tpmif)
-{
- INIT_WORK(&tpmif->work, __tpmif_disconnect_complete, (void *)tpmif);
- schedule_work(&tpmif->work);
-}
-
void __init tpmif_interface_init(void)
{
tpmif_cachep = kmem_cache_create("tpmif_cache", sizeof (tpmif_t),
Index: root/xen-unstable.hg/linux-2.6-xen-sparse/drivers/xen/tpmback/tpmback.c
===================================================================
--- root.orig/xen-unstable.hg/linux-2.6-xen-sparse/drivers/xen/tpmback/tpmback.c
+++ root/xen-unstable.hg/linux-2.6-xen-sparse/drivers/xen/tpmback/tpmback.c
@@ -1063,7 +1063,7 @@ static int __init tpmback_init(void)
module_init(tpmback_init);
-static void __exit tpmback_exit(void)
+void __exit tpmback_exit(void)
{
vtpm_release_packets(NULL, 0);
tpmif_xenbus_exit();
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
This mailing list archive is a service of Copilotco.