diff mbox

[API-NEXT,PATCHv2,2/4] api: cpu: add routines for obtaining socket ids

Message ID 1458771569-17717-2-git-send-email-bill.fischofer@linaro.org
State New
Headers show

Commit Message

Bill Fischofer March 23, 2016, 10:19 p.m. UTC
Add odp_cpu_socket_id() and odp_cpu_socket_id_cpu() routines

Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
---
 include/odp/api/spec/cpu.h | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

Comments

Bill Fischofer March 24, 2016, 2:27 a.m. UTC | #1
Non-NUMA systems would just return ODP_SOCKET_ID_ANY for these calls. This
patch is the result of BKK16 discussions and is simply designed to
introduce basic APIs to permit NUMA concepts to be attached to pools for
platforms/implementations that support NUMA.  They mirror current DPDK
concepts/APIs.

We expect these to be expanded post-Monarch as we define Tiger Moth support
in this area.

On Wed, Mar 23, 2016 at 6:46 PM, Nikolay Nikolaev <
n.nikolaev@virtualopensystems.com> wrote:

> On Thu, Mar 24, 2016 at 12:19 AM, Bill Fischofer

> <bill.fischofer@linaro.org> wrote:

> >

> > Add odp_cpu_socket_id() and odp_cpu_socket_id_cpu() routines

>

> I wonder how those are going to be implemented on non-NUMA systems

> like ThunderX?

> Jerin do you have any comments here?

>

> regards,

> Nikolay Nikolaev

>

> >

> >

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

> > ---

> >  include/odp/api/spec/cpu.h | 25 +++++++++++++++++++++++++

> >  1 file changed, 25 insertions(+)

> >

> > diff --git a/include/odp/api/spec/cpu.h b/include/odp/api/spec/cpu.h

> > index f0e20c4..d383c3b 100644

> > --- a/include/odp/api/spec/cpu.h

> > +++ b/include/odp/api/spec/cpu.h

