qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Zhang, Chen" <chen.zhang@intel.com>
To: "Rao, Lei" <lei.rao@intel.com>,
	"lizhijian@cn.fujitsu.com" <lizhijian@cn.fujitsu.com>,
	"jasowang@redhat.com" <jasowang@redhat.com>,
	"quintela@redhat.com" <quintela@redhat.com>,
	"dgilbert@redhat.com" <dgilbert@redhat.com>,
	"pbonzini@redhat.com" <pbonzini@redhat.com>,
	"lukasstraub2@web.de" <lukasstraub2@web.de>
Cc: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: RE: [PATCH v5 06/10] Add the function of colo_compare_cleanup
Date: Thu, 8 Apr 2021 08:48:33 +0000	[thread overview]
Message-ID: <50a163a2045b4099a2a8b22732f58cf4@intel.com> (raw)
In-Reply-To: <1617263249-54501-7-git-send-email-lei.rao@intel.com>



> -----Original Message-----
> From: Rao, Lei <lei.rao@intel.com>
> Sent: Thursday, April 1, 2021 3:47 PM
> To: Zhang, Chen <chen.zhang@intel.com>; lizhijian@cn.fujitsu.com;
> jasowang@redhat.com; quintela@redhat.com; dgilbert@redhat.com;
> pbonzini@redhat.com; lukasstraub2@web.de
> Cc: qemu-devel@nongnu.org; Rao, Lei <lei.rao@intel.com>
> Subject: [PATCH v5 06/10] Add the function of colo_compare_cleanup
> 
> From: "Rao, Lei" <lei.rao@intel.com>
> 
> This patch fixes the following:
>     #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
>     #1  0x00007f6ae4559859 in __GI_abort () at abort.c:79
>     #2  0x0000559aaa386720 in error_exit (err=16, msg=0x559aaa5973d0
> <__func__.16227> "qemu_mutex_destroy") at util/qemu-thread-posix.c:36
>     #3  0x0000559aaa3868c5 in qemu_mutex_destroy (mutex=0x559aabffe828)
> at util/qemu-thread-posix.c:69
>     #4  0x0000559aaa2f93a8 in char_finalize (obj=0x559aabffe800) at
> chardev/char.c:285
>     #5  0x0000559aaa23318a in object_deinit (obj=0x559aabffe800,
> type=0x559aabfd7d20) at qom/object.c:606
>     #6  0x0000559aaa2331b8 in object_deinit (obj=0x559aabffe800,
> type=0x559aabfd9060) at qom/object.c:610
>     #7  0x0000559aaa233200 in object_finalize (data=0x559aabffe800) at
> qom/object.c:620
>     #8  0x0000559aaa234202 in object_unref (obj=0x559aabffe800) at
> qom/object.c:1074
>     #9  0x0000559aaa2356b6 in object_finalize_child_property
> (obj=0x559aac0dac10, name=0x559aac778760 "compare0-0",
> opaque=0x559aabffe800) at qom/object.c:1584
>     #10 0x0000559aaa232f70 in object_property_del_all (obj=0x559aac0dac10)
> at qom/object.c:557
>     #11 0x0000559aaa2331ed in object_finalize (data=0x559aac0dac10) at
> qom/object.c:619
>     #12 0x0000559aaa234202 in object_unref (obj=0x559aac0dac10) at
> qom/object.c:1074
>     #13 0x0000559aaa2356b6 in object_finalize_child_property
> (obj=0x559aac0c75c0, name=0x559aac0dadc0 "chardevs",
> opaque=0x559aac0dac10) at qom/object.c:1584
>     #14 0x0000559aaa233071 in object_property_del_child
> (obj=0x559aac0c75c0, child=0x559aac0dac10, errp=0x0) at qom/object.c:580
>     #15 0x0000559aaa233155 in object_unparent (obj=0x559aac0dac10) at
> qom/object.c:599
>     #16 0x0000559aaa2fb721 in qemu_chr_cleanup () at chardev/char.c:1159
>     #17 0x0000559aa9f9b110 in main (argc=54, argv=0x7ffeb62fa998,
> envp=0x7ffeb62fab50) at vl.c:4539
> 
> When chardev is cleaned up, chr_write_lock needs to be destroyed. But the
> colo-compare module is not cleaned up normally before it when the guest
> poweroff. It is holding chr_write_lock at this time. This will cause qemu
> crash.So we add the function of colo_compare_cleanup() before
> qemu_chr_cleanup() to fix the bug.
> 
> Signed-off-by: Lei Rao <lei.rao@intel.com>

Reviewed-by: Zhang Chen <chen.zhang@intel.com>

