diff mbox

[RFC] odp_init.h: Add odp_terminate_global

Message ID 1413226577-60331-1-git-send-email-mike.holmes@linaro.org
State Rejected
Headers show

Commit Message

Mike Holmes Oct. 13, 2014, 6:56 p.m. UTC
Unit testing replicates a situation similar to an NFV case where the workload
is varied without rebooting the HW.
In this use case there have to be hooks for the application to inform the
implementation that HW needs to be released.

Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
---

This patch is intended to specify the API, the implementation for it will
require a number of other APIs to be created before it is complete.
If accepted the follow on work would require APIs and implementations for

odp_shm_terminate_global
odp_thread_terminate_global
odp_buffer_pool_terminate_global
odp_queue_terminate_global
odp_schedule_terminate_global
odp_pktio_terminate_global
odp_timer_terminate_global
odp_crypto_terminate_global

I propose that initially the odp_terminate_global just return success and the
implementation of the supporting functionality be built up over time.


 platform/linux-generic/include/api/odp_init.h | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

Comments

Maxim Uvarov Oct. 13, 2014, 7:17 p.m. UTC | #1
We have strange naming with that functions. I think
odp_global_init() / odp_global_terminate() is more common naming for 
functions pairs.
Also it tags for that functions will be near.

Best regards,
Maxim.

