qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Juan Quintela <quintela@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>
Cc: Leonardo Bras <leobras@redhat.com>,
	qemu-devel@nongnu.org, Peter Xu <peterx@redhat.com>,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>
Subject: Re: [PATCH 3/5] migration: ram_release_pages() always receive 1 page as argument
Date: Tue, 21 Dec 2021 10:35:50 +0100	[thread overview]
Message-ID: <87a6gujo5l.fsf@secure.mitica> (raw)
In-Reply-To: <cd82bba4-89c6-8c92-7eb3-467893b43ff7@redhat.com> ("Philippe Mathieu-Daudé"'s message of "Thu, 16 Dec 2021 10:27:49 +0100")

Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
> On 12/16/21 10:13, Juan Quintela wrote:
>> Remove the pages argument. And s/pages/page/
>> 
>> Signed-off-by: Juan Quintela <quintela@redhat.com>
>> ---
>>  migration/ram.c | 8 ++++----
>>  1 file changed, 4 insertions(+), 4 deletions(-)
>
>> -static void ram_release_pages(const char *rbname, uint64_t offset, int pages)
>> +static void ram_release_page(const char *rbname, uint64_t offset)
>>  {
>>      if (!migrate_release_ram() || !migration_in_postcopy()) {
>>          return;
>>      }
>>  
>> -    ram_discard_range(rbname, offset, ((ram_addr_t)pages) << TARGET_PAGE_BITS);
>> +    ram_discard_range(rbname, offset, ((ram_addr_t)1) << TARGET_PAGE_BITS);
>
> 1ULL?

I am changing it, but the argument to ram_discard_range is a size_t, and
that is different in 32 bits arch.  Once told that, it is not worse that
what we have here, as ram_addr_t type depends on the phase of the moon.

/* 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

Later, Juan.

PD. No, I don't know either why it is not casted to size_t.

PD2. And yes, I still think that pure int operations should be ok.
     The value TARGET_PAGE_BITS more typical is 10, and here pages is
     only used with value 1.  C promotion rules should make everything
     ok (famous last words).



  reply	other threads:[~2021-12-21  9:38 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-16  9:13 [PATCH 0/5] migration: misc cleanups Juan Quintela
2021-12-16  9:13 ` [PATCH 1/5] migration: All this fields are unsigned Juan Quintela
2021-12-16  9:26   ` Philippe Mathieu-Daudé
2021-12-17 20:25     ` Richard Henderson
2021-12-17 21:01       ` Philippe Mathieu-Daudé
2021-12-16  9:13 ` [PATCH 2/5] migration: We only need last_stage in two places Juan Quintela
2021-12-16  9:30   ` Philippe Mathieu-Daudé
2021-12-20 19:02     ` Juan Quintela
2021-12-16  9:13 ` [PATCH 3/5] migration: ram_release_pages() always receive 1 page as argument Juan Quintela
2021-12-16  9:27   ` Philippe Mathieu-Daudé
2021-12-21  9:35     ` Juan Quintela [this message]
2021-12-16  9:13 ` [PATCH 4/5] migration: simplify do_compress_ram_page Juan Quintela
2021-12-16  9:13 ` [PATCH 5/5] migration: Move ram_release_pages() call to save_zero_page_to_file() 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=87a6gujo5l.fsf@secure.mitica \
    --to=quintela@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=leobras@redhat.com \
    --cc=peterx@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.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 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).