[Qemu-devel] [PATCH v10 9/9] tpm: Move tpm_cleanup() to right place

Amarnath Valluri posted 9 patches 8 years, 4 months ago
[Qemu-devel] [PATCH v10 9/9] tpm: Move tpm_cleanup() to right place
Posted by Amarnath Valluri 8 years, 4 months ago
As Emulator TPM backend uses chardev, tpm cleanup should happen before chardev
similar to other vhost-users.

Signed-off-by: Amarnath Valluri <amarnath.valluri@intel.com>
---
 tpm.c | 1 -
 vl.c  | 1 +
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/tpm.c b/tpm.c
index 3b8c7ed..3122227 100644
--- a/tpm.c
+++ b/tpm.c
@@ -172,7 +172,6 @@ int tpm_init(void)
         return -1;
     }
 
-    atexit(tpm_cleanup);
     return 0;
 }
 
diff --git a/vl.c b/vl.c
index 9bb5058..ed86209 100644
--- a/vl.c
+++ b/vl.c
@@ -4893,6 +4893,7 @@ int main(int argc, char **argv, char **envp)
     res_free();
 
     /* vhost-user must be cleaned up before chardevs.  */
+    tpm_cleanup();
     net_cleanup();
     audio_cleanup();
     monitor_cleanup();
-- 
2.7.4


Re: [Qemu-devel] [PATCH v10 9/9] tpm: Move tpm_cleanup() to right place
Posted by Marc-André Lureau 8 years, 4 months ago
On Fri, Sep 29, 2017 at 1:10 PM, Amarnath Valluri
<amarnath.valluri@intel.com> wrote:
> As Emulator TPM backend uses chardev, tpm cleanup should happen before chardev
> similar to other vhost-users.
>
> Signed-off-by: Amarnath Valluri <amarnath.valluri@intel.com>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>


> ---
>  tpm.c | 1 -
>  vl.c  | 1 +
>  2 files changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tpm.c b/tpm.c
> index 3b8c7ed..3122227 100644
> --- a/tpm.c
> +++ b/tpm.c
> @@ -172,7 +172,6 @@ int tpm_init(void)
>          return -1;
>      }
>
> -    atexit(tpm_cleanup);
>      return 0;
>  }
>
> diff --git a/vl.c b/vl.c
> index 9bb5058..ed86209 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -4893,6 +4893,7 @@ int main(int argc, char **argv, char **envp)
>      res_free();
>
>      /* vhost-user must be cleaned up before chardevs.  */
> +    tpm_cleanup();
>      net_cleanup();
>      audio_cleanup();
>      monitor_cleanup();
> --
> 2.7.4
>



-- 
Marc-André Lureau

Re: [Qemu-devel] [PATCH v10 9/9] tpm: Move tpm_cleanup() to right place
Posted by Stefan Berger 8 years, 4 months ago
On 09/29/2017 07:10 AM, Amarnath Valluri wrote:
> As Emulator TPM backend uses chardev, tpm cleanup should happen before chardev
> similar to other vhost-users.
>
> Signed-off-by: Amarnath Valluri <amarnath.valluri@intel.com>

Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com>

> ---
>   tpm.c | 1 -
>   vl.c  | 1 +
>   2 files changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tpm.c b/tpm.c
> index 3b8c7ed..3122227 100644
> --- a/tpm.c
> +++ b/tpm.c
> @@ -172,7 +172,6 @@ int tpm_init(void)
>           return -1;
>       }
>
> -    atexit(tpm_cleanup);
>       return 0;
>   }
>
> diff --git a/vl.c b/vl.c
> index 9bb5058..ed86209 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -4893,6 +4893,7 @@ int main(int argc, char **argv, char **envp)
>       res_free();
>
>       /* vhost-user must be cleaned up before chardevs.  */
> +    tpm_cleanup();
>       net_cleanup();
>       audio_cleanup();
>       monitor_cleanup();



Re: [Qemu-devel] [PATCH v10 9/9] tpm: Move tpm_cleanup() to right place
Posted by Richard W.M. Jones 8 years, 3 months ago
On Fri, Sep 29, 2017 at 02:10:21PM +0300, Amarnath Valluri wrote:
> As Emulator TPM backend uses chardev, tpm cleanup should happen before chardev
> similar to other vhost-users.
> 
> Signed-off-by: Amarnath Valluri <amarnath.valluri@intel.com>
> ---
>  tpm.c | 1 -
>  vl.c  | 1 +
>  2 files changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tpm.c b/tpm.c
> index 3b8c7ed..3122227 100644
> --- a/tpm.c
> +++ b/tpm.c
> @@ -172,7 +172,6 @@ int tpm_init(void)
>          return -1;
>      }
>  
> -    atexit(tpm_cleanup);
>      return 0;
>  }
>  
> diff --git a/vl.c b/vl.c
> index 9bb5058..ed86209 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -4893,6 +4893,7 @@ int main(int argc, char **argv, char **envp)
>      res_free();
>  
>      /* vhost-user must be cleaned up before chardevs.  */
> +    tpm_cleanup();
>      net_cleanup();
>      audio_cleanup();
>      monitor_cleanup();

This breaks compilation with --disable-tpm.  I'll post a trivial
patch shortly.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/