DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] librte_eal: ease init in a docker container
@ 2019-05-22 15:41 Nicolas Dichtel
  2019-05-22 15:57 ` Burakov, Anatoly
  2019-05-23  8:56 ` Burakov, Anatoly
  0 siblings, 2 replies; 9+ messages in thread
From: Nicolas Dichtel @ 2019-05-22 15:41 UTC (permalink / raw)
  To: dev; +Cc: Anatoly Burakov, Nicolas Dichtel, Olivier Matz, Didier Pallard

move_pages() is only used to get the numa node id, but this function
is not allowed by default in docker (it needs CAP_SYS_NICE and an update of
the seccomp profile).
get_mempolicy() also requires CAP_SYS_NICE but doesn't need any change in
the default seccomp profile.

Note that the returned value of move_pages() was not checked, thus some
errors could be hidden (if the requested id was 0).

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Reviewed-by: Olivier Matz <olivier.matz@6wind.com>
Reviewed-by: Didier Pallard <didier.pallard@6wind.com>
---
 lib/librte_eal/linux/eal/eal_memalloc.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/lib/librte_eal/linux/eal/eal_memalloc.c b/lib/librte_eal/linux/eal/eal_memalloc.c
index 1e9ebb86dd1b..438faa0ab168 100644
--- a/lib/librte_eal/linux/eal/eal_memalloc.c
+++ b/lib/librte_eal/linux/eal/eal_memalloc.c
@@ -600,9 +600,13 @@ alloc_seg(struct rte_memseg *ms, void *addr, int socket_id,
 	}
 
 #ifdef RTE_EAL_NUMA_AWARE_HUGEPAGES