Thanks
Chen

> ---
>  net/colo-compare.c | 10 ++++++++++
>  net/colo-compare.h |  1 +
>  net/net.c          |  4 ++++
>  3 files changed, 15 insertions(+)
> 
> diff --git a/net/colo-compare.c b/net/colo-compare.c index c142c08..5b538f4
> 100644
> --- a/net/colo-compare.c
> +++ b/net/colo-compare.c
> @@ -1402,6 +1402,16 @@ static void colo_compare_init(Object *obj)
>                               compare_set_vnet_hdr);  }
> 
> +void colo_compare_cleanup(void)
> +{
> +    CompareState *tmp = NULL;
> +    CompareState *n = NULL;
> +
> +    QTAILQ_FOREACH_SAFE(tmp, &net_compares, next, n) {
> +        object_unparent(OBJECT(tmp));
> +    }
> +}
> +
>  static void colo_compare_finalize(Object *obj)  {
>      CompareState *s = COLO_COMPARE(obj); diff --git a/net/colo-compare.h
> b/net/colo-compare.h index 22ddd51..b055270 100644
> --- a/net/colo-compare.h
> +++ b/net/colo-compare.h
> @@ -20,5 +20,6 @@
>  void colo_notify_compares_event(void *opaque, int event, Error **errp);
> void colo_compare_register_notifier(Notifier *notify);  void
> colo_compare_unregister_notifier(Notifier *notify);
> +void colo_compare_cleanup(void);
> 
>  #endif /* QEMU_COLO_COMPARE_H */
> diff --git a/net/net.c b/net/net.c
> index 725a4e1..8fcb2e7 100644
> --- a/net/net.c
> +++ b/net/net.c
> @@ -53,6 +53,7 @@
>  #include "sysemu/sysemu.h"
>  #include "sysemu/runstate.h"
>  #include "sysemu/sysemu.h"
> +#include "net/colo-compare.h"
>  #include "net/filter.h"
>  #include "qapi/string-output-visitor.h"
>  #include "qapi/hmp-output-visitor.h"
> @@ -1463,6 +1464,9 @@ void net_cleanup(void)  {
>      NetClientState *nc;
> 
> +    /*cleanup colo compare module for COLO*/
> +    colo_compare_cleanup();
> +
>      /* We may del multiple entries during qemu_del_net_client(),
>       * so QTAILQ_FOREACH_SAFE() is also not safe here.
>       */
> --
> 1.8.3.1



  reply	other threads:[~2021-04-08  8:50 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-01  7:47 [PATCH v5 00/10] Fixed some bugs and optimized some codes for COLO leirao
2021-04-01  7:47 ` [PATCH v5 01/10] Remove some duplicate trace code leirao
2021-04-08  5:21   ` Zhang, Chen
2021-04-01  7:47 ` [PATCH v5 02/10] Fix the qemu crash when guest shutdown during checkpoint leirao
2021-04-08  5:21   ` Zhang, Chen
2021-04-01  7:47 ` [PATCH v5 03/10] Optimize the function of filter_send leirao
2021-04-08  5:23   ` Zhang, Chen
2021-04-01  7:47 ` [PATCH v5 04/10] Remove migrate_set_block_enabled in checkpoint leirao
2021-04-08  5:25   ` Zhang, Chen
2021-04-01  7:47 ` [PATCH v5 05/10] Add a function named packet_new_nocopy for COLO leirao
2021-04-08  5:30   ` Zhang, Chen
2021-04-01  7:47 ` [PATCH v5 06/10] Add the function of colo_compare_cleanup leirao
2021-04-08  8:48   ` Zhang, Chen [this message]
2021-04-01  7:47 ` [PATCH v5 07/10] Reset the auto-converge counter at every checkpoint leirao
2021-04-01  7:47 ` [PATCH v5 08/10] Reduce the PVM stop time during Checkpoint leirao
2021-04-01  7:47 ` [PATCH v5 09/10] Add the function of colo_bitmap_clear_dirty leirao
2021-04-01  7:47 ` [PATCH v5 10/10] Fixed calculation error of pkt->header_size in fill_pkt_tcp_info() leirao
2021-04-08  8:49   ` Zhang, Chen
2021-04-04 10:22 ` [PATCH v5 00/10] Fixed some bugs and optimized some codes for COLO Lukas Straub

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50a163a2045b4099a2a8b22732f58cf4@intel.com \
    --to=chen.zhang@intel.com \
    --cc=dgilbert@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=lei.rao@intel.com \
    --cc=lizhijian@cn.fujitsu.com \
    --cc=lukasstraub2@web.de \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).