From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 9BA8942809;
	Wed, 22 Mar 2023 12:54:31 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 3CC5840E09;
	Wed, 22 Mar 2023 12:54:31 +0100 (CET)
Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com
 [64.147.123.25])
 by mails.dpdk.org (Postfix) with ESMTP id 1A06C40A84;
 Wed, 22 Mar 2023 12:54:30 +0100 (CET)
Received: from compute2.internal (compute2.nyi.internal [10.202.2.46])
 by mailout.west.internal (Postfix) with ESMTP id E8E823200302;
 Wed, 22 Mar 2023 07:54:27 -0400 (EDT)
Received: from mailfrontend2 ([10.202.2.163])
 by compute2.internal (MEProxy); Wed, 22 Mar 2023 07:54:28 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h=
 cc:cc:content-transfer-encoding:content-type:content-type:date
 :date:from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:sender:subject:subject:to:to; s=fm2; t=
 1679486067; x=1679572467; bh=84o3VsvL89j2h7HOZG/hHSblAjVNlM85mu/
 2+nSUs6s=; b=xkzP4Jkqioxas6obqulGmut694eLMu4XuoMKRhaeu+jDyStOc6S
 at2p3D7IBZb8t1izePkPmWcE1VXdhDsqj887XfDAPL4ohzP+BAua8O0cH0ggh6uW
 TjsAax6lU6EHOC2DO7QLzk3iflGU1KranYS/+Cdq3yO2ZluW5e2fxbaGOvtn3+6w
 sJUHa/2WIDLYmqOm5Dzup71eM7p3pq85iF1BVoowXx3EqLlNisEAwo32Og/lbHHe
 dLL38PtCM/AUACDJOR8qc69VqtVAHTn/afzAuvNRr5Mjp+jdMoGPWMKN2/Qfj7Wz
 JmmxtvbQktlP++W9E0RxgSjlATyBPlFCyEA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc:content-transfer-encoding
 :content-type:content-type:date:date:feedback-id:feedback-id
 :from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:sender:subject:subject:to:to:x-me-proxy
 :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=
 1679486067; x=1679572467; bh=84o3VsvL89j2h7HOZG/hHSblAjVNlM85mu/
 2+nSUs6s=; b=CgDZElcNOHZmOyQTIGylUxO8OPGLlOfgc36+acEcTQw8buZmeq3
 y2L0KWkS+byVk/8lbVrL9mAzjPjQR0Drfe5pTFAh3T5JtwKOTu8slsjqAWZ7xxrd
 vi/EGCQ1pbMmwj9i/gyLzaVSnUPIdYdTyxsOG+wF+665W1wrFk5r9J7VrEAgzmsO
 Fh0Rha3L2wbvvHgdg31KjKIrGspzD3TAVALoj5JUq+hBUkAvvL16O0v2TY189ThR
 /GFGwmrFvNhM4B6G0hG830/wQa8iG1J/Yua3jjB2/eggiy2lkGoON3ueGVgHTrjO
 UZ1PV1tpUipYETL3Az15x93itemXwVozvYw==
X-ME-Sender: <xms:c-waZFLk32Gpq14SstKUupbf0Glr0s-NHJd82fZLQOjCBFqcs41CtQ>
 <xme:c-waZBL_A7NGDliLdBwL6wvnmwI98LcoPLqikjBT3RTd3rU1Eh21A-uLfefZcfDOz
 IvTVp98-32-WpSuBQ>
X-ME-Received: <xmr:c-waZNse1ocFQ4tOMYw0DN7WzAuJHPBsaB5M-tjLM9MR8WzglGJkeMnyginMgCY7Skz1WjKFC0T8Ifb_oV2EAtnqrw>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdegvddgfeehucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne
 cujfgurhephffvvefufffkjghfggfgtgesthfuredttddtvdenucfhrhhomhepvfhhohhm
 rghsucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenuc
 ggtffrrghtthgvrhhnpedtjeeiieefhedtfffgvdelteeufeefheeujefgueetfedttdei
 kefgkeduhedtgfenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfh
 hrohhmpehthhhomhgrshesmhhonhhjrghlohhnrdhnvght
