From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 5A3301B34F for ; Thu, 2 Nov 2017 01:06:12 +0100 (CET) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Nov 2017 17:06:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,331,1505804400"; d="scan'208";a="168108853" Received: from silpixa00372839.ir.intel.com (HELO silpixa00372839.ger.corp.intel.com) ([10.237.222.154]) by orsmga005.jf.intel.com with ESMTP; 01 Nov 2017 17:06:08 -0700 From: Ferruh Yigit To: Thomas Monjalon , Sergio Gonzalez Monroy Cc: dev@dpdk.org, Ferruh Yigit , Jianfeng Tan , Jerin Jacob , Santosh Shukla Date: Thu, 2 Nov 2017 00:06:00 +0000 Message-Id: <20171102000600.85309-1-ferruh.yigit@intel.com> X-Mailer: git-send-email 2.13.6 Subject: [dpdk-dev] [PATCH] eal: force IOVA PA mode if KNI module inserted 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, 02 Nov 2017 00:06:12 -0000 Fix kernel crash with KNI because KNI requires physical addresses. When IOVA VA mode used, memzones and mbufs physical address fields contain virtual addresses. But KNI relies on these fields to enable kernel access for buffers. Those fields having virtual address cause crash in kernel. This is a workaround until KNI fixed properly to work with virtual addresses. Fixes: 72d013644bd6 ("mem: honor IOVA mode in malloc virt2phy") Signed-off-by: Ferruh Yigit --- Cc: Jianfeng Tan Cc: Jerin Jacob Cc: Santosh Shukla Cc: Thomas Monjalon This patch superseded following one: http://dpdk.org/dev/patchwork/patch/31071/ --- lib/librte_eal/linuxapp/eal/eal.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c index 017c402ed..29912a4e5 100644 --- a/lib/librte_eal/linuxapp/eal/eal.c +++ b/lib/librte_eal/linuxapp/eal/eal.c @@ -808,6 +808,15 @@ rte_eal_init(int argc, char **argv) /* autodetect the iova mapping mode (default is iova_pa) */ rte_eal_get_configuration()->iova_mode = rte_bus_get_iommu_class(); + /* Workaround for KNI which requires physical address to work */ + if (rte_eal_get_configuration()->iova_mode == RTE_IOVA_VA && + rte_eal_check_module("rte_kni") == 1) { + rte_eal_get_configuration()->iova_mode = RTE_IOVA_PA; + RTE_LOG(WARNING, EAL, + "Some devices want iova as va but pa will be used because.. " + "KNI module inserted\n"); + } + if (internal_config.no_hugetlbfs == 0 && internal_config.process_type != RTE_PROC_SECONDARY && eal_hugepage_info_init() < 0) { -- 2.13.6