diff mbox

move odph_pause inside linux-generic

Message ID 1444124187-3686-1-git-send-email-maxim.uvarov@linaro.org
State New
Headers show

Commit Message

Maxim Uvarov Oct. 6, 2015, 9:36 a.m. UTC
Move odph_pause inside linux-generic. Validation test is also useless
with such move.

Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
---
 helper/Makefile.am                                         |  4 +---
 helper/ring.c                                              |  2 +-
 helper/test/Makefile.am                                    |  4 +---
 helper/test/odph_pause.c                                   | 14 --------------
 platform/linux-generic/Makefile.am                         |  1 +
 .../linux-generic/include/odp_pause_internal.h             |  4 ++--
 6 files changed, 6 insertions(+), 23 deletions(-)
 delete mode 100644 helper/test/odph_pause.c
 rename helper/odph_pause.h => platform/linux-generic/include/odp_pause_internal.h (93%)

Comments

Savolainen, Petri (Nokia - FI/Espoo) Oct. 7, 2015, 8:09 a.m. UTC | #1
I was actually planning to move odp_pause() to be proper API call.

-Petri

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

> From: lng-odp [mailto:lng-odp-bounces@lists.linaro.org] On Behalf Of EXT

> Maxim Uvarov

> Sent: Tuesday, October 06, 2015 12:36 PM

> To: lng-odp@lists.linaro.org

> Subject: [lng-odp] [PATCH] move odph_pause inside linux-generic

> 

> Move odph_pause inside linux-generic. Validation test is also useless

> with such move.

> 

> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>

> ---

>  helper/Makefile.am                                         |  4 +---

>  helper/ring.c                                              |  2 +-

>  helper/test/Makefile.am                                    |  4 +---

>  helper/test/odph_pause.c                                   | 14 ----------

> ----

>  platform/linux-generic/Makefile.am                         |  1 +

>  .../linux-generic/include/odp_pause_internal.h             |  4 ++--

>  6 files changed, 6 insertions(+), 23 deletions(-)

>  delete mode 100644 helper/test/odph_pause.c

>  rename helper/odph_pause.h => platform/linux-

> generic/include/odp_pause_internal.h (93%)

> 

> diff --git a/helper/Makefile.am b/helper/Makefile.am

> index 1a74e8e..cde8af2 100644

> --- a/helper/Makefile.am

> +++ b/helper/Makefile.am

> @@ -19,9 +19,7 @@ helperinclude_HEADERS = \

>  		  $(srcdir)/include/odp/helper/tcp.h\

>  		  $(srcdir)/include/odp/helper/udp.h

> 

> -noinst_HEADERS = \

> -		 $(srcdir)/odph_debug.h \

> -		 $(srcdir)/odph_pause.h

> +noinst_HEADERS = $(srcdir)/odph_debug.h

> 

>  __LIB__libodphelper_la_SOURCES = \

>  					linux.c \

> diff --git a/helper/ring.c b/helper/ring.c

> index 844abf7..6bb2bda 100644

> --- a/helper/ring.c

> +++ b/helper/ring.c

> @@ -71,7 +71,7 @@

> 

>  #include <odp/shared_memory.h>

>  #include <odp/spinlock.h>

> -#include "odph_pause.h"

> +#include "odp_pause_internal.h"

>  #include <odp/align.h>

>  #include <fcntl.h>

>  #include <stdio.h>

> diff --git a/helper/test/Makefile.am b/helper/test/Makefile.am

> index fbf5a9b..7b73602 100644

> --- a/helper/test/Makefile.am

> +++ b/helper/test/Makefile.am

> @@ -7,8 +7,7 @@ TESTS_ENVIRONMENT += TEST_DIR=${builddir}

> 

>  EXECUTABLES = odp_chksum$(EXEEXT) \

>                odp_thread$(EXEEXT) \

> -              odp_process$(EXEEXT)\

> -              odph_pause$(EXEEXT)

> +              odp_process$(EXEEXT)

> 

>  COMPILE_ONLY =

> 

> @@ -28,4 +27,3 @@ dist_odp_thread_SOURCES = odp_thread.c

>  odp_thread_LDADD = $(LIB)/libodphelper.la $(LIB)/libodp.la

>  dist_odp_process_SOURCES = odp_process.c

>  odp_process_LDADD = $(LIB)/libodphelper.la $(LIB)/libodp.la

> -odph_pause_SOURCES = odph_pause.c

> diff --git a/helper/test/odph_pause.c b/helper/test/odph_pause.c

> deleted file mode 100644

> index f5f5da3..0000000

> --- a/helper/test/odph_pause.c

> +++ /dev/null

> @@ -1,14 +0,0 @@

> -/* Copyright (c) 2015, Linaro Limited

> - * All rights reserved.

> - *

> - * SPDX-License-Identifier:     BSD-3-Clause

> - */

> -

> -#include <test_debug.h>

