From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id D1213A04FA;
	Thu,  6 Feb 2020 08:52:27 +0100 (CET)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 129B41C0B5;
	Thu,  6 Feb 2020 08:52:27 +0100 (CET)
Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com
 [209.85.221.47]) by dpdk.org (Postfix) with ESMTP id 99C3D1C036
 for <dev@dpdk.org>; Thu,  6 Feb 2020 08:52:25 +0100 (CET)
Received: by mail-wr1-f47.google.com with SMTP id w15so5911195wru.4
 for <dev@dpdk.org>; Wed, 05 Feb 2020 23:52:25 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind.com; s=google;
 h=date:from:to:cc:subject:message-id:references:mime-version
 :content-disposition:in-reply-to:user-agent;
 bh=S7JXIqEu9KC16hwi3Ry/rmw7D6aYnqwv1w5NA6fnJtQ=;
 b=MSAWJOcDZ7pefTan+BldsxBDi4dU33/OGnXVIb24RKyADSyZpttDmgdI4cQ+Ln333i
 /0grQI0EmrMj+s3dHBj4t4BmVo9neTw/GGp7+mmPrDqCm29X9Cr4WKKRI0BLk8nmjMty
 wbKS2mjWFZj89eQs2MDMin0wGTeeMizKnCI9CbozNV8ObeQUgB5g9MSKrCNG7wqoifC9
 vXmduWFGNGQYo2Qrr2nMFlLOCT7PDUHkNiZqPF2+fQHgLD0bOYGwo+w06xS8aMzBK16j
 NOgI+cEwJBmp49qsDT9ZbUX0Jb6JdTxJ0sPsPoMWsUAmpOaBYiTNqDKKxk6UHdCJTvRg
 6j1g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:date:from:to:cc:subject:message-id:references
 :mime-version:content-disposition:in-reply-to:user-agent;
 bh=S7JXIqEu9KC16hwi3Ry/rmw7D6aYnqwv1w5NA6fnJtQ=;
 b=NpdrXgv47e1JkCloJNZjzs8UgP+AB9Tpj2XEodS/G0qIpW4uXGTb3nap71hC5qj3uO
 eWCKpp60GkWKvlj2OBCITxjd4ZcTSeKDDqY1afmfZZqd/LiJ29ge0z4vGKTjvoaTJ286
 4ub5B+WTejqlc2xScQd01MwDYc8LWDvQGMQxLyrwOKNGSZGoEi6TmlJDkfe4fOGvhqGV
 9mO7NDYnGgL/hLENGncfn/ecuSbz7qdu31vp+z1htoL0o7o5KeCwZZ92Xhoc/Oazx/8z
 L0F+yAr+U3CsuyniEcRho1h1FqYKQCuvH0lD0H4ke4KccZlEXMB8mtT0WMBaW0rP97HW
 tpNw==
X-Gm-Message-State: APjAAAVC9eWzD8kN9T/CJM/g7U3v6hk3zg5Hdtb2NTn0KzMQBsN8WN3k
 spMD9ZfPy3T1/YB0Lncw8vSPNg==
X-Google-Smtp-Source: APXvYqzZgCeCu+/m7WDn5YBlEYW+Vu83QHNPgQRh9Z+DKp5NFwrEXW4hEmWk8L0CpbaPfHRz2P7p5Q==
X-Received: by 2002:a5d:6451:: with SMTP id d17mr2340317wrw.255.1580975545005; 
 Wed, 05 Feb 2020 23:52:25 -0800 (PST)
Received: from 6wind.com (2a01cb0c0005a600345636f7e65ed1a0.ipv6.abo.wanadoo.fr.
 [2a01:cb0c:5:a600:3456:36f7:e65e:d1a0])
 by smtp.gmail.com with ESMTPSA id c141sm2695767wme.41.2020.02.05.23.52.24
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 05 Feb 2020 23:52:24 -0800 (PST)
Date: Thu, 6 Feb 2020 08:52:23 +0100
From: Olivier Matz <olivier.matz@6wind.com>
To: Slava Ovsiienko <viacheslavo@mellanox.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>, Matan Azrad <matan@mellanox.com>,
 Raslan Darawsheh <rasland@mellanox.com>,
 Ori Kam <orika@mellanox.com>, Shahaf Shuler <shahafs@mellanox.com>,
 "stephen@networkplumber.org" <stephen@networkplumber.org>,
 "thomas@mellanox.net" <thomas@mellanox.net>
