diff mbox

[v2,1/4] api: cpu: Added cpu.h

Message ID 1422961167-2307-1-git-send-email-petri.savolainen@linaro.org
State New
Headers show

Commit Message

Petri Savolainen Feb. 3, 2015, 10:59 a.m. UTC
This file contains cpu related API calls. The calls are
renames from odp_thread_cpu() and odp_sys_cpu_count().

Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>
---
 include/odp.h                            |  1 +
 include/odp/api/cpu.h                    | 54 ++++++++++++++++++++++++++++++++
 platform/linux-generic/Makefile.am       |  2 ++
 platform/linux-generic/include/odp/cpu.h | 26 +++++++++++++++
 4 files changed, 83 insertions(+)
 create mode 100644 include/odp/api/cpu.h
 create mode 100644 platform/linux-generic/include/odp/cpu.h

Comments

Ola Liljedahl Feb. 3, 2015, 11:07 a.m. UTC | #1
On 3 February 2015 at 11:59, Petri Savolainen
<petri.savolainen@linaro.org> wrote:
> This file contains cpu related API calls. The calls are
> renames from odp_thread_cpu() and odp_sys_cpu_count().
>
> Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>
> ---
>  include/odp.h                            |  1 +
>  include/odp/api/cpu.h                    | 54 ++++++++++++++++++++++++++++++++
>  platform/linux-generic/Makefile.am       |  2 ++
>  platform/linux-generic/include/odp/cpu.h | 26 +++++++++++++++
>  4 files changed, 83 insertions(+)
>  create mode 100644 include/odp/api/cpu.h
>  create mode 100644 platform/linux-generic/include/odp/cpu.h
>
> diff --git a/include/odp.h b/include/odp.h
> index 30bed8e..99e01eb 100644
> --- a/include/odp.h
> +++ b/include/odp.h
> @@ -27,6 +27,7 @@ extern "C" {
>  #include <odp/hints.h>
>  #include <odp/debug.h>
>  #include <odp/byteorder.h>
> +#include <odp/cpu.h>
>  #include <odp/cpumask.h>
>  #include <odp/barrier.h>
>  #include <odp/spinlock.h>
> diff --git a/include/odp/api/cpu.h b/include/odp/api/cpu.h
> new file mode 100644
> index 0000000..16461a3
> --- /dev/null
> +++ b/include/odp/api/cpu.h
> @@ -0,0 +1,54 @@
> +/* Copyright (c) 2015, Linaro Limited
> + * All rights reserved.
> + *
> + * SPDX-License-Identifier:     BSD-3-Clause
> + */
> +
> +
> +/**
> + * @file
> + *
> + * ODP CPU API
> + */
> +
> +#ifndef ODP_CPU_H_
> +#define ODP_CPU_H_
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +/** @defgroup odp_cpu ODP CPU
> + *  @{
> + */
> +
> +
> +/**
> + * CPU number
> + *
> + * CPU number where the thread is currently running. CPU numbering is system
> + * specific.
> + *
> + * @return CPU number
> + */
> +int odp_cpu(void);
Why not call thus function odp_cpu_num()? (or odp_cpu_number)?
"odp_cpu" is missing something and does not lead to direct
understanding of what the function does or returns.


> +
> +/**
> + * CPU count
> + *
> + * Report the number of CPU's available to this ODP program.
> + * This may be smaller than the number of (online) CPU's in the system.
> + *
> + * @return Number of available CPU's
> + */
> +int odp_cpu_count(void);
> +
> +/**
> + * @}
> + */
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif
> diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am
> index addb5ec..0e62650 100644
> --- a/platform/linux-generic/Makefile.am
> +++ b/platform/linux-generic/Makefile.am
> @@ -18,6 +18,7 @@ odpinclude_HEADERS = \
>                   $(top_srcdir)/platform/linux-generic/include/odp/classification.h \
>                   $(top_srcdir)/platform/linux-generic/include/odp/compiler.h \
>                   $(top_srcdir)/platform/linux-generic/include/odp/config.h \
> +                 $(top_srcdir)/platform/linux-generic/include/odp/cpu.h \
>                   $(top_srcdir)/platform/linux-generic/include/odp/cpumask.h \
>                   $(top_srcdir)/platform/linux-generic/include/odp/crypto.h \
>                   $(top_srcdir)/platform/linux-generic/include/odp/debug.h \
> @@ -69,6 +70,7 @@ odpapiinclude_HEADERS = \
>                   $(top_srcdir)/include/odp/api/classification.h \
>                   $(top_srcdir)/include/odp/api/compiler.h \
>                   $(top_srcdir)/include/odp/api/config.h \
> +                 $(top_srcdir)/include/odp/api/cpu.h \
>                   $(top_srcdir)/include/odp/api/cpumask.h \
>                   $(top_srcdir)/include/odp/api/crypto.h \
>                   $(top_srcdir)/include/odp/api/debug.h \
> diff --git a/platform/linux-generic/include/odp/cpu.h b/platform/linux-generic/include/odp/cpu.h
> new file mode 100644
> index 0000000..b5b5320
> --- /dev/null
> +++ b/platform/linux-generic/include/odp/cpu.h
> @@ -0,0 +1,26 @@
> +/* Copyright (c) 2015, Linaro Limited
> + * All rights reserved.
> + *
> + * SPDX-License-Identifier:     BSD-3-Clause
> + */
> +
> +/**
> + * @file
> + *
> + * ODP CPU
> + */
> +
> +#ifndef ODP_PLAT_CPU_H_
> +#define ODP_PLAT_CPU_H_
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#include <odp/api/cpu.h>
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif
> --
> 2.2.2
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
Taras Kondratiuk Feb. 3, 2015, 11:19 a.m. UTC | #2
On 02/03/2015 01:07 PM, Ola Liljedahl wrote:
> On 3 February 2015 at 11:59, Petri Savolainen
> <petri.savolainen@linaro.org> wrote:
>> This file contains cpu related API calls. The calls are
>> renames from odp_thread_cpu() and odp_sys_cpu_count().
>>
>> Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>
>> ---
>>   include/odp.h                            |  1 +
>>   include/odp/api/cpu.h                    | 54 ++++++++++++++++++++++++++++++++
>>   platform/linux-generic/Makefile.am       |  2 ++
>>   platform/linux-generic/include/odp/cpu.h | 26 +++++++++++++++
>>   4 files changed, 83 insertions(+)
>>   create mode 100644 include/odp/api/cpu.h
>>   create mode 100644 platform/linux-generic/include/odp/cpu.h
>>
>> diff --git a/include/odp.h b/include/odp.h
>> index 30bed8e..99e01eb 100644
>> --- a/include/odp.h
>> +++ b/include/odp.h
>> @@ -27,6 +27,7 @@ extern "C" {
>>   #include <odp/hints.h>
>>   #include <odp/debug.h>
>>   #include <odp/byteorder.h>
>> +#include <odp/cpu.h>
>>   #include <odp/cpumask.h>
>>   #include <odp/barrier.h>
>>   #include <odp/spinlock.h>
>> diff --git a/include/odp/api/cpu.h b/include/odp/api/cpu.h
>> new file mode 100644
>> index 0000000..16461a3
>> --- /dev/null
>> +++ b/include/odp/api/cpu.h
>> @@ -0,0 +1,54 @@
>> +/* Copyright (c) 2015, Linaro Limited
>> + * All rights reserved.
>> + *
>> + * SPDX-License-Identifier:     BSD-3-Clause
>> + */
>> +
>> +
>> +/**
>> + * @file
>> + *
>> + * ODP CPU API
>> + */
>> +
>> +#ifndef ODP_CPU_H_
>> +#define ODP_CPU_H_
>> +
>> +#ifdef __cplusplus
>> +extern "C" {
>> +#endif
>> +
>> +/** @defgroup odp_cpu ODP CPU
>> + *  @{
>> + */
>> +
>> +
>> +/**
>> + * CPU number
>> + *
>> + * CPU number where the thread is currently running. CPU numbering is system
>> + * specific.
>> + *
>> + * @return CPU number
>> + */
>> +int odp_cpu(void);
> Why not call thus function odp_cpu_num()? (or odp_cpu_number)?
> "odp_cpu" is missing something and does not lead to direct
> understanding of what the function does or returns.

I become odp_cpu_id() in the second patch.
Why not to name it like this in the first patch?
Bill Fischofer Feb. 3, 2015, 5:16 p.m. UTC | #3
For this series:

Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>

On Tue, Feb 3, 2015 at 5:25 AM, Savolainen, Petri (NSN - FI/Espoo) <
petri.savolainen@nsn.com> wrote:

>
>
> > -----Original Message-----
> > From: ext Taras Kondratiuk [mailto:taras.kondratiuk@linaro.org]
> > Sent: Tuesday, February 03, 2015 1:19 PM
> > To: Ola Liljedahl; Petri Savolainen
> > Cc: LNG ODP Mailman List
> > Subject: Re: [lng-odp] [PATCH v2 1/4] api: cpu: Added cpu.h
> >
> > On 02/03/2015 01:07 PM, Ola Liljedahl wrote:
> > > On 3 February 2015 at 11:59, Petri Savolainen
> > > <petri.savolainen@linaro.org> wrote:
> > >> This file contains cpu related API calls. The calls are
> > >> renames from odp_thread_cpu() and odp_sys_cpu_count().
> > >>
> > >> Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>
> > >> ---
> > >>   include/odp.h                            |  1 +
> > >>   include/odp/api/cpu.h                    | 54
> > ++++++++++++++++++++++++++++++++
> > >>   platform/linux-generic/Makefile.am       |  2 ++
> > >>   platform/linux-generic/include/odp/cpu.h | 26 +++++++++++++++
> > >>   4 files changed, 83 insertions(+)
> > >>   create mode 100644 include/odp/api/cpu.h
> > >>   create mode 100644 platform/linux-generic/include/odp/cpu.h
> > >>
> > >> diff --git a/include/odp.h b/include/odp.h
> > >> index 30bed8e..99e01eb 100644
> > >> --- a/include/odp.h
> > >> +++ b/include/odp.h
> > >> @@ -27,6 +27,7 @@ extern "C" {
> > >>   #include <odp/hints.h>
> > >>   #include <odp/debug.h>
> > >>   #include <odp/byteorder.h>
> > >> +#include <odp/cpu.h>
> > >>   #include <odp/cpumask.h>
> > >>   #include <odp/barrier.h>
> > >>   #include <odp/spinlock.h>
> > >> diff --git a/include/odp/api/cpu.h b/include/odp/api/cpu.h
> > >> new file mode 100644
> > >> index 0000000..16461a3
> > >> --- /dev/null
> > >> +++ b/include/odp/api/cpu.h
> > >> @@ -0,0 +1,54 @@
> > >> +/* Copyright (c) 2015, Linaro Limited
> > >> + * All rights reserved.
> > >> + *
> > >> + * SPDX-License-Identifier:     BSD-3-Clause
> > >> + */
> > >> +
> > >> +
> > >> +/**
> > >> + * @file
> > >> + *
> > >> + * ODP CPU API
> > >> + */
> > >> +
> > >> +#ifndef ODP_CPU_H_
> > >> +#define ODP_CPU_H_
> > >> +
> > >> +#ifdef __cplusplus
> > >> +extern "C" {
> > >> +#endif
> > >> +
> > >> +/** @defgroup odp_cpu ODP CPU
> > >> + *  @{
> > >> + */
> > >> +
> > >> +
> > >> +/**
> > >> + * CPU number
> > >> + *
> > >> + * CPU number where the thread is currently running. CPU numbering is
> > system
> > >> + * specific.
> > >> + *
> > >> + * @return CPU number
> > >> + */
> > >> +int odp_cpu(void);
> > > Why not call thus function odp_cpu_num()? (or odp_cpu_number)?
> > > "odp_cpu" is missing something and does not lead to direct
> > > understanding of what the function does or returns.
> >
> > I become odp_cpu_id() in the second patch.
> > Why not to name it like this in the first patch?
>
> I rebased the second commit (should have rebased the first). The commit
> history is not perfect, but I think we can live with that.
>
> -Petri
>
>
>
>
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>
Anders Roxell Feb. 3, 2015, 9:54 p.m. UTC | #4
On 2015-02-03 11:16, Bill Fischofer wrote:
> For this series:
> 
> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>
> 
> On Tue, Feb 3, 2015 at 5:25 AM, Savolainen, Petri (NSN - FI/Espoo) <
> petri.savolainen@nsn.com> wrote:
> 
> >
> >

[...]

> > > >> + *
> > > >> + * CPU number where the thread is currently running. CPU numbering is
> > > system
> > > >> + * specific.
> > > >> + *
> > > >> + * @return CPU number
> > > >> + */
> > > >> +int odp_cpu(void);
> > > > Why not call thus function odp_cpu_num()? (or odp_cpu_number)?
> > > > "odp_cpu" is missing something and does not lead to direct
> > > > understanding of what the function does or returns.
> > >
> > > I become odp_cpu_id() in the second patch.
> > > Why not to name it like this in the first patch?
> >
> > I rebased the second commit (should have rebased the first). The commit
> > history is not perfect, but I think we can live with that.

Why do we think this is good enough when others have to redo their
patches?

Cheers,
Anders
Bill Fischofer Feb. 3, 2015, 10:10 p.m. UTC | #5
My review simply says I'm happy with it.  Others can NAK it if they choose.

On Tue, Feb 3, 2015 at 3:54 PM, Anders Roxell <anders.roxell@linaro.org>
wrote:

> On 2015-02-03 11:16, Bill Fischofer wrote:
> > For this series:
> >
> > Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>
> >
> > On Tue, Feb 3, 2015 at 5:25 AM, Savolainen, Petri (NSN - FI/Espoo) <
> > petri.savolainen@nsn.com> wrote:
> >
> > >
> > >
>
> [...]
>
> > > > >> + *
> > > > >> + * CPU number where the thread is currently running. CPU
> numbering is
> > > > system
> > > > >> + * specific.
> > > > >> + *
> > > > >> + * @return CPU number
> > > > >> + */
> > > > >> +int odp_cpu(void);
> > > > > Why not call thus function odp_cpu_num()? (or odp_cpu_number)?
> > > > > "odp_cpu" is missing something and does not lead to direct
> > > > > understanding of what the function does or returns.
> > > >
> > > > I become odp_cpu_id() in the second patch.
> > > > Why not to name it like this in the first patch?
> > >
> > > I rebased the second commit (should have rebased the first). The commit
> > > history is not perfect, but I think we can live with that.
>
> Why do we think this is good enough when others have to redo their
> patches?
>
> Cheers,
> Anders
>
Mike Holmes Feb. 3, 2015, 10:59 p.m. UTC | #6
On 3 February 2015 at 17:10, Bill Fischofer <bill.fischofer@linaro.org>
wrote:

> My review simply says I'm happy with it.  Others can NAK it if they choose.
>
> On Tue, Feb 3, 2015 at 3:54 PM, Anders Roxell <anders.roxell@linaro.org>
> wrote:
>
>> On 2015-02-03 11:16, Bill Fischofer wrote:
>> > For this series:
>> >
>> > Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>
>> >
>> > On Tue, Feb 3, 2015 at 5:25 AM, Savolainen, Petri (NSN - FI/Espoo) <
>> > petri.savolainen@nsn.com> wrote:
>> >
>> > >
>> > >
>>
>> [...]
>>
>> > > > >> + *
>> > > > >> + * CPU number where the thread is currently running. CPU
>> numbering is
>> > > > system
>> > > > >> + * specific.
>> > > > >> + *
>> > > > >> + * @return CPU number
>> > > > >> + */
>> > > > >> +int odp_cpu(void);
>> > > > > Why not call thus function odp_cpu_num()? (or odp_cpu_number)?
>> > > > > "odp_cpu" is missing something and does not lead to direct
>> > > > > understanding of what the function does or returns.
>> > > >
>> > > > I become odp_cpu_id() in the second patch.
>> > > > Why not to name it like this in the first patch?
>> > >
>> > > I rebased the second commit (should have rebased the first). The
>> commit
>> > > history is not perfect, but I think we can live with that.
>>
>> Why do we think this is good enough when others have to redo their
>> patches?
>>
>
nack: I don't think it is ok to accept something when we know it is
incorrect.



>
>> Cheers,
>> Anders
>>
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>
>
diff mbox

Patch

diff --git a/include/odp.h b/include/odp.h
index 30bed8e..99e01eb 100644
--- a/include/odp.h
+++ b/include/odp.h
@@ -27,6 +27,7 @@  extern "C" {
 #include <odp/hints.h>
 #include <odp/debug.h>
 #include <odp/byteorder.h>
+#include <odp/cpu.h>
 #include <odp/cpumask.h>
 #include <odp/barrier.h>
 #include <odp/spinlock.h>
diff --git a/include/odp/api/cpu.h b/include/odp/api/cpu.h
new file mode 100644
index 0000000..16461a3
--- /dev/null
+++ b/include/odp/api/cpu.h
@@ -0,0 +1,54 @@ 
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+
+/**
+ * @file
+ *
+ * ODP CPU API
+ */
+
+#ifndef ODP_CPU_H_
+#define ODP_CPU_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @defgroup odp_cpu ODP CPU
+ *  @{
+ */
+
+
+/**
+ * CPU number
+ *
+ * CPU number where the thread is currently running. CPU numbering is system
+ * specific.
+ *
+ * @return CPU number
+ */
+int odp_cpu(void);
+
+/**
+ * CPU count
+ *
+ * Report the number of CPU's available to this ODP program.
+ * This may be smaller than the number of (online) CPU's in the system.
+ *
+ * @return Number of available CPU's
+ */
+int odp_cpu_count(void);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am
index addb5ec..0e62650 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -18,6 +18,7 @@  odpinclude_HEADERS = \
 		  $(top_srcdir)/platform/linux-generic/include/odp/classification.h \
 		  $(top_srcdir)/platform/linux-generic/include/odp/compiler.h \
 		  $(top_srcdir)/platform/linux-generic/include/odp/config.h \
+		  $(top_srcdir)/platform/linux-generic/include/odp/cpu.h \
 		  $(top_srcdir)/platform/linux-generic/include/odp/cpumask.h \
 		  $(top_srcdir)/platform/linux-generic/include/odp/crypto.h \
 		  $(top_srcdir)/platform/linux-generic/include/odp/debug.h \
@@ -69,6 +70,7 @@  odpapiinclude_HEADERS = \
 		  $(top_srcdir)/include/odp/api/classification.h \
 		  $(top_srcdir)/include/odp/api/compiler.h \
 		  $(top_srcdir)/include/odp/api/config.h \
+		  $(top_srcdir)/include/odp/api/cpu.h \
 		  $(top_srcdir)/include/odp/api/cpumask.h \
 		  $(top_srcdir)/include/odp/api/crypto.h \
 		  $(top_srcdir)/include/odp/api/debug.h \
diff --git a/platform/linux-generic/include/odp/cpu.h b/platform/linux-generic/include/odp/cpu.h
new file mode 100644
index 0000000..b5b5320
--- /dev/null
+++ b/platform/linux-generic/include/odp/cpu.h
@@ -0,0 +1,26 @@ 
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * ODP CPU
+ */
+
+#ifndef ODP_PLAT_CPU_H_
+#define ODP_PLAT_CPU_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <odp/api/cpu.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif