From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60050.outbound.protection.outlook.com [40.107.6.50]) by dpdk.org (Postfix) with ESMTP id 28E882862 for ; Tue, 6 Nov 2018 07:36:05 +0100 (CET) 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=SreVfgQ7adQyMmH+futOy9tF47aBNuThkAXjvFkKtag=; b=bpR2hdGZWYhuZAEdH1tNN4asiLrD3G/Irko1jBlOlBWjBobfOsRhQYOSn7ZK9mBxCWQUogg6aw4FKCIMdR4/7WJcWxsLdG6WI5XhsXSQ4O0uATLaT2Oh68YOwZa6MrDhzodHSJU/QA2oYFy03o+pnD3svN3gW6+2hCK+CGPfE4g= Received: from AM0PR0502MB4019.eurprd05.prod.outlook.com (52.133.41.11) by AM0PR0502MB3859.eurprd05.prod.outlook.com (52.133.48.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.28; Tue, 6 Nov 2018 06:36:03 +0000 Received: from AM0PR0502MB4019.eurprd05.prod.outlook.com ([fe80::b158:af20:5026:3d25]) by AM0PR0502MB4019.eurprd05.prod.outlook.com ([fe80::b158:af20:5026:3d25%2]) with mapi id 15.20.1294.034; Tue, 6 Nov 2018 06:36:03 +0000 From: Matan Azrad To: Jeff Guo , "konstantin.ananyev@intel.com" , "anatoly.burakov@intel.com" , Thomas Monjalon , "bernard.iremonger@intel.com" , "jingjing.wu@intel.com" , "wenzhuo.lu@intel.com" CC: "ferruh.yigit@intel.com" , "dev@dpdk.org" , "helin.zhang@intel.com" , "shaopeng.he@intel.com" Thread-Topic: [PATCH 3/3] app/testpmd: fix callback issue for hot-unplug Thread-Index: AQHUdZZ8h+lHSEr6OUWDDdkfR7wInqVCSJ3g Date: Tue, 6 Nov 2018 06:36:03 +0000 Message-ID: References: <1541484436-91320-1-git-send-email-jia.guo@intel.com> <1541484436-91320-4-git-send-email-jia.guo@intel.com> In-Reply-To: <1541484436-91320-4-git-send-email-jia.guo@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-microsoft-exchange-diagnostics: 1; AM0PR0502MB3859; 6:MaMBVgGtvPirsUHj6aH0+ZsXPpafCRsMvrq4C7E4Hx8vsJN5kyxB88i8I+tqqwrzz2T2KiCJ7Uy+TQNRKutjh88tUHZ23wMAKTi3533wiwzlZ3JuFqcWIw82p+Ke19y0U6WXGT8CS86dErjk+oF0RsS4xe9EgrofLt404VNxylQDXfMNT3qHsYTcwDYRu2H1Ik2wV7tflXMRAiGgRCKGjI+gQSq0NIe08SOZ/ppO9VeUVo0YvY2MBv0gER8FKxZUkXl+aOIGtBEynCpyAxJopvzWPno5fE+WlRCSfFjpAMkQ7rpwNrysXcEEw+mVjVzauId1I1Fpo8Tf22gubEUf8G6o37garmU5xQHOkJmXcOCbbDvg0sUkropzwJ3pbDdms+Awsod/apNcJTe8bDKFXJJMHwOkXmW/iwu+hryExpVikYUWSXwhEmO/a8jsKChg5ejDdHikEks3QXNrgxIYbA==; 5:2xiJnJ4GStGjLuCbqljRRkLhFpkOUJRLYma8mYG+bv8ykgWgA5VVnhWKjkObXB8WfZYm3HJb5vW2uJjF+8xMOExbtUQBlF+DvJsyrXKyj0XXv+m3FcQlD/JauKqMVkBqxuIpzJpaKbqJbOfc2edQYGYlsDSgW83trnBKzu4Bwi8=; 7:jP2QCdO2OFQqJOlhozZEYsr3nqSf+8SL6Yik5EB3h159wU4jdFGVISwR9rzMrZYwCWml1gkR4sWri6RY7VkGK2s6ho0kjl82TBFWx5mWstslh+gWvhiiTr8v1sSgNMURNRe/SRkvyVh6CHHCrmJ+lA== x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: 87ac30df-ca62-4bf0-b302-08d643b21fc7 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:AM0PR0502MB3859; x-ms-traffictypediagnostic: AM0PR0502MB3859: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(228905959029699); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231382)(944501410)(52105095)(93006095)(93001095)(3002001)(10201501046)(6055026)(148016)(149066)(150057)(6041310)(20161123562045)(20161123560045)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095); SRVR:AM0PR0502MB3859; BCL:0; PCL:0; RULEID:; SRVR:AM0PR0502MB3859; x-forefront-prvs: 0848C1A6AA x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(136003)(396003)(376002)(39860400002)(366004)(189003)(199004)(51444003)(86362001)(6436002)(476003)(3846002)(68736007)(54906003)(110136005)(99286004)(53936002)(8676002)(6116002)(7416002)(102836004)(5660300001)(106356001)(14444005)(478600001)(25786009)(4326008)(33656002)(6246003)(256004)(7696005)(11346002)(66066001)(446003)(316002)(2201001)(76176011)(229853002)(8936002)(81166006)(7736002)(575784001)(97736004)(105586002)(305945005)(186003)(71200400001)(6506007)(71190400001)(74316002)(81156014)(2900100001)(55016002)(2906002)(2501003)(486006)(14454004)(9686003)(26005); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR0502MB3859; 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-microsoft-antispam-message-info: hTPepcSjFtI+BMsTQ/xVNUduCebqx46niHYbACFASvDQbs1T4qYd0FQDw8SSqwe2kG6WU6Rw3kESj4T/79J05rLx7GpeVrrqwlQExRgErvfOVuW20Xncby05bxBrGDAytnuPC8ye416EeinX/CaEJgza96/KKaCdnmfbN/gx56D0dTgapOJkhmG5D8VUgaNYjCIc4E2KaSVP+iQ9q2c9cfL0mF2f4A1pzCVO8yk6kcj/TCxtthMEQ9S9dMDqEiai6Geq1xU0QUG9LOp+Qtzz1XyI04s/hys4DulKcOeiesjyETt7bgP1sW377s/QISkcAyw+q2aDKZBoPacTC+32ZM4BhXcnEc2IkLlFSTkH4yU= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM 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: 87ac30df-ca62-4bf0-b302-08d643b21fc7 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Nov 2018 06:36:03.5034 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0502MB3859 Subject: Re: [dpdk-dev] [PATCH 3/3] app/testpmd: fix callback issue for hot-unplug 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: Tue, 06 Nov 2018 06:36:05 -0000 Hi Jeff From: Jeff Guo > Before detach device when device be hot-unplugged, the failure process in > user space and kernel space both need to be finished, such as eal interru= pt > callback need to be inactive before the callback be unregistered when dev= ice > is being cleaned. This patch add rte alarm for device detaching, with tha= t it > could finish interrupt callback soon and give time to let the failure pro= cess > done before detaching. >=20 > Fixes: 2049c5113fe8 ("app/testpmd: use hotplug failure handler") > Signed-off-by: Jeff Guo > --- > app/test-pmd/testpmd.c | 13 ++++++++++++- > 1 file changed, 12 insertions(+), 1 deletion(-) >=20 > diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index > 9c0edca..9c673cf 100644 > --- a/app/test-pmd/testpmd.c > +++ b/app/test-pmd/testpmd.c > @@ -2620,7 +2620,18 @@ eth_dev_event_callback(const char > *device_name, enum rte_dev_event_type type, > device_name); > return; > } > - rmv_event_callback((void *)(intptr_t)port_id); > + /* > + * Before detach device, the hot-unplug failure process in > + * user space and kernel space both need to be finished, > + * such as eal interrupt callback need to be inactive before > + * the callback be unregistered when device is being cleaned. > + * So finished interrupt callback soon here and give time to > + * let the work done before detaching. > + */ > + if (rte_eal_alarm_set(100000, > + rmv_event_callback, (void > *)(intptr_t)port_id)) > + RTE_LOG(ERR, EAL, > + "Could not set up deferred device It looks me strange to use callback and alarm to remove a device: Why not to use callback and that is it? I think that it's better to let the EAL to detach the device after all the = callbacks were done and not to do it by the user callback. So the application\callback owners just need to clean its resources with un= derstanding that after the callback the device(and the callback itself) wil= l be detached by the EAL.=20 > removal\n"); > break; > case RTE_DEV_EVENT_ADD: > RTE_LOG(ERR, EAL, "The device: %s has been added!\n", > -- > 2.7.4