From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id E5C9A1B22E for ; Wed, 1 Nov 2017 02:07:33 +0100 (CET) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 31 Oct 2017 18:07:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,326,1505804400"; d="scan'208";a="144485404" Received: from silpixa00372839.ir.intel.com (HELO silpixa00372839.ger.corp.intel.com) ([10.237.222.154]) by orsmga004.jf.intel.com with ESMTP; 31 Oct 2017 18:07:30 -0700 From: Ferruh Yigit To: Thomas Monjalon , Bruce Richardson , Sergio Gonzalez Monroy Cc: dev@dpdk.org, Ferruh Yigit , Jianfeng Tan , Santosh Shukla Date: Wed, 1 Nov 2017 01:07:26 +0000 Message-Id: <20171101010726.17781-1-ferruh.yigit@intel.com> X-Mailer: git-send-email 2.13.6 Subject: [dpdk-dev] [PATCH] eal: disable IOVA mode detection by default 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: Wed, 01 Nov 2017 01:07:34 -0000 Fix kernel crash with KNI because KNI requires physical addresses. A config option introduced to disable IOVA mode detection and to set it to physical address by default. Disabling config option will enable IOVA mode detection. When there is no intension to use KNI, it is safe to enable detection. Config option disable IOVA mode detection by default to be sure only who is aware of result enable it. Fixes: 72d013644bd6 ("mem: honor IOVA mode in malloc virt2phy") Signed-off-by: Ferruh Yigit --- Cc: Jianfeng Tan Cc: Santosh Shukla Cc: Thomas Monjalon --- config/common_base | 5 +++++ lib/librte_eal/bsdapp/eal/eal.c | 4 ++++ lib/librte_eal/linuxapp/eal/eal.c | 4 ++++ 3 files changed, 13 insertions(+) diff --git a/config/common_base b/config/common_base index 82ee75456..903e7685b 100644 --- a/config/common_base +++ b/config/common_base @@ -107,6 +107,11 @@ CONFIG_RTE_MALLOC_DEBUG=n CONFIG_RTE_EAL_NUMA_AWARE_HUGEPAGES=n # +# Disabling PHYS_IOVA may crash kernel for KNI, use with caution +# +CONFIG_RTE_EAL_USE_PHYS_IOVA=y + +# # Recognize/ignore the AVX/AVX512 CPU flags for performance/power testing. # AVX512 is marked as experimental for now, will enable it after enough # field test and possible optimization. diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c index 09112b6f9..db485951b 100644 --- a/lib/librte_eal/bsdapp/eal/eal.c +++ b/lib/librte_eal/bsdapp/eal/eal.c @@ -570,8 +570,12 @@ rte_eal_init(int argc, char **argv) return -1; } +#ifdef RTE_EAL_USE_PHYS_IOVA + rte_eal_get_configuration()->iova_mode = RTE_IOVA_PA; +#else /* autodetect the iova mapping mode (default is iova_pa) */ rte_eal_get_configuration()->iova_mode = rte_bus_get_iommu_class(); +#endif if (internal_config.no_hugetlbfs == 0 && internal_config.process_type != RTE_PROC_SECONDARY && diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c index 017c402ed..1775bb33f 100644 --- a/lib/librte_eal/linuxapp/eal/eal.c +++ b/lib/librte_eal/linuxapp/eal/eal.c @@ -805,8 +805,12 @@ rte_eal_init(int argc, char **argv) return -1; } +#ifdef RTE_EAL_USE_PHYS_IOVA + rte_eal_get_configuration()->iova_mode = RTE_IOVA_PA; +#else /* autodetect the iova mapping mode (default is iova_pa) */ rte_eal_get_configuration()->iova_mode = rte_bus_get_iommu_class(); +#endif if (internal_config.no_hugetlbfs == 0 && internal_config.process_type != RTE_PROC_SECONDARY && -- 2.13.6