From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0050.outbound.protection.outlook.com [104.47.32.50]) by dpdk.org (Postfix) with ESMTP id 86BFB1B349 for ; Thu, 2 Nov 2017 04:58:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=yuUUR/wz/2ljnMxQJokdTFwi92LU0WQ4xtRi+l6nPog=; b=H8W46WbLO7HkneLTclpUlGED3vCGVa9rkFxLnZOZvh02lq9a8+WKxSvFiSeiB8arwLtxAt8BKdMedo02pr+Oxm5Gk7tR0Zj+tvNphcLpIj0897Q12K412hcoD2Qp1nwnRXNOapyu7dXu54nksw0KlcUHdd3WyelIBR4UJixlFuw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Santosh.Shukla@cavium.com; Received: from [IPv6:2401:4900:1988:5bfe:f07a:915d:ad:cabd] (2401:4900:1988:5bfe:f07a:915d:ad:cabd) by MWHPR07MB3104.namprd07.prod.outlook.com (10.172.95.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.178.6; Thu, 2 Nov 2017 03:58:53 +0000 To: Ferruh Yigit , Thomas Monjalon , Sergio Gonzalez Monroy Cc: dev@dpdk.org, Jianfeng Tan , Jerin Jacob References: <20171102000600.85309-1-ferruh.yigit@intel.com> From: santosh Message-ID: <3a029ac2-2b6b-b0c2-a577-967b6feba0c9@caviumnetworks.com> Date: Thu, 2 Nov 2017 09:28:24 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20171102000600.85309-1-ferruh.yigit@intel.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US X-Originating-IP: [2401:4900:1988:5bfe:f07a:915d:ad:cabd] X-ClientProxiedBy: PN1PR01CA0113.INDPRD01.PROD.OUTLOOK.COM (10.174.144.29) To MWHPR07MB3104.namprd07.prod.outlook.com (10.172.95.10) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4c952821-e2d3-4c15-41bd-08d521a60aca X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(4534020)(4602075)(2017052603199); SRVR:MWHPR07MB3104; X-Microsoft-Exchange-Diagnostics: 1; MWHPR07MB3104; 3:w7R02Yf7IuYOA5x0BBqH6W2Nr20DR51r6J8DddjI8jBUEL9Kab9cL4kUE0ztlk4D/405AkA1+XDtkKosrDq59vpJ5y14TlW7x3R50CTZrQ121L5Gy+FM+qzyQz56BXRlspYM7R+pyzbCW8EJBQgSZMO3W13EQmY6aYqrTjM9rH6qdA4fQhKe8dqt2CVr6iIsqyYkA+GrZWmVBbYzUCYy5x+7kOPm6FEoGDosfNyWE8RkHmS/+c/BLlad5qvCyW2O; 25:1M7ysAlBh3X6v1qXex80pAeoaY8STB3xVutmRg23z2M+uUWaJeimz2HMRL9ta+V/31prUvEp47m3prZALuXGleM5jnjnxcVqJg6pddI2RSh2XcJP3f3iaKQgBk4swi8WSQMI37wC0pYaiRawQXZXzUg6vvoihalZhArA/Pvs/AyUBaX+boc25iUqWnARReZWJw2Gjfebuyk9n+1q4gocaJjMKDRiHV7ET5b3NeZCJsazd2cpJFttQRJ1bdzIhfL+gjPF2TUyhaaFJykxjvgo4vMGG2AerawcsBxNMBxqzmPq7e6IWsRGatoMFo8FqSvvIcTvvmB3juOEMTkiZ3TDJw==; 31:gfwVpG56WcJ9LqAwxhHhbEJFZjVO7zEyattokOvTrI0cUjAgFyH9U0m2DGCKoLiXg/cOBkTLzUkwa+HyGrypaq/g1Pr6QJTwQazRdZ3lPxDDGHlVYY2BLZOhQxbK34TiS7qONPYmudMtC4A/yKfGDpKkiypFjogNo9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M82K1yl9gYrYwXdxw31 X-Exchange-Antispam-Report-Test: UriScan:(228905959029699); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(3002001)(100000703101)(100105400095)(3231020)(93006095)(10201501046)(6041248)(20161123564025)(20161123558100)(20161123562025)(20161123555025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:MWHPR07MB3104; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:MWHPR07MB3104; X-Forefront-PRVS: 047999FF16 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(376002)(346002)(24454002)(189002)(199003)(229853002)(2906002)(7736002)(316002)(25786009)(305945005)(6246003)(107886003)(4326008)(8676002)(1706002)(53936002)(53376002)(36756003)(54906003)(58126008)(6116002)(110136005)(50466002)(64126003)(97736004)(23676003)(230700001)(101416001)(5660300001)(76176999)(54356999)(65826007)(6666003)(65806001)(72206003)(81166006)(189998001)(478600001)(65956001)(68736007)(81156014)(105586002)(8936002)(86152003)(33646002)(106356001)(6306002)(83506002)(31686004)(31696002)(6486002)(2950100002)(966005)(47776003)(42882006)(50986999); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR07MB3104; H:[IPv6:2401:4900:1988:5bfe:f07a:915d:ad:cabd]; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtNV0hQUjA3TUIzMTA0OzIzOjRCeHorZXZQSTlHTEFPbkRiZ0V2S3p5b1kr?= =?utf-8?B?Q0wrc2VCUDE0UUk4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:NAreWB8W0RMeEJ/srntoq8PcNbhAA9GpPps15diIjE/t/HbChYdfkYu9735BcZh2fgKo1umm7acTvLos2HK9JSezLDZL52GCV+6398NCXnuINVOSV0uI43IwPtBcE+Gw2Gp2mWAMaScLhVpXzFs6t9pDg5czwD2PS/i56mK8Qeyxg2mpi2jnjSpVYSUmxAvnn9NJxCL5CuSpdOfR2Zac7MKtqLfa/tVkdZdimaV+H6ukBTmALb5JKfLS+qvzqpbr6hSnkpyEuH2zA6rrPb3/via4GKjXzaMGmCnr2g7SXaShXFRewD/30zF5Ovp6cn7v66IJ3SlxPBHj/X1cVkmWSqmv2JSuhYo7TrDL0zSpBM0=; 5:c6tt4SZPFLsN1NLtlIIkkRISBdLJe65Gm8VaqZ1z0/t5J7sPt/oCHuDYyf+LaM1KrSS2qGSRvbpOKJ2uuQ0K6QEY3/5vfQ3Ozs0yGQL9YfNJ0bpXQsK0+4QKO+GW0zWO+gtCxiizCve60fBJaurOyjhBCdXGbM5+sOMbI77Nb9A=; 24:qFSMI7y3/LMQcJsLVMdEB45JoTYGhQO3FZFohG/iCVXh1zC8b2IK6cUOtDO3w38nqEeF5vd9hZtclA2cCuQoAIsyUvhjV8FFdqZsPSW5ESQ=; 7:PtFRFVIBB9hORMKeE9R8qtDnYTzHYAoFcntq/ZJh1mCmDikFceSAfH24gU/fSUIg77xpZ+kF4tFHvwWrm6KcLC6s3QT/AfFpAVu+T9aIphFxzf7SjOMAZXHPeq+YGjqewhElsu5kvCrtzPB2fKXwIkzUM2hjGjjDjjZwI4qniOSLXWdML5Nzo29ijttosrH1EZM/fSA3HCBsWoG6qxLFq/8LsenBBXASk86hbatkHq2gLyGuOTNTSuIYa7L+N7C2 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Nov 2017 03:58:53.8201 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4c952821-e2d3-4c15-41bd-08d521a60aca X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR07MB3104 Subject: Re: [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 03:59:00 -0000 Hi Ferruh, On Thursday 02 November 2017 05:36 AM, Ferruh Yigit wrote: > 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) { Rather checking for KNI module at linuxapp/eal, I was suggesting to move KNI detection code in bus layer like below: diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c index cdf8106..971586c 100644 --- a/drivers/bus/pci/linux/pci.c +++ b/drivers/bus/pci/linux/pci.c @@ -586,11 +586,13 @@ rte_pci_get_iommu_class(void) bool is_vfio_noiommu_enabled = true; bool has_iova_va; bool is_bound_uio; + bool has_kni; is_bound = pci_one_device_is_bound(); if (!is_bound) return RTE_IOVA_DC; + has_kni = rte_eal_check_module("rte_kni"); has_iova_va = pci_one_device_has_iova_va(); is_bound_uio = pci_one_device_bound_uio(); #ifdef VFIO_PRESENT @@ -598,7 +600,7 @@ rte_pci_get_iommu_class(void) true : false; #endif - if (has_iova_va && !is_bound_uio && !is_vfio_noiommu_enabled) + if (has_iova_va && !is_bound_uio && !has_kni && !is_vfio_noiommu_enabled) return RTE_IOVA_VA; if (has_iova_va) { @@ -607,6 +609,9 @@ rte_pci_get_iommu_class(void) RTE_LOG(WARNING, EAL, "vfio-noiommu mode configured\n"); if (is_bound_uio) RTE_LOG(WARNING, EAL, "few device bound to UIO\n"); + if (has_kni) + RTE_LOG(WARNING, EAL, "Some devices want iova as va but pa will be used because.." + "KNI module inserted\n"); } return RTE_IOVA_PA; It builds but I haven;t tested, can you please give it a try. Thanks.