-	move_pages(getpid(), 1, &addr, NULL, &cur_socket_id, 0);
-
-	if (cur_socket_id != socket_id) {
+	ret = get_mempolicy(&cur_socket_id, NULL, 0, addr,
+			    MPOL_F_NODE | MPOL_F_ADDR);
+	if (ret < 0) {
+		RTE_LOG(DEBUG, EAL, "%s(): get_mempolicy: %s\n",
+			__func__, strerror(errno));
+		goto mapped;
+	} else if (cur_socket_id != socket_id) {
 		RTE_LOG(DEBUG, EAL,
 				"%s(): allocation happened on wrong socket (wanted %d, got %d)\n",
 			__func__, socket_id, cur_socket_id);
-- 
2.21.0


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

* Re: [dpdk-dev] [PATCH] librte_eal: ease init in a docker container
  2019-05-22 15:41 [dpdk-dev] [PATCH] librte_eal: ease init in a docker container Nicolas Dichtel
@ 2019-05-22 15:57 ` Burakov, Anatoly
  2019-05-22 16:08   ` Nicolas Dichtel
  2019-05-23  8:56 ` Burakov, Anatoly
  1 sibling, 1 reply; 9+ messages in thread
From: Burakov, Anatoly @ 2019-05-22 15:57 UTC (permalink / raw)
  To: Nicolas Dichtel, dev; +Cc: Olivier Matz, Didier Pallard

On 22-May-19 4:41 PM, Nicolas Dichtel wrote:
> move_pages() is only used to get the numa node id, but this function
> is not allowed by default in docker (it needs CAP_SYS_NICE and an update of
> the seccomp profile).
> get_mempolicy() also requires CAP_SYS_NICE but doesn't need any change in
> the default seccomp profile.
> 
> Note that the returned value of move_pages() was not checked, thus some
> errors could be hidden (if the requested id was 0).
> 
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> Reviewed-by: Olivier Matz <olivier.matz@6wind.com>
> Reviewed-by: Didier Pallard <didier.pallard@6wind.com>
> ---

I can see the check for move_pages and it's a good fix, but what is the 
relation to docker init here? The patch by itself only enables handling 
of move_pages() failure and adds nothing else. The commit message 
doesn't match the patch in question IMO.

Also, Cc: stable and Fixes: ?

-- 
Thanks,
Anatoly

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

* Re: [dpdk-dev] [PATCH] librte_eal: ease init in a docker container
  2019-05-22 15:57 ` Burakov, Anatoly
@ 2019-05-22 16:08   ` Nicolas Dichtel
  2019-05-23  8:48     ` Burakov, Anatoly
  0 siblings, 1 reply; 9+ messages in thread
From: Nicolas Dichtel @ 2019-05-22 16:08 UTC (permalink / raw)
  To: Burakov, Anatoly, dev; +Cc: Olivier Matz, Didier Pallard


Le 22/05/2019 à 17:57, Burakov, Anatoly a écrit :
> On 22-May-19 4:41 PM, Nicolas Dichtel wrote:
>> move_pages() is only used to get the numa node id, but this function
>> is not allowed by default in docker (it needs CAP_SYS_NICE and an update of
>> the seccomp profile).
>> get_mempolicy() also requires CAP_SYS_NICE but doesn't need any change in
>> the default seccomp profile.
>>
>> Note that the returned value of move_pages() was not checked, thus some
>> errors could be hidden (if the requested id was 0).
>>
>> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
>> Reviewed-by: Olivier Matz <olivier.matz@6wind.com>
>> Reviewed-by: Didier Pallard <didier.pallard@6wind.com>
>> ---
> 
> I can see the check for move_pages and it's a good fix, but what is the relation
> to docker init here? The patch by itself only enables handling of move_pages()
> failure and adds nothing else. The commit message doesn't match the patch in
> question IMO.
I'm not sure to understand your comment. The call to move_pages() is replaced by
a call to get_mempolicy().
What am I missing?


Regards,
Nicolas

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

* Re: [dpdk-dev] [PATCH] librte_eal: ease init in a docker container
  2019-05-22 16:08   ` Nicolas Dichtel
@ 2019-05-23  8:48     ` Burakov, Anatoly
  0 siblings, 0 replies; 9+ messages in thread
From: Burakov, Anatoly @ 2019-05-23  8:48 UTC (permalink / raw)
  To: nicolas.dichtel, dev; +Cc: Olivier Matz, Didier Pallard

On 22-May-19 5:08 PM, Nicolas Dichtel wrote:
> 
> Le 22/05/2019 à 17:57, Burakov, Anatoly a écrit :
>> On 22-May-19 4:41 PM, Nicolas Dichtel wrote:
>>> move_pages() is only used to get the numa node id, but this function
>>> is not allowed by default in docker (it needs CAP_SYS_NICE and an update of
>>> the seccomp profile).
>>> get_mempolicy() also requires CAP_SYS_NICE but doesn't need any change in
>>> the default seccomp profile.
>>>
>>> Note that the returned value of move_pages() was not checked, thus some
>>> errors could be hidden (if the requested id was 0).
>>>
>>> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
>>> Reviewed-by: Olivier Matz <olivier.matz@6wind.com>
>>> Reviewed-by: Didier Pallard <didier.pallard@6wind.com>
>>> ---
>>
>> I can see the check for move_pages and it's a good fix, but what is the relation
>> to docker init here? The patch by itself only enables handling of move_pages()
>> failure and adds nothing else. The commit message doesn't match the patch in
>> question IMO.
> I'm not sure to understand your comment. The call to move_pages() is replaced by
> a call to get_mempolicy().
> What am I missing?
> 

Oh, apologies, i misread the patch. It is i who was missing something :)

> 
> Regards,
> Nicolas
> 


-- 
Thanks,
Anatoly

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

* Re: [dpdk-dev] [PATCH] librte_eal: ease init in a docker container
  2019-05-22 15:41 [dpdk-dev] [PATCH] librte_eal: ease init in a docker container Nicolas Dichtel
  2019-05-22 15:57 ` Burakov, Anatoly
@ 2019-05-23  8:56 ` Burakov, Anatoly
  2019-05-23  9:00   ` David Marchand
  1 sibling, 1 reply; 9+ messages in thread
From: Burakov, Anatoly @ 2019-05-23  8:56 UTC (permalink / raw)
  To: Nicolas Dichtel, dev; +Cc: Olivier Matz, Didier Pallard

On 22-May-19 4:41 PM, Nicolas Dichtel wrote:
> move_pages() is only used to get the numa node id, but this function
> is not allowed by default in docker (it needs CAP_SYS_NICE and an update of
> the seccomp profile).
> get_mempolicy() also requires CAP_SYS_NICE but doesn't need any change in
> the default seccomp profile.
> 
> Note that the returned value of move_pages() was not checked, thus some
> errors could be hidden (if the requested id was 0).
> 
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> Reviewed-by: Olivier Matz <olivier.matz@6wind.com>
> Reviewed-by: Didier Pallard <didier.pallard@6wind.com>
> ---

Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>

Still, should at least specify Cc: stable, if not Fixes tag too (since 
ignoring return value of move_pages() is technically a bug).

-- 
Thanks,
Anatoly

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

* Re: [dpdk-dev] [PATCH] librte_eal: ease init in a docker container
  2019-05-23  8:56 ` Burakov, Anatoly
@ 2019-05-23  9:00   ` David Marchand
  2019-05-23  9:52     ` [dpdk-dev] [PATCH v2] mem: " Nicolas Dichtel
  0 siblings, 1 reply; 9+ messages in thread
From: David Marchand @ 2019-05-23  9:00 UTC (permalink / raw)
  To: Burakov, Anatoly; +Cc: Nicolas Dichtel, dev, Olivier Matz, Didier Pallard

s/librte_eal/mem/ for the title prefix.

On Thu, May 23, 2019 at 10:56 AM Burakov, Anatoly <anatoly.burakov@intel.com>
wrote:

> On 22-May-19 4:41 PM, Nicolas Dichtel wrote:
> > move_pages() is only used to get the numa node id, but this function
> > is not allowed by default in docker (it needs CAP_SYS_NICE and an update
> of
> > the seccomp profile).
> > get_mempolicy() also requires CAP_SYS_NICE but doesn't need any change in
> > the default seccomp profile.
> >
> > Note that the returned value of move_pages() was not checked, thus some
> > errors could be hidden (if the requested id was 0).
> >
> > Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> > Reviewed-by: Olivier Matz <olivier.matz@6wind.com>
> > Reviewed-by: Didier Pallard <didier.pallard@6wind.com>
> > ---
>
> Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
>
> Still, should at least specify Cc: stable, if not Fixes tag too (since
> ignoring return value of move_pages() is technically a bug).
>

+1
At first I was wondering if we should separate the fix from the
enhancement, but I suppose backporting both things as one patch is fine too.


-- 
David Marchand

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

* [dpdk-dev] [PATCH v2] mem: ease init in a docker container
  2019-05-23  9:00   ` David Marchand
@ 2019-05-23  9:52     ` Nicolas Dichtel
  2019-05-23 14:29       ` [dpdk-dev] [dpdk-stable] " David Marchand
  0 siblings, 1 reply; 9+ messages in thread
From: Nicolas Dichtel @ 2019-05-23  9:52 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Nicolas Dichtel, stable, Olivier Matz, Didier Pallard

move_pages() is only used to get the numa node id, but this function
is not allowed by default in docker (it needs CAP_SYS_NICE and an update of
the seccomp profile).
get_mempolicy() also requires CAP_SYS_NICE but doesn't need any change in
the default seccomp profile.

Note that the returned value of move_pages() was not checked, thus some
errors could be hidden (if the requested id was 0).

Cc: stable@dpdk.org
Fixes: 582bed1e1d1d ("mem: support mapping hugepages at runtime")
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Reviewed-by: Olivier Matz <olivier.matz@6wind.com>
Reviewed-by: Didier Pallard <didier.pallard@6wind.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
---

v2: add fixes tag + cc stable
    fix title prefix

 lib/librte_eal/linux/eal/eal_memalloc.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/lib/librte_eal/linux/eal/eal_memalloc.c b/lib/librte_eal/linux/eal/eal_memalloc.c
index 1e9ebb86dd1b..438faa0ab168 100644
--- a/lib/librte_eal/linux/eal/eal_memalloc.c
+++ b/lib/librte_eal/linux/eal/eal_memalloc.c
@@ -600,9 +600,13 @@ alloc_seg(struct rte_memseg *ms, void *addr, int socket_id,
 	}
 
 #ifdef RTE_EAL_NUMA_AWARE_HUGEPAGES
-	move_pages(getpid(), 1, &addr, NULL, &cur_socket_id, 0);
-
-	if (cur_socket_id != socket_id) {
+	ret = get_mempolicy(&cur_socket_id, NULL, 0, addr,
+			    MPOL_F_NODE | MPOL_F_ADDR);
+	if (ret < 0) {
+		RTE_LOG(DEBUG, EAL, "%s(): get_mempolicy: %s\n",
+			__func__, strerror(errno));
+		goto mapped;
+	} else if (cur_socket_id != socket_id) {
 		RTE_LOG(DEBUG, EAL,
 				"%s(): allocation happened on wrong socket (wanted %d, got %d)\n",
 			__func__, socket_id, cur_socket_id);
-- 
2.21.0


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

* Re: [dpdk-dev] [dpdk-stable] [PATCH v2] mem: ease init in a docker container
  2019-05-23  9:52     ` [dpdk-dev] [PATCH v2] mem: " Nicolas Dichtel
@ 2019-05-23 14:29       ` David Marchand
  2019-06-04 11:05         ` Thomas Monjalon
  0 siblings, 1 reply; 9+ messages in thread
From: David Marchand @ 2019-05-23 14:29 UTC (permalink / raw)
  To: Nicolas Dichtel
  Cc: dev, Anatoly Burakov, dpdk stable, Olivier Matz, Didier Pallard

On Thu, May 23, 2019 at 11:53 AM Nicolas Dichtel <nicolas.dichtel@6wind.com>
wrote:

> move_pages() is only used to get the numa node id, but this function
> is not allowed by default in docker (it needs CAP_SYS_NICE and an update of
> the seccomp profile).
> get_mempolicy() also requires CAP_SYS_NICE but doesn't need any change in
> the default seccomp profile.
>
> Note that the returned value of move_pages() was not checked, thus some
> errors could be hidden (if the requested id was 0).
>
> Cc: stable@dpdk.org
> Fixes: 582bed1e1d1d ("mem: support mapping hugepages at runtime")
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> Reviewed-by: Olivier Matz <olivier.matz@6wind.com>
> Reviewed-by: Didier Pallard <didier.pallard@6wind.com>
> Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
> ---
>
> v2: add fixes tag + cc stable
>     fix title prefix
>
>  lib/librte_eal/linux/eal/eal_memalloc.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/lib/librte_eal/linux/eal/eal_memalloc.c
> b/lib/librte_eal/linux/eal/eal_memalloc.c
> index 1e9ebb86dd1b..438faa0ab168 100644
> --- a/lib/librte_eal/linux/eal/eal_memalloc.c
> +++ b/lib/librte_eal/linux/eal/eal_memalloc.c
> @@ -600,9 +600,13 @@ alloc_seg(struct rte_memseg *ms, void *addr, int
> socket_id,
>         }
>
>  #ifdef RTE_EAL_NUMA_AWARE_HUGEPAGES
> -       move_pages(getpid(), 1, &addr, NULL, &cur_socket_id, 0);
> -
> -       if (cur_socket_id != socket_id) {
> +       ret = get_mempolicy(&cur_socket_id, NULL, 0, addr,
> +                           MPOL_F_NODE | MPOL_F_ADDR);
> +       if (ret < 0) {
> +               RTE_LOG(DEBUG, EAL, "%s(): get_mempolicy: %s\n",
> +                       __func__, strerror(errno));
> +               goto mapped;
> +       } else if (cur_socket_id != socket_id) {
>                 RTE_LOG(DEBUG, EAL,
>                                 "%s(): allocation happened on wrong socket
> (wanted %d, got %d)\n",
>                         __func__, socket_id, cur_socket_id);
> --
> 2.21.0
>
>
Reviewed-by: David Marchand <david.marchand@redhat.com>

-- 
David Marchand

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

* Re: [dpdk-dev] [dpdk-stable] [PATCH v2] mem: ease init in a docker container
  2019-05-23 14:29       ` [dpdk-dev] [dpdk-stable] " David Marchand
@ 2019-06-04 11:05         ` Thomas Monjalon
  0 siblings, 0 replies; 9+ messages in thread
From: Thomas Monjalon @ 2019-06-04 11:05 UTC (permalink / raw)
  To: Nicolas Dichtel
  Cc: stable, David Marchand, dev, Anatoly Burakov, Olivier Matz,
	Didier Pallard

23/05/2019 16:29, David Marchand:
> On Thu, May 23, 2019 at 11:53 AM Nicolas Dichtel <nicolas.dichtel@6wind.com>
> wrote:
> 
> > move_pages() is only used to get the numa node id, but this function
> > is not allowed by default in docker (it needs CAP_SYS_NICE and an update of
> > the seccomp profile).
> > get_mempolicy() also requires CAP_SYS_NICE but doesn't need any change in
> > the default seccomp profile.
> >
> > Note that the returned value of move_pages() was not checked, thus some
> > errors could be hidden (if the requested id was 0).
> >
> > Cc: stable@dpdk.org
> > Fixes: 582bed1e1d1d ("mem: support mapping hugepages at runtime")
> > Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> > Reviewed-by: Olivier Matz <olivier.matz@6wind.com>
> > Reviewed-by: Didier Pallard <didier.pallard@6wind.com>
> > Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
> Reviewed-by: David Marchand <david.marchand@redhat.com>

Applied, thanks Nico



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

end of thread, other threads:[~2019-06-04 11:05 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-22 15:41 [dpdk-dev] [PATCH] librte_eal: ease init in a docker container Nicolas Dichtel
2019-05-22 15:57 ` Burakov, Anatoly
2019-05-22 16:08   ` Nicolas Dichtel
2019-05-23  8:48     ` Burakov, Anatoly
2019-05-23  8:56 ` Burakov, Anatoly
2019-05-23  9:00   ` David Marchand
2019-05-23  9:52     ` [dpdk-dev] [PATCH v2] mem: " Nicolas Dichtel
2019-05-23 14:29       ` [dpdk-dev] [dpdk-stable] " David Marchand
2019-06-04 11:05         ` Thomas Monjalon

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