Message-ID: <20200206075223.GL22738@platinum>
References: <AM4PR05MB32657F4EC029471A22542B6FD2050@AM4PR05MB3265.eurprd05.prod.outlook.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <AM4PR05MB32657F4EC029471A22542B6FD2050@AM4PR05MB3265.eurprd05.prod.outlook.com>
User-Agent: Mutt/1.10.1 (2018-07-13)
Subject: Re: [dpdk-dev] app/test: unit test problem with testing mbuf in
 forked child process
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

Hi Slava,

On Wed, Jan 29, 2020 at 12:31:35PM +0000, Slava Ovsiienko wrote:
> While working on the unit test for the mbuf with pinned external buffers I found that:
> app/test/test_mbuf.c:
> - test_failing_mbuf_sanity_check()
>   - verify_mbuf_check_panics(buf)
>     - fork()
>       - child process()
> 
> Does not work (either over regular mbufs, not pinned ones) in correct way.
> The mbuf being tested is not mapped (in huge page) to child process and it always completes with seg fault.
> The question - is this problem of my setup, or did we change the memory mapping model
> and this unit test should be updated?

I tried to reproduce the issue, but in my case it looks it's working.
I added some prints in rte_mbuf_sanity_check() and rte_mbuf_check().
Here is the log on my platform:


# cat /sys/devices/system/node/node1/hugepages/hugepages-2048kB/nr_hugepages
512

