DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] eal: allow start two dpdk with no-huge option
@ 2018-07-10 14:54 thiery.ouattara
  2018-07-10 15:00 ` Burakov, Anatoly
  0 siblings, 1 reply; 3+ messages in thread
From: thiery.ouattara @ 2018-07-10 14:54 UTC (permalink / raw)
  To: dev; +Cc: thiery.ouattara, anatoly.burakov

From: Kignelman OUATTARA <thiery.ouattara@outscale.com>

in last version (v18.02), we was using no-huge option to
start 2 dpdk instances simultanusly (for testing purpose).

but since v18.05 when we start 2 instances:
- the first dpdk app start normaly
- the 2nd can't start because LOCK_EX option is set in
  flock(fd, LOCK_EX | LOCK_NB).

So i did this patch to change LOCK_EX to LOCK_SH if no-huge
option is set.

Signed-off-by: Kignelman OUATTARA <thiery.ouattara@outscale.com>
---
 lib/librte_eal/common/eal_common_fbarray.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/librte_eal/common/eal_common_fbarray.c b/lib/librte_eal/common/eal_common_fbarray.c
index 019f84c..7a7b9af 100644
--- a/lib/librte_eal/common/eal_common_fbarray.c
+++ b/lib/librte_eal/common/eal_common_fbarray.c
@@ -414,6 +414,7 @@ struct used_mask {
 	struct used_mask *msk;
 	void *data = NULL;
 	int fd = -1;
+	int lock_opt = LOCK_EX;
 
 	if (arr == NULL) {
 		rte_errno = EINVAL;
@@ -436,6 +437,9 @@ struct used_mask {
 
 	eal_get_fbarray_path(path, sizeof(path), name);
 
+	if (internal_config.no_hugetlbfs)
+		lock_opt = LOCK_SH;
+
 	/*
 	 * Each fbarray is unique to process namespace, i.e. the filename
 	 * depends on process prefix. Try to take out a lock and see if we
@@ -447,7 +451,7 @@ struct used_mask {
 				path, strerror(errno));
 		rte_errno = errno;
 		goto fail;
-	} else if (flock(fd, LOCK_EX | LOCK_NB)) {
+	} else if (flock(fd, lock_opt | LOCK_NB)) {
 		RTE_LOG(DEBUG, EAL, "%s(): couldn't lock %s: %s\n", __func__,
 				path, strerror(errno));
 		rte_errno = EBUSY;
-- 
1.9.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] eal: allow start two dpdk with no-huge option
  2018-07-10 14:54 [dpdk-dev] [PATCH] eal: allow start two dpdk with no-huge option thiery.ouattara
@ 2018-07-10 15:00 ` Burakov, Anatoly
  2018-07-10 15:19   ` Thiery Ouattara
  0 siblings, 1 reply; 3+ messages in thread
From: Burakov, Anatoly @ 2018-07-10 15:00 UTC (permalink / raw)
  To: thiery.ouattara, dev

On 10-Jul-18 3:54 PM, thiery.ouattara@outscale.com wrote:
> From: Kignelman OUATTARA <thiery.ouattara@outscale.com>
> 
> in last version (v18.02), we was using no-huge option to
> start 2 dpdk instances simultanusly (for testing purpose).
> 
> but since v18.05 when we start 2 instances:
> - the first dpdk app start normaly
> - the 2nd can't start because LOCK_EX option is set in
>    flock(fd, LOCK_EX | LOCK_NB).
> 
> So i did this patch to change LOCK_EX to LOCK_SH if no-huge
> option is set.
> 
> Signed-off-by: Kignelman OUATTARA <thiery.ouattara@outscale.com>
> ---

Hi Kignelman,

I don't think this is safe to do. Even though hugepage memory is not 
used, the --no-huge mode still stores page segments in fbarrays, so 
while you would be able to *run* DPDK in such a scenario, the second 
process would corrupt the memory of the first.

As a proper alternative, i would suggest looking at my --in-memory mode 
patchset:

http://patches.dpdk.org/patch/40582/
http://patches.dpdk.org/patch/40583/
http://patches.dpdk.org/patch/40585/
http://patches.dpdk.org/patch/40584/
http://patches.dpdk.org/patch/40587/
http://patches.dpdk.org/patch/40586/
http://patches.dpdk.org/patch/40588/
http://patches.dpdk.org/patch/40590/
http://patches.dpdk.org/patch/40589/

This will solve the problem at its source.

-- 
Thanks,
Anatoly

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] eal: allow start two dpdk with no-huge option
  2018-07-10 15:00 ` Burakov, Anatoly
@ 2018-07-10 15:19   ` Thiery Ouattara
  0 siblings, 0 replies; 3+ messages in thread
From: Thiery Ouattara @ 2018-07-10 15:19 UTC (permalink / raw)
  To: Burakov, Anatoly; +Cc: dev

2018-07-10 17:00 GMT+02:00 Burakov, Anatoly <anatoly.burakov@intel.com>:

> On 10-Jul-18 3:54 PM, thiery.ouattara@outscale.com wrote:
>
>> From: Kignelman OUATTARA <thiery.ouattara@outscale.com>
>>
>> in last version (v18.02), we was using no-huge option to
>> start 2 dpdk instances simultanusly (for testing purpose).
>>
>> but since v18.05 when we start 2 instances:
>> - the first dpdk app start normaly
>> - the 2nd can't start because LOCK_EX option is set in
>>    flock(fd, LOCK_EX | LOCK_NB).
>>
>> So i did this patch to change LOCK_EX to LOCK_SH if no-huge
>> option is set.
>>
>> Signed-off-by: Kignelman OUATTARA <thiery.ouattara@outscale.com>
>> ---
>>
>
> Hi Kignelman,
>
> I don't think this is safe to do. Even though hugepage memory is not used,
> the --no-huge mode still stores page segments in fbarrays, so while you
> would be able to *run* DPDK in such a scenario, the second process would
> corrupt the memory of the first.
>
> As a proper alternative, i would suggest looking at my --in-memory mode
> patchset:
>
> http://patches.dpdk.org/patch/40582/
> http://patches.dpdk.org/patch/40583/
> http://patches.dpdk.org/patch/40585/
> http://patches.dpdk.org/patch/40584/
> http://patches.dpdk.org/patch/40587/
> http://patches.dpdk.org/patch/40586/
> http://patches.dpdk.org/patch/40588/
> http://patches.dpdk.org/patch/40590/
> http://patches.dpdk.org/patch/40589/
>
> This will solve the problem at its source.
>
> --
> Thanks,
> Anatoly
>

Hi Anatoly,

Thanks for your reply, i will test with your patches

Thanks,
Kignelman

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-07-10 15:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-10 14:54 [dpdk-dev] [PATCH] eal: allow start two dpdk with no-huge option thiery.ouattara
2018-07-10 15:00 ` Burakov, Anatoly
2018-07-10 15:19   ` Thiery Ouattara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).