eal/linux: enable the hugepage mem dump

Message ID 20220308094125.2716847-1-fengli@smartx.com (mailing list archive)
State Superseded, archived
Delegated to: David Marchand
Headers
Series eal/linux: enable the hugepage mem dump |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS

Commit Message

Li Feng March 8, 2022, 9:41 a.m. UTC
These hugepages include important structures. We should dump these
hugepages into a coredump file for debugging when generating a coredump.

Signed-off-by: Li Feng <fengli@smartx.com>
---
 lib/eal/linux/eal_memalloc.c | 2 ++
 1 file changed, 2 insertions(+)
  

Comments

Burakov, Anatoly March 31, 2022, 2:46 p.m. UTC | #1
On 08-Mar-22 9:41 AM, Li Feng wrote:
> These hugepages include important structures. We should dump these
> hugepages into a coredump file for debugging when generating a coredump.
> 
> Signed-off-by: Li Feng <fengli@smartx.com>
> ---
>   lib/eal/linux/eal_memalloc.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/lib/eal/linux/eal_memalloc.c b/lib/eal/linux/eal_memalloc.c
> index f8b1588cae..d7c2eb14a1 100644
> --- a/lib/eal/linux/eal_memalloc.c
> +++ b/lib/eal/linux/eal_memalloc.c
> @@ -623,6 +623,8 @@ alloc_seg(struct rte_memseg *ms, void *addr, int socket_id,
>   		goto resized;
>   	}
>   
> +	eal_mem_set_dump(va, alloc_sz, true);
> +
>   	/* In linux, hugetlb limitations, like cgroup, are
>   	 * enforced at fault time instead of mmap(), even
>   	 * with the option of MAP_POPULATE. Kernel will send

I am amicable to the idea of including allocated hugepage data in core 
dumps, but even with that assumption, i think you're setting the dump 
flag a little too early, and never cleanup if something fails down the line.

Perhaps move this to the very end of the function, after we have 
succeeded in creating a new segment?
  
Li Feng April 1, 2022, 9:11 a.m. UTC | #2
On Thu, Mar 31, 2022 at 10:47 PM Burakov, Anatoly
<anatoly.burakov@intel.com> wrote:
>
> On 08-Mar-22 9:41 AM, Li Feng wrote:
> > These hugepages include important structures. We should dump these
> > hugepages into a coredump file for debugging when generating a coredump.
> >
> > Signed-off-by: Li Feng <fengli@smartx.com>
> > ---
> >   lib/eal/linux/eal_memalloc.c | 2 ++
> >   1 file changed, 2 insertions(+)
> >
> > diff --git a/lib/eal/linux/eal_memalloc.c b/lib/eal/linux/eal_memalloc.c
> > index f8b1588cae..d7c2eb14a1 100644
> > --- a/lib/eal/linux/eal_memalloc.c
> > +++ b/lib/eal/linux/eal_memalloc.c
> > @@ -623,6 +623,8 @@ alloc_seg(struct rte_memseg *ms, void *addr, int socket_id,
> >               goto resized;
> >       }
> >
> > +     eal_mem_set_dump(va, alloc_sz, true);
> > +
> >       /* In linux, hugetlb limitations, like cgroup, are
> >        * enforced at fault time instead of mmap(), even
> >        * with the option of MAP_POPULATE. Kernel will send
>
> I am amicable to the idea of including allocated hugepage data in core
> dumps, but even with that assumption, i think you're setting the dump
> flag a little too early, and never cleanup if something fails down the line.
>
> Perhaps move this to the very end of the function, after we have
> succeeded in creating a new segment?

Done in the v2, thanks.

>
> --
> Thanks,
> Anatoly
  

Patch

diff --git a/lib/eal/linux/eal_memalloc.c b/lib/eal/linux/eal_memalloc.c
index f8b1588cae..d7c2eb14a1 100644
--- a/lib/eal/linux/eal_memalloc.c
+++ b/lib/eal/linux/eal_memalloc.c
@@ -623,6 +623,8 @@  alloc_seg(struct rte_memseg *ms, void *addr, int socket_id,
 		goto resized;
 	}
 
+	eal_mem_set_dump(va, alloc_sz, true);
+
 	/* In linux, hugetlb limitations, like cgroup, are
 	 * enforced at fault time instead of mmap(), even
 	 * with the option of MAP_POPULATE. Kernel will send