diff mbox

implement odp_init_global flags

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

Commit Message

Maxim Uvarov Aug. 4, 2014, 9:37 a.m. UTC
For some cases all layers of odp initialization is not needed
and can be skipped. For example odp_timer_init() launch timer
which acts each second is not needed for all applications.

Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
---
 example/generator/odp_generator.c        |  2 +-
 example/l2fwd/odp_l2fwd.c                |  2 +-
 example/odp_example/odp_example.c        |  2 +-
 example/packet/odp_pktio.c               |  2 +-
 example/packet_netmap/odp_pktio_netmap.c |  2 +-
 example/timer/odp_timer_test.c           |  2 +-
 include/odp_init.h                       |  9 +++++-
 platform/linux-dpdk/odp_init.c           | 50 ++++++++++++++++++++------------
 platform/linux-generic/odp_init.c        | 50 ++++++++++++++++++++------------
 platform/linux-keystone2/odp_init.c      | 50 ++++++++++++++++++++------------
 test/api_test/odp_common.c               |  2 +-
 11 files changed, 108 insertions(+), 65 deletions(-)

Comments

Taras Kondratiuk Aug. 4, 2014, 10:36 a.m. UTC | #1
On 08/04/2014 12:37 PM, Maxim Uvarov wrote:
> For some cases all layers of odp initialization is not needed
> and can be skipped. For example odp_timer_init() launch timer
> which acts each second is not needed for all applications.

IMO bug is in a timer code. This patch just hides it.
Maxim Uvarov Aug. 4, 2014, 12:30 p.m. UTC | #2
On 08/04/2014 02:36 PM, Taras Kondratiuk wrote:
> On 08/04/2014 12:37 PM, Maxim Uvarov wrote:
>> For some cases all layers of odp initialization is not needed
>> and can be skipped. For example odp_timer_init() launch timer
>> which acts each second is not needed for all applications.
>
> IMO bug is in a timer code. This patch just hides it.

Hi Taras, it's it the same what we discussed some time ago? I supposed 
that if you don't
need timer then you just don't initialize it. If you don't need 
scheduler, then no need to init it also.
I don't think that this patch hides timer bug, and which exactly bug are 
you talking about.

Simple example - I want some app isolated on core without any timer 
interrupts. Why do I need
init all odp thins and spend recourses for maintaining them?

Best regards,
Maxim.
Santosh Shukla Aug. 4, 2014, 12:58 p.m. UTC | #3
On 4 August 2014 18:00, Maxim Uvarov <maxim.uvarov@linaro.org> wrote:
> On 08/04/2014 02:36 PM, Taras Kondratiuk wrote:
>>
>> On 08/04/2014 12:37 PM, Maxim Uvarov wrote:
>>>
>>> For some cases all layers of odp initialization is not needed
>>> and can be skipped. For example odp_timer_init() launch timer
>>> which acts each second is not needed for all applications.
>>
>>
>> IMO bug is in a timer code. This patch just hides it.
>
>
> Hi Taras, it's it the same what we discussed some time ago? I supposed that
> if you don't
> need timer then you just don't initialize it. If you don't need scheduler,
> then no need to init it also.
> I don't think that this patch hides timer bug, and which exactly bug are you
> talking about.
>
> Simple example - I want some app isolated on core without any timer
> interrupts. Why do I need
> init all odp thins and spend recourses for maintaining them?
>

I support this patch change. In my no_hz_full use-case I do need to
mask out timer and other not needed odp init sequence and I am
following exactly same method.


> Best regards,
> Maxim.
>
>
>
>
>
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
Santosh Shukla Aug. 4, 2014, 1:04 p.m. UTC | #4
On 4 August 2014 18:28, Santosh Shukla <santosh.shukla@linaro.org> wrote:
> On 4 August 2014 18:00, Maxim Uvarov <maxim.uvarov@linaro.org> wrote:
>> On 08/04/2014 02:36 PM, Taras Kondratiuk wrote:
>>>
>>> On 08/04/2014 12:37 PM, Maxim Uvarov wrote:
>>>>
>>>> For some cases all layers of odp initialization is not needed
>>>> and can be skipped. For example odp_timer_init() launch timer
>>>> which acts each second is not needed for all applications.
>>>
>>>
>>> IMO bug is in a timer code. This patch just hides it.
>>
>>
>> Hi Taras, it's it the same what we discussed some time ago? I supposed that
>> if you don't
>> need timer then you just don't initialize it. If you don't need scheduler,
>> then no need to init it also.
>> I don't think that this patch hides timer bug, and which exactly bug are you
>> talking about.
>>
>> Simple example - I want some app isolated on core without any timer
>> interrupts. Why do I need
>> init all odp thins and spend recourses for maintaining them?
>>
>
> I support this patch change. In my no_hz_full use-case I do need to
> mask out timer and other not needed odp init sequence and I am
> following exactly same method.
>