> -#include "../odph_pause.h"

> -

> -int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED)

> -{

> -	odph_pause();

> -	return 0;

> -}

> diff --git a/platform/linux-generic/Makefile.am b/platform/linux-

> generic/Makefile.am

> index 4c79730..b9ed3b0 100644

> --- a/platform/linux-generic/Makefile.am

> +++ b/platform/linux-generic/Makefile.am

> @@ -128,6 +128,7 @@ noinst_HEADERS = \

>  		  ${srcdir}/include/odp_packet_io_internal.h \

>  		  ${srcdir}/include/odp_packet_io_queue.h \

>  		  ${srcdir}/include/odp_packet_socket.h \

> +		  ${srcdir}/include/odp_pause_internal.h \

>  		  ${srcdir}/include/odp_pool_internal.h \

>  		  ${srcdir}/include/odp_queue_internal.h \

>  		  ${srcdir}/include/odp_schedule_internal.h \

> diff --git a/helper/odph_pause.h b/platform/linux-

> generic/include/odp_pause_internal.h

> similarity index 93%

> rename from helper/odph_pause.h

> rename to platform/linux-generic/include/odp_pause_internal.h

> index 5618f1f..ad2c628 100644

> --- a/helper/odph_pause.h

> +++ b/platform/linux-generic/include/odp_pause_internal.h

> @@ -4,8 +4,8 @@

>   * SPDX-License-Identifier:     BSD-3-Clause

>   */

> 

> -#ifndef ODPH_PAUSE_H_

> -#define ODPH_PAUSE_H_

> +#ifndef ODP_PAUSE_INTERNAL_H_

> +#define ODP_PAUSE_INTERNAL_H_

> 

>  #ifdef __cplusplus

