[PATCH] postcopy-ram: do not use qatomic_mb_read

Paolo Bonzini posted 1 patch 1 year ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20230406101612.241872-1-pbonzini@redhat.com
Maintainers: Juan Quintela <quintela@redhat.com>, "Dr. David Alan Gilbert" <dgilbert@redhat.com>
migration/postcopy-ram.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] postcopy-ram: do not use qatomic_mb_read
Posted by Paolo Bonzini 1 year ago
It does not even pair with a qatomic_mb_set(), so it is clearer to use
load-acquire in this case; they are synonyms.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 migration/postcopy-ram.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c
index 41c07136501a..23befd5ca8a2 100644
--- a/migration/postcopy-ram.c
+++ b/migration/postcopy-ram.c
@@ -1495,7 +1495,7 @@ static PostcopyState incoming_postcopy_state;
 
 PostcopyState  postcopy_state_get(void)
 {
-    return qatomic_mb_read(&incoming_postcopy_state);
+    return qatomic_load_acquire(&incoming_postcopy_state);
 }
 
 /* Set the state and return the old state */
-- 
2.39.2
Re: [PATCH] postcopy-ram: do not use qatomic_mb_read
Posted by Juan Quintela 1 year ago
Paolo Bonzini <pbonzini@redhat.com> wrote:
> It does not even pair with a qatomic_mb_set(), so it is clearer to use
> load-acquire in this case; they are synonyms.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Juan Quintela <quintela@redhat.com>

queued on my tree.

I guess this is for 8.1, right?

Later, Juan.

> ---
>  migration/postcopy-ram.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c
> index 41c07136501a..23befd5ca8a2 100644
> --- a/migration/postcopy-ram.c
> +++ b/migration/postcopy-ram.c
> @@ -1495,7 +1495,7 @@ static PostcopyState incoming_postcopy_state;
>  
>  PostcopyState  postcopy_state_get(void)
>  {
> -    return qatomic_mb_read(&incoming_postcopy_state);
> +    return qatomic_load_acquire(&incoming_postcopy_state);
>  }
>  
>  /* Set the state and return the old state */