From: Markus Armbruster <armbru@redhat.com>
To: John Snow <jsnow@redhat.com>
Cc: qemu-block@nongnu.org, vsementsov@virtuozzo.com, famz@redhat.com,
qemu-devel@nongnu.org, mreitz@redhat.com
Subject: Re: [Qemu-devel] [PATCH v10 07/10] hbitmap: serialization
Date: Fri, 25 Nov 2016 15:59:17 +0100 [thread overview]
Message-ID: <87vavba9mi.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <1476395910-8697-8-git-send-email-jsnow@redhat.com> (John Snow's message of "Thu, 13 Oct 2016 17:58:27 -0400")
John Snow <jsnow@redhat.com> writes:
> From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
>
> Functions to serialize / deserialize(restore) HBitmap. HBitmap should be
> saved to linear sequence of bits independently of endianness and bitmap
> array element (unsigned long) size. Therefore Little Endian is chosen.
>
> These functions are appropriate for dirty bitmap migration, restoring
> the bitmap in several steps is available. To save performance, every
> step writes only the last level of the bitmap. All other levels are
> restored by hbitmap_deserialize_finish() as a last step of restoring.
> So, HBitmap is inconsistent while restoring.
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> [Fix left shift operand to 1UL; add "finish" parameter. - Fam]
> Signed-off-by: Fam Zheng <famz@redhat.com>
>
> Signed-off-by: John Snow <jsnow@redhat.com>
[...]
> diff --git a/util/hbitmap.c b/util/hbitmap.c
> index f303975..5d1a21c 100644
> --- a/util/hbitmap.c
> +++ b/util/hbitmap.c
> @@ -397,6 +397,143 @@ bool hbitmap_get(const HBitmap *hb, uint64_t item)
> return (hb->levels[HBITMAP_LEVELS - 1][pos >> BITS_PER_LEVEL] & bit) != 0;
> }
>
> +uint64_t hbitmap_serialization_granularity(const HBitmap *hb)
> +{
> + /* Require at least 64 bit granularity to be safe on both 64 bit and 32 bit
> + * hosts. */
> + return 64 << hb->granularity;
> +}
Coverity reports:
*** CID 1365378: Integer handling issues (OVERFLOW_BEFORE_WIDEN)
/util/hbitmap.c: 404 in hbitmap_serialization_granularity()
398 }
399
400 uint64_t hbitmap_serialization_granularity(const HBitmap *hb)
401 {
402 /* Require at least 64 bit granularity to be safe on both 64 bit and 32 bit
403 * hosts. */
>>> CID 1365378: Integer handling issues (OVERFLOW_BEFORE_WIDEN)
>>> Potentially overflowing expression "0x40 << hb->granularity" with type "int" (32 bits, signed) is evaluated using 32-bit arithmetic, and then used in a context that expects an expression of type "uint64_t" (64 bits, unsigned).
404 return 64 << hb->granularity;
405 }
406
407 /* Start should be aligned to serialization granularity, chunk size should be
408 * aligned to serialization granularity too, except for last chunk.
409 */
Use (uint64_t)64 << hb->granularity for an unsigned 64 bit shift.
[...]
next prev parent reply other threads:[~2016-11-25 14:59 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-13 21:58 [Qemu-devel] [PATCH v10 00/10] Dirty bitmap changes for migration/persistence work John Snow
2016-10-13 21:58 ` [Qemu-devel] [PATCH v10 01/10] block: Hide HBitmap in block dirty bitmap interface John Snow
2016-10-13 21:58 ` [Qemu-devel] [PATCH v10 02/10] HBitmap: Introduce "meta" bitmap to track bit changes John Snow
2016-10-13 21:58 ` [Qemu-devel] [PATCH v10 03/10] tests: Add test code for meta bitmap John Snow
2016-10-13 21:58 ` [Qemu-devel] [PATCH v10 04/10] block: Support meta dirty bitmap John Snow
2016-10-13 21:58 ` [Qemu-devel] [PATCH v10 05/10] block: Add two dirty bitmap getters John Snow
2016-10-13 21:58 ` [Qemu-devel] [PATCH v10 06/10] block: Assert that bdrv_release_dirty_bitmap succeeded John Snow
2016-10-13 21:58 ` [Qemu-devel] [PATCH v10 07/10] hbitmap: serialization John Snow
2016-11-25 14:59 ` Markus Armbruster [this message]
2016-11-28 16:10 ` John Snow
2016-10-13 21:58 ` [Qemu-devel] [PATCH v10 08/10] block: BdrvDirtyBitmap serialization interface John Snow
2016-10-13 21:58 ` [Qemu-devel] [PATCH v10 09/10] tests: Add test code for hbitmap serialization John Snow
2016-10-13 21:58 ` [Qemu-devel] [PATCH v10 10/10] block: More operations for meta dirty bitmap John Snow
2016-10-17 18:56 ` [Qemu-devel] [PATCH v10 00/10] Dirty bitmap changes for migration/persistence work Max Reitz
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=87vavba9mi.fsf@dusky.pond.sub.org \
--to=armbru@redhat.com \
--cc=famz@redhat.com \
--cc=jsnow@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=vsementsov@virtuozzo.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 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.