diff mbox series

[v2,4/6] eal: update rte_eal_wait_lcore definition

Message ID 20210909231312.2572006-5-honnappa.nagarahalli@arm.com
State New
Headers show
Series Use correct memory ordering in eal functions | expand

Commit Message

Honnappa Nagarahalli Sept. 9, 2021, 11:13 p.m. UTC
Since the FINISHED state is removed, the API rte_eal_wait_lcore
is updated to always return the status of the last function that
ran in the worker core.

Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>

Reviewed-by: Feifei Wang <feifei.wang@arm.com>

---
 lib/eal/common/eal_common_launch.c |  6 ++----
 lib/eal/include/rte_launch.h       | 12 +++++-------
 2 files changed, 7 insertions(+), 11 deletions(-)

-- 
2.25.1

Comments

Honnappa Nagarahalli Sept. 9, 2021, 11:37 p.m. UTC | #1
+ Techboard.

This is the API (not ABI as I mentioned) compatibility breakage that I mentioned during the last Techboard meeting.

The removal of the FINISHED state itself was announced. This is a change related to that. However, the specific API change was not called out in the deprecation notice.


> -----Original Message-----

> From: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>

> Sent: Thursday, September 9, 2021 6:13 PM

> To: dev@dpdk.org; Honnappa Nagarahalli

> <Honnappa.Nagarahalli@arm.com>; konstantin.ananyev@intel.com;

> david.marchand@redhat.com; Feifei Wang <Feifei.Wang2@arm.com>

> Cc: Ruifeng Wang <Ruifeng.Wang@arm.com>; nd <nd@arm.com>; Feifei

> Wang (Arm Technology China) <Feifei.Wang@arm.com>

> Subject: [PATCH v2 4/6] eal: update rte_eal_wait_lcore definition

> 

> Since the FINISHED state is removed, the API rte_eal_wait_lcore is updated to

> always return the status of the last function that ran in the worker core.

> 

> Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>

> Reviewed-by: Feifei Wang <feifei.wang@arm.com>

> ---

>  lib/eal/common/eal_common_launch.c |  6 ++----

>  lib/eal/include/rte_launch.h       | 12 +++++-------

>  2 files changed, 7 insertions(+), 11 deletions(-)

> 

> diff --git a/lib/eal/common/eal_common_launch.c

> b/lib/eal/common/eal_common_launch.c

> index 78fd940267..4bc842417a 100644

> --- a/lib/eal/common/eal_common_launch.c

> +++ b/lib/eal/common/eal_common_launch.c

> @@ -23,10 +23,8 @@

>  int

>  rte_eal_wait_lcore(unsigned worker_id)

>  {

> -	if (lcore_config[worker_id].state == WAIT)

> -		return 0;

> -

> -	while (lcore_config[worker_id].state != WAIT)

> +	while (__atomic_load_n(&lcore_config[worker_id].state,

> +					__ATOMIC_ACQUIRE) != WAIT)

>  		rte_pause();

> 

>  	rte_rmb();

> diff --git a/lib/eal/include/rte_launch.h b/lib/eal/include/rte_launch.h index

> ed0bb4762a..f2d386e6e2 100644

> --- a/lib/eal/include/rte_launch.h

> +++ b/lib/eal/include/rte_launch.h

> @@ -119,18 +119,16 @@ enum rte_lcore_state_t

> rte_eal_get_lcore_state(unsigned int worker_id);

>   *

>   * To be executed on the MAIN lcore only.

>   *

> - * If the worker lcore identified by the worker_id is in a FINISHED state,

> - * switch to the WAIT state. If the lcore is in RUNNING state, wait until

> - * the lcore finishes its job and moves to the FINISHED state.

> + * If the lcore identified by the worker_id is in RUNNING state, wait

> + until

> + * the lcore finishes its job and moves to the WAIT state.

>   *

>   * @param worker_id

>   *   The identifier of the lcore.

>   * @return

> - *   - 0: If the lcore identified by the worker_id is in a WAIT state.

> + *   - 0: If the remote launch function was never called on the lcore

> + *     identified by the worker_id.

>   *   - The value that was returned by the previous remote launch

> - *     function call if the lcore identified by the worker_id was in a

> - *     FINISHED or RUNNING state. In this case, it changes the state

> - *     of the lcore to WAIT.

> + *     function call.

>   */

>  int rte_eal_wait_lcore(unsigned worker_id);

> 

> --

> 2.25.1
diff mbox series

Patch

diff --git a/lib/eal/common/eal_common_launch.c b/lib/eal/common/eal_common_launch.c
index 78fd940267..4bc842417a 100644
--- a/lib/eal/common/eal_common_launch.c
+++ b/lib/eal/common/eal_common_launch.c
@@ -23,10 +23,8 @@ 
 int
 rte_eal_wait_lcore(unsigned worker_id)
 {
-	if (lcore_config[worker_id].state == WAIT)
-		return 0;
-
-	while (lcore_config[worker_id].state != WAIT)
+	while (__atomic_load_n(&lcore_config[worker_id].state,
+					__ATOMIC_ACQUIRE) != WAIT)
 		rte_pause();
 
 	rte_rmb();
diff --git a/lib/eal/include/rte_launch.h b/lib/eal/include/rte_launch.h
index ed0bb4762a..f2d386e6e2 100644
--- a/lib/eal/include/rte_launch.h
+++ b/lib/eal/include/rte_launch.h
@@ -119,18 +119,16 @@  enum rte_lcore_state_t rte_eal_get_lcore_state(unsigned int worker_id);
  *
  * To be executed on the MAIN lcore only.
  *
- * If the worker lcore identified by the worker_id is in a FINISHED state,
- * switch to the WAIT state. If the lcore is in RUNNING state, wait until
- * the lcore finishes its job and moves to the FINISHED state.
+ * If the lcore identified by the worker_id is in RUNNING state, wait until
+ * the lcore finishes its job and moves to the WAIT state.
  *
  * @param worker_id
  *   The identifier of the lcore.
  * @return
- *   - 0: If the lcore identified by the worker_id is in a WAIT state.
+ *   - 0: If the remote launch function was never called on the lcore
+ *     identified by the worker_id.
  *   - The value that was returned by the previous remote launch
- *     function call if the lcore identified by the worker_id was in a
- *     FINISHED or RUNNING state. In this case, it changes the state
- *     of the lcore to WAIT.
+ *     function call.
  */
 int rte_eal_wait_lcore(unsigned worker_id);