qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: Juan Quintela <quintela@redhat.com>
Cc: qemu-devel@nongnu.org,
	Leonardo Bras Soares Passos <lsoaresp@redhat.com>,
	James Houghton <jthoughton@google.com>,
	"Dr . David Alan Gilbert" <dgilbert@redhat.com>
Subject: Re: [PATCH RFC 14/21] migration: Map hugetlbfs ramblocks twice, and pre-allocate
Date: Mon, 6 Feb 2023 16:40:04 -0500	[thread overview]
Message-ID: <Y+FztLMi/uH8xJjR@x1n> (raw)
In-Reply-To: <874js5xlnb.fsf@secure.mitica>

On Wed, Feb 01, 2023 at 07:53:28PM +0100, Juan Quintela wrote:
> Peter Xu <peterx@redhat.com> wrote:
> > On Mon, Jan 30, 2023 at 06:24:20AM +0100, Juan Quintela wrote:
> >> I would consider here:
> >> 
> >>     uint8_t *host_doublemap;
> >> 
> >> as I have not a small name that means
> >>     uint8_t *host_map_smaller_size_pages;
> >> 
> >> That explains why we need it.
> >
> > Sure, I can rename this one if it helps.
> >
> > One thing worth mention is that, it's not mapping things in small page size
> > here with host_doublemap but in huge page size only.
> 
> Thanks.
> 
> 
> > It's just that UFFDIO_CONTINUE needs another mapping to resolve the page
> > faults. It'll be the guest hugetlb ramblocks that will be mapped in small
> > pages during postcopy.
> 
> ok
> >> Not initialized variables, remove the last two.
> >
> > I can do this.
> >
> >> 
> >> > +    if (!migrate_hugetlb_doublemap()) {
> >> > +        return 0;
> >> > +    }
> >> > +
> >> 
> >> I would move the declaration of the RAMBlock here.
> >
> > But isn't QEMU in most cases declaring variables at the start of any code
> > block, rather than after or in the middle of any code segments?  IIRC some
> > compiler should start to fail with it, even though not on the modern ones.
> 
> We can declare variables since c99.  Only 24 years have passed O:-)

Oh OK :)

> 
> Anyways:
> 
> Exhibit A: We already have that kind of code
> 
> static int nocomp_send_prepare(MultiFDSendParams *p, Error **errp)
> {
>     MultiFDPages_t *pages = p->pages;
> 
>     for (int i = 0; i < p->normal_num; i++) {
>         p->iov[p->iovs_num].iov_base = pages->block->host + p->normal[i];
>         p->iov[p->iovs_num].iov_len = p->page_size;
>         p->iovs_num++;
>     }
> 
>     p->next_packet_size = p->normal_num * p->page_size;
>     p->flags |= MULTIFD_FLAG_NOCOMP;
>     return nocomp;
> }
> 
> Exhibit B:
> 
> from configure:
> 
> #if defined(__clang_major__) && defined(__clang_minor__)
> # ifdef __apple_build_version__
> #  if __clang_major__ < 10 || (__clang_major__ == 10 && __clang_minor__ < 0)
> #   error You need at least XCode Clang v10.0 to compile QEMU
> #  endif
> # else
> #  if __clang_major__ < 6 || (__clang_major__ == 6 && __clang_minor__ < 0)
> #   error You need at least Clang v6.0 to compile QEMU
> #  endif
> # endif
> #elif defined(__GNUC__) && defined(__GNUC_MINOR__)
> # if __GNUC__ < 7 || (__GNUC__ == 7 && __GNUC_MINOR__ < 4)
> #  error You need at least GCC v7.4.0 to compile QEMU
> # endif
> #else
> # error You either need GCC or Clang to compiler QEMU
> #endif
> int main (void) { return 0; }
> EOF
> 
> gcc-7.4.0: supports C11, so we are good here
> https://gcc.gnu.org/onlinedocs/gcc-7.4.0/gcc/Standards.html#C-Language
> 
> clang 6.0: supports c11 and c17 standard
> https://releases.llvm.org/6.0.0/tools/clang/docs/ReleaseNotes.html
> 
> 
> So as far as I can see, we are good here.

Thanks, I'll switch over.

-- 
Peter Xu



  reply	other threads:[~2023-02-06 21:40 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-17 22:08 [PATCH RFC 00/21] migration: Support hugetlb doublemaps Peter Xu
2023-01-17 22:08 ` [PATCH RFC 01/21] update linux headers Peter Xu
2023-01-17 22:08 ` [PATCH RFC 02/21] util: Include osdep.h first in util/mmap-alloc.c Peter Xu
2023-01-18 12:00   ` Dr. David Alan Gilbert
2023-01-25  0:19   ` Philippe Mathieu-Daudé
2023-01-30  4:57   ` Juan Quintela
2023-01-17 22:08 ` [PATCH RFC 03/21] physmem: Add qemu_ram_is_hugetlb() Peter Xu
2023-01-18 12:02   ` Dr. David Alan Gilbert
2023-01-30  5:00   ` Juan Quintela
2023-01-17 22:08 ` [PATCH RFC 04/21] madvise: Include linux/mman.h under linux-headers/ Peter Xu
2023-01-18 12:08   ` Dr. David Alan Gilbert
2023-01-30  5:01   ` Juan Quintela
2023-01-17 22:08 ` [PATCH RFC 05/21] madvise: Add QEMU_MADV_SPLIT Peter Xu
2023-01-30  5:01   ` Juan Quintela
2023-01-17 22:08 ` [PATCH RFC 06/21] madvise: Add QEMU_MADV_COLLAPSE Peter Xu
2023-01-18 18:51   ` Dr. David Alan Gilbert
2023-01-18 20:21     ` Peter Xu
2023-01-30  5:02   ` Juan Quintela
2023-01-17 22:09 ` [PATCH RFC 07/21] ramblock: Cache file offset for file-backed ramblocks Peter Xu
2023-01-30  5:02   ` Juan Quintela
2023-01-17 22:09 ` [PATCH RFC 08/21] ramblock: Cache the length to do file mmap() on ramblocks Peter Xu
2023-01-23 18:51   ` Dr. David Alan Gilbert
2023-01-24 20:28     ` Peter Xu
2023-01-30  5:05   ` Juan Quintela
2023-01-30 22:07     ` Peter Xu
2023-01-17 22:09 ` [PATCH RFC 09/21] ramblock: Add RAM_READONLY Peter Xu
2023-01-23 19:42   ` Dr. David Alan Gilbert
2023-01-30  5:06   ` Juan Quintela
2023-01-17 22:09 ` [PATCH RFC 10/21] ramblock: Add ramblock_file_map() Peter Xu
2023-01-24 10:06   ` Dr. David Alan Gilbert
2023-01-24 20:47     ` Peter Xu
2023-01-25  9:24       ` Dr. David Alan Gilbert
2023-01-25 14:46         ` Peter Xu
2023-01-30  5:09   ` Juan Quintela
2023-01-17 22:09 ` [PATCH RFC 11/21] migration: Add hugetlb-doublemap cap Peter Xu
2023-01-24 12:45   ` Dr. David Alan Gilbert
2023-01-24 21:15     ` Peter Xu
2023-01-30  5:13   ` Juan Quintela
2023-01-17 22:09 ` [PATCH RFC 12/21] migration: Introduce page size for-migration-only Peter Xu
2023-01-24 13:20   ` Dr. David Alan Gilbert
2023-01-24 21:36     ` Peter Xu
2023-01-24 22:03       ` Peter Xu
2023-01-30  5:17   ` Juan Quintela
2023-01-17 22:09 ` [PATCH RFC 13/21] migration: Add migration_ram_pagesize_largest() Peter Xu
2023-01-24 17:34   ` Dr. David Alan Gilbert
2023-01-30  5:19   ` Juan Quintela
2023-01-17 22:09 ` [PATCH RFC 14/21] migration: Map hugetlbfs ramblocks twice, and pre-allocate Peter Xu
2023-01-25 14:25   ` Dr. David Alan Gilbert
2023-01-30  5:24   ` Juan Quintela
2023-01-30 22:35     ` Peter Xu
2023-02-01 18:53       ` Juan Quintela
2023-02-06 21:40         ` Peter Xu [this message]
2023-01-17 22:09 ` [PATCH RFC 15/21] migration: Teach qemu about minor faults and doublemap Peter Xu
2023-01-30  5:45   ` Juan Quintela
2023-01-30 22:50     ` Peter Xu
2023-02-01 18:55       ` Juan Quintela
2023-01-17 22:09 ` [PATCH RFC 16/21] migration: Enable doublemap with MADV_SPLIT Peter Xu
2023-02-01 18:59   ` Juan Quintela
2023-01-17 22:09 ` [PATCH RFC 17/21] migration: Rework ram discard logic for hugetlb double-map Peter Xu
2023-02-01 19:03   ` Juan Quintela
2023-01-17 22:09 ` [PATCH RFC 18/21] migration: Allow postcopy_register_shared_ufd() to fail Peter Xu
2023-02-01 19:09   ` Juan Quintela
2023-01-17 22:09 ` [PATCH RFC 19/21] migration: Add postcopy_mark_received() Peter Xu
2023-02-01 19:10   ` Juan Quintela
2023-01-17 22:09 ` [PATCH RFC 20/21] migration: Handle page faults using UFFDIO_CONTINUE Peter Xu
2023-02-01 19:24   ` Juan Quintela
2023-02-01 19:52     ` Juan Quintela
2023-01-17 22:09 ` [PATCH RFC 21/21] migration: Collapse huge pages again after postcopy finished Peter Xu
2023-02-01 19:49   ` 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=Y+FztLMi/uH8xJjR@x1n \
    --to=peterx@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=jthoughton@google.com \
    --cc=lsoaresp@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).