Reviewed-by : Santosh Shukla <santosh.shukla@linaro.org>

>
>> Best regards,
>> Maxim.
>>
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> lng-odp mailing list
>> lng-odp@lists.linaro.org
>> http://lists.linaro.org/mailman/listinfo/lng-odp
Taras Kondratiuk Aug. 4, 2014, 2:17 p.m. UTC | #5
On 08/04/2014 03:30 PM, Maxim Uvarov wrote:
> On 08/04/2014 02:36 PM, Taras Kondratiuk wrote:
>> On 08/04/2014 12:37 PM, Maxim Uvarov wrote:
>>> For some cases all layers of odp initialization is not needed
>>> and can be skipped. For example odp_timer_init() launch timer
>>> which acts each second is not needed for all applications.
>>
>> IMO bug is in a timer code. This patch just hides it.
>
> Hi Taras, it's it the same what we discussed some time ago? I supposed
> that if you don't
> need timer then you just don't initialize it. If you don't need
> scheduler, then no need to init it also.
> I don't think that this patch hides timer bug, and which exactly bug are
> you talking about.

Yes we are talking about the same bug: timer gets triggered even if
application didn't initialize it.

> Simple example - I want some app isolated on core without any timer
> interrupts. Why do I need
> init all odp thins and spend recourses for maintaining them?

There should not be a timer interrupt if application didn't call timer
API to setup one. That should be fixed first, before masking the issue
by disabling timer global init.

The patch you sent makes sense, but not in a context of this issue.
Timer bug is one thing and passing some info to init function is
completely different thing. Let's not mix them.

And regarding the patch. IMO logic should be opposite: application
should specify API sets it is going to use. Otherwise if new API set is 
added you have to change all application to disable that set.
Maxim Uvarov Aug. 4, 2014, 2:47 p.m. UTC | #6
On 08/04/2014 06:17 PM, Taras Kondratiuk wrote:
> On 08/04/2014 03:30 PM, Maxim Uvarov wrote:
>> On 08/04/2014 02:36 PM, Taras Kondratiuk wrote:
>>> On 08/04/2014 12:37 PM, Maxim Uvarov wrote:
>>>> For some cases all layers of odp initialization is not needed
>>>> and can be skipped. For example odp_timer_init() launch timer
>>>> which acts each second is not needed for all applications.
>>>
>>> IMO bug is in a timer code. This patch just hides it.
>>
>> Hi Taras, it's it the same what we discussed some time ago? I supposed
>> that if you don't
>> need timer then you just don't initialize it. If you don't need
>> scheduler, then no need to init it also.
>> I don't think that this patch hides timer bug, and which exactly bug are
>> you talking about.
>
> Yes we are talking about the same bug: timer gets triggered even if
> application didn't initialize it.
>
>> Simple example - I want some app isolated on core without any timer
>> interrupts. Why do I need
>> init all odp thins and spend recourses for maintaining them?
>
> There should not be a timer interrupt if application didn't call timer
> API to setup one. That should be fixed first, before masking the issue
> by disabling timer global init.
>
> The patch you sent makes sense, but not in a context of this issue.
> Timer bug is one thing and passing some info to init function is
> completely different thing. Let's not mix them.
ok I will reword patch description.
>
> And regarding the patch. IMO logic should be opposite: application
> should specify API sets it is going to use. Otherwise if new API set 
> is added you have to change all application to disable that set.
My logic was that default it odp_global_init(0) inits everything and we 
can customize init but adding flags.

Let's see if we change login to opposite then we can do initialization 
in different steps, like:

odp_init_global(SHM)
... do something then
odp_init_global(QUEUE)
  ...do something then
odp_init_global(SHED|TIMER)
.....

That looks reasonable. Will revert logic.

