From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 75643A057B; Thu, 2 Apr 2020 04:40:32 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BF0401BE97; Thu, 2 Apr 2020 04:40:31 +0200 (CEST) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by dpdk.org (Postfix) with ESMTP id 4F0831BE95 for ; Thu, 2 Apr 2020 04:40:30 +0200 (CEST) Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0322d9VC013605; Wed, 1 Apr 2020 22:40:29 -0400 Received: from ppma04dal.us.ibm.com (7a.29.35a9.ip4.static.sl-reverse.com [169.53.41.122]) by mx0a-001b2d01.pphosted.com with ESMTP id 304hjavwy5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 01 Apr 2020 22:40:29 -0400 Received: from pps.filterd (ppma04dal.us.ibm.com [127.0.0.1]) by ppma04dal.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id 0322e9IA013858; Thu, 2 Apr 2020 02:40:28 GMT Received: from b03cxnp08027.gho.boulder.ibm.com (b03cxnp08027.gho.boulder.ibm.com [9.17.130.19]) by ppma04dal.us.ibm.com with ESMTP id 301x76y4f7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 02 Apr 2020 02:40:28 +0000 Received: from b03ledav002.gho.boulder.ibm.com (b03ledav002.gho.boulder.ibm.com [9.17.130.233]) by b03cxnp08027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0322eQEl17367644 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 2 Apr 2020 02:40:26 GMT Received: from b03ledav002.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CA4CB13604F; Thu, 2 Apr 2020 02:40:26 +0000 (GMT) Received: from b03ledav002.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3862A136051; Thu, 2 Apr 2020 02:40:25 +0000 (GMT) Received: from Davids-MBP.randomparity.org (unknown [9.211.102.135]) by b03ledav002.gho.boulder.ibm.com (Postfix) with ESMTP; Thu, 2 Apr 2020 02:40:25 +0000 (GMT) To: Anatoly Burakov , dev@dpdk.org References: <156a0627fb472087aad43d9279ab0f684a2367ce.1585746650.git.anatoly.burakov@intel.com> From: David Christensen Message-ID: <2cca0eba-e3bc-c89b-01bb-cc37d906d867@linux.vnet.ibm.com> Date: Wed, 1 Apr 2020 19:40:24 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: <156a0627fb472087aad43d9279ab0f684a2367ce.1585746650.git.anatoly.burakov@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.676 definitions=2020-04-01_04:2020-03-31, 2020-04-01 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 impostorscore=0 suspectscore=2 adultscore=0 priorityscore=1501 mlxscore=0 lowpriorityscore=0 clxscore=1015 spamscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004020017 Subject: Re: [dpdk-dev] [PATCH 1/2] test/malloc: run realloc tests on external heap X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 4/1/20 6:11 AM, Anatoly Burakov wrote: > Due to the fact that the rte_realloc() test depends on the layout of > underlying memory, it can sometimes fail due to fragmentation of the > memory. To address this, make it so that the realloc autotests are run > using a newly created external memory heap instead of main memory. > > Bugzilla ID: 424 > > Signed-off-by: Anatoly Burakov ... > +static int > +test_realloc(void) > +{ > + const char *heap_name = "realloc_heap"; > + int realloc_heap_socket; > + unsigned int mem_sz = 1U << 13; /* 8K */ > + unsigned int page_sz = sysconf(_SC_PAGESIZE); > + void *mem; > + int ret; > + > + /* > + * the realloc tests depend on specific layout of underlying memory, so > + * to prevent accidental failures to do fragmented main heap, we will > + * do all of our tests on an artificially created memory. > + */ > + if (rte_malloc_heap_create(heap_name) != 0) { > + printf("Failed to create external heap\n"); > + ret = -1; > + goto end; > + } > + realloc_heap_socket = rte_malloc_heap_get_socket(heap_name); > + > + mem = mmap(NULL, mem_sz, PROT_READ | PROT_WRITE, > + MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); > + if (mem == MAP_FAILED) { > + printf("Failed to allocate memory for external heap\n"); > + ret = -1; > + goto heap_destroy; > + } > + > + if (rte_malloc_heap_memory_add( > + heap_name, mem, mem_sz, NULL, 0, page_sz) != 0) { > + printf("Failed to add memory to external heap\n"); > + ret = -1; > + goto mem_free; > + } > + > + /* run the socket-bound tests */ > + ret = test_realloc_socket(realloc_heap_socket); > + > + if (ret != 0) > + goto mem_remove; > + > + /* now, run the NUMA node tests */ > + ret = test_realloc_numa(); > + > +mem_remove: > + rte_malloc_heap_memory_remove(heap_name, mem, mem_sz); > +mem_free: > + munmap(mem, mem_sz); > +heap_destroy: > + rte_malloc_heap_destroy(heap_name); > +end: > return ret; > } > Works on an x86_64 Lenovo server which was previously failing. Still fails on a Power 9 system but with a new error: RTE>>malloc_autotest test_str_to_size() passed test_zero_aligned_alloc() passed test_malloc_bad_params() passed Failed to add memory to external heap test_realloc() failed Test Failed I'm guessing page_sz is the problem: (gdb) s rte_malloc_heap_memory_add (heap_name=0x11bceda0 "realloc_heap", va_addr=0x7ffff4c80000, len=8192, iova_addrs=0x0, n_pages=0, page_sz=65536) at ../lib/librte_eal/common/rte_malloc.c:358 358 struct malloc_heap *heap = NULL; (gdb) n 363 if (heap_name == NULL || va_addr == NULL || (gdb) n 364 page_sz == 0 || !rte_is_power_of_2(page_sz) || (gdb) n 365 RTE_ALIGN(len, page_sz) != len || (gdb) n 364 page_sz == 0 || !rte_is_power_of_2(page_sz) || (gdb) n 371 rte_errno = EINVAL; When I change page_sz to 4K the test succeeds. Dave