From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-f41.google.com (mail-ed1-f41.google.com [209.85.208.41]) by dpdk.org (Postfix) with ESMTP id 8B3911B48D for ; Thu, 27 Sep 2018 15:14:35 +0200 (CEST) Received: by mail-ed1-f41.google.com with SMTP id k14-v6so4967094edr.13 for ; Thu, 27 Sep 2018 06:14:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netronome-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=uwaRcsfsuee7Su8o9v8xmfuPszDA3H+p5m0SZHYuno0=; b=ooqh1xf3qXUrAQOs/FOgQwBHxfesycvauqvTD3HMw5zSBqIfWjtOvJAA6uwQxq1LYE lSPC2XkBPkTirPKrEClZTOU305RSbQ8/P3FKhKGjt09ex+O0j2EaXEXlOVzq5wXfwZMi x7tbm5QMgAITyRbhBtryJ/C8z7GQQofQjwM5Z4kKdwM0Twd0CZWg0XCYeOULGrw5qVVH i6TWul5iIpp0T8aBu37JtH8mlKEO+UMzQZW+eoDrOZ34KQD8cw25rM/x9McSotxxdOqf mxMhJ07M5NY3uaYiaNhvvYJ3FvIzE/w5cU91A0ayV3XTFXADvCVh+rW5aIyBH1pH/m+a 98hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=uwaRcsfsuee7Su8o9v8xmfuPszDA3H+p5m0SZHYuno0=; b=aDlXLsdZb3+LngFkVSNN3tNvLwY9UjaTyiGLov9yv20Qgt9C7F0TOPWT8KCGCACwps DsQRqu0HCKJHNF01bQSjoZVfMJ4YXdMISKRHdUnGBM/UXxLOBw95+bSB1asr6ARj4SPo lNWbLAHuRMJQ/2vfjJgrxnbJJX1SEfdxqJuPhgtPnl0d/Uoid9Uig0R4YSc+jtO/Ui3g ow3EBmyHFNmOF1gTpNQGzDpJq7NDs+MtLlcIGEHDw7F63HvhzQ80n3nSrFiZ3gkHV5/N GesDWGQkJ6jE6+Plt/SHOC0FGE60B9WilaZAotR2XbUW1iwrWYwXuntisu5HTGzNMyey V56A== X-Gm-Message-State: ABuFfohX2Ceed7vzDq8jXLmCrlUXXETcy+cPy+L3Vbxs7bZ+gZ6RCNrH FZM6WFCkRpKXS43u740wirqBXyjDeX3X6bCYiDCahg== X-Google-Smtp-Source: ACcGV61Gr+VRo2HiffeGZuDiOAPhczW+mxuZGaOXxEOIqyMXMkZaHRkeAI5Yuojlcdv659iUv1+u2W2ph5QczOBCwN8= X-Received: by 2002:a17:906:5583:: with SMTP id y3-v6mr1752284ejp.79.1538054075145; Thu, 27 Sep 2018 06:14:35 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Alejandro Lucero Date: Thu, 27 Sep 2018 14:14:24 +0100 Message-ID: To: "Burakov, Anatoly" Cc: dev , "Mcnamara, John" , marko.kovacevic@intel.com, laszlo.madarassy@ericsson.com, laszlo.vadkerti@ericsson.com, andras.kovacs@ericsson.com, winnie.tian@ericsson.com, daniel.andrasi@ericsson.com, janos.kobor@ericsson.com, geza.koblo@ericsson.com, srinath.mannam@broadcom.com, scott.branden@broadcom.com, Ajit Khaparde , "Wiles, Keith" , Bruce Richardson , Thomas Monjalon , Shreyansh Jain , Shahaf Shuler , Andrew Rybchenko Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH v6 04/21] mem: do not check for invalid socket ID 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: , X-List-Received-Date: Thu, 27 Sep 2018 13:14:35 -0000 On Thu, Sep 27, 2018 at 11:41 AM Anatoly Burakov wrote: > We will be assigning "invalid" socket ID's to external heap, and > malloc will now be able to verify if a supplied socket ID is in > fact a valid one, rendering parameter checks for sockets > obsolete. > > This changes the semantics of what we understand by "socket ID", > so document the change in the release notes. > > Signed-off-by: Anatoly Burakov > --- > doc/guides/rel_notes/release_18_11.rst | 7 +++++++ > lib/librte_eal/common/eal_common_memzone.c | 8 +++++--- > lib/librte_eal/common/malloc_heap.c | 2 +- > lib/librte_eal/common/rte_malloc.c | 4 ---- > 4 files changed, 13 insertions(+), 8 deletions(-) > > diff --git a/doc/guides/rel_notes/release_18_11.rst > b/doc/guides/rel_notes/release_18_11.rst > index 5fc71e208..6ee236302 100644 > --- a/doc/guides/rel_notes/release_18_11.rst > +++ b/doc/guides/rel_notes/release_18_11.rst > @@ -98,6 +98,13 @@ API Changes > users of memseg-walk-related functions, as they will now have to skip > externally allocated segments in most cases if the intent is to only > iterate > over internal DPDK memory. > + - ``socket_id`` parameter across the entire DPDK has gained additional > + meaning, as some socket ID's will now be representing externally > allocated > + memory. No changes will be required for existing code as backwards > + compatibility will be kept, and those who do not use this feature > will not > + see these extra socket ID's. Any new API's must not check socket ID > + parameters themselves, and must instead leave it to the memory > subsystem to > + decide whether socket ID is a valid one. > > ABI Changes > ----------- > diff --git a/lib/librte_eal/common/eal_common_memzone.c > b/lib/librte_eal/common/eal_common_memzone.c > index 7300fe05d..b7081afbf 100644 > --- a/lib/librte_eal/common/eal_common_memzone.c > +++ b/lib/librte_eal/common/eal_common_memzone.c > @@ -120,13 +120,15 @@ memzone_reserve_aligned_thread_unsafe(const char > *name, size_t len, > return NULL; > } > > - if ((socket_id != SOCKET_ID_ANY) && > - (socket_id >= RTE_MAX_NUMA_NODES || socket_id < 0)) { > + if ((socket_id != SOCKET_ID_ANY) && socket_id < 0) { > Should not it be better to use RTE_MAX_HEAP instead of removing the check? > rte_errno = EINVAL; > return NULL; > } > > - if (!rte_eal_has_hugepages()) > + /* only set socket to SOCKET_ID_ANY if we aren't allocating for an > + * external heap. > + */ > + if (!rte_eal_has_hugepages() && socket_id < RTE_MAX_NUMA_NODES) > socket_id = SOCKET_ID_ANY; > > contig = (flags & RTE_MEMZONE_IOVA_CONTIG) != 0; > diff --git a/lib/librte_eal/common/malloc_heap.c > b/lib/librte_eal/common/malloc_heap.c > index 1d1e35708..73e478076 100644 > --- a/lib/librte_eal/common/malloc_heap.c > +++ b/lib/librte_eal/common/malloc_heap.c > @@ -647,7 +647,7 @@ malloc_heap_alloc(const char *type, size_t size, int > socket_arg, > if (size == 0 || (align && !rte_is_power_of_2(align))) > return NULL; > > - if (!rte_eal_has_hugepages()) > + if (!rte_eal_has_hugepages() && socket_arg < RTE_MAX_NUMA_NODES) > socket_arg = SOCKET_ID_ANY; > > if (socket_arg == SOCKET_ID_ANY) > diff --git a/lib/librte_eal/common/rte_malloc.c > b/lib/librte_eal/common/rte_malloc.c > index 73d6df31d..9ba1472c3 100644 > --- a/lib/librte_eal/common/rte_malloc.c > +++ b/lib/librte_eal/common/rte_malloc.c > @@ -47,10 +47,6 @@ rte_malloc_socket(const char *type, size_t size, > unsigned int align, > if (!rte_eal_has_hugepages()) > socket_arg = SOCKET_ID_ANY; > > - /* Check socket parameter */ > - if (socket_arg >= RTE_MAX_NUMA_NODES) > - return NULL; > - > Sane than before. Better to keep the sanity check using RTE_MAX_HEAPS. > return malloc_heap_alloc(type, size, socket_arg, 0, > align == 0 ? 1 : align, 0, false); > } > -- > 2.17.1 >