On 10/13/2014 10:56 PM, Mike Holmes wrote:
> Unit testing replicates a situation similar to an NFV case where the workload
> is varied without rebooting the HW.
> In this use case there have to be hooks for the application to inform the
> implementation that HW needs to be released.
>
> Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
> ---
>
> This patch is intended to specify the API, the implementation for it will
> require a number of other APIs to be created before it is complete.
> If accepted the follow on work would require APIs and implementations for
>
> odp_shm_terminate_global
> odp_thread_terminate_global
> odp_buffer_pool_terminate_global
> odp_queue_terminate_global
> odp_schedule_terminate_global
> odp_pktio_terminate_global
> odp_timer_terminate_global
> odp_crypto_terminate_global
>
> I propose that initially the odp_terminate_global just return success and the
> implementation of the supporting functionality be built up over time.
>
>
>   platform/linux-generic/include/api/odp_init.h | 20 ++++++++++++++++++++
>   1 file changed, 20 insertions(+)
>
> diff --git a/platform/linux-generic/include/api/odp_init.h b/platform/linux-generic/include/api/odp_init.h
> index fab4f6e..f24ff5a 100644
> --- a/platform/linux-generic/include/api/odp_init.h
> +++ b/platform/linux-generic/include/api/odp_init.h
> @@ -48,6 +48,8 @@ typedef struct odp_platform_init_t {
>    *
>    * This function must be called once before calling any other ODP API
>    * functions.
> + * @sa odp_terminate_global()
> + *
>    * @param[in] params Those parameters that are interpreted by the ODP API
>    * @param[in] platform_params Those parameters that are passed without
>    * interpretation by the ODP API to the implementation.
> @@ -56,6 +58,24 @@ typedef struct odp_platform_init_t {
>   int odp_init_global(odp_init_t *params, odp_platform_init_t *platform_params);
>   
>   /**
> + * Terminate ODP session.
> + *
> + * This function is the final ODP call made when terminating
> + * an ODP application in a controlled way. It cannot handle exceptional
> + * circumstances.
> + * In general it calls the API modules terminate functions in the reverse order
> + * to that which the module init functions were called during odp_init_global()
> + *
> + * @warning The unwinding of HW resources to allow them to be re used without reseting
> + * the device is a complex task that the application is expected to coordinate.
> + * This api may have  platform dependant implications.
> + * @sa odp_init_global()
> + *
> + * @return 0 if successful
> + */
> +int odp_terminate_global(void);
> +
> +/**
>    * Perform thread local ODP initialization.
>    *
>    * All threads must call this function before calling
Taras Kondratiuk Oct. 14, 2014, 7:53 a.m. UTC | #2
On 10/13/2014 09:56 PM, Mike Holmes wrote:
> Unit testing replicates a situation similar to an NFV case where the workload
> is varied without rebooting the HW.
> In this use case there have to be hooks for the application to inform the
> implementation that HW needs to be released.

odp_init_global -> odp_term_global ?
What about local termination?

>
> Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
> ---
>
> This patch is intended to specify the API, the implementation for it will
> require a number of other APIs to be created before it is complete.
> If accepted the follow on work would require APIs and implementations for
>
> odp_shm_terminate_global
> odp_thread_terminate_global
> odp_buffer_pool_terminate_global
> odp_queue_terminate_global
> odp_schedule_terminate_global
> odp_pktio_terminate_global
> odp_timer_terminate_global
> odp_crypto_terminate_global

IMO it is an implementation details. Do you want to make them public?
Mike Holmes Oct. 14, 2014, 11:59 a.m. UTC | #3
On 14 October 2014 03:53, Taras Kondratiuk <taras.kondratiuk@linaro.org>
wrote:

> On 10/13/2014 09:56 PM, Mike Holmes wrote:
>
>> Unit testing replicates a situation similar to an NFV case where the
>> workload
>> is varied without rebooting the HW.
>> In this use case there have to be hooks for the application to inform the
>> implementation that HW needs to be released.
>>
>
> odp_init_global -> odp_term_global ?
> What about local termination?


I hoped to tackle them one at a time to define how the API signature should
look, but yes, we need that too.


>
>
>
>> Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
>> ---
>>
>> This patch is intended to specify the API, the implementation for it will
>> require a number of other APIs to be created before it is complete.
>> If accepted the follow on work would require APIs and implementations for
>>
>> odp_shm_terminate_global
>> odp_thread_terminate_global
>> odp_buffer_pool_terminate_global
>> odp_queue_terminate_global
>> odp_schedule_terminate_global
>> odp_pktio_terminate_global
>> odp_timer_terminate_global
>> odp_crypto_terminate_global
>>
>
> IMO it is an implementation details. Do you want to make them public?
>

No, but presumably to actually implement the termination these areas will
need addressing so I wanted to make the scope clear for what had to happen
under the covers.
Mike Holmes Oct. 14, 2014, 7:35 p.m. UTC | #4
odp_init_global -> odp_term_global

This pair work for me, I assume that odp_term_global  takes no arguments,
any things it needs to know are already known as global data in the
implementation.
It should just return success or failure - possibly setting errno ?

Mike

On 14 October 2014 07:59, Mike Holmes <mike.holmes@linaro.org> wrote:

>
>
> On 14 October 2014 03:53, Taras Kondratiuk <taras.kondratiuk@linaro.org>
> wrote:
>
>> On 10/13/2014 09:56 PM, Mike Holmes wrote:
>>
>>> Unit testing replicates a situation similar to an NFV case where the
>>> workload
>>> is varied without rebooting the HW.
>>> In this use case there have to be hooks for the application to inform the
>>> implementation that HW needs to be released.
>>>
>>
>> odp_init_global -> odp_term_global ?
>> What about local termination?
>
>
> I hoped to tackle them one at a time to define how the API signature
> should look, but yes, we need that too.
>
>
>>
>>
>>
>>> Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
>>> ---
>>>
>>> This patch is intended to specify the API, the implementation for it will
>>> require a number of other APIs to be created before it is complete.
>>> If accepted the follow on work would require APIs and implementations for
>>>
>>> odp_shm_terminate_global
>>> odp_thread_terminate_global
>>> odp_buffer_pool_terminate_global
>>> odp_queue_terminate_global
>>> odp_schedule_terminate_global
>>> odp_pktio_terminate_global
>>> odp_timer_terminate_global
>>> odp_crypto_terminate_global
>>>
>>
>> IMO it is an implementation details. Do you want to make them public?
>>
>
> No, but presumably to actually implement the termination these areas will
> need addressing so I wanted to make the scope clear for what had to happen
> under the covers.
>
>
> --
> *Mike Holmes*
> Linaro  Sr Technical Manager
> LNG - ODP
>
diff mbox

Patch

diff --git a/platform/linux-generic/include/api/odp_init.h b/platform/linux-generic/include/api/odp_init.h
index fab4f6e..f24ff5a 100644
--- a/platform/linux-generic/include/api/odp_init.h
+++ b/platform/linux-generic/include/api/odp_init.h
@@ -48,6 +48,8 @@  typedef struct odp_platform_init_t {
  *
  * This function must be called once before calling any other ODP API
  * functions.
+ * @sa odp_terminate_global()
+ *
  * @param[in] params Those parameters that are interpreted by the ODP API
  * @param[in] platform_params Those parameters that are passed without
  * interpretation by the ODP API to the implementation.
@@ -56,6 +58,24 @@  typedef struct odp_platform_init_t {
 int odp_init_global(odp_init_t *params, odp_platform_init_t *platform_params);
 
 /**
+ * Terminate ODP session.
+ *
+ * This function is the final ODP call made when terminating
+ * an ODP application in a controlled way. It cannot handle exceptional
+ * circumstances.
+ * In general it calls the API modules terminate functions in the reverse order
+ * to that which the module init functions were called during odp_init_global()
+ *
+ * @warning The unwinding of HW resources to allow them to be re used without reseting
+ * the device is a complex task that the application is expected to coordinate.
+ * This api may have  platform dependant implications.
+ * @sa odp_init_global()
+ *
+ * @return 0 if successful
+ */
+int odp_terminate_global(void);
+
+/**
  * Perform thread local ODP initialization.
  *
  * All threads must call this function before calling