>  extern "C" {

> --

> 1.9.1

> 

> _______________________________________________

> lng-odp mailing list

> lng-odp@lists.linaro.org

> https://lists.linaro.org/mailman/listinfo/lng-odp
Maxim Uvarov Oct. 7, 2015, 9:26 a.m. UTC | #2
On 10/07/15 11:09, Savolainen, Petri (Nokia - FI/Espoo) wrote:
> I was actually planning to move odp_pause() to be proper API call.
>
> -Petri
Ok, if it's needed I don't object.

Maxim.

>> -----Original Message-----
>> From: lng-odp [mailto:lng-odp-bounces@lists.linaro.org] On Behalf Of EXT
>> Maxim Uvarov
>> Sent: Tuesday, October 06, 2015 12:36 PM
>> To: lng-odp@lists.linaro.org
>> Subject: [lng-odp] [PATCH] move odph_pause inside linux-generic
>>
>> Move odph_pause inside linux-generic. Validation test is also useless
>> with such move.
>>
>> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
>> ---
>>   helper/Makefile.am                                         |  4 +---
>>   helper/ring.c                                              |  2 +-
>>   helper/test/Makefile.am                                    |  4 +---
>>   helper/test/odph_pause.c                                   | 14 ----------
>> ----
>>   platform/linux-generic/Makefile.am                         |  1 +
>>   .../linux-generic/include/odp_pause_internal.h             |  4 ++--
>>   6 files changed, 6 insertions(+), 23 deletions(-)
>>   delete mode 100644 helper/test/odph_pause.c
>>   rename helper/odph_pause.h => platform/linux-
>> generic/include/odp_pause_internal.h (93%)
>>
>> diff --git a/helper/Makefile.am b/helper/Makefile.am
>> index 1a74e8e..cde8af2 100644
>> --- a/helper/Makefile.am
>> +++ b/helper/Makefile.am
>> @@ -19,9 +19,7 @@ helperinclude_HEADERS = \
>>   		  $(srcdir)/include/odp/helper/tcp.h\
>>   		  $(srcdir)/include/odp/helper/udp.h
>>
>> -noinst_HEADERS = \
>> -		 $(srcdir)/odph_debug.h \
>> -		 $(srcdir)/odph_pause.h
>> +noinst_HEADERS = $(srcdir)/odph_debug.h
>>
>>   __LIB__libodphelper_la_SOURCES = \
>>   					linux.c \
>> diff --git a/helper/ring.c b/helper/ring.c
>> index 844abf7..6bb2bda 100644
>> --- a/helper/ring.c
>> +++ b/helper/ring.c
>> @@ -71,7 +71,7 @@
>>
>>   #include <odp/shared_memory.h>
>>   #include <odp/spinlock.h>
>> -#include "odph_pause.h"
>> +#include "odp_pause_internal.h"
>>   #include <odp/align.h>
>>   #include <fcntl.h>
>>   #include <stdio.h>
>> diff --git a/helper/test/Makefile.am b/helper/test/Makefile.am
>> index fbf5a9b..7b73602 100644
>> --- a/helper/test/Makefile.am
>> +++ b/helper/test/Makefile.am
>> @@ -7,8 +7,7 @@ TESTS_ENVIRONMENT += TEST_DIR=${builddir}
>>
>>   EXECUTABLES = odp_chksum$(EXEEXT) \
>>                 odp_thread$(EXEEXT) \
>> -              odp_process$(EXEEXT)\
>> -              odph_pause$(EXEEXT)
>> +              odp_process$(EXEEXT)
>>
>>   COMPILE_ONLY =
>>
>> @@ -28,4 +27,3 @@ dist_odp_thread_SOURCES = odp_thread.c
>>   odp_thread_LDADD = $(LIB)/libodphelper.la $(LIB)/libodp.la
>>   dist_odp_process_SOURCES = odp_process.c
>>   odp_process_LDADD = $(LIB)/libodphelper.la $(LIB)/libodp.la
>> -odph_pause_SOURCES = odph_pause.c
>> diff --git a/helper/test/odph_pause.c b/helper/test/odph_pause.c
>> deleted file mode 100644
>> index f5f5da3..0000000
>> --- a/helper/test/odph_pause.c
>> +++ /dev/null
>> @@ -1,14 +0,0 @@
>> -/* Copyright (c) 2015, Linaro Limited
>> - * All rights reserved.
>> - *
>> - * SPDX-License-Identifier:     BSD-3-Clause
>> - */
>> -
>> -#include <test_debug.h>
>> -#include "../odph_pause.h"
>> -
>> -int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED)
>> -{
>> -	odph_pause();
>> -	return 0;
>> -}
>> diff --git a/platform/linux-generic/Makefile.am b/platform/linux-
>> generic/Makefile.am
>> index 4c79730..b9ed3b0 100644
>> --- a/platform/linux-generic/Makefile.am
>> +++ b/platform/linux-generic/Makefile.am
>> @@ -128,6 +128,7 @@ noinst_HEADERS = \
>>   		  ${srcdir}/include/odp_packet_io_internal.h \
>>   		  ${srcdir}/include/odp_packet_io_queue.h \
>>   		  ${srcdir}/include/odp_packet_socket.h \
>> +		  ${srcdir}/include/odp_pause_internal.h \
>>   		  ${srcdir}/include/odp_pool_internal.h \
>>   		  ${srcdir}/include/odp_queue_internal.h \
>>   		  ${srcdir}/include/odp_schedule_internal.h \
>> diff --git a/helper/odph_pause.h b/platform/linux-
>> generic/include/odp_pause_internal.h
>> similarity index 93%
>> rename from helper/odph_pause.h
>> rename to platform/linux-generic/include/odp_pause_internal.h
>> index 5618f1f..ad2c628 100644
>> --- a/helper/odph_pause.h
>> +++ b/platform/linux-generic/include/odp_pause_internal.h
>> @@ -4,8 +4,8 @@
>>    * SPDX-License-Identifier:     BSD-3-Clause
>>    */
>>
>> -#ifndef ODPH_PAUSE_H_
>> -#define ODPH_PAUSE_H_
>> +#ifndef ODP_PAUSE_INTERNAL_H_
>> +#define ODP_PAUSE_INTERNAL_H_
>>
>>   #ifdef __cplusplus
>>   extern "C" {
>> --
>> 1.9.1
>>
>> _______________________________________________
>> lng-odp mailing list
>> lng-odp@lists.linaro.org
>> https://lists.linaro.org/mailman/listinfo/lng-odp
Ola Liljedahl Oct. 7, 2015, 11:38 a.m. UTC | #3
On 7 October 2015 at 10:09, Savolainen, Petri (Nokia - FI/Espoo) <
petri.savolainen@nokia.com> wrote:

> I was actually planning to move odp_pause() to be proper API call.
>
What is the use case for such a public API call? Where would an application
use this call?

I think situations where you need something like pause are platform and
architecture specific. E.g. when implementing (spin) locks on ARMv8, you
wouldn't necessarily use pause while spinning, you could use WFE (wait for
event) instead in order not to busy wait. (There are trade-offs between
scalability and overhead in contented/uncontended situations though).



