[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] When doing local migration, a timing-related problem occurred due to the



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 18c3da3ad6f7f7d09944a0dcb9c95e4a7da13ee6
# Parent  72ef14e79cc0c07947b4fd467b62b4971b86dc3c
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>
---
 linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c      |    2 +-
 linux-2.6-xen-sparse/drivers/xen/tpmback/common.h    |    2 --
 linux-2.6-xen-sparse/drivers/xen/tpmback/interface.c |   10 +---------
 linux-2.6-xen-sparse/drivers/xen/tpmback/tpmback.c   |    2 +-
 linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c    |    2 +-
 5 files changed, 4 insertions(+), 14 deletions(-)

diff -r 72ef14e79cc0 -r 18c3da3ad6f7 
linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c
--- a/linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c   Wed May 17 23:23:26 
2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c   Wed May 17 23:28:22 
2006 +0100
@@ -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)) {
                /*
diff -r 72ef14e79cc0 -r 18c3da3ad6f7 
linux-2.6-xen-sparse/drivers/xen/tpmback/common.h
--- a/linux-2.6-xen-sparse/drivers/xen/tpmback/common.h Wed May 17 23:23:26 
2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/tpmback/common.h Wed May 17 23:28:22 
2006 +0100
@@ -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;
diff -r 72ef14e79cc0 -r 18c3da3ad6f7 
linux-2.6-xen-sparse/drivers/xen/tpmback/interface.c
--- a/linux-2.6-xen-sparse/drivers/xen/tpmback/interface.c      Wed May 17 
23:23:26 2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/tpmback/interface.c      Wed May 17 
23:28:22 2006 +0100
@@ -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);
 
@@ -165,12 +163,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)
diff -r 72ef14e79cc0 -r 18c3da3ad6f7 
linux-2.6-xen-sparse/drivers/xen/tpmback/tpmback.c
--- a/linux-2.6-xen-sparse/drivers/xen/tpmback/tpmback.c        Wed May 17 
23:23:26 2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/tpmback/tpmback.c        Wed May 17 
23:28:22 2006 +0100
@@ -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();
diff -r 72ef14e79cc0 -r 18c3da3ad6f7 
linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c
--- a/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c Wed May 17 23:23:26 
2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c Wed May 17 23:28:22 
2006 +0100
@@ -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:

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.