> > @@ -36,6 +36,31 @@ extern "C" {

> >  int odp_cpu_id(void);

> >

> >  /**

> > + * CPU socket id

> > + *

> > + * Returns the socket id associated with the calling CPU on NUMA

> systems.

> > + * Socket ID numbering is system specific.

> > + *

> > + * @return Socket ID of the calling CPU

> > + * @retval ODP_SOCKET_ID_ANY If the caller is not running on a NUMA

> system.

> > + */

> > +uint32_t odp_cpu_socket_id(void);

> > +

> > +/**

> > + * CPU socket id of designated CPU

> > + *

> > + * Returns the socket id associated with a specific CPU on NUMA systems.

> > + * Socket ID numbering is system specific.

> > + *

> > + * @param cpu_id ID of the CPU for which socket ID information is

> requested.

> > + *

> > + * @return Socket ID of the designated CPU

> > + * @retval ODP_SOCKET_ID_ANY If the specified CPU is unknown or caller

> is

> > + *                           not running on a NUMA system.

> > + */

> > +uint32_t odp_cpu_socket_id_cpu(int cpu_id);

> > +

> > +/**

> >   * CPU count

> >   *

> >   * Report the number of CPU's available to this ODP program.

> > --

> > 2.5.0

> >

> > _______________________________________________

> > lng-odp mailing list

> > lng-odp@lists.linaro.org

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

>
Jerin Jacob March 24, 2016, 7:32 a.m. UTC | #2
On Thu, Mar 24, 2016 at 01:46:44AM +0200, Nikolay Nikolaev wrote:
> On Thu, Mar 24, 2016 at 12:19 AM, Bill Fischofer
> <bill.fischofer@linaro.org> wrote:
> >
> > Add odp_cpu_socket_id() and odp_cpu_socket_id_cpu() routines
> 
> I wonder how those are going to be implemented on non-NUMA systems
> like ThunderX?

I think you meant NUMA platform like ThunderX.

From HW perspective, any resources which explicitly connected by ODP
application (like passing odp_pool_t in odp_pktio_open)
should be on the same node for the optimal performance.

IMO, We should have "get socked id" function to know where the pktio is
physically connected up and then connect the resource chain from the
application.

But the issue here is that application need to know the pktio socket id
without opening it.

something like below in HW perspective.

socket_id = odp_pktio_socket_id()
pool = odp_pool_create(socket_id...)
pktio = odp_pktio_open(pool)

and to make sure to run odp_pktin_recv() on the socket_id which
was created earlier.

Jerin

> Jerin do you have any comments here?
> 
> regards,
> Nikolay Nikolaev
> 
> >
> >
> > Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
> > ---
> >  include/odp/api/spec/cpu.h | 25 +++++++++++++++++++++++++
> >  1 file changed, 25 insertions(+)
> >
> > diff --git a/include/odp/api/spec/cpu.h b/include/odp/api/spec/cpu.h
> > index f0e20c4..d383c3b 100644
> > --- a/include/odp/api/spec/cpu.h
> > +++ b/include/odp/api/spec/cpu.h
> > @@ -36,6 +36,31 @@ extern "C" {
> >  int odp_cpu_id(void);
> >
> >  /**
> > + * CPU socket id
> > + *
> > + * Returns the socket id associated with the calling CPU on NUMA systems.
> > + * Socket ID numbering is system specific.
> > + *
> > + * @return Socket ID of the calling CPU
> > + * @retval ODP_SOCKET_ID_ANY If the caller is not running on a NUMA system.
> > + */
> > +uint32_t odp_cpu_socket_id(void);
> > +
> > +/**
> > + * CPU socket id of designated CPU
> > + *
> > + * Returns the socket id associated with a specific CPU on NUMA systems.
> > + * Socket ID numbering is system specific.
> > + *
> > + * @param cpu_id ID of the CPU for which socket ID information is requested.
> > + *
> > + * @return Socket ID of the designated CPU
> > + * @retval ODP_SOCKET_ID_ANY If the specified CPU is unknown or caller is
> > + *                           not running on a NUMA system.
> > + */
> > +uint32_t odp_cpu_socket_id_cpu(int cpu_id);
> > +
> > +/**
> >   * CPU count
> >   *
> >   * Report the number of CPU's available to this ODP program.
> > --
> > 2.5.0
> >
> > _______________________________________________
> > lng-odp mailing list
> > lng-odp@lists.linaro.org
> > https://lists.linaro.org/mailman/listinfo/lng-odp
Bill Fischofer March 24, 2016, 11:10 a.m. UTC | #3
Thanks, Jerin.  So is an odp_cpu_socket_id() function not interesting to
you and odp_pktio_socket_id() is what's wanted/needed?  Or are you saying
we should have both?

On Thu, Mar 24, 2016 at 2:32 AM, Jerin Jacob <jerin.jacob@caviumnetworks.com
> wrote:


> On Thu, Mar 24, 2016 at 01:46:44AM +0200, Nikolay Nikolaev wrote:

> > On Thu, Mar 24, 2016 at 12:19 AM, Bill Fischofer

> > <bill.fischofer@linaro.org> wrote:

> > >

> > > Add odp_cpu_socket_id() and odp_cpu_socket_id_cpu() routines

> >

> > I wonder how those are going to be implemented on non-NUMA systems

> > like ThunderX?

>

> I think you meant NUMA platform like ThunderX.

>

> From HW perspective, any resources which explicitly connected by ODP

> application (like passing odp_pool_t in odp_pktio_open)

> should be on the same node for the optimal performance.

>

> IMO, We should have "get socked id" function to know where the pktio is

> physically connected up and then connect the resource chain from the

> application.

>

> But the issue here is that application need to know the pktio socket id

> without opening it.

>

> something like below in HW perspective.

>

> socket_id = odp_pktio_socket_id()

> pool = odp_pool_create(socket_id...)

> pktio = odp_pktio_open(pool)

>

> and to make sure to run odp_pktin_recv() on the socket_id which

> was created earlier.

>

> Jerin

>

> > Jerin do you have any comments here?

> >

> > regards,

> > Nikolay Nikolaev

> >

> > >

> > >

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

> > > ---

> > >  include/odp/api/spec/cpu.h | 25 +++++++++++++++++++++++++

> > >  1 file changed, 25 insertions(+)

> > >

> > > diff --git a/include/odp/api/spec/cpu.h b/include/odp/api/spec/cpu.h

> > > index f0e20c4..d383c3b 100644

> > > --- a/include/odp/api/spec/cpu.h

> > > +++ b/include/odp/api/spec/cpu.h

> > > @@ -36,6 +36,31 @@ extern "C" {

> > >  int odp_cpu_id(void);

> > >

> > >  /**

> > > + * CPU socket id

> > > + *

> > > + * Returns the socket id associated with the calling CPU on NUMA

> systems.

> > > + * Socket ID numbering is system specific.

> > > + *

> > > + * @return Socket ID of the calling CPU

> > > + * @retval ODP_SOCKET_ID_ANY If the caller is not running on a NUMA

> system.

> > > + */

> > > +uint32_t odp_cpu_socket_id(void);

> > > +

> > > +/**

> > > + * CPU socket id of designated CPU

> > > + *

> > > + * Returns the socket id associated with a specific CPU on NUMA

> systems.

> > > + * Socket ID numbering is system specific.

> > > + *

> > > + * @param cpu_id ID of the CPU for which socket ID information is

> requested.

> > > + *

> > > + * @return Socket ID of the designated CPU

> > > + * @retval ODP_SOCKET_ID_ANY If the specified CPU is unknown or

> caller is

> > > + *                           not running on a NUMA system.

> > > + */

> > > +uint32_t odp_cpu_socket_id_cpu(int cpu_id);

> > > +

> > > +/**

> > >   * CPU count

> > >   *

> > >   * Report the number of CPU's available to this ODP program.

> > > --

> > > 2.5.0

> > >

> > > _______________________________________________

> > > lng-odp mailing list

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

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

>
Bill Fischofer March 24, 2016, 10:36 p.m. UTC | #4
Can you suggest a reasonable terminology to use for Monarch? The consensus
at BKK was that while we won't have a complete NUMA story until Tiger Moth,
we did want to have some basic vocabulary in place for Monarch that we can
build on. Remaining completely silent on NUMA would seem to put ODP
implementations at a disadvantage on NUMA systems today.  This proposal
simply puts ODP APIs on an even footing with what DPDK is currently
offering.

On Thu, Mar 24, 2016 at 9:40 AM, Savolainen, Petri (Nokia - FI/Espoo) <
petri.savolainen@nokia.com> wrote:

> Hi,

>

> As I mentioned in BKK, I think we should not hurry to add a simple socket

> ID API.

>

> CPU/cache/accelerator topology inside SoCs may include already multiple

> hierarchy levels. CPUs may be clustered and each cluster may have its own

> set of accelerators. Instead, we should choose terminology for expressing

> SoC and socket hierarchies. With virtualization all these IDs (CPUs,

> sockets, etc) are guest local, which may not anymore represent the real

> world hierarchy (that's OK but we should be specific about that). For

> example, a quick test with KVM resulted a default setup that did place each

> CPU into its own "socket". Four consecutive CPUs on the same physical

> socket did show up as four different sockets - single CPU on each socket

> (without any L3 cache !).

>

> -Petri

>

>

>

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

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

> > Bill Fischofer

> > Sent: Thursday, March 24, 2016 12:19 AM

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

> > Subject: [lng-odp] [API-NEXT PATCHv2 2/4] api: cpu: add routines for

> > obtaining socket ids

> >

> > Add odp_cpu_socket_id() and odp_cpu_socket_id_cpu() routines

> >

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

> > ---

> >  include/odp/api/spec/cpu.h | 25 +++++++++++++++++++++++++

> >  1 file changed, 25 insertions(+)

> >

> > diff --git a/include/odp/api/spec/cpu.h b/include/odp/api/spec/cpu.h

> > index f0e20c4..d383c3b 100644

> > --- a/include/odp/api/spec/cpu.h

> > +++ b/include/odp/api/spec/cpu.h

> > @@ -36,6 +36,31 @@ extern "C" {

> >  int odp_cpu_id(void);

> >

> >  /**

> > + * CPU socket id

> > + *

> > + * Returns the socket id associated with the calling CPU on NUMA

> systems.

> > + * Socket ID numbering is system specific.

> > + *

> > + * @return Socket ID of the calling CPU

> > + * @retval ODP_SOCKET_ID_ANY If the caller is not running on a NUMA

> > system.

> > + */

> > +uint32_t odp_cpu_socket_id(void);

> > +

> > +/**

> > + * CPU socket id of designated CPU

> > + *

> > + * Returns the socket id associated with a specific CPU on NUMA systems.

> > + * Socket ID numbering is system specific.

> > + *

> > + * @param cpu_id ID of the CPU for which socket ID information is

> > requested.

> > + *

> > + * @return Socket ID of the designated CPU

> > + * @retval ODP_SOCKET_ID_ANY If the specified CPU is unknown or caller

> is

> > + *                           not running on a NUMA system.

> > + */

> > +uint32_t odp_cpu_socket_id_cpu(int cpu_id);

> > +

> > +/**

> >   * CPU count

> >   *

> >   * Report the number of CPU's available to this ODP program.

> > --

> > 2.5.0

> >

> > _______________________________________________

> > lng-odp mailing list

> > lng-odp@lists.linaro.org

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

>
Maxim Uvarov March 28, 2016, 3:41 p.m. UTC | #5
Jerin,  do you thin that we need both?

Maxim.

On 03/24/16 14:10, Bill Fischofer wrote:
> Thanks, Jerin.  So is an odp_cpu_socket_id() function not interesting 
> to you and odp_pktio_socket_id() is what's wanted/needed?  Or are you 
> saying we should have both?
>
> On Thu, Mar 24, 2016 at 2:32 AM, Jerin Jacob 
> <jerin.jacob@caviumnetworks.com 
> <mailto:jerin.jacob@caviumnetworks.com>> wrote:
>
>     On Thu, Mar 24, 2016 at 01:46:44AM +0200, Nikolay Nikolaev wrote:
>     > On Thu, Mar 24, 2016 at 12:19 AM, Bill Fischofer
>     > <bill.fischofer@linaro.org <mailto:bill.fischofer@linaro.org>>
>     wrote:
>     > >
>     > > Add odp_cpu_socket_id() and odp_cpu_socket_id_cpu() routines
>     >
>     > I wonder how those are going to be implemented on non-NUMA systems
>     > like ThunderX?
>
>     I think you meant NUMA platform like ThunderX.
>
>     From HW perspective, any resources which explicitly connected by ODP
>     application (like passing odp_pool_t in odp_pktio_open)
>     should be on the same node for the optimal performance.
>
>     IMO, We should have "get socked id" function to know where the
>     pktio is
>     physically connected up and then connect the resource chain from the
>     application.
>
>     But the issue here is that application need to know the pktio
>     socket id
>     without opening it.
>
>     something like below in HW perspective.
>
>     socket_id = odp_pktio_socket_id()
>     pool = odp_pool_create(socket_id...)
>     pktio = odp_pktio_open(pool)
>
>     and to make sure to run odp_pktin_recv() on the socket_id which
>     was created earlier.
>
>     Jerin
>
>     > Jerin do you have any comments here?
>     >
>     > regards,
>     > Nikolay Nikolaev
>     >
>     > >
>     > >
>     > > Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org
>     <mailto:bill.fischofer@linaro.org>>
>     > > ---
>     > >  include/odp/api/spec/cpu.h | 25 +++++++++++++++++++++++++
>     > >  1 file changed, 25 insertions(+)
>     > >
>     > > diff --git a/include/odp/api/spec/cpu.h
>     b/include/odp/api/spec/cpu.h
>     > > index f0e20c4..d383c3b 100644
>     > > --- a/include/odp/api/spec/cpu.h
>     > > +++ b/include/odp/api/spec/cpu.h
>     > > @@ -36,6 +36,31 @@ extern "C" {
>     > >  int odp_cpu_id(void);
>     > >
>     > >  /**
>     > > + * CPU socket id
>     > > + *
>     > > + * Returns the socket id associated with the calling CPU on
>     NUMA systems.
>     > > + * Socket ID numbering is system specific.
>     > > + *
>     > > + * @return Socket ID of the calling CPU
>     > > + * @retval ODP_SOCKET_ID_ANY If the caller is not running on
>     a NUMA system.
>     > > + */
>     > > +uint32_t odp_cpu_socket_id(void);
>     > > +
>     > > +/**
>     > > + * CPU socket id of designated CPU
>     > > + *
>     > > + * Returns the socket id associated with a specific CPU on
>     NUMA systems.
>     > > + * Socket ID numbering is system specific.
>     > > + *
>     > > + * @param cpu_id ID of the CPU for which socket ID
>     information is requested.
>     > > + *
>     > > + * @return Socket ID of the designated CPU
>     > > + * @retval ODP_SOCKET_ID_ANY If the specified CPU is unknown
>     or caller is
>     > > + *                           not running on a NUMA system.
>     > > + */
>     > > +uint32_t odp_cpu_socket_id_cpu(int cpu_id);
>     > > +
>     > > +/**
>     > >   * CPU count
>     > >   *
>     > >   * Report the number of CPU's available to this ODP program.
>     > > --
>     > > 2.5.0
>     > >
>     > > _______________________________________________
>     > > 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
> https://lists.linaro.org/mailman/listinfo/lng-odp
Jerin Jacob March 28, 2016, 4:26 p.m. UTC | #6
On Mon, Mar 28, 2016 at 06:41:29PM +0300, Maxim Uvarov wrote:
> Jerin,  do you thin that we need both?

Both are requried. But not sure about invoking odp_pktio_socket_id()
before odp_pktio_open is the correct approach or not ?(as mentioed
earlier in the mail).

How about other devices in the framework, queue, crypto etc?

>
> Maxim.
>
> On 03/24/16 14:10, Bill Fischofer wrote:
> >Thanks, Jerin.  So is an odp_cpu_socket_id() function not interesting to
> >you and odp_pktio_socket_id() is what's wanted/needed?  Or are you saying
> >we should have both?
> >
> >On Thu, Mar 24, 2016 at 2:32 AM, Jerin Jacob
> ><jerin.jacob@caviumnetworks.com <mailto:jerin.jacob@caviumnetworks.com>>
> >wrote:
> >
> >    On Thu, Mar 24, 2016 at 01:46:44AM +0200, Nikolay Nikolaev wrote:
> >    > On Thu, Mar 24, 2016 at 12:19 AM, Bill Fischofer
> >    > <bill.fischofer@linaro.org <mailto:bill.fischofer@linaro.org>>
> >    wrote:
> >    > >
> >    > > Add odp_cpu_socket_id() and odp_cpu_socket_id_cpu() routines
> >    >
> >    > I wonder how those are going to be implemented on non-NUMA systems
> >    > like ThunderX?
> >
> >    I think you meant NUMA platform like ThunderX.
> >
> >    From HW perspective, any resources which explicitly connected by ODP
> >    application (like passing odp_pool_t in odp_pktio_open)
> >    should be on the same node for the optimal performance.
> >
> >    IMO, We should have "get socked id" function to know where the
> >    pktio is
> >    physically connected up and then connect the resource chain from the
> >    application.
> >
> >    But the issue here is that application need to know the pktio
> >    socket id
> >    without opening it.
> >
> >    something like below in HW perspective.
> >
> >    socket_id = odp_pktio_socket_id()
> >    pool = odp_pool_create(socket_id...)
> >    pktio = odp_pktio_open(pool)
> >
> >    and to make sure to run odp_pktin_recv() on the socket_id which
> >    was created earlier.
> >
> >    Jerin
> >
> >    > Jerin do you have any comments here?
> >    >
> >    > regards,
> >    > Nikolay Nikolaev
> >    >
> >    > >
> >    > >
> >    > > Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org
> >    <mailto:bill.fischofer@linaro.org>>
> >    > > ---
> >    > >  include/odp/api/spec/cpu.h | 25 +++++++++++++++++++++++++
> >    > >  1 file changed, 25 insertions(+)
> >    > >
> >    > > diff --git a/include/odp/api/spec/cpu.h
> >    b/include/odp/api/spec/cpu.h
> >    > > index f0e20c4..d383c3b 100644
> >    > > --- a/include/odp/api/spec/cpu.h
> >    > > +++ b/include/odp/api/spec/cpu.h
> >    > > @@ -36,6 +36,31 @@ extern "C" {
> >    > >  int odp_cpu_id(void);
> >    > >
> >    > >  /**
> >    > > + * CPU socket id
> >    > > + *
> >    > > + * Returns the socket id associated with the calling CPU on
> >    NUMA systems.
> >    > > + * Socket ID numbering is system specific.
> >    > > + *
> >    > > + * @return Socket ID of the calling CPU
> >    > > + * @retval ODP_SOCKET_ID_ANY If the caller is not running on
> >    a NUMA system.
> >    > > + */
> >    > > +uint32_t odp_cpu_socket_id(void);
> >    > > +
> >    > > +/**
> >    > > + * CPU socket id of designated CPU
> >    > > + *
> >    > > + * Returns the socket id associated with a specific CPU on
> >    NUMA systems.
> >    > > + * Socket ID numbering is system specific.
> >    > > + *
> >    > > + * @param cpu_id ID of the CPU for which socket ID
> >    information is requested.
> >    > > + *
> >    > > + * @return Socket ID of the designated CPU
> >    > > + * @retval ODP_SOCKET_ID_ANY If the specified CPU is unknown
> >    or caller is
> >    > > + *                           not running on a NUMA system.
> >    > > + */
> >    > > +uint32_t odp_cpu_socket_id_cpu(int cpu_id);
> >    > > +
> >    > > +/**
> >    > >   * CPU count
> >    > >   *
> >    > >   * Report the number of CPU's available to this ODP program.
> >    > > --
> >    > > 2.5.0
> >    > >
> >    > > _______________________________________________
> >    > > 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
> >https://lists.linaro.org/mailman/listinfo/lng-odp
>
Bill Fischofer March 28, 2016, 6:51 p.m. UTC | #7
We can discuss this during tomorrow's ODP call.  Jerin, can you join us for
that?  15:00 UTC.  Thanks.

On Mon, Mar 28, 2016 at 11:26 AM, Jerin Jacob <
jerin.jacob@caviumnetworks.com> wrote:

> On Mon, Mar 28, 2016 at 06:41:29PM +0300, Maxim Uvarov wrote:

> > Jerin,  do you thin that we need both?

>

> Both are requried. But not sure about invoking odp_pktio_socket_id()

> before odp_pktio_open is the correct approach or not ?(as mentioed

> earlier in the mail).

>

> How about other devices in the framework, queue, crypto etc?

>

> >

> > Maxim.

> >

> > On 03/24/16 14:10, Bill Fischofer wrote:

> > >Thanks, Jerin.  So is an odp_cpu_socket_id() function not interesting to

> > >you and odp_pktio_socket_id() is what's wanted/needed?  Or are you

> saying

> > >we should have both?

> > >

> > >On Thu, Mar 24, 2016 at 2:32 AM, Jerin Jacob

> > ><jerin.jacob@caviumnetworks.com <mailto:jerin.jacob@caviumnetworks.com

> >>

> > >wrote:

> > >

> > >    On Thu, Mar 24, 2016 at 01:46:44AM +0200, Nikolay Nikolaev wrote:

> > >    > On Thu, Mar 24, 2016 at 12:19 AM, Bill Fischofer

> > >    > <bill.fischofer@linaro.org <mailto:bill.fischofer@linaro.org>>

> > >    wrote:

> > >    > >

> > >    > > Add odp_cpu_socket_id() and odp_cpu_socket_id_cpu() routines

> > >    >

> > >    > I wonder how those are going to be implemented on non-NUMA systems

> > >    > like ThunderX?

> > >

> > >    I think you meant NUMA platform like ThunderX.

> > >

> > >    From HW perspective, any resources which explicitly connected by ODP

> > >    application (like passing odp_pool_t in odp_pktio_open)

> > >    should be on the same node for the optimal performance.

> > >

> > >    IMO, We should have "get socked id" function to know where the

> > >    pktio is

> > >    physically connected up and then connect the resource chain from the

> > >    application.

> > >

> > >    But the issue here is that application need to know the pktio

> > >    socket id

> > >    without opening it.

> > >

> > >    something like below in HW perspective.

> > >

> > >    socket_id = odp_pktio_socket_id()

> > >    pool = odp_pool_create(socket_id...)

> > >    pktio = odp_pktio_open(pool)

> > >

> > >    and to make sure to run odp_pktin_recv() on the socket_id which

> > >    was created earlier.

> > >

> > >    Jerin

> > >

> > >    > Jerin do you have any comments here?

> > >    >

> > >    > regards,

> > >    > Nikolay Nikolaev

> > >    >

> > >    > >

> > >    > >

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

> > >    <mailto:bill.fischofer@linaro.org>>

> > >    > > ---

> > >    > >  include/odp/api/spec/cpu.h | 25 +++++++++++++++++++++++++

> > >    > >  1 file changed, 25 insertions(+)

> > >    > >

> > >    > > diff --git a/include/odp/api/spec/cpu.h

> > >    b/include/odp/api/spec/cpu.h

> > >    > > index f0e20c4..d383c3b 100644

> > >    > > --- a/include/odp/api/spec/cpu.h

> > >    > > +++ b/include/odp/api/spec/cpu.h

> > >    > > @@ -36,6 +36,31 @@ extern "C" {

> > >    > >  int odp_cpu_id(void);

> > >    > >

> > >    > >  /**

> > >    > > + * CPU socket id

> > >    > > + *

> > >    > > + * Returns the socket id associated with the calling CPU on

> > >    NUMA systems.

> > >    > > + * Socket ID numbering is system specific.

> > >    > > + *

> > >    > > + * @return Socket ID of the calling CPU

> > >    > > + * @retval ODP_SOCKET_ID_ANY If the caller is not running on

> > >    a NUMA system.

> > >    > > + */

> > >    > > +uint32_t odp_cpu_socket_id(void);

> > >    > > +

> > >    > > +/**

> > >    > > + * CPU socket id of designated CPU

> > >    > > + *

> > >    > > + * Returns the socket id associated with a specific CPU on

> > >    NUMA systems.

> > >    > > + * Socket ID numbering is system specific.

> > >    > > + *

> > >    > > + * @param cpu_id ID of the CPU for which socket ID

> > >    information is requested.

> > >    > > + *

> > >    > > + * @return Socket ID of the designated CPU

> > >    > > + * @retval ODP_SOCKET_ID_ANY If the specified CPU is unknown

> > >    or caller is

> > >    > > + *                           not running on a NUMA system.

> > >    > > + */

> > >    > > +uint32_t odp_cpu_socket_id_cpu(int cpu_id);

> > >    > > +

> > >    > > +/**

> > >    > >   * CPU count

> > >    > >   *

> > >    > >   * Report the number of CPU's available to this ODP program.

> > >    > > --

> > >    > > 2.5.0

> > >    > >

> > >    > > _______________________________________________

> > >    > > 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

> > >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/include/odp/api/spec/cpu.h b/include/odp/api/spec/cpu.h
index f0e20c4..d383c3b 100644
--- a/include/odp/api/spec/cpu.h
+++ b/include/odp/api/spec/cpu.h
@@ -36,6 +36,31 @@  extern "C" {
 int odp_cpu_id(void);
 
 /**
+ * CPU socket id
+ *
+ * Returns the socket id associated with the calling CPU on NUMA systems.
+ * Socket ID numbering is system specific.
+ *
+ * @return Socket ID of the calling CPU
+ * @retval ODP_SOCKET_ID_ANY If the caller is not running on a NUMA system.
+ */
+uint32_t odp_cpu_socket_id(void);
+
+/**
+ * CPU socket id of designated CPU
+ *
+ * Returns the socket id associated with a specific CPU on NUMA systems.
+ * Socket ID numbering is system specific.
+ *
+ * @param cpu_id ID of the CPU for which socket ID information is requested.
+ *
+ * @return Socket ID of the designated CPU
+ * @retval ODP_SOCKET_ID_ANY If the specified CPU is unknown or caller is
+ *                           not running on a NUMA system.
+ */
+uint32_t odp_cpu_socket_id_cpu(int cpu_id);
+
+/**
  * CPU count
  *
  * Report the number of CPU's available to this ODP program.