diff mbox

[1/2] linux-generic: odp_cpumask.c: assert on ODP_CPUMASK_SIZE

Message ID 1446128307-9588-1-git-send-email-anders.roxell@linaro.org
State Accepted
Commit 3f20cb3393909ffa71a541841e7f2ba3ac0261fe
Headers show

Commit Message

Anders Roxell Oct. 29, 2015, 2:18 p.m. UTC
The API definition of a CPU mask must not be incompatible with the
platform it is implemented on

Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
---
 platform/linux-generic/odp_cpumask.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Anders Roxell Nov. 5, 2015, 10:08 a.m. UTC | #1
On 2015-10-29 15:18, Anders Roxell wrote:
> The API definition of a CPU mask must not be incompatible with the
> platform it is implemented on
> 
> Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
> ---
>  platform/linux-generic/odp_cpumask.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/platform/linux-generic/odp_cpumask.c b/platform/linux-generic/odp_cpumask.c
> index b31e1ca..5cd6a38 100644
> --- a/platform/linux-generic/odp_cpumask.c
> +++ b/platform/linux-generic/odp_cpumask.c
> @@ -16,6 +16,10 @@
>  #include <stdlib.h>
>  #include <string.h>
>  
> +/** @internal Compile time assert */
> +_ODP_STATIC_ASSERT(CPU_SETSIZE >= ODP_CPUMASK_SIZE,
> +		   "ODP_CPUMASK_SIZE__SIZE_ERROR");
> +
>  void odp_cpumask_from_str(odp_cpumask_t *mask, const char *str_in)
>  {
>  	cpu_set_t cpuset;
> -- 
> 2.1.4
> 

ping
Mike Holmes Nov. 6, 2015, 6:34 p.m. UTC | #2
On 29 October 2015 at 10:18, Anders Roxell <anders.roxell@linaro.org> wrote:

> The API definition of a CPU mask must not be incompatible with the

> platform it is implemented on

>

> Signed-off-by: Anders Roxell <anders.roxell@linaro.org>

>


For the series

I dont think ODP should limit the maximum number of threads, it could be
greater than the number of cores if the application is happy with the
compromise. It should assert if the platform mask can't cope with the API
definition of a mask however

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




> ---

>  platform/linux-generic/odp_cpumask.c | 4 ++++

>  1 file changed, 4 insertions(+)

>

> diff --git a/platform/linux-generic/odp_cpumask.c

> b/platform/linux-generic/odp_cpumask.c

> index b31e1ca..5cd6a38 100644

> --- a/platform/linux-generic/odp_cpumask.c

> +++ b/platform/linux-generic/odp_cpumask.c

> @@ -16,6 +16,10 @@

>  #include <stdlib.h>

>  #include <string.h>

>

> +/** @internal Compile time assert */

> +_ODP_STATIC_ASSERT(CPU_SETSIZE >= ODP_CPUMASK_SIZE,

> +                  "ODP_CPUMASK_SIZE__SIZE_ERROR");

> +

>  void odp_cpumask_from_str(odp_cpumask_t *mask, const char *str_in)

>  {

>         cpu_set_t cpuset;

> --

> 2.1.4

>

> _______________________________________________

> lng-odp mailing list

> lng-odp@lists.linaro.org

> https://lists.linaro.org/mailman/listinfo/lng-odp

>




-- 
Mike Holmes
Technical Manager - Linaro Networking Group
Linaro.org <http://www.linaro.org/> *│ *Open source software for ARM SoCs
Maxim Uvarov Nov. 10, 2015, 11:57 a.m. UTC | #3
Merged,
Maxim.

On 11/06/2015 21:34, Mike Holmes wrote:
>
>
> On 29 October 2015 at 10:18, Anders Roxell <anders.roxell@linaro.org 
> <mailto:anders.roxell@linaro.org>> wrote:
>
>     The API definition of a CPU mask must not be incompatible with the
>     platform it is implemented on
>
>     Signed-off-by: Anders Roxell <anders.roxell@linaro.org
>     <mailto:anders.roxell@linaro.org>>
>
>
> For the series
>
> I dont think ODP should limit the maximum number of threads, it could 
> be greater than the number of cores if the application is happy with 
> the compromise. It should assert if the platform mask can't cope with 
> the API definition of a mask however
>
> Reviewed-by: Mike Holmes <mike.holmes@linaro.org 
> <mailto:mike.holmes@linaro.org>>
>
>     ---
>      platform/linux-generic/odp_cpumask.c | 4 ++++
>      1 file changed, 4 insertions(+)
>
>     diff --git a/platform/linux-generic/odp_cpumask.c
>     b/platform/linux-generic/odp_cpumask.c
>     index b31e1ca..5cd6a38 100644
>     --- a/platform/linux-generic/odp_cpumask.c
>     +++ b/platform/linux-generic/odp_cpumask.c
>     @@ -16,6 +16,10 @@
>      #include <stdlib.h>
>      #include <string.h>
>
>     +/** @internal Compile time assert */
>     +_ODP_STATIC_ASSERT(CPU_SETSIZE >= ODP_CPUMASK_SIZE,
>     +                  "ODP_CPUMASK_SIZE__SIZE_ERROR");
>     +
>      void odp_cpumask_from_str(odp_cpumask_t *mask, const char *str_in)
>      {
>             cpu_set_t cpuset;
>     --
>     2.1.4
>
>     _______________________________________________
>     lng-odp mailing list
>     lng-odp@lists.linaro.org <mailto:lng-odp@lists.linaro.org>
>     https://lists.linaro.org/mailman/listinfo/lng-odp
>
>
>
>
> -- 
> Mike Holmes
> Technical Manager - Linaro Networking Group
> Linaro.org <http://www.linaro.org/>***│ *Open source software for ARM SoCs
>
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
Maxim Uvarov Nov. 10, 2015, 12:20 p.m. UTC | #4
Merged,
Maxim.

On 11/06/2015 21:34, Mike Holmes wrote:
>
>
> On 29 October 2015 at 10:18, Anders Roxell <anders.roxell@linaro.org 
> <mailto:anders.roxell@linaro.org>> wrote:
>
>     The API definition of a CPU mask must not be incompatible with the
>     platform it is implemented on
>
>     Signed-off-by: Anders Roxell <anders.roxell@linaro.org
>     <mailto:anders.roxell@linaro.org>>
>
>
> For the series
>
> I dont think ODP should limit the maximum number of threads, it could 
> be greater than the number of cores if the application is happy with 
> the compromise. It should assert if the platform mask can't cope with 
> the API definition of a mask however
>
> Reviewed-by: Mike Holmes <mike.holmes@linaro.org 
> <mailto:mike.holmes@linaro.org>>
>
>     ---
>      platform/linux-generic/odp_cpumask.c | 4 ++++
>      1 file changed, 4 insertions(+)
>
>     diff --git a/platform/linux-generic/odp_cpumask.c
>     b/platform/linux-generic/odp_cpumask.c
>     index b31e1ca..5cd6a38 100644
>     --- a/platform/linux-generic/odp_cpumask.c
>     +++ b/platform/linux-generic/odp_cpumask.c
>     @@ -16,6 +16,10 @@
>      #include <stdlib.h>
>      #include <string.h>
>
>     +/** @internal Compile time assert */
>     +_ODP_STATIC_ASSERT(CPU_SETSIZE >= ODP_CPUMASK_SIZE,
>     +                  "ODP_CPUMASK_SIZE__SIZE_ERROR");
>     +
>      void odp_cpumask_from_str(odp_cpumask_t *mask, const char *str_in)
>      {
>             cpu_set_t cpuset;
>     --
>     2.1.4
>
>     _______________________________________________
>     lng-odp mailing list
>     lng-odp@lists.linaro.org <mailto:lng-odp@lists.linaro.org>
>     https://lists.linaro.org/mailman/listinfo/lng-odp
>
>
>
>
> -- 
> Mike Holmes
> Technical Manager - Linaro Networking Group
> Linaro.org <http://www.linaro.org/>***│ *Open source software for ARM SoCs
>
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
diff mbox

Patch

diff --git a/platform/linux-generic/odp_cpumask.c b/platform/linux-generic/odp_cpumask.c
index b31e1ca..5cd6a38 100644
--- a/platform/linux-generic/odp_cpumask.c
+++ b/platform/linux-generic/odp_cpumask.c
@@ -16,6 +16,10 @@ 
 #include <stdlib.h>
 #include <string.h>
 
+/** @internal Compile time assert */
+_ODP_STATIC_ASSERT(CPU_SETSIZE >= ODP_CPUMASK_SIZE,
+		   "ODP_CPUMASK_SIZE__SIZE_ERROR");
+
 void odp_cpumask_from_str(odp_cpumask_t *mask, const char *str_in)
 {
 	cpu_set_t cpuset;