# ./devtools/test-build.sh -s -v -j16 x86_64-native-linuxapp-gcc
[...]
# ./x86_64-native-linuxapp-gcc/app/test
EAL: Detected 24 lcore(s)
EAL: Detected 2 NUMA nodes
EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
EAL: Selected IOVA mode 'PA'
EAL: No free hugepages reported in hugepages-2048kB
EAL: No available hugepages reported in hugepages-1048576kB
EAL: Probing VFIO support...
EAL: PCI device 0000:01:00.0 on NUMA socket -1
EAL:   Invalid NUMA socket, default to 0
EAL:   probe driver: 8086:10a7 net_e1000_igb
EAL: PCI device 0000:01:00.1 on NUMA socket -1
EAL:   Invalid NUMA socket, default to 0
EAL:   probe driver: 8086:10a7 net_e1000_igb
EAL: PCI device 0000:04:00.0 on NUMA socket -1
EAL:   Invalid NUMA socket, default to 0
EAL:   probe driver: 8086:10fb net_ixgbe
EAL: PCI device 0000:04:00.1 on NUMA socket -1
EAL:   Invalid NUMA socket, default to 0
EAL:   probe driver: 8086:10fb net_ixgbe
APP: HPET is not enabled, using TSC as default timer
RTE>>mbuf_autotest
[...]
Now checking for error conditions
rte_mbuf_sanity_check((nil))
rte_mbuf_check((nil)):188
PANIC in rte_mbuf_sanity_check():
mbuf is NULL
13: [./x86_64-native-linuxapp-gcc/app/test(_start+0x2a) [0x555cc9791a1a]]
12: [/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7) [0x7feb31e00b97]]
11: [./x86_64-native-linuxapp-gcc/app/test(main+0x3be) [0x555cc96d868e]]
10: [./x86_64-native-linuxapp-gcc/app/test(cmdline_interact+0x3b) [0x555cc9c07f9b]]
9: [./x86_64-native-linuxapp-gcc/app/test(+0x6299e0) [0x555cc9c079e0]]
8: [./x86_64-native-linuxapp-gcc/app/test(rdline_char_in+0x9d1) [0x555cc9c0b4a1]]
7: [./x86_64-native-linuxapp-gcc/app/test(+0x629ce0) [0x555cc9c07ce0]]
6: [./x86_64-native-linuxapp-gcc/app/test(cmdline_parse+0x328) [0x555cc9c08ce8]]
5: [./x86_64-native-linuxapp-gcc/app/test(+0x1b3b33) [0x555cc9791b33]]
4: [./x86_64-native-linuxapp-gcc/app/test(+0x24b12c) [0x555cc982912c]]
3: [./x86_64-native-linuxapp-gcc/app/test(rte_mbuf_sanity_check+0x130) [0x555cc9b72fa0]]
2: [./x86_64-native-linuxapp-gcc/app/test(__rte_panic+0xbd) [0x555cc96c8a62]]
1: [./x86_64-native-linuxapp-gcc/app/test(rte_dump_stack+0x2e) [0x555cc9be749e]]
rte_mbuf_sanity_check(0x7ffdf4c53f00)
rte_mbuf_check(0x7ffdf4c53f00):188
rte_mbuf_check(0x7ffdf4c53f00):194
PANIC in rte_mbuf_sanity_check():
bad mbuf pool
13: [./x86_64-native-linuxapp-gcc/app/test(_start+0x2a) [0x555cc9791a1a]]
12: [/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7) [0x7feb31e00b97]]
11: [./x86_64-native-linuxapp-gcc/app/test(main+0x3be) [0x555cc96d868e]]
10: [./x86_64-native-linuxapp-gcc/app/test(cmdline_interact+0x3b) [0x555cc9c07f9b]]
9: [./x86_64-native-linuxapp-gcc/app/test(+0x6299e0) [0x555cc9c079e0]]
8: [./x86_64-native-linuxapp-gcc/app/test(rdline_char_in+0x9d1) [0x555cc9c0b4a1]]
7: [./x86_64-native-linuxapp-gcc/app/test(+0x629ce0) [0x555cc9c07ce0]]
6: [./x86_64-native-linuxapp-gcc/app/test(cmdline_parse+0x328) [0x555cc9c08ce8]]
5: [./x86_64-native-linuxapp-gcc/app/test(+0x1b3b33) [0x555cc9791b33]]
4: [./x86_64-native-linuxapp-gcc/app/test(+0x24b149) [0x555cc9829149]]
3: [./x86_64-native-linuxapp-gcc/app/test(rte_mbuf_sanity_check+0x130) [0x555cc9b72fa0]]
2: [./x86_64-native-linuxapp-gcc/app/test(__rte_panic+0xbd) [0x555cc96c8a62]]
1: [./x86_64-native-linuxapp-gcc/app/test(rte_dump_stack+0x2e) [0x555cc9be749e]]
rte_mbuf_sanity_check(0x7ffdf4c53f00)
rte_mbuf_check(0x7ffdf4c53f00):188
rte_mbuf_check(0x7ffdf4c53f00):194
PANIC in rte_mbuf_sanity_check():
bad IO addr
13: [./x86_64-native-linuxapp-gcc/app/test(_start+0x2a) [0x555cc9791a1a]]
12: [/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7) [0x7feb31e00b97]]
11: [./x86_64-native-linuxapp-gcc/app/test(main+0x3be) [0x555cc96d868e]]
10: [./x86_64-native-linuxapp-gcc/app/test(cmdline_interact+0x3b) [0x555cc9c07f9b]]
9: [./x86_64-native-linuxapp-gcc/app/test(+0x6299e0) [0x555cc9c079e0]]
8: [./x86_64-native-linuxapp-gcc/app/test(rdline_char_in+0x9d1) [0x555cc9c0b4a1]]
7: [./x86_64-native-linuxapp-gcc/app/test(+0x629ce0) [0x555cc9c07ce0]]
6: [./x86_64-native-linuxapp-gcc/app/test(cmdline_parse+0x328) [0x555cc9c08ce8]]
5: [./x86_64-native-linuxapp-gcc/app/test(+0x1b3b33) [0x555cc9791b33]]
4: [./x86_64-native-linuxapp-gcc/app/test(+0x24b149) [0x555cc9829149]]
3: [./x86_64-native-linuxapp-gcc/app/test(rte_mbuf_sanity_check+0x130) [0x555cc9b72fa0]]
2: [./x86_64-native-linuxapp-gcc/app/test(__rte_panic+0xbd) [0x555cc96c8a62]]
1: [./x86_64-native-linuxapp-gcc/app/test(rte_dump_stack+0x2e) [0x555cc9be749e]]
rte_mbuf_sanity_check(0x7ffdf4c53f00)
rte_mbuf_check(0x7ffdf4c53f00):188
rte_mbuf_check(0x7ffdf4c53f00):194
PANIC in rte_mbuf_sanity_check():
bad virt addr
13: [./x86_64-native-linuxapp-gcc/app/test(_start+0x2a) [0x555cc9791a1a]]
12: [/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7) [0x7feb31e00b97]]
11: [./x86_64-native-linuxapp-gcc/app/test(main+0x3be) [0x555cc96d868e]]
10: [./x86_64-native-linuxapp-gcc/app/test(cmdline_interact+0x3b) [0x555cc9c07f9b]]
9: [./x86_64-native-linuxapp-gcc/app/test(+0x6299e0) [0x555cc9c079e0]]
8: [./x86_64-native-linuxapp-gcc/app/test(rdline_char_in+0x9d1) [0x555cc9c0b4a1]]
7: [./x86_64-native-linuxapp-gcc/app/test(+0x629ce0) [0x555cc9c07ce0]]
6: [./x86_64-native-linuxapp-gcc/app/test(cmdline_parse+0x328) [0x555cc9c08ce8]]
5: [./x86_64-native-linuxapp-gcc/app/test(+0x1b3b33) [0x555cc9791b33]]
4: [./x86_64-native-linuxapp-gcc/app/test(+0x24b149) [0x555cc9829149]]
3: [./x86_64-native-linuxapp-gcc/app/test(rte_mbuf_sanity_check+0x130) [0x555cc9b72fa0]]
2: [./x86_64-native-linuxapp-gcc/app/test(__rte_panic+0xbd) [0x555cc96c8a62]]
1: [./x86_64-native-linuxapp-gcc/app/test(rte_dump_stack+0x2e) [0x555cc9be749e]]
rte_mbuf_sanity_check(0x7ffdf4c53f00)
rte_mbuf_check(0x7ffdf4c53f00):188
rte_mbuf_check(0x7ffdf4c53f00):194
rte_mbuf_check(0x7ffdf4c53f00):209
PANIC in rte_mbuf_sanity_check():
bad ref cnt
13: [./x86_64-native-linuxapp-gcc/app/test(_start+0x2a) [0x555cc9791a1a]]
12: [/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7) [0x7feb31e00b97]]
11: [./x86_64-native-linuxapp-gcc/app/test(main+0x3be) [0x555cc96d868e]]
10: [./x86_64-native-linuxapp-gcc/app/test(cmdline_interact+0x3b) [0x555cc9c07f9b]]
9: [./x86_64-native-linuxapp-gcc/app/test(+0x6299e0) [0x555cc9c079e0]]
8: [./x86_64-native-linuxapp-gcc/app/test(rdline_char_in+0x9d1) [0x555cc9c0b4a1]]
7: [./x86_64-native-linuxapp-gcc/app/test(+0x629ce0) [0x555cc9c07ce0]]
6: [./x86_64-native-linuxapp-gcc/app/test(cmdline_parse+0x328) [0x555cc9c08ce8]]
5: [./x86_64-native-linuxapp-gcc/app/test(+0x1b3b33) [0x555cc9791b33]]
4: [./x86_64-native-linuxapp-gcc/app/test(+0x24b149) [0x555cc9829149]]
3: [./x86_64-native-linuxapp-gcc/app/test(rte_mbuf_sanity_check+0x130) [0x555cc9b72fa0]]
2: [./x86_64-native-linuxapp-gcc/app/test(__rte_panic+0xbd) [0x555cc96c8a62]]
1: [./x86_64-native-linuxapp-gcc/app/test(rte_dump_stack+0x2e) [0x555cc9be749e]]
rte_mbuf_sanity_check(0x7ffdf4c53f00)
rte_mbuf_check(0x7ffdf4c53f00):188
rte_mbuf_check(0x7ffdf4c53f00):194
rte_mbuf_check(0x7ffdf4c53f00):209
PANIC in rte_mbuf_sanity_check():
bad ref cnt
13: [./x86_64-native-linuxapp-gcc/app/test(_start+0x2a) [0x555cc9791a1a]]
12: [/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7) [0x7feb31e00b97]]
11: [./x86_64-native-linuxapp-gcc/app/test(main+0x3be) [0x555cc96d868e]]
10: [./x86_64-native-linuxapp-gcc/app/test(cmdline_interact+0x3b) [0x555cc9c07f9b]]
9: [./x86_64-native-linuxapp-gcc/app/test(+0x6299e0) [0x555cc9c079e0]]
8: [./x86_64-native-linuxapp-gcc/app/test(rdline_char_in+0x9d1) [0x555cc9c0b4a1]]
7: [./x86_64-native-linuxapp-gcc/app/test(+0x629ce0) [0x555cc9c07ce0]]
6: [./x86_64-native-linuxapp-gcc/app/test(cmdline_parse+0x328) [0x555cc9c08ce8]]
5: [./x86_64-native-linuxapp-gcc/app/test(+0x1b3b33) [0x555cc9791b33]]
4: [./x86_64-native-linuxapp-gcc/app/test(+0x24b149) [0x555cc9829149]]
3: [./x86_64-native-linuxapp-gcc/app/test(rte_mbuf_sanity_check+0x130) [0x555cc9b72fa0]]
2: [./x86_64-native-linuxapp-gcc/app/test(__rte_panic+0xbd) [0x555cc96c8a62]]
1: [./x86_64-native-linuxapp-gcc/app/test(rte_dump_stack+0x2e) [0x555cc9be749e]]

Can you give more details about how you start the test?

Thanks,
Olivier