ia64/xen-unstable

changeset 10076:18c3da3ad6f7

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@us.ibm.com>
author kaf24@firebug.cl.cam.ac.uk
date Wed May 17 23:28:22 2006 +0100 (2006-05-17)
parents 72ef14e79cc0
children dbe396fd6fd8
files linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c linux-2.6-xen-sparse/drivers/xen/tpmback/common.h linux-2.6-xen-sparse/drivers/xen/tpmback/interface.c linux-2.6-xen-sparse/drivers/xen/tpmback/tpmback.c linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c	Wed May 17 23:23:26 2006 +0100
     1.2 +++ b/linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c	Wed May 17 23:28:22 2006 +0100
     1.3 @@ -416,7 +416,7 @@ static int tpmfront_suspend(struct xenbu
     1.4  		 */
     1.5  		interruptible_sleep_on_timeout(&tp->wait_q, 100);
     1.6  	}
     1.7 -	xenbus_switch_state(dev, XenbusStateClosed);
     1.8 +	xenbus_switch_state(dev, XenbusStateClosing);
     1.9  
    1.10  	if (atomic_read(&tp->tx_busy)) {
    1.11  		/*
     2.1 --- a/linux-2.6-xen-sparse/drivers/xen/tpmback/common.h	Wed May 17 23:23:26 2006 +0100
     2.2 +++ b/linux-2.6-xen-sparse/drivers/xen/tpmback/common.h	Wed May 17 23:28:22 2006 +0100
     2.3 @@ -45,8 +45,6 @@ typedef struct tpmif_st {
     2.4  	long int tpm_instance;
     2.5  	unsigned long mmap_vstart;
     2.6  
     2.7 -	struct work_struct work;
     2.8 -
     2.9  	grant_handle_t shmem_handle;
    2.10  	grant_ref_t shmem_ref;
    2.11  	struct page *pagerange;
     3.1 --- a/linux-2.6-xen-sparse/drivers/xen/tpmback/interface.c	Wed May 17 23:23:26 2006 +0100
     3.2 +++ b/linux-2.6-xen-sparse/drivers/xen/tpmback/interface.c	Wed May 17 23:28:22 2006 +0100
     3.3 @@ -152,10 +152,8 @@ int tpmif_map(tpmif_t *tpmif, unsigned l
     3.4  	return 0;
     3.5  }
     3.6  
     3.7 -static void __tpmif_disconnect_complete(void *arg)
     3.8 +void tpmif_disconnect_complete(tpmif_t *tpmif)
     3.9  {
    3.10 -	tpmif_t *tpmif = (tpmif_t *) arg;
    3.11 -
    3.12  	if (tpmif->irq)
    3.13  		unbind_from_irqhandler(tpmif->irq, tpmif);
    3.14  
    3.15 @@ -167,12 +165,6 @@ static void __tpmif_disconnect_complete(
    3.16  	free_tpmif(tpmif);
    3.17  }
    3.18  
    3.19 -void tpmif_disconnect_complete(tpmif_t * tpmif)
    3.20 -{
    3.21 -	INIT_WORK(&tpmif->work, __tpmif_disconnect_complete, (void *)tpmif);
    3.22 -	schedule_work(&tpmif->work);
    3.23 -}
    3.24 -
    3.25  void __init tpmif_interface_init(void)
    3.26  {
    3.27  	tpmif_cachep = kmem_cache_create("tpmif_cache", sizeof (tpmif_t),
     4.1 --- a/linux-2.6-xen-sparse/drivers/xen/tpmback/tpmback.c	Wed May 17 23:23:26 2006 +0100
     4.2 +++ b/linux-2.6-xen-sparse/drivers/xen/tpmback/tpmback.c	Wed May 17 23:28:22 2006 +0100
     4.3 @@ -1063,7 +1063,7 @@ static int __init tpmback_init(void)
     4.4  
     4.5  module_init(tpmback_init);
     4.6  
     4.7 -static void __exit tpmback_exit(void)
     4.8 +void __exit tpmback_exit(void)
     4.9  {
    4.10  	vtpm_release_packets(NULL, 0);
    4.11  	tpmif_xenbus_exit();
     5.1 --- a/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c	Wed May 17 23:23:26 2006 +0100
     5.2 +++ b/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c	Wed May 17 23:28:22 2006 +0100
     5.3 @@ -150,7 +150,7 @@ static void frontend_changed(struct xenb
     5.4  		break;
     5.5  
     5.6  	case XenbusStateClosing:
     5.7 -		xenbus_switch_state(dev, XenbusStateClosing);
     5.8 +		be->tpmif->tpm_instance = -1;
     5.9  		break;
    5.10  
    5.11  	case XenbusStateClosed: