From: Peter Xu <peterx@redhat.com>
To: Richard Henderson <richard.henderson@linaro.org>
Cc: qemu-devel@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>,
Fabiano Rosas <farosas@suse.de>
Subject: Re: [PULL 00/10] Next patches
Date: Thu, 13 Aug 2026 09:41:05 -0400 [thread overview]
Message-ID: <an3JcZvNNS8o_UFg@x1.local> (raw)
In-Reply-To: <an26zg9zVW-JrV9f@x1.local>
On Thu, Aug 13, 2026 at 08:38:38AM -0400, Peter Xu wrote:
> On Wed, Aug 12, 2026 at 03:01:14PM -0700, Richard Henderson wrote:
> > On 8/12/26 08:14, Peter Xu wrote:
> > > The following changes since commit 84f07211cc5b4fc6a371559bf8a5de4fb068e648:
> > >
> > > Update version for v11.1.0 release (2026-08-11 10:04:46 -0400)
> > >
> > > are available in the Git repository at:
> > >
> > > https://gitlab.com/peterx/qemu.git tags/next-pull-request
> > >
> > > for you to fetch changes up to 2375e9b1239eb6ad794eaae29245b94f429c87c5:
> > >
> > > migration: Fix rare hang of migration_channel_read_peek() (2026-08-12 10:42:09 -0400)
> > >
> > > ----------------------------------------------------------------
> > > migration/mem pull for 11.2
> > >
> > > next 11.2:
> > > - Dongli's patch to add cpr-transfer support for HMP
> > > - Fabiano's doc update for migration on security issues
> > > - Gavin's fix for MMIO access support for memory APIs, reverting ram_device ops
> > > - Sam's migration test build fix for !ASN1
> > > - Peter's a few migration hardening fixes
> >
> > MacOS build failures:
> >
> > https://gitlab.com/qemu-project/qemu/-/jobs/15865084063
> > https://gitlab.com/qemu-project/qemu/-/jobs/15865084064
> >
> > ../migration/ram.c:4291:54: error: incompatible pointer types passing
> > 'ram_addr_t *' (aka 'unsigned long *') to parameter of type 'uint64_t *'
> > (aka 'unsigned long long *') [-Werror,-Wincompatible-pointer-types]
> > 4291 | if (usub64_overflow(total_ram_bytes, length, &total_ram_bytes)) {
> > | ^~~~~~~~~~~~~~~~
> > /Users/gitlab/builds/qemu-project/qemu/include/qemu/host-utils.h:552:70:
> > note: passing argument to parameter 'ret' here
> > 552 | static inline bool usub64_overflow(uint64_t x, uint64_t y, uint64_t *ret)
> > | ^
> >
> > Note that ram_addr_t maps to uintptr_t not uint64_t.
> > Which should be functionally the same, but is probably
> > an 'unsigned long' vs 'unsigned long long' mismatch.
> >
> > Perhaps we should just be using __builtin_add_overflow via a macro instead
> > of inlines so that we get the full functionality of the types accepted by
> > the builtin.
>
> Ohhh I almost missed this email... somehow it lost all CCs include myself.
> I'll see how to fix and repost, thanks for the hints!
So for this one I plan to squash this (will repost in a minute):
diff --git a/migration/ram.c b/migration/ram.c
index 85feff578c..b6eb842746 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -4263,7 +4263,7 @@ static int parse_ramblock(QEMUFile *f, RAMBlock *block, ram_addr_t length)
return ret;
}
-static int parse_ramblocks(QEMUFile *f, ram_addr_t total_ram_bytes)
+static int parse_ramblocks(QEMUFile *f, uint64_t total_ram_bytes)
{
int ret = 0;
@@ -4271,7 +4271,7 @@ static int parse_ramblocks(QEMUFile *f, ram_addr_t total_ram_bytes)
while (total_ram_bytes) {
RAMBlock *block;
char id[256];
- ram_addr_t length;
+ uint64_t length;
int len = qemu_get_byte(f);
qemu_get_buffer(f, (uint8_t *)id, len);
After all, whole migration treats ram_addr_t to be u64, at least on wire.
For the long term, do we want to fully expose __builtin_add_overflow(), or
the new macro would do something more than what __builtin_add_overflow()
does?
Now when I think about it from the root, I tend to like what Xen defines
with ram_addr_t:
/* address in the RAM (different from a physical address) */
#if defined(CONFIG_XEN_BACKEND)
typedef uint64_t ram_addr_t;
# define RAM_ADDR_MAX UINT64_MAX
# define RAM_ADDR_FMT "%" PRIx64
#else
typedef uintptr_t ram_addr_t;
# define RAM_ADDR_MAX UINTPTR_MAX
# define RAM_ADDR_FMT "%" PRIxPTR
#endif
I don't know how we supported 32bit host emulating anything larger, but
logically it's doable, then IIUC uintptr_t won't be enough allocating
anything >4G? If emulating 64bits is too much, I still think it seems valid
to emulate e.g. PAE 36bits on a 32bit. I didn't check how it was done now
or before, but logically it sounds that it should still work.
Meanwhile, we should never directly use a ram_addr_t* to be a pointer - it
simply is not, but only the address space qemu uses internally for
ramblocks. That also implies to me that this seems to be a bit off.
Thanks,
--
Peter Xu
next prev parent reply other threads:[~2026-08-13 13:41 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-12 15:14 [PULL 00/10] Next patches Peter Xu
2026-08-12 15:14 ` [PULL 01/10] docs: Add security considerations for migration Peter Xu
2026-08-12 15:14 ` [PULL 02/10] migration/cpr: Add HMP support for cpr-transfer Peter Xu
2026-08-12 15:14 ` [PULL 03/10] system/memory: Use memmove() for directly accessible regions Peter Xu
2026-08-12 15:14 ` [PULL 04/10] system/memory: Use qemu_ram_move() " Peter Xu
2026-08-12 15:14 ` [PULL 05/10] system/memory: Make ram device region directly accessible Peter Xu
2026-08-12 15:14 ` [PULL 06/10] tests/qtest/migration: Only build tls_no_hostname test with TASN1 Peter Xu
2026-08-12 15:14 ` [PULL 07/10] migration/multifd: Validate next_packet_size in zlib/zstd recv Peter Xu
2026-08-12 15:14 ` [PULL 08/10] migration/multifd: Replace assert() with error_setg() in recv paths Peter Xu
2026-08-12 15:14 ` [PULL 09/10] migration/ram: Check for RAMBlock size mismatch when parsing Peter Xu
2026-08-12 15:14 ` [PULL 10/10] migration: Fix rare hang of migration_channel_read_peek() Peter Xu
2026-08-12 22:01 ` [PULL 00/10] Next patches Richard Henderson
2026-08-13 12:38 ` Peter Xu
2026-08-13 13:41 ` Peter Xu [this message]
2026-08-13 14:14 ` Richard Henderson
2026-08-13 14:51 ` Philippe Mathieu-Daudé
2026-08-13 15:05 ` Peter Xu
2026-08-13 15:18 ` Philippe Mathieu-Daudé
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=an3JcZvNNS8o_UFg@x1.local \
--to=peterx@redhat.com \
--cc=farosas@suse.de \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/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.