> -Petri
>
> > -----Original Message-----
> > From: lng-odp [mailto:lng-odp-bounces@lists.linaro.org] On Behalf Of EXT
> > Maxim Uvarov
> > Sent: Tuesday, October 06, 2015 12:36 PM
> > To: lng-odp@lists.linaro.org
> > Subject: [lng-odp] [PATCH] move odph_pause inside linux-generic
> >
> > Move odph_pause inside linux-generic. Validation test is also useless
> > with such move.
> >
> > Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
> > ---
> >  helper/Makefile.am                                         |  4 +---
> >  helper/ring.c                                              |  2 +-
> >  helper/test/Makefile.am                                    |  4 +---
> >  helper/test/odph_pause.c                                   | 14
> ----------
> > ----
> >  platform/linux-generic/Makefile.am                         |  1 +
> >  .../linux-generic/include/odp_pause_internal.h             |  4 ++--
> >  6 files changed, 6 insertions(+), 23 deletions(-)
> >  delete mode 100644 helper/test/odph_pause.c
> >  rename helper/odph_pause.h => platform/linux-
> > generic/include/odp_pause_internal.h (93%)
> >
> > diff --git a/helper/Makefile.am b/helper/Makefile.am
> > index 1a74e8e..cde8af2 100644
> > --- a/helper/Makefile.am
> > +++ b/helper/Makefile.am
> > @@ -19,9 +19,7 @@ helperinclude_HEADERS = \
> >                 $(srcdir)/include/odp/helper/tcp.h\
> >                 $(srcdir)/include/odp/helper/udp.h
> >
> > -noinst_HEADERS = \
> > -              $(srcdir)/odph_debug.h \
> > -              $(srcdir)/odph_pause.h
> > +noinst_HEADERS = $(srcdir)/odph_debug.h
> >
> >  __LIB__libodphelper_la_SOURCES = \
> >                                       linux.c \
> > diff --git a/helper/ring.c b/helper/ring.c
> > index 844abf7..6bb2bda 100644
> > --- a/helper/ring.c
> > +++ b/helper/ring.c
> > @@ -71,7 +71,7 @@
> >
> >  #include <odp/shared_memory.h>
> >  #include <odp/spinlock.h>
> > -#include "odph_pause.h"
> > +#include "odp_pause_internal.h"
> >  #include <odp/align.h>
> >  #include <fcntl.h>
> >  #include <stdio.h>
> > diff --git a/helper/test/Makefile.am b/helper/test/Makefile.am
> > index fbf5a9b..7b73602 100644
> > --- a/helper/test/Makefile.am
> > +++ b/helper/test/Makefile.am
> > @@ -7,8 +7,7 @@ TESTS_ENVIRONMENT += TEST_DIR=${builddir}
> >
> >  EXECUTABLES = odp_chksum$(EXEEXT) \
> >                odp_thread$(EXEEXT) \
> > -              odp_process$(EXEEXT)\
> > -              odph_pause$(EXEEXT)
> > +              odp_process$(EXEEXT)
> >
> >  COMPILE_ONLY =
> >
> > @@ -28,4 +27,3 @@ dist_odp_thread_SOURCES = odp_thread.c
> >  odp_thread_LDADD = $(LIB)/libodphelper.la $(LIB)/libodp.la
> >  dist_odp_process_SOURCES = odp_process.c
> >  odp_process_LDADD = $(LIB)/libodphelper.la $(LIB)/libodp.la
> > -odph_pause_SOURCES = odph_pause.c
> > diff --git a/helper/test/odph_pause.c b/helper/test/odph_pause.c
> > deleted file mode 100644
> > index f5f5da3..0000000
> > --- a/helper/test/odph_pause.c
> > +++ /dev/null
> > @@ -1,14 +0,0 @@
> > -/* Copyright (c) 2015, Linaro Limited
> > - * All rights reserved.
> > - *
> > - * SPDX-License-Identifier:     BSD-3-Clause
> > - */
> > -
> > -#include <test_debug.h>
> > -#include "../odph_pause.h"
> > -
> > -int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED)
> > -{
> > -     odph_pause();
> > -     return 0;
> > -}
> > diff --git a/platform/linux-generic/Makefile.am b/platform/linux-
> > generic/Makefile.am
> > index 4c79730..b9ed3b0 100644
> > --- a/platform/linux-generic/Makefile.am
> > +++ b/platform/linux-generic/Makefile.am
> > @@ -128,6 +128,7 @@ noinst_HEADERS = \
> >                 ${srcdir}/include/odp_packet_io_internal.h \
> >                 ${srcdir}/include/odp_packet_io_queue.h \
> >                 ${srcdir}/include/odp_packet_socket.h \
> > +               ${srcdir}/include/odp_pause_internal.h \
> >                 ${srcdir}/include/odp_pool_internal.h \
> >                 ${srcdir}/include/odp_queue_internal.h \
> >                 ${srcdir}/include/odp_schedule_internal.h \
> > diff --git a/helper/odph_pause.h b/platform/linux-
> > generic/include/odp_pause_internal.h
> > similarity index 93%
> > rename from helper/odph_pause.h
> > rename to platform/linux-generic/include/odp_pause_internal.h
> > index 5618f1f..ad2c628 100644
> > --- a/helper/odph_pause.h
> > +++ b/platform/linux-generic/include/odp_pause_internal.h
> > @@ -4,8 +4,8 @@
> >   * SPDX-License-Identifier:     BSD-3-Clause
> >   */
> >
> > -#ifndef ODPH_PAUSE_H_
> > -#define ODPH_PAUSE_H_
> > +#ifndef ODP_PAUSE_INTERNAL_H_
> > +#define ODP_PAUSE_INTERNAL_H_
> >
> >  #ifdef __cplusplus
> >  extern "C" {
> > --
> > 1.9.1
> >
> > _______________________________________________
> > lng-odp mailing list
> > lng-odp@lists.linaro.org
> > https://lists.linaro.org/mailman/listinfo/lng-odp
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
>
Savolainen, Petri (Nokia - FI/Espoo) Oct. 7, 2015, 12:32 p.m. UTC | #4
From: EXT Ola Liljedahl [mailto:ola.liljedahl@linaro.org]

Sent: Wednesday, October 07, 2015 2:38 PM
To: Savolainen, Petri (Nokia - FI/Espoo)
Cc: EXT Maxim Uvarov; lng-odp@lists.linaro.org
Subject: Re: [lng-odp] [PATCH] move odph_pause inside linux-generic

On 7 October 2015 at 10:09, Savolainen, Petri (Nokia - FI/Espoo) <petri.savolainen@nokia.com<mailto:petri.savolainen@nokia.com>> wrote:
I was actually planning to move odp_pause() to be proper API call.
What is the use case for such a public API call? Where would an application use this call?

Yes, application could use it while spinning on something.

I think situations where you need something like pause are platform and architecture specific. E.g. when implementing (spin) locks on ARMv8, you wouldn't necessarily use pause while spinning, you could use WFE (wait for event) instead in order not to busy wait. (There are trade-offs between scalability and overhead in contented/uncontended situations though).

Yes, I’d expect an ARM implementation to use WFE to implement odp_pause().

-Petri



-Petri

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

> From: lng-odp [mailto:lng-odp-bounces@lists.linaro.org<mailto:lng-odp-bounces@lists.linaro.org>] On Behalf Of EXT

> Maxim Uvarov

> Sent: Tuesday, October 06, 2015 12:36 PM

> To: lng-odp@lists.linaro.org<mailto:lng-odp@lists.linaro.org>

> Subject: [lng-odp] [PATCH] move odph_pause inside linux-generic

>

> Move odph_pause inside linux-generic. Validation test is also useless

> with such move.

>

> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org<mailto:maxim.uvarov@linaro.org>>

> ---

>  helper/Makefile.am                                         |  4 +---

>  helper/ring.c                                              |  2 +-

>  helper/test/Makefile.am                                    |  4 +---

>  helper/test/odph_pause.c                                   | 14 ----------

> ----

>  platform/linux-generic/Makefile.am                         |  1 +

>  .../linux-generic/include/odp_pause_internal.h             |  4 ++--

>  6 files changed, 6 insertions(+), 23 deletions(-)

>  delete mode 100644 helper/test/odph_pause.c

>  rename helper/odph_pause.h => platform/linux-

> generic/include/odp_pause_internal.h (93%)

>

> diff --git a/helper/Makefile.am b/helper/Makefile.am

> index 1a74e8e..cde8af2 100644

> --- a/helper/Makefile.am

> +++ b/helper/Makefile.am

> @@ -19,9 +19,7 @@ helperinclude_HEADERS = \

>                 $(srcdir)/include/odp/helper/tcp.h\

>                 $(srcdir)/include/odp/helper/udp.h

>

> -noinst_HEADERS = \

> -              $(srcdir)/odph_debug.h \

> -              $(srcdir)/odph_pause.h

> +noinst_HEADERS = $(srcdir)/odph_debug.h

>

>  __LIB__libodphelper_la_SOURCES = \

>                                       linux.c \

> diff --git a/helper/ring.c b/helper/ring.c

> index 844abf7..6bb2bda 100644

> --- a/helper/ring.c

> +++ b/helper/ring.c

> @@ -71,7 +71,7 @@

>

>  #include <odp/shared_memory.h>

>  #include <odp/spinlock.h>

> -#include "odph_pause.h"

> +#include "odp_pause_internal.h"

>  #include <odp/align.h>

>  #include <fcntl.h>

>  #include <stdio.h>

> diff --git a/helper/test/Makefile.am b/helper/test/Makefile.am

> index fbf5a9b..7b73602 100644

> --- a/helper/test/Makefile.am

> +++ b/helper/test/Makefile.am

> @@ -7,8 +7,7 @@ TESTS_ENVIRONMENT += TEST_DIR=${builddir}

>

>  EXECUTABLES = odp_chksum$(EXEEXT) \

>                odp_thread$(EXEEXT) \

> -              odp_process$(EXEEXT)\

> -              odph_pause$(EXEEXT)

> +              odp_process$(EXEEXT)

>

>  COMPILE_ONLY =

>

> @@ -28,4 +27,3 @@ dist_odp_thread_SOURCES = odp_thread.c

>  odp_thread_LDADD = $(LIB)/libodphelper.la<http://libodphelper.la> $(LIB)/libodp.la<http://libodp.la>

>  dist_odp_process_SOURCES = odp_process.c

>  odp_process_LDADD = $(LIB)/libodphelper.la<http://libodphelper.la> $(LIB)/libodp.la<http://libodp.la>

> -odph_pause_SOURCES = odph_pause.c

> diff --git a/helper/test/odph_pause.c b/helper/test/odph_pause.c

> deleted file mode 100644

> index f5f5da3..0000000

> --- a/helper/test/odph_pause.c

> +++ /dev/null

> @@ -1,14 +0,0 @@

> -/* Copyright (c) 2015, Linaro Limited

> - * All rights reserved.

> - *

> - * SPDX-License-Identifier:     BSD-3-Clause

> - */

> -

> -#include <test_debug.h>

> -#include "../odph_pause.h"

> -

> -int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED)

