All of lore.kernel.org
 help / color / mirror / Atom feed
From: 858585 jemmy <jemmy858585@gmail.com>
To: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: Juan Quintela <quintela@redhat.com>,
	qemu-devel <qemu-devel@nongnu.org>,
	Lidong Chen <lidongchen@tencent.com>
Subject: Re: [Qemu-devel] [PATCH] migration: release MigrationIncomingState in migration_object_finalize
Date: Tue, 17 Jul 2018 22:55:55 +0800	[thread overview]
Message-ID: <CAOGPPbcQ2FkaT0xOS8JQaoHxzQYQdk0m2S2sVGYYWdmSqQagnQ@mail.gmail.com> (raw)
In-Reply-To: <CAOGPPbdxP=7C5m45LXFd3Yw8UEbKzdShjoXXFwORu8xruVOCiA@mail.gmail.com>

On Thu, Jul 12, 2018 at 12:08 PM, 858585 jemmy <jemmy858585@gmail.com> wrote:
> On Fri, Jul 6, 2018 at 6:41 PM, Dr. David Alan Gilbert
> <dgilbert@redhat.com> wrote:
>> * Dr. David Alan Gilbert (dgilbert@redhat.com) wrote:
>>> * Lidong Chen (jemmy858585@gmail.com) wrote:
>>> > Qemu initialize the MigrationIncomingState structure in migration_object_init,
>>> > but not release it. this patch release it in migration_object_finalize.
>>> >
>>> > Signed-off-by: Lidong Chen <lidongchen@tencent.com>
>>>
>>> Queued
>>
>> I've had to unqueue this, see below:
>>
>>>
>>> > ---
>>> >  migration/migration.c | 7 +++++++
>>> >  1 file changed, 7 insertions(+)
>>> >
>>> > diff --git a/migration/migration.c b/migration/migration.c
>>> > index 05aec2c..e009a05 100644
>>> > --- a/migration/migration.c
>>> > +++ b/migration/migration.c
>>> > @@ -156,6 +156,13 @@ void migration_object_init(void)
>>> >  void migration_object_finalize(void)
>>> >  {
>>> >      object_unref(OBJECT(current_migration));
>>> > +
>>> > +    qemu_sem_destroy(&current_incoming->postcopy_pause_sem_fault);
>>> > +    qemu_sem_destroy(&current_incoming->postcopy_pause_sem_dst);
>>> > +    qemu_event_destroy(&current_incoming->main_thread_load_event);
>>> > +    qemu_mutex_destroy(&current_incoming->rp_mutex);
>>> > +    g_array_free(current_incoming->postcopy_remote_fds, true);
>>
>> That array is already free'd in migration_incoming_state_destroy,
>> so I see reliable glib assert's from this array free.
>
> The migration_incoming_state_destroy only invoked in destination qemu.
> The source qemu will not free this memory.
> So I think free current_incoming->postcopy_remote_fds is not good way.
>
> and migration_object_init and migration_object_finalize should not be
> invoked in main
> function. It's better to  alloc memory when start migration and
> release it when migration finished.
>
> I will submit a new version patch to fix it.

I find many function use current_incoming and current_migration,
if we alloc these when migration start, and release these when
migration finished, it need change many function.
so I will just remove
g_array_free(current_incoming->postcopy_remote_fds, true) from the
patch.

Thanks

>
>>
>> Dave
>>
>>> > +    g_free(current_incoming);
>>> >  }
>>> >
>>> >  /* For outgoing */
>>> > --
>>> > 1.8.3.1
>>> >
>>> --
>>> Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
>> --
>> Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

      reply	other threads:[~2018-07-17 14:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-04  9:55 [Qemu-devel] [PATCH] migration: release MigrationIncomingState in migration_object_finalize Lidong Chen
2018-07-05 11:05 ` Dr. David Alan Gilbert
2018-07-06  9:53 ` Dr. David Alan Gilbert
2018-07-06 10:41   ` Dr. David Alan Gilbert
2018-07-12  4:08     ` 858585 jemmy
2018-07-17 14:55       ` 858585 jemmy [this message]

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=CAOGPPbcQ2FkaT0xOS8JQaoHxzQYQdk0m2S2sVGYYWdmSqQagnQ@mail.gmail.com \
    --to=jemmy858585@gmail.com \
    --cc=dgilbert@redhat.com \
    --cc=lidongchen@tencent.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.