From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu-devel@nongnu.org, quintela@redhat.com
Subject: Re: [PATCH 3/6] migration: Clean up signed vs. unsigned XBZRLE cache-size
Date: Fri, 13 Nov 2020 10:40:15 +0000 [thread overview]
Message-ID: <20201113104015.GB3251@work-vm> (raw)
In-Reply-To: <20201113065236.2644169-4-armbru@redhat.com>
* Markus Armbruster (armbru@redhat.com) wrote:
> 73af8dd8d7 "migration: Make xbzrle_cache_size a migration
> parameter" (v2.11.0) made the new parameter unsigned (QAPI type
> 'size', uint64_t in C). It neglected to update existing code, which
> continues to use int64_t.
>
> migrate_xbzrle_cache_size() returns the new parameter. Adjust its
> return type.
>
> QMP query-migrate-cache-size returns migrate_xbzrle_cache_size().
> Adjust its return type.
>
> migrate-set-parameters passes the new parameter to
> xbzrle_cache_resize(). Adjust its parameter type.
>
> xbzrle_cache_resize() passes it on to cache_init(). Adjust its
> parameter type.
>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> ---
> qapi/migration.json | 4 ++--
> migration/migration.h | 2 +-
> migration/page_cache.h | 2 +-
> migration/ram.h | 2 +-
> migration/migration.c | 4 ++--
> migration/page_cache.c | 2 +-
> migration/ram.c | 2 +-
> 7 files changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/qapi/migration.json b/qapi/migration.json
> index 3ad3720cf0..e8a4dfecce 100644
> --- a/qapi/migration.json
> +++ b/qapi/migration.json
> @@ -78,7 +78,7 @@
> # Since: 1.2
> ##
> { 'struct': 'XBZRLECacheStats',
> - 'data': {'cache-size': 'int', 'bytes': 'int', 'pages': 'int',
> + 'data': {'cache-size': 'size', 'bytes': 'int', 'pages': 'int',
> 'cache-miss': 'int', 'cache-miss-rate': 'number',
> 'encoding-rate': 'number', 'overflow': 'int' } }
>
> @@ -1465,7 +1465,7 @@
> # <- { "return": 67108864 }
> #
> ##
> -{ 'command': 'query-migrate-cache-size', 'returns': 'int',
> +{ 'command': 'query-migrate-cache-size', 'returns': 'size',
> 'features': [ 'deprecated' ] }
>
> ##
> diff --git a/migration/migration.h b/migration/migration.h
> index d096b77f74..0387dc40d6 100644
> --- a/migration/migration.h
> +++ b/migration/migration.h
> @@ -324,7 +324,7 @@ int migrate_multifd_zlib_level(void);
> int migrate_multifd_zstd_level(void);
>
> int migrate_use_xbzrle(void);
> -int64_t migrate_xbzrle_cache_size(void);
> +uint64_t migrate_xbzrle_cache_size(void);
> bool migrate_colo_enabled(void);
>
> bool migrate_use_block(void);
> diff --git a/migration/page_cache.h b/migration/page_cache.h
> index 0cb94498a0..8733b4df6e 100644
> --- a/migration/page_cache.h
> +++ b/migration/page_cache.h
> @@ -28,7 +28,7 @@ typedef struct PageCache PageCache;
> * @page_size: cache page size
> * @errp: set *errp if the check failed, with reason
> */
> -PageCache *cache_init(int64_t cache_size, size_t page_size, Error **errp);
> +PageCache *cache_init(uint64_t cache_size, size_t page_size, Error **errp);
> /**
> * cache_fini: free all cache resources
> * @cache pointer to the PageCache struct
> diff --git a/migration/ram.h b/migration/ram.h
> index 011e85414e..016eaa3378 100644
> --- a/migration/ram.h
> +++ b/migration/ram.h
> @@ -47,7 +47,7 @@ bool ramblock_is_ignored(RAMBlock *block);
> INTERNAL_RAMBLOCK_FOREACH(block) \
> if (!qemu_ram_is_migratable(block)) {} else
>
> -int xbzrle_cache_resize(int64_t new_size, Error **errp);
> +int xbzrle_cache_resize(uint64_t new_size, Error **errp);
> uint64_t ram_bytes_remaining(void);
> uint64_t ram_bytes_total(void);
>
> diff --git a/migration/migration.c b/migration/migration.c
> index cad56fbf8c..3daed2da0e 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -2226,7 +2226,7 @@ void qmp_migrate_set_cache_size(int64_t value, Error **errp)
> qmp_migrate_set_parameters(&p, errp);
> }
>
> -int64_t qmp_query_migrate_cache_size(Error **errp)
> +uint64_t qmp_query_migrate_cache_size(Error **errp)
> {
> return migrate_xbzrle_cache_size();
> }
> @@ -2456,7 +2456,7 @@ int migrate_use_xbzrle(void)
> return s->enabled_capabilities[MIGRATION_CAPABILITY_XBZRLE];
> }
>
> -int64_t migrate_xbzrle_cache_size(void)
> +uint64_t migrate_xbzrle_cache_size(void)
> {
> MigrationState *s;
>
> diff --git a/migration/page_cache.c b/migration/page_cache.c
> index 098b436223..b384f265fb 100644
> --- a/migration/page_cache.c
> +++ b/migration/page_cache.c
> @@ -38,7 +38,7 @@ struct PageCache {
> size_t num_items;
> };
>
> -PageCache *cache_init(int64_t new_size, size_t page_size, Error **errp)
> +PageCache *cache_init(uint64_t new_size, size_t page_size, Error **errp)
> {
> int64_t i;
> size_t num_pages = new_size / page_size;
> diff --git a/migration/ram.c b/migration/ram.c
> index add5396a62..a84425d04f 100644
> --- a/migration/ram.c
> +++ b/migration/ram.c
> @@ -126,7 +126,7 @@ static void XBZRLE_cache_unlock(void)
> * @new_size: new cache size
> * @errp: set *errp if the check failed, with reason
> */
> -int xbzrle_cache_resize(int64_t new_size, Error **errp)
> +int xbzrle_cache_resize(uint64_t new_size, Error **errp)
> {
> PageCache *new_cache;
> int64_t ret = 0;
> --
> 2.26.2
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
next prev parent reply other threads:[~2020-11-13 10:41 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-13 6:52 [PATCH 0/6] migration: Fixes and cleanups aroung migrate-set-parameters Markus Armbruster
2020-11-13 6:52 ` [PATCH 1/6] migration: Fix and clean up around @tls-authz Markus Armbruster
2020-11-13 11:56 ` Dr. David Alan Gilbert
2020-12-10 17:35 ` Dr. David Alan Gilbert
2020-12-10 18:10 ` Daniel P. Berrangé
2020-12-14 10:14 ` Markus Armbruster
2020-12-16 10:55 ` Daniel P. Berrangé
2020-12-17 13:07 ` Markus Armbruster
2020-12-17 14:04 ` Daniel P. Berrangé
2021-01-27 16:01 ` Markus Armbruster
2020-11-13 6:52 ` [PATCH 2/6] migration: Fix migrate-set-parameters argument validation Markus Armbruster
2020-11-13 11:49 ` Dr. David Alan Gilbert
2020-11-13 13:24 ` Markus Armbruster
2020-11-13 6:52 ` [PATCH 3/6] migration: Clean up signed vs. unsigned XBZRLE cache-size Markus Armbruster
2020-11-13 10:40 ` Dr. David Alan Gilbert [this message]
2020-11-13 6:52 ` [PATCH 4/6] migration: Check xbzrle-cache-size more carefully Markus Armbruster
2020-11-13 10:59 ` Dr. David Alan Gilbert
2020-11-13 13:35 ` Markus Armbruster
2020-11-13 16:39 ` Dr. David Alan Gilbert
2020-11-16 7:00 ` Markus Armbruster
2020-11-13 6:52 ` [PATCH 5/6] migration: Fix cache_init()'s "Failed to allocate" error messages Markus Armbruster
2020-11-13 11:01 ` Dr. David Alan Gilbert
2020-11-13 6:52 ` [PATCH 6/6] migration: Fix a few absurdly defective " Markus Armbruster
2020-11-13 11:27 ` Dr. David Alan Gilbert
2020-11-13 11:56 ` [PATCH 0/6] migration: Fixes and cleanups aroung migrate-set-parameters Dr. David Alan Gilbert
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=20201113104015.GB3251@work-vm \
--to=dgilbert@redhat.com \
--cc=armbru@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@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).