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 21E7EA0351 for ; Mon, 10 Jan 2022 08:46:26 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1887C4013F; Mon, 10 Jan 2022 08:46:26 +0100 (CET) Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by mails.dpdk.org (Postfix) with ESMTP id 79F3D4013F for ; Mon, 10 Jan 2022 08:46:25 +0100 (CET) Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 4E870406EC for ; Mon, 10 Jan 2022 07:46:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1641800785; bh=viVUph+/nQCzJ5DNcuLBmJjvHJo2v9NTNiSOk8tcd/I=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=jV4b18sYt8Am/6KaO9u/sM6C5BtQZk4MQm41NSDYQLAZNgqKKfsZ90XqLgGFvhyBY kdGjQb12N4xCszD1PIwEjT/FJaXxXR2Tyrs58WT3EYtWzAUDG7spkd+TAP2SWMBBUK XXtuWKIIVVHz1fiJDuzsccC9mIYfL/Smo0QHm3dVyeK5KZT+1/wxp6sbWXD697rI8V Z8+nyDxxt/CdgPxpYUL0TvqtSod5GW3SG474xhocsQno8HRYH2dW5LebTVdEUpHT91 fods6DQbIoZUISG/ZVLKck4tRihFU5WOgi5hIqrtUhnmK/LUmN+MyHz6z+rnz84/x5 rz6JwtT0ho8ww== Received: by mail-qt1-f197.google.com with SMTP id c7-20020ac80087000000b002c419378084so10164730qtg.18 for ; Sun, 09 Jan 2022 23:46:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=viVUph+/nQCzJ5DNcuLBmJjvHJo2v9NTNiSOk8tcd/I=; b=G/tcyC5v3Kp4TE+P48AhK1P8O9uGrZCKQZadw8uiACiT1Trfy76zmxNq5x1Zt2jfhv 1t3IMU0J/1qjLo3mqR7n9ALt2eZk6g8o4SpxGJihB/Ww9vBos2R49DHW+OMqqcwq+FHG dhvu5d0yZ27J0HHgGtFDXihEWdPLTaoexeXZjXHSnuQEBQt4ws+Xnv4OjSVXaAIs1zYg VRJIpDkx6UullfylywwVnoWtX5BbZqmtUbAjMmNTYTrNNbUmLIXgwFZ4YCDlgmktqneF CUMlJEGrQIa6BVdtKe+6NwNVuCii11A12tehQy6Dcuyx1k/0ijYVjhMW2D28i36ppV8B Dtvw== X-Gm-Message-State: AOAM5310omwMADbJPrR8D1lQdbVlE/b1W56iwhnhC3aMJdo9V+m7HAkl 3od20/3AFYcWZbR5+ezVqJ5xk+vPMQQlymw8DZPOqPvbdhA53E/XIu6P22d8v4MHh+D2QWEmx2W 29ZDyO5zuy1qVFbWQyWCl9CIvHxzyVs28rjxPcx+/ X-Received: by 2002:a05:620a:2a13:: with SMTP id o19mr4486292qkp.585.1641800784241; Sun, 09 Jan 2022 23:46:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJxzFt3r/1lrQ8/TXCLgvwCs5Swpp/ANMFGSJTLUrzL9Rto9XEGAcTebCaLaCgc0pwYxzK509SGsxc2nZOdTD/E= X-Received: by 2002:a05:620a:2a13:: with SMTP id o19mr4486283qkp.585.1641800784011; Sun, 09 Jan 2022 23:46:24 -0800 (PST) MIME-Version: 1.0 References: <20211225105344.28355-1-lihuisong@huawei.com> <20211225105344.28355-3-lihuisong@huawei.com> In-Reply-To: <20211225105344.28355-3-lihuisong@huawei.com> From: Christian Ehrhardt Date: Mon, 10 Jan 2022 08:45:58 +0100 Message-ID: Subject: Re: [PATCH 19.11 2/4] net/hns3: fix secondary process reference count To: Huisong Li Cc: stable@dpdk.org, humin29@huawei.com Content-Type: text/plain; charset="UTF-8" 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 Sat, Dec 25, 2021 at 11:58 AM Huisong Li wrote: > > [ upstream commit 323263717774df318d8a6e64ac8bfe546e03b8f6 ] > Thank you, queued for 19.11.12 (later this year) > The "secondary_cnt" will be increased when a secondary process > initialized. But the value of this variable is not decreased when the > secondary process exits, which causes the primary process senses that > the secondary process still exists. As a result, the primary process > fails to send messages to the secondary process after the secondary > process exits. > > Fixes: 23d4b61fee5d ("net/hns3: support multiple process") > > Signed-off-by: Huisong Li > Signed-off-by: Min Hu (Connor) > --- > drivers/net/hns3/hns3_ethdev.c | 5 +++-- > drivers/net/hns3/hns3_ethdev_vf.c | 6 ++++-- > drivers/net/hns3/hns3_mp.c | 3 ++- > 3 files changed, 9 insertions(+), 5 deletions(-) > > diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c > index a2676f84b0..d245c5db8b 100644 > --- a/drivers/net/hns3/hns3_ethdev.c > +++ b/drivers/net/hns3/hns3_ethdev.c > @@ -4749,6 +4749,7 @@ hns3_dev_close(struct rte_eth_dev *eth_dev) > if (rte_eal_process_type() != RTE_PROC_PRIMARY) { > rte_free(eth_dev->process_private); > eth_dev->process_private = NULL; > + __atomic_fetch_sub(&hw->secondary_cnt, 1, __ATOMIC_RELAXED); > return; > } > > @@ -5437,8 +5438,7 @@ hns3_dev_init(struct rte_eth_dev *eth_dev) > "process, ret = %d", ret); > goto err_mp_init_secondary; > } > - > - hw->secondary_cnt++; > + __atomic_fetch_add(&hw->secondary_cnt, 1, __ATOMIC_RELAXED); > return 0; > } > > @@ -5551,6 +5551,7 @@ hns3_dev_uninit(struct rte_eth_dev *eth_dev) > if (rte_eal_process_type() != RTE_PROC_PRIMARY) { > rte_free(eth_dev->process_private); > eth_dev->process_private = NULL; > + __atomic_fetch_sub(&hw->secondary_cnt, 1, __ATOMIC_RELAXED); > return 0; > } > > diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c > index 790e76a0db..972a6f00e4 100644 > --- a/drivers/net/hns3/hns3_ethdev_vf.c > +++ b/drivers/net/hns3/hns3_ethdev_vf.c > @@ -1653,6 +1653,8 @@ hns3vf_dev_close(struct rte_eth_dev *eth_dev) > > if (rte_eal_process_type() != RTE_PROC_PRIMARY) { > rte_free(eth_dev->process_private); > + eth_dev->process_private = NULL; > + __atomic_fetch_sub(&hw->secondary_cnt, 1, __ATOMIC_RELAXED); > return; > } > > @@ -2291,8 +2293,7 @@ hns3vf_dev_init(struct rte_eth_dev *eth_dev) > "process, ret = %d", ret); > goto err_mp_init_secondary; > } > - > - hw->secondary_cnt++; > + __atomic_fetch_add(&hw->secondary_cnt, 1, __ATOMIC_RELAXED); > return 0; > } > > @@ -2386,6 +2387,7 @@ hns3vf_dev_uninit(struct rte_eth_dev *eth_dev) > if (rte_eal_process_type() != RTE_PROC_PRIMARY) { > rte_free(eth_dev->process_private); > eth_dev->process_private = NULL; > + __atomic_fetch_sub(&hw->secondary_cnt, 1, __ATOMIC_RELAXED); > return 0; > } > > diff --git a/drivers/net/hns3/hns3_mp.c b/drivers/net/hns3/hns3_mp.c > index a03f2cf13c..9b5ff475a9 100644 > --- a/drivers/net/hns3/hns3_mp.c > +++ b/drivers/net/hns3/hns3_mp.c > @@ -132,7 +132,8 @@ mp_req_on_rxtx(struct rte_eth_dev *dev, enum hns3_mp_req_type type) > int ret; > int i; > > - if (rte_eal_process_type() == RTE_PROC_SECONDARY || !hw->secondary_cnt) > + if (rte_eal_process_type() == RTE_PROC_SECONDARY || > + __atomic_load_n(&hw->secondary_cnt, __ATOMIC_RELAXED) == 0) > return; > if (type != HNS3_MP_REQ_START_RXTX && type != HNS3_MP_REQ_STOP_RXTX) { > hns3_err(hw, "port %u unknown request (req_type %d)", > -- > 2.33.0 > -- Christian Ehrhardt Staff Engineer, Ubuntu Server Canonical Ltd