From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 42791A0552 for ; Tue, 31 May 2022 19:09:00 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 62F07427EC; Tue, 31 May 2022 19:08:59 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id AE31A4067B; Tue, 31 May 2022 19:08:56 +0200 (CEST) Received: from [192.168.1.38] (unknown [188.170.81.145]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by shelob.oktetlabs.ru (Postfix) with ESMTPSA id DDBAB86; Tue, 31 May 2022 20:08:55 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru DDBAB86 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1654016936; bh=9DpTTt1cP8Mb5ekZFV2qjwBFOfQhYgqj8graD74Pm2Q=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=W1UHB8mORxOxRxPr45N5pyRvUFBanjU8BwIFKM+NX7d6P/pvFvp9HaDmJCtPPq4aC VUdV5To/htu84LELEFO8j7268lPAfO0QrHITS+KvWdoO7WNAOD/BbVAULM2p70G9zc ujBfIW1iLPiiFSU5FxP8h10xBj/Txo6FqavXp970= Message-ID: Date: Tue, 31 May 2022 20:08:55 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PATCH] ethdev: fix dev close in secondary process Content-Language: en-US To: "Min Hu (Connor)" , dev@dpdk.org Cc: stable@dpdk.org, Thomas Monjalon , Ferruh Yigit , Anatoly Burakov , Ajit Khaparde References: <20220527023553.48177-1-humin29@huawei.com> From: Andrew Rybchenko In-Reply-To: <20220527023553.48177-1-humin29@huawei.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org On 5/27/22 05:35, Min Hu (Connor) wrote: > From: Min Hu > > Shared memory like port private resources should only be reserved > by primary process. Secondary process should not start dev, and > the state of 'dev_started' is only meaningful to primary process. > While secondary process need to close dev to release process private > resources. > > This patch limited the scope of 'dev_started'. I agree with the patch since secondary process should not be obliged to wait for device stop before closing ethdev. In any case closing ethdev in secondary process should do nothing harmful to the primary process. However, the patch description pretends to limit dev_started scope for secondary processes in general. It is wrong since secondary processes need the information and that's why it is stored in shared memory. > > Fixes: febc855b358e ("ethdev: forbid closing started device") > Cc: stable@dpdk.org > > Signed-off-by: Min Hu > --- > lib/ethdev/rte_ethdev.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c > index 09abee6345..f34c6580a4 100644 > --- a/lib/ethdev/rte_ethdev.c > +++ b/lib/ethdev/rte_ethdev.c > @@ -1574,7 +1574,8 @@ rte_eth_dev_close(uint16_t port_id) > RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); > dev = &rte_eth_devices[port_id]; > > - if (dev->data->dev_started) { > + if (rte_eal_process_type() == RTE_PROC_PRIMARY && > + dev->data->dev_started) { > RTE_ETHDEV_LOG(ERR, "Cannot close started device (port %u)\n", > port_id); > return -EINVAL;