> -{

> -     odph_pause();

> -     return 0;

> -}

> diff --git a/platform/linux-generic/Makefile.am b/platform/linux-

> generic/Makefile.am

> index 4c79730..b9ed3b0 100644

> --- a/platform/linux-generic/Makefile.am

> +++ b/platform/linux-generic/Makefile.am

> @@ -128,6 +128,7 @@ noinst_HEADERS = \

>                 ${srcdir}/include/odp_packet_io_internal.h \

>                 ${srcdir}/include/odp_packet_io_queue.h \

>                 ${srcdir}/include/odp_packet_socket.h \

> +               ${srcdir}/include/odp_pause_internal.h \

>                 ${srcdir}/include/odp_pool_internal.h \

>                 ${srcdir}/include/odp_queue_internal.h \

>                 ${srcdir}/include/odp_schedule_internal.h \

> diff --git a/helper/odph_pause.h b/platform/linux-

> generic/include/odp_pause_internal.h

> similarity index 93%

> rename from helper/odph_pause.h

> rename to platform/linux-generic/include/odp_pause_internal.h

> index 5618f1f..ad2c628 100644

> --- a/helper/odph_pause.h

> +++ b/platform/linux-generic/include/odp_pause_internal.h

> @@ -4,8 +4,8 @@

>   * SPDX-License-Identifier:     BSD-3-Clause

