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 BFE39A0093; Thu, 21 Apr 2022 11:36:48 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6188240042; Thu, 21 Apr 2022 11:36:48 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id EE62A40040; Thu, 21 Apr 2022 11:36:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1650533807; x=1682069807; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=4CzgeP6tIHpbOboAOFb1FspmFA0dJb7Zbdo6xggMFoA=; b=FX9hTbiFQ5L7XYk/jWTCd8bTffvrzqe+SQvjL0F7paSPuw0/R2IMQvkz LVkwKYvUt6nyl5uuDni1EFSN6IdqBbGYJigM3MQv//seYSWteJyd6BrwT SSdLLob7DT4/hQT2znZ3KxT3kZjcbgisR2NqeHdQKnyafSf4H8JaECHOm Roe/e8RTd2S9KSOqeTiej8Uhg/JauqCkokhsywcEo3F8sJSs/g6Qenjg8 DNtH2yLAzaCMa1TUmdfRg1IQ1d/Mmz7ASQyy55yIVa1EVVF3IJ1Pmu/dD QtWtsxnyqWoPBGeQ8wL81A1Lg2UjPY58MS7ZrmpvMYvfs7+xysqJU7JmS Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10323"; a="263762755" X-IronPort-AV: E=Sophos;i="5.90,278,1643702400"; d="scan'208";a="263762755" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Apr 2022 02:36:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,278,1643702400"; d="scan'208";a="577120478" Received: from unknown (HELO skylake-dev-5.localdomain) ([10.190.210.19]) by orsmga008.jf.intel.com with ESMTP; 21 Apr 2022 02:36:35 -0700 From: Deepak Khandelwal To: anatoly.burakov@intel.com Cc: dev@dpdk.org, stable@dpdk.org, balaji.chintalapalle@intel.com Subject: [PATCH v2] eal/linux: skip attaching to external memory chunk Date: Thu, 21 Apr 2022 14:41:21 +0530 Message-Id: <1650532281-193591-1-git-send-email-deepak.khandelwal@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1649075577-67300-1-git-send-email-deepak.khandelwal@intel.com> References: <1649075577-67300-1-git-send-email-deepak.khandelwal@intel.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Currently, EAL init in secondary processes will attach all fbarrays in the memconfig to have access to primary process' page tables. However, fbarrays corresponding to external memory segments should not be attached at initialization, because this will happen as part of `rte_extmem_attach` or `rte_malloc_heap_memory_attach` calls. Both external memory API's document this: rte_malloc: http://doc.dpdk.org/api/rte__malloc_8h.html#af6360dea35bdf162feeb2b62cf149fd3 rte_extmem: http://doc.dpdk.org/api/rte__memory_8h.html#a2796da68de6825f8edf53759f8e4d230 Fixes: ff3619d6244b ("malloc: allow attaching to external memory chunks") Cc: stable@dpdk.org Signed-off-by: Deepak Khandelwal Suggested-by: Anatoly Burakov Acked-by: Anatoly Burakov --- v2: * commit message updated and handle for BSD --- lib/eal/freebsd/eal_memory.c | 4 ++-- lib/eal/linux/eal_memory.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/eal/freebsd/eal_memory.c b/lib/eal/freebsd/eal_memory.c index 78ac142..17ab10e 100644 --- a/lib/eal/freebsd/eal_memory.c +++ b/lib/eal/freebsd/eal_memory.c @@ -446,8 +446,8 @@ struct attach_walk_args { msl = &mcfg->memsegs[msl_idx]; - /* skip empty memseg lists */ - if (msl->memseg_arr.len == 0) + /* skip empty and external memseg lists */ + if (msl->memseg_arr.len == 0 || msl->external) continue; if (rte_fbarray_attach(&msl->memseg_arr)) { diff --git a/lib/eal/linux/eal_memory.c b/lib/eal/linux/eal_memory.c index ee1a9e6..c890c42 100644 --- a/lib/eal/linux/eal_memory.c +++ b/lib/eal/linux/eal_memory.c @@ -1874,8 +1874,8 @@ void numa_error(char *where) msl = &mcfg->memsegs[msl_idx]; - /* skip empty memseg lists */ - if (msl->memseg_arr.len == 0) + /* skip empty and external memseg lists */ + if (msl->memseg_arr.len == 0 || msl->external) continue; if (rte_fbarray_attach(&msl->memseg_arr)) { -- 1.8.3.1