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 47AD7A053A; Thu, 23 Jan 2020 17:00:38 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2221F2956; Thu, 23 Jan 2020 17:00:38 +0100 (CET) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20061.outbound.protection.outlook.com [40.107.2.61]) by dpdk.org (Postfix) with ESMTP id D8B5427D; Thu, 23 Jan 2020 17:00:36 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N6SF0HLGm6cZlXB17+V0A8ecZW0Qmubh5pIYSJ3gpUIlobfb4Xe1l12nFzgCnuj8lrQlzGBnT/ciHYqF1IonWi0jcwq5lCCfFvw6uLsnc/Ll7H6fv9XNmyHAH/dcY7slh5Dhffc8KLEsX+O+72CHqUnMzay2FWEGjQegany0aWOIvJJebhGVY3axg94CYBRWEw+ktD8Lnz+Xkid+caOSyG8eAkaPOvyooj0hfo7/6NOzLoPEv5R+wxVBpQz1ok9i+/iSTqmZ+v+4LKREBvdlERyjiiztH8NWvZLhnLqii+seEzBDIItHUre1N6tzxHyazbpObPM0P9na6YdT3gQ9Cg== 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=27JVN0e5GL9Amgp3d/x/SHyD/Iwhuc54fNJEYmqQ42s=; b=V+yiowzF0H24DD////XQYTD3odG/vAaIGg+DbTmpk0UE4difxAvn+GCleHD5Ki/MIBvIYD0vBaiqGHeIS6AqPI/6V3Pg7xUtwT4pHpBL0KartUUYuc2j0FaLUkIz45zYll7BO//7pQyWC6/THsyobuAj+dfWSDFYDbnXBjPuu9g3g2GXoTFFINbn38AyUnq1BqSerDg8o9cE00NQQ4Ipb3aFqbsxlZqQtJqarDwevq7AKrBjj+f8OHYJOXQpTacqLeB8qSfpzkkxQXvH94rtpzpm7m6sL56rCDlXKrhuSWIRBsGiaLry+DT/pOZYtHrLz271U1xNetBA2veXPVQ3Xg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=27JVN0e5GL9Amgp3d/x/SHyD/Iwhuc54fNJEYmqQ42s=; b=WKAmvp53O9Nrichm0yy+qPjpL7xjHcEw5a7IqykuAjifxACJWQR/E2d8rTDR01i/b4PvKmRHieG2K0VqO0XtMLQtT09/zrZL4icsgOrbJE4C2OP6cVyM9+173puHYR9p10FqquLmil8JgbhgQunqTUaMeFS5vHCtkSb17jJJ17s= Received: from AM0PR0502MB4019.eurprd05.prod.outlook.com (52.133.39.139) by AM0PR0502MB3954.eurprd05.prod.outlook.com (52.133.39.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2665.20; Thu, 23 Jan 2020 16:00:36 +0000 Received: from AM0PR0502MB4019.eurprd05.prod.outlook.com ([fe80::e495:9258:db09:1de8]) by AM0PR0502MB4019.eurprd05.prod.outlook.com ([fe80::e495:9258:db09:1de8%7]) with mapi id 15.20.2644.027; Thu, 23 Jan 2020 16:00:35 +0000 From: Matan Azrad To: Ferruh Yigit , Wenzhuo Lu , Jingjing Wu , Bernard Iremonger CC: "dev@dpdk.org" , "stable@dpdk.org" Thread-Topic: [PATCH] app/testpmd: fix hotplug Thread-Index: AQHV0gCZc+E5PYXQAkiVKrFpKI0bUKf4ZHsQ Date: Thu, 23 Jan 2020 16:00:35 +0000 Message-ID: References: <20200123151509.3207419-1-ferruh.yigit@intel.com> In-Reply-To: <20200123151509.3207419-1-ferruh.yigit@intel.com> Accept-Language: en-US, he-IL Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=matan@mellanox.com; x-originating-ip: [193.47.165.251] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: ba77ffd5-6fff-4358-0f7a-08d7a01d624c x-ms-traffictypediagnostic: AM0PR0502MB3954: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-forefront-prvs: 029174C036 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(39860400002)(366004)(136003)(396003)(346002)(376002)(189003)(199004)(9686003)(86362001)(55016002)(4326008)(478600001)(54906003)(81156014)(2906002)(81166006)(8676002)(33656002)(8936002)(26005)(6506007)(186003)(7696005)(316002)(52536014)(71200400001)(66556008)(66446008)(66946007)(66476007)(110136005)(76116006)(5660300002)(64756008); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR0502MB3954; H:AM0PR0502MB4019.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: wDeLOggLHdkbej2Jegmg7aZurhmb7iRdWKCGETlUlBktOXN+jdwht59YEGIAr0votd2Swu8obrqqb2ufog04f3yvDJAb3afJVbiGYZJBoN7Z5iM6XXpMkbum7iOFm6h1iIUTk748Bjhyr0x6kZ9l8UPzA+8nsQc2JFkzIPN9yRrkySN6ayioSbdkqWoZb1souLMf1sk77LO4UVhkUtUlAsywNCpz6N0ULqGR1bcK+c0BNGU6DUG9hp4o902D2MyeMY+sTY8o0y5LU5z+8lJvjc+eJEAxI5pYOmM1rqWXrH9OjJzFmaeESlZZwKxFK3iDjgzdiZjV7xMERwkbiStOp7kHkMN42spnItDUcGOGnTCEdTxUFdOAPfTjVxrKsMZsss+JPoq7b4u/EbkVQwXfr/fX6jpEzQMyhrE8n2ETv5Zj7FoUhXn2xU259vvUWWRF x-ms-exchange-antispam-messagedata: M1mJletzF07Rq9sV92fS1BT6/sNHn6vmeOZrCGCJdyTxEK/BDiOWyf4U7xJcdl47523NX1+SPA1qKYmneqhdEvAcLplgT7bUkCectv1MT9TNp11VlB/YBCHo2C+geGJIJNDOAUT4ezhh9ANfdf4QJw== x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: ba77ffd5-6fff-4358-0f7a-08d7a01d624c X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Jan 2020 16:00:35.9122 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: XMgiFfhJtMJfF3X4Pz/QgdRm+T/zR+2RbqWHeSd9nTKlE53p6GSz9YX6XnRpjj5bOhKks/CJVeQb8MyFofOSUA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0502MB3954 Subject: Re: [dpdk-dev] [PATCH] app/testpmd: fix hotplug 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" Hi From: Ferruh Yigit > The 'port_id_is_invalid()' check in the 'detach_port_device()' is breakin= g the > hotplug support, since at that stage port will be closed and validity che= ck > always fail [1] and removing the device is not really completed. >=20 > But this cause the vfio request interrupt keep triggered continuously and > makes the application unusable, since port is closed but device is not > removed, the remove path keep generating error log: >=20 > EAL: can not get port by device 0000:00:05.0! > EAL: can not get port by device 0000:00:05.0! > EAL: can not get port by device 0000:00:05.0! > EAL: can not get port by device 0000:00:05.0! > EAL: can not get port by device 0000:00:05.0! > EAL: can not get port by device 0000:00:05.0! >=20 > Fixed by removing 'port_id_is_invalid()' check from 'detach_port_device()= ', > anyway it shouldn't be required. Without this check device remove works a= s > expected. >=20 > Only "Invalid port_id=3D0" logs seen a few times, which is because the ac= tual > removal not done synchronously but an alarm set for it, until the alarm f= ired > application may receive many interrupts, expect the first ones cause the > error. > So this patch also removes the logging from checking the invalid port in > 'rmv_port_callback()' to reduce the noise. >=20 > [1] > rmv_port_callback() > stop_port(port_id); > close_port(port_id); > detach_port_device(port_id); >=20 > Fixes: 43d0e304980a ("app/testpmd: fix invalid port detaching") > Cc: stable@dpdk.org >=20 > Signed-off-by: Ferruh Yigit > --- > app/test-pmd/testpmd.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) >=20 > diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index > f9f4cd1d3..3323013bb 100644 > --- a/app/test-pmd/testpmd.c > +++ b/app/test-pmd/testpmd.c > @@ -2641,9 +2641,6 @@ detach_port_device(portid_t port_id) >=20 > printf("Removing a device...\n"); >=20 > - if (port_id_is_invalid(port_id, ENABLED_WARN)) > - return; > - I don't think this is the correct fix. See the line below - you use the port structure, it makes sense to check it= s validity before. > dev =3D rte_eth_devices[port_id].device; > if (dev =3D=3D NULL) { > printf("Device already removed\n"); > @@ -2875,7 +2872,8 @@ rmv_port_callback(void *arg) > int org_no_link_check =3D no_link_check; > portid_t port_id =3D (intptr_t)arg; >=20 > - RTE_ETH_VALID_PORTID_OR_RET(port_id); > + if (!rte_eth_dev_is_valid_port(port_id)) > + return; >=20 > if (!test_done && port_is_forwarding(port_id)) { > need_to_start =3D 1; IMO the correct fix is to change this function to get pointer to rte_device= instead of port ID and change the Testpmd command line to get the device i= nstead of port ID. Matan