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, qemu-block@nongnu.org,
	Stefan Hajnoczi <stefanha@redhat.com>,
	Leonardo Bras <leobras@redhat.com>, Fam Zheng <fam@euphon.net>
Subject: Re: [PATCH 0/9] QEMU file cleanups
Date: Thu, 4 May 2023 11:24:35 -0400	[thread overview]
Message-ID: <ZFPOMzR+zWODGcYY@x1n> (raw)
In-Reply-To: <87ttwsp2kx.fsf@secure.mitica>

On Thu, May 04, 2023 at 04:56:46PM +0200, Juan Quintela wrote:
> Peter Xu <peterx@redhat.com> wrote:
> > On Thu, May 04, 2023 at 01:38:32PM +0200, Juan Quintela wrote:
> >> - convince and review code to see that everything is uint64_t.
> >
> > One general question to patches regarding this - what's the major benefit
> > of using uint64_t?
> >
> > It doubles the possible numbers to hold, but it's already 64bits so I don't
> > think it matters a lot.
> 
> We were checking for negatives even when that can't be.
> And we are doing this dance of
> 
> int64_t x, y;
> uint64_t a, b;
> 
> x = a;
> b = y;
> 
> This is always confusing and not always right.

Yeah this is confusing, but if anything can go wrong with this I assume we
could have some bigger problem anyway..

> 
> > The thing is we're removing some code trying to
> > detect negative which seems to be still helpful to detect e.g. overflows
> > (even though I don't think it'll happen).  I just still think it's good to
> > know when overflow happens, and not sure what I missed on benefits of using
> > unsigned here.
> 
> If you grep through the code, you see that half of the things are
> int64_t and the other half is uint64_t.  I find it always confusing.

Right, I'm personally curious whether we should just use int64_t always
unless necessary. :) Another good thing with int64_t is it's also suitable
for error report when used in retvals.

But no strong opinion here, I don't think that's a huge deal for now.
Having such an alignment on types makes sense to me.

Thanks,

-- 
Peter Xu



  reply	other threads:[~2023-05-04 17:39 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-04 11:38 [PATCH 0/9] QEMU file cleanups Juan Quintela
2023-05-04 11:38 ` [PATCH 1/9] migration: max_postcopy_bandwidth is a size parameter Juan Quintela
2023-05-04 16:48   ` Daniel P. Berrangé
2023-05-04 11:38 ` [PATCH 2/9] migration: qemu_file_total_transferred() function is monotonic Juan Quintela
2023-05-04 16:49   ` Daniel P. Berrangé
2023-05-04 11:38 ` [PATCH 3/9] qemu-file: make qemu_file_[sg]et_rate_limit() use an uint64_t Juan Quintela
2023-05-04 16:50   ` Daniel P. Berrangé
2023-05-04 23:59   ` Juan Quintela
2023-05-04 11:38 ` [PATCH 4/9] qemu-file: Make rate_limit_used " Juan Quintela
2023-05-04 16:51   ` Daniel P. Berrangé
2023-05-04 11:38 ` [PATCH 5/9] qemu-file: No need to check for shutdown in qemu_file_rate_limit Juan Quintela
2023-05-04 14:27   ` Peter Xu
2023-05-04 16:51   ` Daniel P. Berrangé
2023-05-04 11:38 ` [PATCH 6/9] qemu-file: remove shutdown member Juan Quintela
2023-05-04 14:27   ` Peter Xu
2023-05-04 16:52   ` Daniel P. Berrangé
2023-05-04 11:38 ` [PATCH 7/9] qemu-file: Make total_transferred an uint64_t Juan Quintela
2023-05-04 16:53   ` Daniel P. Berrangé
2023-05-04 11:38 ` [PATCH 8/9] qemu-file: Make ram_control_save_page() use accessors for rate_limit Juan Quintela
2023-05-04 14:28   ` Peter Xu
2023-05-04 16:53   ` Daniel P. Berrangé
2023-05-04 11:38 ` [PATCH 9/9] qemu-file: Account for rate_limit usage on qemu_fflush() Juan Quintela
2023-05-04 14:43   ` Peter Xu
2023-05-04 14:59     ` Juan Quintela
2023-05-04 16:58   ` Daniel P. Berrangé
2023-05-04 17:22     ` Juan Quintela
2023-05-05  7:19       ` Daniel P. Berrangé
2023-05-05 12:14         ` Juan Quintela
2023-05-04 14:45 ` [PATCH 0/9] QEMU file cleanups Peter Xu
2023-05-04 14:56   ` Juan Quintela
2023-05-04 15:24     ` Peter Xu [this message]
2023-05-04 15:29       ` 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=ZFPOMzR+zWODGcYY@x1n \
    --to=peterx@redhat.com \
    --cc=fam@euphon.net \
    --cc=leobras@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=stefanha@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).