X-ME-Proxy: <xmx:c-waZGZRq9bpkq9A4DOx0m8pkgkAINY-SGO2CbLgmU2tRzndyGVgMQ>
 <xmx:c-waZMYQXwyOFU7tDjZpmB5oZHs5muNf_jQMj7wDb9HXiwU4odpd-Q>
 <xmx:c-waZKCk-ljqy-RpmgHfSqiEWFow8CFeg4mRlrmd-Mv0T-kCed1htw>
 <xmx:c-waZLzl1GBaIkbNYkPjefcnVw1P59ABaYXkwZ0LHGvx1BzwKP7aVg>
Feedback-ID: i47234305:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed,
 22 Mar 2023 07:54:25 -0400 (EDT)
From: Thomas Monjalon <thomas@monjalon.net>
To: "Huang, Wei" <wei.huang@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
 "david.marchand@redhat.com" <david.marchand@redhat.com>,
 "stable@dpdk.org" <stable@dpdk.org>, "Xu, Rosen" <rosen.xu@intel.com>,
 "Zhang, Tianfei" <tianfei.zhang@intel.com>,
 "Zhang, Qi Z" <qi.z.zhang@intel.com>
Subject: Re: [PATCH v1] raw/ifpga: remove virtual device unplug operation
Date: Wed, 22 Mar 2023 12:54:24 +0100
Message-ID: <5367342.29KlJPOoH8@thomas>
In-Reply-To: <DM6PR11MB3530B0A55D11406EDE6CF9B9EF869@DM6PR11MB3530.namprd11.prod.outlook.com>
References: <20230316204445.360330-1-wei.huang@intel.com>
 <2637984.KRxA6XjA2N@thomas>
 <DM6PR11MB3530B0A55D11406EDE6CF9B9EF869@DM6PR11MB3530.namprd11.prod.outlook.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="us-ascii"
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

22/03/2023 02:26, Huang, Wei:
> From: Thomas Monjalon <thomas@monjalon.net>
> > 21/03/2023 09:41, Huang, Wei:
> > > From: Thomas Monjalon <thomas@monjalon.net>
> > > > 21/03/2023 01:11, Huang, Wei:
> > > > > From: Thomas Monjalon <thomas@monjalon.net>
> > > > > > 16/03/2023 21:44, Wei Huang:
> > > > > > > VDEV bus has implemented cleanup() function to perform cleanup
> > > > > > > for devices on the bus during eal_cleanup(), so there is no
> > > > > > > need for ifpga driver to record virtual devices and unplug them.
> > > > > >
> > > > > > Why no need?
> > > > > > If the application wants to explicitly remove a device, what happens?
> > > > > >
> > > > > >
> > > > > EAL will output an error information "Cannot find plugged device (%s)".
> > > >
> > > > It does not look what we expect.
> > > >
> > > Let me clear it.
> > > With this patch, no error information will be outputted.
> > > Without this patch, error information will be outputted.
> > > Because bus cleanup action will unplug virtual device, then ifpga PMD
> > > unplug the virtual device which is already be cleanup,
> > 
> > Why ipfga unplug the device after the bus cleanup?
> > I'm not following.
> > 
> The virtual device is created upon ifpga, if VDEV bus doesn't perform cleanup,
> ifpga has the responsibility to unplug these virtual devices.

Really I don't understand the flow.
Are you talking about EAL cleanup case?
What happens first? Do you need ifpga to be called first?
I think you need the correct checks to allow any order of cleanup.

> > > bus->find_device() returns NULL,
> > > EAL output "Cannot find plugged device (%s)\n" at line 302 in
> > > eal_common_dev.c
> > 
> > Anyway, the good answer is not to completely remove the "remove"
> > operation.
> > 
> If not to completely remove the "remove", the same virtual device will be unplug twice, is it reasonable?

You need to add a check to not unplug something already unplugged.
But you must allow the user calling "remove" directly.