qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: Richard Henderson <richard.henderson@linaro.org>, qemu-devel@nongnu.org
Cc: "Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Hyman Huang" <huangy81@chinatelecom.cn>,
	"Peter Xu" <peterx@redhat.com>,
	"Markus Armbruster" <armbru@redhat.com>
Subject: Re: [PATCH] softmmu: Move dirtylimit.c into the target independent source set
Date: Wed, 26 Apr 2023 17:05:14 +0200	[thread overview]
Message-ID: <0b417bc6-8f49-54c6-1d23-9884ce45b792@redhat.com> (raw)
In-Reply-To: <8177194c-853e-de0b-fe06-0ae82bbc127f@linaro.org>

On 13/04/2023 12.31, Richard Henderson wrote:
> On 4/13/23 07:45, Thomas Huth wrote:
>>       uint32_t dirty_ring_size = kvm_dirty_ring_size();
>>       uint64_t dirty_ring_size_meory_MB =
>> -        dirty_ring_size * TARGET_PAGE_SIZE >> 20;
>> +        dirty_ring_size * qemu_target_page_size() >> 20;
> 
> Existing problem, the types here are suspicious: dirty_ring_size is 
> uint32_t, dirty_ring_size_meory (typo) is uint64_t.
> 
> I wonder if this is better computed as
> 
>      uint32_t dirty_ring_size_MB = dirty_ring_size >> (20 - 
> qemu_target_page_bits());

qemu_target_page_size() returns a "size_t", so I think it should be fine for 
64-bit hosts. But for 32-bit hosts, this looks error prone, indeed, so I 
think your suggestion is a good idea. Care to send a patch?

  Thomas



  reply	other threads:[~2023-04-26 15:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-13  5:45 [PATCH] softmmu: Move dirtylimit.c into the target independent source set Thomas Huth
2023-04-13 10:31 ` Richard Henderson
2023-04-26 15:05   ` Thomas Huth [this message]
2023-04-13 13:02 ` Fabiano Rosas

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=0b417bc6-8f49-54c6-1d23-9884ce45b792@redhat.com \
    --to=thuth@redhat.com \
    --cc=armbru@redhat.com \
    --cc=huangy81@chinatelecom.cn \
    --cc=peterx@redhat.com \
    --cc=philmd@linaro.org \
    --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 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).