>   */

>

> -#ifndef ODPH_PAUSE_H_

> -#define ODPH_PAUSE_H_

> +#ifndef ODP_PAUSE_INTERNAL_H_

> +#define ODP_PAUSE_INTERNAL_H_

>

>  #ifdef __cplusplus

>  extern "C" {

> --

> 1.9.1

>

> _______________________________________________

> lng-odp mailing list

> lng-odp@lists.linaro.org<mailto:lng-odp@lists.linaro.org>

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

_______________________________________________
lng-odp mailing list
lng-odp@lists.linaro.org<mailto:lng-odp@lists.linaro.org>
https://lists.linaro.org/mailman/listinfo/lng-odp
Ola Liljedahl Oct. 7, 2015, 1:35 p.m. UTC | #5
On 7 October 2015 at 14:32, Savolainen, Petri (Nokia - FI/Espoo) <
petri.savolainen@nokia.com> wrote:

>
>
>
>
> *From:* EXT Ola Liljedahl [mailto:ola.liljedahl@linaro.org]
> *Sent:* Wednesday, October 07, 2015 2:38 PM
> *To:* Savolainen, Petri (Nokia - FI/Espoo)
> *Cc:* EXT Maxim Uvarov; lng-odp@lists.linaro.org
> *Subject:* Re: [lng-odp] [PATCH] move odph_pause inside linux-generic
>
>
>
> On 7 October 2015 at 10:09, Savolainen, Petri (Nokia - FI/Espoo) <
> petri.savolainen@nokia.com> wrote:
>
> I was actually planning to move odp_pause() to be proper API call.
>
> What is the use case for such a public API call? Where would an
> application use this call?
>
>
>
> Yes, application could use it while spinning on something.
>
>
>
> I think situations where you need something like pause are platform and
> architecture specific. E.g. when implementing (spin) locks on ARMv8, you
> wouldn't necessarily use pause while spinning, you could use WFE (wait for
> event) instead in order not to busy wait. (There are trade-offs between
> scalability and overhead in contented/uncontended situations though).
>
>
>
> Yes, I’d expect an ARM implementation to use WFE to implement odp_pause().
>
WFE cannot be used on its own. It must be associated with a preceding LDX
(load exclusive) operation. And some CPU must send an event, either
explicitly (using SEV) or implicitly (by writing to the memory location
monitored by the LDX/WFE sequence).

ARM does have a YIELD instruction which is intended for multi-threaded CPU
cores, one thread can hint the core that it is not doing any useful work at
the moment and the core can run another thread instead. I don't know how
YIELD is implemented on non-MT cores.


