From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3DB0D4408F for ; Wed, 22 May 2024 12:22:13 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F247C402C9; Wed, 22 May 2024 12:22:12 +0200 (CEST) Received: from mail-ej1-f47.google.com (mail-ej1-f47.google.com [209.85.218.47]) by mails.dpdk.org (Postfix) with ESMTP id 354CC400D6 for ; Wed, 22 May 2024 12:22:12 +0200 (CEST) Received: by mail-ej1-f47.google.com with SMTP id a640c23a62f3a-a59ab4f60a6so857242666b.0 for ; Wed, 22 May 2024 03:22:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716373332; x=1716978132; darn=dpdk.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=o6ohj+xvzdEDvVdWDgRVYz7/f+GoDEmZyx2uK34Berk=; b=H1rmujZH/8d/GTV+ZBcmqA0Q+fDpyMeGLH4GpqnqEqGgyvfn5UL7TEVSU2/lTc2z4V 3RsEDL5jSKgrxPtnJYKq3ktDxbjsMhMDNk40sYrT/NeHCupZLGm0SqUWYOt3H0zzhAZ3 9aWGoW486+Frw/ncYhuccNmPldAZun1121Wcrn9VNrDe2D0KeZQhLr6YswpW8wKeIYeK 2uHuSa1s1G/ZSsdhSiISqDQt2Z0LL25qb2SiWK60+MRLKw1w/nj+5jP3rURdCiKwI4cO JXcRL5t4jyL8NN8xQ5O8oLRdncUN9UIbmRUjFcJWUZXzbLs30jDVr59YSl8KDZ8ZR6nY Balg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716373332; x=1716978132; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=o6ohj+xvzdEDvVdWDgRVYz7/f+GoDEmZyx2uK34Berk=; b=rs1vPuNI1iqX6VXPnk6/8haFE+HsRhhy/gd333sTiTV/hrtCIJVh569HXPxRYswmIA 0VNcY6lTM1G3QWgPFORl5H5+Qoy6Rmo7auUG8LrVOPhKGnaROo3p8naVekrNnSSetnNC gLKuf484DpTnd890sL/jrGBbItYoekoUISHiUKxLdrkT1Y9l+ug9rgM1MSI8ZWlE5jJH xkz1y1k53FuxtfgWvSES0gD9CunWma69QMNXRkE91UIrG3AMeG9EQZDbVPJenj3BS/gd ZoRr90jC7XwhxWrTNYfoS9Z2FnJY4FGHjSA+jY8/2CUCXjJZIf2yTseM3fpCsu4nOhdr DQ7g== X-Gm-Message-State: AOJu0YyqvEwMRTh81+4GpT/SkubhTk/2H14/k5Nl+yk7ZVNCyEFWBMVp QvFvEuhuH+uM8TMiTpEz6/My7KGCw2GlE72bl/8pc7g8ZEKeUEyVKTFnbA1ylb0PH39AU4M4oXC Vvl2IxhU5AtXtCYHQMNvuNN6m5XxnmHvZDbE= X-Google-Smtp-Source: AGHT+IHoSROtZLcbZQiSO2GFYrBVByTFfeR25epybxwMdZsj8dvHfsVR+9De9fAVVQAvYJskCdp7dxxo03y4gJD3GkM= X-Received: by 2002:a17:906:22ce:b0:a59:d0be:dba4 with SMTP id a640c23a62f3a-a62280b0922mr145349666b.13.1716373331499; Wed, 22 May 2024 03:22:11 -0700 (PDT) MIME-Version: 1.0 References: <20240510180743.53c37660@sovereign> In-Reply-To: <20240510180743.53c37660@sovereign> From: Antonio Di Bacco Date: Wed, 22 May 2024 12:22:00 +0200 Message-ID: Subject: Re: Failure while allocating 1GB hugepages To: Dmitry Kozlyuk Cc: users@dpdk.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: users@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK usage discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: users-bounces@dpdk.org That was really useful. Thx On Fri, May 10, 2024 at 5:07=E2=80=AFPM Dmitry Kozlyuk wrote: > > 2024-05-10 11:33 (UTC+0200), Antonio Di Bacco: > > I have 16 hugepages available per NUMA on a 4 NUMA system: > > > > [user@node-1 hugepages]$ cat > > /sys/devices/system/node/*/hugepages/hugepages-1048576kB/free_hugepages > > 16 > > 16 > > 16 > > 16 > > > > Using the following program with dpdk 21.11, sometimes I can allocate > > a few pages but most of the time I cannot. I tried also to remove > > rtemap_* under /dev/hugepages. > > rte_memzone_reserve_aligned is always supposed to use a new page? > > > > #include > > #include > > #include > > > > #include > > #include > > > > int main(int argc, char **argv) > > { > > const struct rte_memzone *mz; > > int ret; > > printf("pid: %d\n", getpid()); > > // Initialize EAL > > ret =3D rte_eal_init(argc, argv); > > if (ret < 0) { > > fprintf(stderr, "Error with EAL initialization\n"); > > return -1; > > } > > > > for (int socket =3D 0; socket < 4; socket++) > > { > > for (int i =3D 0; i < 16; i++) > > { > > // Allocate memory using rte_memzone_reserve_aligned > > char name[32]; > > sprintf(name, "my_memzone%d-%d", i, socket); > > mz =3D rte_memzone_reserve_aligned(name, 1ULL << 30, socket, > > RTE_MEMZONE_IOVA_CONTIG, 1ULL << 30); > > > > if (mz =3D=3D NULL) { > > printf("errno %s\n", rte_strerror(rte_errno)); > > fprintf(stderr, "Memory allocation failed\n"); > > rte_eal_cleanup(); > > return -1; > > } > > > > printf("Memory allocated with name %s at socket %d physical > > address: %p, addr %p addr64 %lx size: %zu\n", name, mz->socket_id, > > (mz->iova), mz->addr, mz->addr_64, mz->len); > > } > > } > > > > // Clean up EAL > > rte_eal_cleanup(); > > return 0; > > } > > Hi Antonio, > > Does it succeed without RTE_MEMZONE_IOVA_CONTIG? > If so, does your system/app have ASLR enabled? > > When memzone size is 1G and hugepage size is 1G, > two hugepages are required: one for the requested amount of memory, > and one for memory allocator element header, > which does not fit into the same page obviously. > I suspect that two allocated hugepages get non-continuous IOVA > and that's why the function fails. > There are no useful logs in EAL to check the suspicion, > but you can hack elem_check_phys_contig() in malloc_elem.c.