All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Peter Xu <peterx@redhat.com>
Cc: qemu-devel@nongnu.org,
	"Daniel P . Berrange" <berrange@redhat.com>,
	Juan Quintela <quintela@redhat.com>,
	ani@anisinha.ca,
	Leonardo Bras Soares Passos <lsoaresp@redhat.com>,
	Manish Mishra <manish.mishra@nutanix.com>
Subject: Re: [PATCH v2 06/15] migration: Yield bitmap_mutex properly when sending/sleeping
Date: Thu, 13 Oct 2022 17:37:19 +0100	[thread overview]
Message-ID: <Y0g+v1ZDorVRHkUm@work-vm> (raw)
In-Reply-To: <Y0g6i6z3K4mglmPb@x1n>

* Peter Xu (peterx@redhat.com) wrote:
> On Wed, Oct 12, 2022 at 01:51:07PM -0400, Peter Xu wrote:
> > On Wed, Oct 12, 2022 at 05:43:53PM +0100, Dr. David Alan Gilbert wrote:
> > > * Peter Xu (peterx@redhat.com) wrote:
> > > > Don't take the bitmap mutex when sending pages, or when being throttled by
> > > > migration_rate_limit() (which is a bit tricky to call it here in ram code,
> > > > but seems still helpful).
> > > > 
> > > > It prepares for the possibility of concurrently sending pages in >1 threads
> > > > using the function ram_save_host_page() because all threads may need the
> > > > bitmap_mutex to operate on bitmaps, so that either sendmsg() or any kind of
> > > > qemu_sem_wait() blocking for one thread will not block the other from
> > > > progressing.
> > > > 
> > > > Signed-off-by: Peter Xu <peterx@redhat.com>
> > > 
> > > Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> > > 
> > > although a comment above the reclaration of ram_save_host_pages saying
> > > it can drop the lock would be veyr good.
> > 
> > Let me add that.  Thanks,
> 
> A fixup to this patch attached to touch up the comment for
> ram_save_host_page().

Yep, that's right (I don't think we have any formal annotation for
locks)

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

> -- 
> Peter Xu

> From dcc3adce062df7216851890d49f7d2b1fa2e84a4 Mon Sep 17 00:00:00 2001
> From: Peter Xu <peterx@redhat.com>
> Date: Thu, 13 Oct 2022 12:18:04 -0400
> Subject: [PATCH] fixup! migration: Yield bitmap_mutex properly when
>  sending/sleeping
> Content-type: text/plain
> 
> Signed-off-by: Peter Xu <peterx@redhat.com>
> ---
>  migration/ram.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/migration/ram.c b/migration/ram.c
> index 538667b974..b311ece48c 100644
> --- a/migration/ram.c
> +++ b/migration/ram.c
> @@ -2407,9 +2407,14 @@ out:
>   * a host page in which case the remainder of the hostpage is sent.
>   * Only dirty target pages are sent. Note that the host page size may
>   * be a huge page for this block.
> + *
>   * The saving stops at the boundary of the used_length of the block
>   * if the RAMBlock isn't a multiple of the host page size.
>   *
> + * The caller must be with ram_state.bitmap_mutex held to call this
> + * function.  Note that this function can temporarily release the lock, but
> + * when the function is returned it'll make sure the lock is still held.
> + *
>   * Returns the number of pages written or negative on error
>   *
>   * @rs: current RAM state
> -- 
> 2.37.3
> 

-- 
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK



  reply	other threads:[~2022-10-13 16:40 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-11 21:55 [PATCH v2 00/15] migration: Postcopy Preempt-Full Peter Xu
2022-10-11 21:55 ` [PATCH v2 01/15] migration: Take bitmap mutex when completing ram migration Peter Xu
2022-10-12 16:14   ` Dr. David Alan Gilbert
2022-11-14 15:06   ` Juan Quintela
2022-10-11 21:55 ` [PATCH v2 02/15] migration: Add postcopy_preempt_active() Peter Xu
2022-11-14 15:07   ` Juan Quintela
2022-10-11 21:55 ` [PATCH v2 03/15] migration: Cleanup xbzrle zero page cache update logic Peter Xu
2022-11-14 15:08   ` Juan Quintela
2022-10-11 21:55 ` [PATCH v2 04/15] migration: Trivial cleanup save_page_header() on same block check Peter Xu
2022-11-14 15:08   ` Juan Quintela
2022-10-11 21:55 ` [PATCH v2 05/15] migration: Remove RAMState.f references in compression code Peter Xu
2022-11-14 15:09   ` Juan Quintela
2022-10-11 21:55 ` [PATCH v2 06/15] migration: Yield bitmap_mutex properly when sending/sleeping Peter Xu
2022-10-12 16:43   ` Dr. David Alan Gilbert
2022-10-12 17:51     ` Peter Xu
2022-10-13 16:19       ` Peter Xu
2022-10-13 16:37         ` Dr. David Alan Gilbert [this message]
2022-11-15  9:19         ` Juan Quintela
2022-10-11 21:55 ` [PATCH v2 07/15] migration: Use atomic ops properly for page accountings Peter Xu
2022-11-14 15:14   ` Juan Quintela
2022-10-11 21:55 ` [PATCH v2 08/15] migration: Teach PSS about host page Peter Xu
2022-10-11 21:55 ` [PATCH v2 09/15] migration: Introduce pss_channel Peter Xu
2022-10-11 21:55 ` [PATCH v2 10/15] migration: Add pss_init() Peter Xu
2022-10-11 21:55 ` [PATCH v2 11/15] migration: Make PageSearchStatus part of RAMState Peter Xu
2022-10-11 21:55 ` [PATCH v2 12/15] migration: Move last_sent_block into PageSearchStatus Peter Xu
2022-11-14 15:19   ` Juan Quintela
2022-10-11 21:55 ` [PATCH v2 13/15] migration: Send requested page directly in rp-return thread Peter Xu
2022-10-11 21:55 ` [PATCH v2 14/15] migration: Remove old preempt code around state maintainance Peter Xu
2022-11-14 15:19   ` Juan Quintela
2022-10-11 21:55 ` [PATCH v2 15/15] migration: Drop rs->f Peter Xu
2022-11-14 15:18   ` Juan Quintela

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=Y0g+v1ZDorVRHkUm@work-vm \
    --to=dgilbert@redhat.com \
    --cc=ani@anisinha.ca \
    --cc=berrange@redhat.com \
    --cc=lsoaresp@redhat.com \
    --cc=manish.mishra@nutanix.com \
    --cc=peterx@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 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.