>
> -Petri
>
>
>
>
>
>
> -Petri
>
>
> > -----Original Message-----
> > From: lng-odp [mailto:lng-odp-bounces@lists.linaro.org] On Behalf Of EXT
> > Maxim Uvarov
> > Sent: Tuesday, October 06, 2015 12:36 PM
> > To: lng-odp@lists.linaro.org
> > Subject: [lng-odp] [PATCH] move odph_pause inside linux-generic
> >
> > Move odph_pause inside linux-generic. Validation test is also useless
> > with such move.
> >
> > Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
> > ---
> >  helper/Makefile.am                                         |  4 +---
> >  helper/ring.c                                              |  2 +-
> >  helper/test/Makefile.am                                    |  4 +---
> >  helper/test/odph_pause.c                                   | 14
> ----------
> > ----
> >  platform/linux-generic/Makefile.am                         |  1 +
> >  .../linux-generic/include/odp_pause_internal.h             |  4 ++--
> >  6 files changed, 6 insertions(+), 23 deletions(-)
> >  delete mode 100644 helper/test/odph_pause.c
> >  rename helper/odph_pause.h => platform/linux-
> > generic/include/odp_pause_internal.h (93%)
> >
> > diff --git a/helper/Makefile.am b/helper/Makefile.am
> > index 1a74e8e..cde8af2 100644
> > --- a/helper/Makefile.am
> > +++ b/helper/Makefile.am
> > @@ -19,9 +19,7 @@ helperinclude_HEADERS = \
> >                 $(srcdir)/include/odp/helper/tcp.h\
> >                 $(srcdir)/include/odp/helper/udp.h
> >
> > -noinst_HEADERS = \
> > -              $(srcdir)/odph_debug.h \
> > -              $(srcdir)/odph_pause.h
> > +noinst_HEADERS = $(srcdir)/odph_debug.h
> >
> >  __LIB__libodphelper_la_SOURCES = \
> >                                       linux.c \
> > diff --git a/helper/ring.c b/helper/ring.c
> > index 844abf7..6bb2bda 100644
> > --- a/helper/ring.c
> > +++ b/helper/ring.c
> > @@ -71,7 +71,7 @@
> >
> >  #include <odp/shared_memory.h>
> >  #include <odp/spinlock.h>
> > -#include "odph_pause.h"
> > +#include "odp_pause_internal.h"
> >  #include <odp/align.h>
> >  #include <fcntl.h>
> >  #include <stdio.h>
> > diff --git a/helper/test/Makefile.am b/helper/test/Makefile.am
> > index fbf5a9b..7b73602 100644
> > --- a/helper/test/Makefile.am
> > +++ b/helper/test/Makefile.am
> > @@ -7,8 +7,7 @@ TESTS_ENVIRONMENT += TEST_DIR=${builddir}
> >
> >  EXECUTABLES = odp_chksum$(EXEEXT) \
> >                odp_thread$(EXEEXT) \
> > -              odp_process$(EXEEXT)\
> > -              odph_pause$(EXEEXT)
> > +              odp_process$(EXEEXT)
> >
> >  COMPILE_ONLY =
> >
> > @@ -28,4 +27,3 @@ dist_odp_thread_SOURCES = odp_thread.c
> >  odp_thread_LDADD = $(LIB)/libodphelper.la $(LIB)/libodp.la
> >  dist_odp_process_SOURCES = odp_process.c
> >  odp_process_LDADD = $(LIB)/libodphelper.la $(LIB)/libodp.la
> > -odph_pause_SOURCES = odph_pause.c
> > diff --git a/helper/test/odph_pause.c b/helper/test/odph_pause.c
> > deleted file mode 100644
> > index f5f5da3..0000000
> > --- a/helper/test/odph_pause.c
> > +++ /dev/null
> > @@ -1,14 +0,0 @@
> > -/* Copyright (c) 2015, Linaro Limited
> > - * All rights reserved.
> > - *
> > - * SPDX-License-Identifier:     BSD-3-Clause
> > - */
> > -
> > -#include <test_debug.h>
> > -#include "../odph_pause.h"
> > -
> > -int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED)
> > -{
> > -     odph_pause();
> > -     return 0;
> > -}
> > diff --git a/platform/linux-generic/Makefile.am b/platform/linux-
> > generic/Makefile.am
> > index 4c79730..b9ed3b0 100644
> > --- a/platform/linux-generic/Makefile.am
> > +++ b/platform/linux-generic/Makefile.am
> > @@ -128,6 +128,7 @@ noinst_HEADERS = \
> >                 ${srcdir}/include/odp_packet_io_internal.h \
> >                 ${srcdir}/include/odp_packet_io_queue.h \
> >                 ${srcdir}/include/odp_packet_socket.h \
> > +               ${srcdir}/include/odp_pause_internal.h \
> >                 ${srcdir}/include/odp_pool_internal.h \
> >                 ${srcdir}/include/odp_queue_internal.h \
> >                 ${srcdir}/include/odp_schedule_internal.h \
> > diff --git a/helper/odph_pause.h b/platform/linux-
> > generic/include/odp_pause_internal.h
> > similarity index 93%
> > rename from helper/odph_pause.h
> > rename to platform/linux-generic/include/odp_pause_internal.h
> > index 5618f1f..ad2c628 100644
> > --- a/helper/odph_pause.h
> > +++ b/platform/linux-generic/include/odp_pause_internal.h
> > @@ -4,8 +4,8 @@
> >   * SPDX-License-Identifier:     BSD-3-Clause
> >   */
> >
> > -#ifndef ODPH_PAUSE_H_
> > -#define ODPH_PAUSE_H_
> > +#ifndef ODP_PAUSE_INTERNAL_H_
> > +#define ODP_PAUSE_INTERNAL_H_
> >
> >  #ifdef __cplusplus
> >  extern "C" {
> > --
> > 1.9.1
> >
> > _______________________________________________
> > lng-odp mailing list
> > lng-odp@lists.linaro.org
> > https://lists.linaro.org/mailman/listinfo/lng-odp
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
>
>
>
diff mbox

Patch

diff --git a/helper/Makefile.am b/helper/Makefile.am
index 1a74e8e..cde8af2 100644
--- a/helper/Makefile.am
+++ b/helper/Makefile.am
@@ -19,9 +19,7 @@  helperinclude_HEADERS = \
 		  $(srcdir)/include/odp/helper/tcp.h\
 		  $(srcdir)/include/odp/helper/udp.h
 
-noinst_HEADERS = \
-		 $(srcdir)/odph_debug.h \
-		 $(srcdir)/odph_pause.h
+noinst_HEADERS = $(srcdir)/odph_debug.h
 
 __LIB__libodphelper_la_SOURCES = \
 					linux.c \
diff --git a/helper/ring.c b/helper/ring.c
index 844abf7..6bb2bda 100644
--- a/helper/ring.c
+++ b/helper/ring.c
@@ -71,7 +71,7 @@ 
 
 #include <odp/shared_memory.h>
 #include <odp/spinlock.h>
-#include "odph_pause.h"
+#include "odp_pause_internal.h"
 #include <odp/align.h>
 #include <fcntl.h>
 #include <stdio.h>
diff --git a/helper/test/Makefile.am b/helper/test/Makefile.am
index fbf5a9b..7b73602 100644
--- a/helper/test/Makefile.am
+++ b/helper/test/Makefile.am
@@ -7,8 +7,7 @@  TESTS_ENVIRONMENT += TEST_DIR=${builddir}
 
 EXECUTABLES = odp_chksum$(EXEEXT) \
               odp_thread$(EXEEXT) \
-              odp_process$(EXEEXT)\
-              odph_pause$(EXEEXT)
+              odp_process$(EXEEXT)
 
 COMPILE_ONLY =
 
@@ -28,4 +27,3 @@  dist_odp_thread_SOURCES = odp_thread.c
 odp_thread_LDADD = $(LIB)/libodphelper.la $(LIB)/libodp.la
 dist_odp_process_SOURCES = odp_process.c
 odp_process_LDADD = $(LIB)/libodphelper.la $(LIB)/libodp.la
-odph_pause_SOURCES = odph_pause.c
diff --git a/helper/test/odph_pause.c b/helper/test/odph_pause.c
deleted file mode 100644
index f5f5da3..0000000
--- a/helper/test/odph_pause.c
+++ /dev/null
@@ -1,14 +0,0 @@ 
-/* Copyright (c) 2015, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier:     BSD-3-Clause
- */
-
-#include <test_debug.h>
-#include "../odph_pause.h"
-
-int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED)
-{
-	odph_pause();
-	return 0;
-}
diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am
index 4c79730..b9ed3b0 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -128,6 +128,7 @@  noinst_HEADERS = \
 		  ${srcdir}/include/odp_packet_io_internal.h \
 		  ${srcdir}/include/odp_packet_io_queue.h \
 		  ${srcdir}/include/odp_packet_socket.h \
+		  ${srcdir}/include/odp_pause_internal.h \
 		  ${srcdir}/include/odp_pool_internal.h \
 		  ${srcdir}/include/odp_queue_internal.h \
 		  ${srcdir}/include/odp_schedule_internal.h \
diff --git a/helper/odph_pause.h b/platform/linux-generic/include/odp_pause_internal.h
similarity index 93%
rename from helper/odph_pause.h
rename to platform/linux-generic/include/odp_pause_internal.h
index 5618f1f..ad2c628 100644
--- a/helper/odph_pause.h
+++ b/platform/linux-generic/include/odp_pause_internal.h
@@ -4,8 +4,8 @@ 
  * SPDX-License-Identifier:     BSD-3-Clause
  */
 
-#ifndef ODPH_PAUSE_H_
-#define ODPH_PAUSE_H_
+#ifndef ODP_PAUSE_INTERNAL_H_
+#define ODP_PAUSE_INTERNAL_H_
 
 #ifdef __cplusplus
 extern "C" {