Maxim.
Santosh Shukla Aug. 4, 2014, 3:45 p.m. UTC | #7
On 4 August 2014 19:47, Taras Kondratiuk <taras.kondratiuk@linaro.org> wrote:
> On 08/04/2014 03:30 PM, Maxim Uvarov wrote:
>>
>> On 08/04/2014 02:36 PM, Taras Kondratiuk wrote:
>>>
>>> On 08/04/2014 12:37 PM, Maxim Uvarov wrote:
>>>>
>>>> For some cases all layers of odp initialization is not needed
>>>> and can be skipped. For example odp_timer_init() launch timer
>>>> which acts each second is not needed for all applications.
>>>
>>>
>>> IMO bug is in a timer code. This patch just hides it.
>>
>>
>> Hi Taras, it's it the same what we discussed some time ago? I supposed
>> that if you don't
>> need timer then you just don't initialize it. If you don't need
>> scheduler, then no need to init it also.
>> I don't think that this patch hides timer bug, and which exactly bug are
>> you talking about.
>
>
> Yes we are talking about the same bug: timer gets triggered even if
> application didn't initialize it.
>

Calling timer_init in odp_init_global func is bug? then I have
different opinion, iirc, its done for linux-generic, platform specific
can choose to avoid. Given that some specific use-case like no_hz_full
where no extra init required for linux-generic case, there we need
some configuration which enable/disable timer_init path statically,
Either by using flag or Macro ifdef format.

I still don't call it a bug But an improvement.

>
>> Simple example - I want some app isolated on core without any timer
>> interrupts. Why do I need
>> init all odp thins and spend recourses for maintaining them?
>
>
> There should not be a timer interrupt if application didn't call timer
> API to setup one. That should be fixed first, before masking the issue
> by disabling timer global init.
>
> The patch you sent makes sense, but not in a context of this issue.
> Timer bug is one thing and passing some info to init function is
> completely different thing. Let's not mix them.
>
> And regarding the patch. IMO logic should be opposite: application
> should specify API sets it is going to use. Otherwise if new API set is
> added you have to change all application to disable that set.
>

Yes, if we find masking init services in _global func painful then
application can write its own set of api's for initialization sequence
avoiding odp_init_global. a much better method. I guess.

>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
Taras Kondratiuk Aug. 4, 2014, 4:23 p.m. UTC | #8
On 08/04/2014 06:45 PM, Santosh Shukla wrote:
> On 4 August 2014 19:47, Taras Kondratiuk <taras.kondratiuk@linaro.org> wrote:
>> On 08/04/2014 03:30 PM, Maxim Uvarov wrote:
>>>
>>> On 08/04/2014 02:36 PM, Taras Kondratiuk wrote:
>>>>
>>>> On 08/04/2014 12:37 PM, Maxim Uvarov wrote:
>>>>>
>>>>> For some cases all layers of odp initialization is not needed
>>>>> and can be skipped. For example odp_timer_init() launch timer
>>>>> which acts each second is not needed for all applications.
>>>>
>>>>
>>>> IMO bug is in a timer code. This patch just hides it.
>>>
>>>
>>> Hi Taras, it's it the same what we discussed some time ago? I supposed
>>> that if you don't
>>> need timer then you just don't initialize it. If you don't need
>>> scheduler, then no need to init it also.
>>> I don't think that this patch hides timer bug, and which exactly bug are
>>> you talking about.
>>
>>
>> Yes we are talking about the same bug: timer gets triggered even if
>> application didn't initialize it.
>>
>
> Calling timer_init in odp_init_global func is bug? then I have
> different opinion, iirc, its done for linux-generic, platform specific
> can choose to avoid. Given that some specific use-case like no_hz_full
> where no extra init required for linux-generic case, there we need
> some configuration which enable/disable timer_init path statically,
> Either by using flag or Macro ifdef format.
>
> I still don't call it a bug But an improvement.

Maybe I'm missing something, but why odp_timer_init_global() registers
a timer? IMO it should set up whatever is needed to be able to register 
timer *on application request* via odp_timer_create(). Before that there 
should be no default timer interrupts.

>>> Simple example - I want some app isolated on core without any timer
>>> interrupts. Why do I need
>>> init all odp thins and spend recourses for maintaining them?
>>
>>
>> There should not be a timer interrupt if application didn't call timer
>> API to setup one. That should be fixed first, before masking the issue
>> by disabling timer global init.
>>
>> The patch you sent makes sense, but not in a context of this issue.
>> Timer bug is one thing and passing some info to init function is
>> completely different thing. Let's not mix them.
>>
>> And regarding the patch. IMO logic should be opposite: application
>> should specify API sets it is going to use. Otherwise if new API set is
>> added you have to change all application to disable that set.
>>
>
> Yes, if we find masking init services in _global func painful then
> application can write its own set of api's for initialization sequence
> avoiding odp_init_global. a much better method. I guess.

