[PATCH v3] vhost: exclude VM hugepages from coredumps

Maxime Coquelin maxime.coquelin at redhat.com
Fri Feb 10 16:59:18 CET 2023


Thanks David for the report.

On 2/10/23 16:53, David Marchand wrote:
> Hello Mike,
> 
> On Wed, Dec 7, 2022 at 5:54 PM Mike Pattrick <mkp at redhat.com> wrote:
>>
>> Currently if an application wants to include shared hugepages in
>> coredumps in conjunction with the vhost library, the coredump will be
>> larger than expected and include unneeded virtual machine memory.
>>
>> This patch will mark all vhost huge pages as DONTDUMP, except for some
>> select pages used by DPDK.
>>
>> Signed-off-by: Mike Pattrick <mkp at redhat.com>
> 
> I noticed the following warnings today on my f37 kernel, while running
> a vhost-user/virtio-user testpmd setup on next-virtio branch.
> Linux dmarchan 6.1.9-200.fc37.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Feb  2
> 00:21:48 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
> My system has 2M hugepages, only.

FYI, I don't see it on my system which is using 2MB hugepages too:
Linux max-t490s 6.1.9-100.fc36.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Feb  2 
03:27:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Almost the same Kernel BTW.

> 
> $ rm vhost-net; strace -e trace=madvise -f
> ./build-clang/app/dpdk-testpmd --in-memory --no-pci
> --vdev=net_vhost0,iface=./vhost-net,client=1 -- -i
> 
> $ ./build-clang/app/dpdk-testpmd --in-memory --single-file-segment
> --no-pci --vdev
> 'net_virtio_user0,mac=00:01:02:03:04:05,path=./vhost-net,server=1'  --
> -i
> 
> Then, on the "vhost side" testpmd:
> ...
> VHOST_CONFIG: (./vhost-net) read message VHOST_USER_SET_VRING_NUM
> VHOST_CONFIG: (./vhost-net) read message VHOST_USER_SET_VRING_BASE
> VHOST_CONFIG: (./vhost-net) vring base idx:0 last_used_idx:0 last_avail_idx:0.
> VHOST_CONFIG: (./vhost-net) read message VHOST_USER_SET_VRING_ADDR
> VHOST_CONFIG: (./vhost-net) read message VHOST_USER_SET_VRING_KICK
> VHOST_CONFIG: (./vhost-net) vring kick idx:0 file:391
> [pid 59565] madvise(0x7fa6d8da4000, 2052, MADV_DODUMP) = -1 EINVAL
> (Invalid argument)
> VHOST_CONFIG: could not set coredump preference (Invalid argument).
> [pid 59565] madvise(0x7fa6d8da5000, 2052, MADV_DODUMP) = -1 EINVAL
> (Invalid argument)
> VHOST_CONFIG: could not set coredump preference (Invalid argument).
> [pid 59565] madvise(0x7fa6d8da6000, 2052, MADV_DODUMP) = -1 EINVAL
> (Invalid argument)
> VHOST_CONFIG: could not set coredump preference (Invalid argument).
> VHOST_CONFIG: (./vhost-net) read message VHOST_USER_SET_VRING_NUM
> VHOST_CONFIG: (./vhost-net) read message VHOST_USER_SET_VRING_BASE
> 
> Looking at the whole trace, only madvise calls with MADV_DODUMP (with
> all of them for a 2052 size) fail.
> 
> I did not investigate further.
> Could you have a look please?
> 
> 

Maxime



More information about the dev mailing list