qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] softmmu: Move dirtylimit.c into the target independent sourc


From: Thomas Huth
Subject: Re: [PATCH] softmmu: Move dirtylimit.c into the target independent source set
Date: Wed, 26 Apr 2023 17:05:14 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0

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 via email to

[Prev in Thread] Current Thread [Next in Thread]