Normally odp_init_global() will initialize a vendor SDK. I'm not sure I 
understand how it can be made in a several steps under application control.
My point was to change the patch to have a single odp_init_global(), but 
change 'polarity' of flags, so flags will signal to implementation which 
sets of API application is going to use. And sure implementation may 
ignore this hints.
Santosh Shukla Aug. 4, 2014, 5:02 p.m. UTC | #9
On 4 August 2014 21:53, Taras Kondratiuk <taras.kondratiuk@linaro.org> wrote:
> On 08/04/2014 06:45 PM, Santosh Shukla wrote:
>>
>> On 4 August 2014 19:47, Taras Kondratiuk <taras.kondratiuk@linaro.org>
>> wrote:
>>>
>>> On 08/04/2014 03:30 PM, Maxim Uvarov wrote:
>>>>
>>>>
>>>> On 08/04/2014 02:36 PM, Taras Kondratiuk wrote:
>>>>>
>>>>>
>>>>> On 08/04/2014 12:37 PM, Maxim Uvarov wrote:
>>>>>>
>>>>>>
>>>>>> For some cases all layers of odp initialization is not needed
>>>>>> and can be skipped. For example odp_timer_init() launch timer
>>>>>> which acts each second is not needed for all applications.
>>>>>
>>>>>
>>>>>
>>>>> IMO bug is in a timer code. This patch just hides it.
>>>>
>>>>
>>>>
>>>> Hi Taras, it's it the same what we discussed some time ago? I supposed
>>>> that if you don't
>>>> need timer then you just don't initialize it. If you don't need
>>>> scheduler, then no need to init it also.
>>>> I don't think that this patch hides timer bug, and which exactly bug are
>>>> you talking about.
>>>
>>>
>>>
>>> Yes we are talking about the same bug: timer gets triggered even if
>>> application didn't initialize it.
>>>
>>
>> Calling timer_init in odp_init_global func is bug? then I have
>> different opinion, iirc, its done for linux-generic, platform specific
>> can choose to avoid. Given that some specific use-case like no_hz_full
>> where no extra init required for linux-generic case, there we need
>> some configuration which enable/disable timer_init path statically,
>> Either by using flag or Macro ifdef format.
>>
>> I still don't call it a bug But an improvement.
>
>
> Maybe I'm missing something, but why odp_timer_init_global() registers
> a timer? IMO it should set up whatever is needed to be able to register
> timer *on application request* via odp_timer_create(). Before that there
> should be no default timer interrupts.

You are right. It does register timer and generates interrupt in
odp_timer_init_global. Moving timer_init to timer_create api specifics
even better enhancement for application. However you could very much
discard odp_timer_init in your application by not using
odp_global_init and calling buffer,shm,queue,sched_init api in your
application. For example, IN my no_hz_full+isolation application, some
application don't need shm (and timer by default) sevices so
application writer has to decide which one to pick or drop.

Or passing a flag to odp_global_init(flag) is another way to solve the
problem Or Sticking with Macro.

>
>
>>>> Simple example - I want some app isolated on core without any timer
>>>> interrupts. Why do I need
>>>> init all odp thins and spend recourses for maintaining them?
>>>
>>>
>>>
>>> There should not be a timer interrupt if application didn't call timer
>>> API to setup one. That should be fixed first, before masking the issue
>>> by disabling timer global init.
>>>
>>> The patch you sent makes sense, but not in a context of this issue.
>>> Timer bug is one thing and passing some info to init function is
>>> completely different thing. Let's not mix them.
>>>
>>> And regarding the patch. IMO logic should be opposite: application
>>> should specify API sets it is going to use. Otherwise if new API set is
>>> added you have to change all application to disable that set.
>>>
>>
>> Yes, if we find masking init services in _global func painful then
>> application can write its own set of api's for initialization sequence
>> avoiding odp_init_global. a much better method. I guess.
>
>
> Normally odp_init_global() will initialize a vendor SDK. I'm not sure I
> understand how it can be made in a several steps under application control.

Explained above. Does it make sense to you?

