diff mbox series

[ovs-dev,v2] treewide: Remove uses of ATOMIC_VAR_INIT.

Message ID 20230313152848.44667-1-dceara@redhat.com
State Accepted
Headers show
Series [ovs-dev,v2] treewide: Remove uses of ATOMIC_VAR_INIT. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_ovn-kubernetes success github build: passed
ovsrobot/github-robot-_Build_and_Test fail github build: failed

Commit Message

Dumitru Ceara March 13, 2023, 3:28 p.m. UTC
ATOMIC_VAR_INIT has been removed in OVS since
https://github.com/openvswitch/ovs/commit/71ca8393b700 because it has a
trivial definition and was deprecated (to be removed) in newer
standards.

Stop using it in OVN too.

Reported-at: https://github.com/ovn-org/ovn/actions/runs/4394882419/jobs/7696233921#step:13:3361
Signed-off-by: Dumitru Ceara <dceara@redhat.com>
---
V2:
- Addressed Ilya's comments:
  - use atomic_init() for (re)initialization of atomic variables.
---
 lib/ovn-parallel-hmap.c | 4 ++--
 northd/northd.c         | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

Comments

Ilya Maximets March 13, 2023, 8:14 p.m. UTC | #1
On 3/13/23 16:28, Dumitru Ceara wrote:
> ATOMIC_VAR_INIT has been removed in OVS since
> https://github.com/openvswitch/ovs/commit/71ca8393b700 because it has a
> trivial definition and was deprecated (to be removed) in newer
> standards.
> 
> Stop using it in OVN too.
> 
> Reported-at: https://github.com/ovn-org/ovn/actions/runs/4394882419/jobs/7696233921#step:13:3361
> Signed-off-by: Dumitru Ceara <dceara@redhat.com>
> ---
> V2:
> - Addressed Ilya's comments:
>   - use atomic_init() for (re)initialization of atomic variables.
> ---
>  lib/ovn-parallel-hmap.c | 4 ++--
>  northd/northd.c         | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)

Thanks!  I didn't test, but LGTM.

Acked-by: Ilya Maximets <i.maximets@ovn.org>

> 
> diff --git a/lib/ovn-parallel-hmap.c b/lib/ovn-parallel-hmap.c
> index 828e5a0e2f..a0ba681a1e 100644
> --- a/lib/ovn-parallel-hmap.c
> +++ b/lib/ovn-parallel-hmap.c
> @@ -41,7 +41,7 @@ VLOG_DEFINE_THIS_MODULE(ovn_parallel_hmap);
>  #define WORKER_SEM_NAME "%x-%p-%"PRIxSIZE
>  #define MAIN_SEM_NAME "%x-%p-main"
>  
> -static atomic_bool initial_pool_setup = ATOMIC_VAR_INIT(false);
> +static atomic_bool initial_pool_setup = false;
>  
>  /* This is set only in the process of exit and the set is
>   * accompanied by a fence. It does not need to be atomic or be
> @@ -156,7 +156,7 @@ init_controls(struct worker_pool *pool)
>          new_control->pool = pool;
>          new_control->worker = 0;
>          ovs_mutex_init(&new_control->mutex);
> -        new_control->finished = ATOMIC_VAR_INIT(false);
> +        atomic_init(&new_control->finished, false);
>          sprintf(sem_name, WORKER_SEM_NAME, sembase, pool, i);
>          new_control->fire = sem_open(sem_name, O_CREAT, S_IRWXU, 0);
>          if (new_control->fire == SEM_FAILED) {
> diff --git a/northd/northd.c b/northd/northd.c
> index fda02c3240..5f0b436c20 100644
> --- a/northd/northd.c
> +++ b/northd/northd.c
> @@ -1069,8 +1069,8 @@ init_mcast_flow_count(struct ovn_datapath *od)
>      }
>  
>      struct mcast_switch_info *mcast_sw_info = &od->mcast_info.sw;
> -    mcast_sw_info->active_v4_flows = ATOMIC_VAR_INIT(0);
> -    mcast_sw_info->active_v6_flows = ATOMIC_VAR_INIT(0);
> +    atomic_init(&mcast_sw_info->active_v4_flows, 0);
> +    atomic_init(&mcast_sw_info->active_v6_flows, 0);
>  }
>  
>  static void
Dumitru Ceara March 16, 2023, 10:29 a.m. UTC | #2
On 3/13/23 21:14, Ilya Maximets wrote:
> On 3/13/23 16:28, Dumitru Ceara wrote:
>> ATOMIC_VAR_INIT has been removed in OVS since
>> https://github.com/openvswitch/ovs/commit/71ca8393b700 because it has a
>> trivial definition and was deprecated (to be removed) in newer
>> standards.
>>
>> Stop using it in OVN too.
>>
>> Reported-at: https://github.com/ovn-org/ovn/actions/runs/4394882419/jobs/7696233921#step:13:3361
>> Signed-off-by: Dumitru Ceara <dceara@redhat.com>
>> ---
>> V2:
>> - Addressed Ilya's comments:
>>   - use atomic_init() for (re)initialization of atomic variables.
>> ---
>>  lib/ovn-parallel-hmap.c | 4 ++--
>>  northd/northd.c         | 4 ++--
>>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> Thanks!  I didn't test, but LGTM.
> 
> Acked-by: Ilya Maximets <i.maximets@ovn.org>
> 

Thanks!  I applied this to the main branch.
diff mbox series

Patch

diff --git a/lib/ovn-parallel-hmap.c b/lib/ovn-parallel-hmap.c
index 828e5a0e2f..a0ba681a1e 100644
--- a/lib/ovn-parallel-hmap.c
+++ b/lib/ovn-parallel-hmap.c
@@ -41,7 +41,7 @@  VLOG_DEFINE_THIS_MODULE(ovn_parallel_hmap);
 #define WORKER_SEM_NAME "%x-%p-%"PRIxSIZE
 #define MAIN_SEM_NAME "%x-%p-main"
 
-static atomic_bool initial_pool_setup = ATOMIC_VAR_INIT(false);
+static atomic_bool initial_pool_setup = false;
 
 /* This is set only in the process of exit and the set is
  * accompanied by a fence. It does not need to be atomic or be
@@ -156,7 +156,7 @@  init_controls(struct worker_pool *pool)
         new_control->pool = pool;
         new_control->worker = 0;
         ovs_mutex_init(&new_control->mutex);
-        new_control->finished = ATOMIC_VAR_INIT(false);
+        atomic_init(&new_control->finished, false);
         sprintf(sem_name, WORKER_SEM_NAME, sembase, pool, i);
         new_control->fire = sem_open(sem_name, O_CREAT, S_IRWXU, 0);
         if (new_control->fire == SEM_FAILED) {
diff --git a/northd/northd.c b/northd/northd.c
index fda02c3240..5f0b436c20 100644
--- a/northd/northd.c
+++ b/northd/northd.c
@@ -1069,8 +1069,8 @@  init_mcast_flow_count(struct ovn_datapath *od)
     }
 
     struct mcast_switch_info *mcast_sw_info = &od->mcast_info.sw;
-    mcast_sw_info->active_v4_flows = ATOMIC_VAR_INIT(0);
-    mcast_sw_info->active_v6_flows = ATOMIC_VAR_INIT(0);
+    atomic_init(&mcast_sw_info->active_v4_flows, 0);
+    atomic_init(&mcast_sw_info->active_v6_flows, 0);
 }
 
 static void