From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id C1231A0471 for ; Mon, 15 Jul 2019 16:26:47 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8982A2E81; Mon, 15 Jul 2019 16:26:47 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id DD49D2C6A for ; Mon, 15 Jul 2019 16:26:45 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x6FEPGfI013723; Mon, 15 Jul 2019 07:26:40 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=HBlXDmDXdj/NJFavsTbZwnLuIWV1AoTLi6HXzMI1G5g=; b=EVEWvrrt0JxGv5VN4z78bm3cmHpPXq7OjGZYW2znvrQ5hSUdf5Wa75DrEcddGSKuvQgF l/RB6rRJTzL1KRHDyX9pEn1+t0Jo4LJbEaWnIhc+JXUwJkDGIO2pKv7tdmrEqzodgWVc G3J3qxAfNDTsKqRNcwSQnFIUjucFN3D6jIyHi16fSDxjkDO7LuDG9gaJi0XiVZ4aOJWE DJaYWa0zpFesuRes4M05eIbczPF1gSy7UVQ1cR0JzR4fU0Eo777ikMmQypb/BwketHr5 qiE2+BKOap1tiCEn7m2mLFsX0tPNdXowFX3VG4SkYlTCpG4KErk6I57S6psB3lFGbG3B 4w== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0a-0016f401.pphosted.com with ESMTP id 2tqcnpqwd7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 15 Jul 2019 07:26:40 -0700 Received: from SC-EXCH04.marvell.com (10.93.176.84) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 15 Jul 2019 07:26:39 -0700 Received: from NAM03-BY2-obe.outbound.protection.outlook.com (104.47.42.54) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Mon, 15 Jul 2019 07:26:39 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AqKbTP5v173+J5oTeWZ+3tQsFE0Mp84bhNX7fYhFNzVZmveOJE4xNdDC1wzvSgmnCDdB2smmKP40c6JdODDXx/Em06pA9VmljtBSgIH/jnEQcq3L219XFQxap6jlVauqaRkqA9eoHR3fXkZwcBEcpziLqCH8lWSGRNAPnGc9ZysvBiyZZOHYe0wVJvMu07eOXLt/cHHrWYqp58iry5aZlCuzHv0kvYZOmoWEluvxQgjkqo7ZjEih0Ry/5L/ArdvWaZ7j4JUizrVUii3vVPY82D+Fb2PJ5AC3rPFxiQ2XTHy5KYG4M8tKsvS1pFPuzCjxDctLUv6KnPKbmf44OyWowg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HBlXDmDXdj/NJFavsTbZwnLuIWV1AoTLi6HXzMI1G5g=; b=fYPd1+tLvCbkzhDWtrML+vkelbkrEw+lqfvaH7IGjepLd+mrt9X7/7+xCCbCJLtUdgqMMzngvBA/54qGHsTznnTSvh6b4fFZq1DSySHCgB5UJxOOQC+CtHA+aNwyxazSKPguW2qc2GsWEb3aplgsGBAJPJsnGiAejLvZvi8o7h7RJLa07WeMQyBG3vA0zB4knuxgCfxcdDC7a8F/4ctHbrbF5W6iPbpQlVq+pn82uoTknGKu+xuLaWgn5NgdiCiXr6Byr0LsWJHnc6rqavz1nQDZCpb7XAdFihdcTuZqXB0gZNPYM8ryRa8uHWLOTvULYCkHDXlzl/rDGHsgwVvXAQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1;spf=pass smtp.mailfrom=marvell.com;dmarc=pass action=none header.from=marvell.com;dkim=pass header.d=marvell.com;arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector2-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HBlXDmDXdj/NJFavsTbZwnLuIWV1AoTLi6HXzMI1G5g=; b=MBES4PrtcmvjWgiVYnrLtQiYRAmF6CdVd6oB9g3TvPlfb05cywQ9bD7729UaN5BgjqIP87r0Ofazp45hmH2V0JC/3yf/D4njGtQBw5puxeZCzgt1/UD/3nVs4igMu0vkj+t3MXF4rwZPJA/JoNeVxXy2CJXsL/yaXkYp8kAdrJY= Received: from BYAPR18MB2424.namprd18.prod.outlook.com (20.179.91.149) by BYAPR18MB2743.namprd18.prod.outlook.com (20.179.56.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2073.10; Mon, 15 Jul 2019 14:26:34 +0000 Received: from BYAPR18MB2424.namprd18.prod.outlook.com ([fe80::2d42:12b6:aa2e:2862]) by BYAPR18MB2424.namprd18.prod.outlook.com ([fe80::2d42:12b6:aa2e:2862%4]) with mapi id 15.20.2073.012; Mon, 15 Jul 2019 14:26:34 +0000 From: Jerin Jacob Kollanukkaran To: Thomas Monjalon , "Burakov, Anatoly" CC: David Marchand , "dev@dpdk.org" , John McNamara , Marko Kovacevic , Igor Russkikh , Pavel Belous , Ajit Khaparde , Somnath Kotur , Wenzhuo Lu , John Daley , "Hyong Youb Kim" , Qi Zhang , Xiao Wang , Beilei Xing , Jingjing Wu , Qiming Yang , "Konstantin Ananyev" , Matan Azrad , Shahaf Shuler , Yongseok Koh , Viacheslav Ovsiienko , Alejandro Lucero , Nithin Kumar Dabilpuram , Kiran Kumar Kokkilagadda , Rasesh Mody , Shahed Shaikh , Bruce Richardson , "alialnu@mellanox.com" , "aconole@redhat.com" Thread-Topic: [PATCH 2/2] eal: fix IOVA mode selection as VA for pci drivers Thread-Index: AQHVN2lUvS4FC9UUg0eo3J1cfmDleKbG1AEAgAAcB4CABNF8gA== Date: Mon, 15 Jul 2019 14:26:34 +0000 Message-ID: References: <1562795329-16652-1-git-send-email-david.marchand@redhat.com> <1562795329-16652-3-git-send-email-david.marchand@redhat.com> <615dc23b-639a-01a0-4871-4c168e64bbb9@intel.com> <2927698.45TxNz31xh@xps> In-Reply-To: <2927698.45TxNz31xh@xps> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [106.200.248.176] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: cd14be12-b7b2-4d22-5fc5-08d7093070ab x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328)(7193020); SRVR:BYAPR18MB2743; x-ms-traffictypediagnostic: BYAPR18MB2743: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:10000; x-forefront-prvs: 00997889E7 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(376002)(366004)(39850400004)(396003)(136003)(346002)(52314003)(199004)(189003)(476003)(446003)(11346002)(33656002)(486006)(55016002)(71190400001)(64756008)(66556008)(66446008)(71200400001)(86362001)(6436002)(5660300002)(478600001)(4326008)(52536014)(76116006)(25786009)(66476007)(66066001)(66946007)(99286004)(316002)(2906002)(7696005)(6506007)(54906003)(110136005)(7416002)(76176011)(8936002)(6116002)(3846002)(6246003)(53936002)(14454004)(9686003)(7736002)(68736007)(305945005)(74316002)(14444005)(256004)(229853002)(102836004)(26005)(186003)(81166006)(8676002)(81156014); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR18MB2743; H:BYAPR18MB2424.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: marvell.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: eX2+RvfaApsbpzJpV2s56hxTb/M9Ty8QIkOaFEm0iFxwFyljqTj7AeMNha//pMpyKE6V/yMRZMwl7+gHS8UOLQz3yXEmL9xoQlHFhbhk6yg8Zulu1JTJO9B4OLB4irRzID6C6jCLIa8+uXp/k5+kGHM0JJrCYY/j5IUAB/uaz97obalDKnaqoHHzdxe5Q+YEYAXCZS8sqz6P0L9YKOERf/+PpUwWu85+fDD6A+DK6VpogU7QQ8Vzg7dT8xUccgynyFp9QvMEhJjkyKTgZdFENT3NqFDHnAk0GmAG7ZBsTQDV8nvcX9ALrlGGP5Qrmp2UwWll50yYoq/9xiV/KeXzBEpKL+dh86G5POqJCMb2Q18san9bvcOcM+D5bokw4JBXySfYZOXIwjnEnnTQQSoSKe7CJLXraFK1G5pmaCByIOI= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: cd14be12-b7b2-4d22-5fc5-08d7093070ab X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Jul 2019 14:26:34.4357 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: jerinj@marvell.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR18MB2743 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:5.22.84,1.0.8 definitions=2019-07-15_04:2019-07-15,2019-07-15 signatures=0 Subject: Re: [dpdk-dev] [PATCH 2/2] eal: fix IOVA mode selection as VA for pci drivers 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" > > > + > > > +IOVA Mode is selected by considering what the current usable > > > +Devices on the system requires and/or supports. > > > + > > > +Below is the 2-step heuristic for this choice. > > > + > > > +For the first step, EAL asks each bus its requirement in terms of > > > +IOVA mode and decides on a preferred IOVA mode. > > > + > > > +- if all buses report RTE_IOVA_PA, then the preferred IOVA mode is > > > +RTE_IOVA_PA, > > > +- if all buses report RTE_IOVA_VA, then the preferred IOVA mode is > > > +RTE_IOVA_VA, > > > +- if all buses report RTE_IOVA_DC, no bus expressed a preferrence, > > > +then the > > > + preferred mode is RTE_IOVA_DC, > > > +- if the buses disagree (at least one wants RTE_IOVA_PA and at > > > +least one wants > > > + RTE_IOVA_VA), then the preferred IOVA mode is RTE_IOVA_DC (see > > > +below with the > > > + check on Physical Addresses availability), > > > + > > > +The second step is checking if the preferred mode complies with the > > > +Physical Addresses availability since those are only available to > > > +root user in recent kernels. > > > + > > > +- if the preferred mode is RTE_IOVA_PA but there is no access to > > > +Physical > > > + Addresses, then EAL init will fail early, since later probing of > > > +the devices > > > + would fail anyway, > > > +- if the preferred mode is RTE_IOVA_DC then based on the Physical > > > +Addresses > > > + availability, the preferred mode is adjusted to RTE_IOVA_PA or > RTE_IOVA_VA. > > > + In the case when the buses had disagreed on the IOVA Mode at the > > > +first step, > > > + part of the buses won't work because of this decision. > > > > Is there any specific reason why we always prefer PA if physical > > addresses are available? Since we're already assuming that all devices > > support PA and VA anyway, what's the harm in enabling VA by default? >=20 > If PA is available, it means we are running as root. > We can assume that using root is a choice, probably related to a preferen= ce > for PA. # Even if we are running as root, Why to choose PA in case of DC? ie. Following logic is not need if (iova_mode =3D=3D RTE_IOVA_DC) { iova_mode =3D phys_addrs ? RTE_IOVA_PA : RTE_IOVA_V= A; RTE_LOG(DEBUG, EAL, "Buses did not request a specific IOVA mode= , using '%s' based on physical addresses availability.\n", phys_addrs ? "PA" : "VA"); } # When DPDK running on guest, Anyway it can not access the real PA, It will= be IPA. So I don't understand logic behind choose PA when DC. To me, it make sense = to choose PA when DC. # To align with RTE_PCI_DRV_NEED_MAPPING flag and reflect it "need" rather than support, I think, flag can be changed to RTE_PCI_DRV_NEED_IOVA_AS_VA Other than above points, Reviewed this patch and tested on octeontx2, It looks good to me.