> My point was to change the patch to have a single odp_init_global(), but
> change 'polarity' of flags, so flags will signal to implementation which
> sets of API application is going to use. And sure implementation may ignore
> this hints.

Right,
diff mbox

Patch

diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c
index e4a72fa..af1ff89 100644
--- a/example/generator/odp_generator.c
+++ b/example/generator/odp_generator.c
@@ -530,7 +530,7 @@  int main(int argc, char *argv[])
 	int core_count;
 
 	/* Init ODP before calling anything else */
-	if (odp_init_global()) {
+	if (odp_init_global(ODP_INIT_F_ALL)) {
 		ODP_ERR("Error: ODP global init failed.\n");
 		exit(EXIT_FAILURE);
 	}
diff --git a/example/l2fwd/odp_l2fwd.c b/example/l2fwd/odp_l2fwd.c
index e331ff2..6b6c75a 100644
--- a/example/l2fwd/odp_l2fwd.c
+++ b/example/l2fwd/odp_l2fwd.c
@@ -288,7 +288,7 @@  int main(int argc, char *argv[])
 	odp_pktio_t pktio;
 
 	/* Init ODP before calling anything else */
-	if (odp_init_global()) {
+	if (odp_init_global(ODP_INIT_F_ALL)) {
 		ODP_ERR("Error: ODP global init failed.\n");
 		exit(EXIT_FAILURE);
 	}
diff --git a/example/odp_example/odp_example.c b/example/odp_example/odp_example.c
index be96093..f6197f8 100644
--- a/example/odp_example/odp_example.c
+++ b/example/odp_example/odp_example.c
@@ -934,7 +934,7 @@  int main(int argc, char *argv[])
 
 	memset(thread_tbl, 0, sizeof(thread_tbl));
 
-	if (odp_init_global()) {
+	if (odp_init_global(ODP_INIT_F_ALL)) {
 		printf("ODP global init failed.\n");
 		return -1;
 	}
diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c
index edf8cfd..3e56453 100644
--- a/example/packet/odp_pktio.c
+++ b/example/packet/odp_pktio.c
@@ -285,7 +285,7 @@  int main(int argc, char *argv[])
 	int core_count;
 
 	/* Init ODP before calling anything else */
-	if (odp_init_global()) {
+	if (odp_init_global(ODP_INIT_F_NOTIMER)) {
 		ODP_ERR("Error: ODP global init failed.\n");
 		exit(EXIT_FAILURE);
 	}
diff --git a/example/packet_netmap/odp_pktio_netmap.c b/example/packet_netmap/odp_pktio_netmap.c
index 7d33b19..9e38607 100644
--- a/example/packet_netmap/odp_pktio_netmap.c
+++ b/example/packet_netmap/odp_pktio_netmap.c
@@ -201,7 +201,7 @@  int main(int argc, char *argv[])
 	int i;
 
 	/* Init ODP before calling anything else */
-	if (odp_init_global()) {
+	if (odp_init_global(ODP_INIT_F_NOTIMER)) {
 		ODP_ERR("Error: ODP global init failed.\n");
 		exit(EXIT_FAILURE);
 	}
diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c
index dbe0e5b..4e566bc 100644
--- a/example/timer/odp_timer_test.c
+++ b/example/timer/odp_timer_test.c
@@ -210,7 +210,7 @@  int main(int argc, char *argv[])
 
 	memset(thread_tbl, 0, sizeof(thread_tbl));
 
-	if (odp_init_global()) {
+	if (odp_init_global(ODP_INIT_F_ALL)) {
 		printf("ODP global init failed.\n");
 		return -1;
 	}
diff --git a/include/odp_init.h b/include/odp_init.h
index 490324a..cbb16e9 100644
--- a/include/odp_init.h
+++ b/include/odp_init.h
@@ -22,6 +22,13 @@  extern "C" {
 
 #include <odp_std_types.h>
 
+#define ODP_INIT_F_ALL		0
+#define ODP_INIT_F_NOSHMINIT	(1 << 0)
+#define ODP_INIT_F_NOGPOOL	(1 << 1)
+#define ODP_INIT_F_NOGQUEUE	(1 << 2)
+#define ODP_INIT_F_NOSCHEDULE	(1 << 3)
+#define ODP_INIT_F_NOPKTIO	(1 << 4)
+#define ODP_INIT_F_NOTIMER	(1 >> 5)
 
 
 
@@ -33,7 +40,7 @@  extern "C" {
  *
  * @return 0 if successful
  */
-int odp_init_global(void);
+int odp_init_global(uint8_t flags);
 
 
 /**
diff --git a/platform/linux-dpdk/odp_init.c b/platform/linux-dpdk/odp_init.c
index ecc2066..bb18237 100644
--- a/platform/linux-dpdk/odp_init.c
+++ b/platform/linux-dpdk/odp_init.c
@@ -50,7 +50,7 @@  int odp_init_dpdk(void)
 	return 0;
 }
 
-int odp_init_global(void)
+int odp_init_global(uint8_t flags)
 {
 	odp_thread_init_global();
 
@@ -61,34 +61,46 @@  int odp_init_global(void)
 		return -1;
 	}
 
-	if (odp_shm_init_global()) {
-		ODP_ERR("ODP shm init failed.\n");
-		return -1;
+	if (!(flags & ODP_INIT_F_NOSHMINIT)) {
+		if (odp_shm_init_global()) {
+			ODP_ERR("ODP shm init failed.\n");
+			return -1;
+		}
 	}
 
-	if (odp_buffer_pool_init_global()) {
-		ODP_ERR("ODP buffer pool init failed.\n");
-		return -1;
+	if (!(flags & ODP_INIT_F_NOGPOOL)) {
+		if (odp_buffer_pool_init_global()) {
+			ODP_ERR("ODP buffer pool init failed.\n");
+			return -1;
+		}
 	}
 
-	if (odp_queue_init_global()) {
-		ODP_ERR("ODP queue init failed.\n");
-		return -1;
+	if (!(flags & ODP_INIT_F_NOGQUEUE)) {
+		if (odp_queue_init_global()) {
+			ODP_ERR("ODP queue init failed.\n");
+			return -1;
+		}
 	}
 
-	if (odp_schedule_init_global()) {
-		ODP_ERR("ODP schedule init failed.\n");
-		return -1;
+	if (!(flags & ODP_INIT_F_NOSCHEDULE)) {
+		if (odp_schedule_init_global()) {
+			ODP_ERR("ODP schedule init failed.\n");
+			return -1;
+		}
 	}
 
-	if (odp_pktio_init_global()) {
-		ODP_ERR("ODP packet io init failed.\n");
-		return -1;
+	if (!(flags & ODP_INIT_F_NOPKTIO)) {
+		if (odp_pktio_init_global()) {
+			ODP_ERR("ODP packet io init failed.\n");
+			return -1;
+		}
 	}
 
-	if (odp_timer_init_global()) {
-		ODP_ERR("ODP timer init failed.\n");
-		return -1;
+	if (!(flags & ODP_INIT_F_NOTIMER)) {
+		if (odp_timer_init_global()) {
+			ODP_ERR("ODP timer init failed.\n");
+			return -1;
+		}
 	}
 
 	return 0;
diff --git a/platform/linux-generic/odp_init.c b/platform/linux-generic/odp_init.c
index d4c2eb8..16ba79a 100644
--- a/platform/linux-generic/odp_init.c
+++ b/platform/linux-generic/odp_init.c
@@ -9,40 +9,52 @@ 
 #include <odp_debug.h>
 
 
-int odp_init_global(void)
+int odp_init_global(uint8_t flags)
 {
 	odp_thread_init_global();
 
 	odp_system_info_init();
 
-	if (odp_shm_init_global()) {
-		ODP_ERR("ODP shm init failed.\n");
-		return -1;
+	if (!(flags & ODP_INIT_F_NOSHMINIT)) {
+		if (odp_shm_init_global()) {
+			ODP_ERR("ODP shm init failed.\n");
+			return -1;
+		}
 	}
 
-	if (odp_buffer_pool_init_global()) {
-		ODP_ERR("ODP buffer pool init failed.\n");
-		return -1;
+	if (!(flags & ODP_INIT_F_NOGPOOL)) {
+		if (odp_buffer_pool_init_global()) {
+			ODP_ERR("ODP buffer pool init failed.\n");
+			return -1;
+		}
 	}
 
-	if (odp_queue_init_global()) {
-		ODP_ERR("ODP queue init failed.\n");
-		return -1;
+	if (!(flags & ODP_INIT_F_NOGQUEUE)) {
+		if (odp_queue_init_global()) {
+			ODP_ERR("ODP queue init failed.\n");
+			return -1;
+		}
 	}
 
-	if (odp_schedule_init_global()) {
-		ODP_ERR("ODP schedule init failed.\n");
-		return -1;
+	if (!(flags & ODP_INIT_F_NOSCHEDULE)) {
+		if (odp_schedule_init_global()) {
+			ODP_ERR("ODP schedule init failed.\n");
+			return -1;
+		}
 	}
 
-	if (odp_pktio_init_global()) {
-		ODP_ERR("ODP packet io init failed.\n");
-		return -1;
+	if (!(flags & ODP_INIT_F_NOPKTIO)) {
+		if (odp_pktio_init_global()) {
+			ODP_ERR("ODP packet io init failed.\n");
+			return -1;
+		}
 	}
 
-	if (odp_timer_init_global()) {
-		ODP_ERR("ODP timer init failed.\n");
-		return -1;
+	if (!(flags & ODP_INIT_F_NOTIMER)) {
+		if (odp_timer_init_global()) {
+			ODP_ERR("ODP timer init failed.\n");
+			return -1;
+		}
 	}
 
 	return 0;
diff --git a/platform/linux-keystone2/odp_init.c b/platform/linux-keystone2/odp_init.c
index f832551..a11fb27 100644
--- a/platform/linux-keystone2/odp_init.c
+++ b/platform/linux-keystone2/odp_init.c
@@ -90,7 +90,7 @@  static int ti_init_hw_config(void)
 }
 
 
-int odp_init_global(void)
+int odp_init_global(uint8_t flags)
 {
 	odp_thread_init_global();
 
@@ -99,34 +99,46 @@  int odp_init_global(void)
 	ti_em_osal_core_init_global();
 	ti_init_hw_config();
 
-	if (odp_shm_init_global()) {
-		ODP_ERR("ODP shm init failed.\n");
-		return -1;
+	if (!(flags & ODP_INIT_F_NOSHMINIT)) {
+		if (odp_shm_init_global()) {
+			ODP_ERR("ODP shm init failed.\n");
+			return -1;
+		}
 	}
 
-	if (odp_buffer_pool_init_global()) {
-		ODP_ERR("ODP buffer pool init failed.\n");
-		return -1;
+	if (!(flags & ODP_INIT_F_NOGPOOL)) {
+		if (odp_buffer_pool_init_global()) {
+			ODP_ERR("ODP buffer pool init failed.\n");
+			return -1;
+		}
 	}
 
-	if (odp_queue_init_global()) {
-		ODP_ERR("ODP queue init failed.\n");
-		return -1;
+	if (!(flags & ODP_INIT_F_NOGQUEUE)) {
+		if (odp_queue_init_global()) {
+			ODP_ERR("ODP queue init failed.\n");
+			return -1;
+		}
 	}
 
-	if (odp_schedule_init_global()) {
-		ODP_ERR("ODP schedule init failed.\n");
-		return -1;
+	if (!(flags & ODP_INIT_F_NOSCHEDULE)) {
+		if (odp_schedule_init_global()) {
+			ODP_ERR("ODP schedule init failed.\n");
+			return -1;
+		}
 	}
 
-	if (odp_pktio_init_global()) {
-		ODP_ERR("ODP packet io init failed.\n");
-		return -1;
+	if (!(flags & ODP_INIT_F_NOPKTIO)) {
+		if (odp_pktio_init_global()) {
+			ODP_ERR("ODP packet io init failed.\n");
+			return -1;
+		}
 	}
 
-	if (odp_timer_init_global()) {
-		ODP_ERR("ODP timer init failed.\n");
-		return -1;
+	if (!(flags & ODP_INIT_F_NOTIMER)) {
+		if (odp_timer_init_global()) {
+			ODP_ERR("ODP timer init failed.\n");
+			return -1;
+		}
 	}
 
 	return 0;
diff --git a/test/api_test/odp_common.c b/test/api_test/odp_common.c
index 89ebd2d..dcb13ed 100644
--- a/test/api_test/odp_common.c
+++ b/test/api_test/odp_common.c
@@ -56,7 +56,7 @@  int odp_test_global_init(void)
 {
 	memset(thread_tbl, 0, sizeof(thread_tbl));
 
-	if (odp_init_global()) {
+	if (odp_init_global(ODP_INIT_F_ALL)) {
 		ODP_ERR("ODP global init failed.\n");
 		return -1;
 	}