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 A4437A00BE; Mon, 11 Apr 2022 03:01:13 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 451E24067B; Mon, 11 Apr 2022 03:01:13 +0200 (CEST) Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by mails.dpdk.org (Postfix) with ESMTP id CC71240040 for ; Mon, 11 Apr 2022 03:01:11 +0200 (CEST) Received: from kwepemi500012.china.huawei.com (unknown [172.30.72.53]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Kc9Wk5F9lz1HBdn; Mon, 11 Apr 2022 09:00:34 +0800 (CST) Received: from [10.67.103.128] (10.67.103.128) by kwepemi500012.china.huawei.com (7.221.188.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Mon, 11 Apr 2022 09:01:06 +0800 Subject: Re: [RFC 3/3] examples/bond: fix invalid use of trylock To: =?UTF-8?Q?Mattias_R=c3=b6nnblom?= , CC: Thomas Monjalon , David Marchand , , , , References: <20220410135140.161842-1-mattias.ronnblom@ericsson.com> <20220410135140.161842-3-mattias.ronnblom@ericsson.com> From: "Min Hu (Connor)" Message-ID: <3443f2f4-ef5d-d727-e6d7-945e00211a11@huawei.com> Date: Mon, 11 Apr 2022 09:01:06 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.3.1 MIME-Version: 1.0 In-Reply-To: <20220410135140.161842-3-mattias.ronnblom@ericsson.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.103.128] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemi500012.china.huawei.com (7.221.188.12) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Acked-by: Min Hu (Connor) 在 2022/4/10 21:51, Mattias Rönnblom 写道: > The conditional rte_spinlock_trylock() was used as if it is an > unconditional lock operation in a number of places. > > Fixes: cc7e8ae84faa ("examples/bond: add example application for link bonding mode 6") > Cc: michalx.k.jastrzebski@intel.com > > Signed-off-by: Mattias Rönnblom > --- > examples/bond/main.c | 14 +++++++------- > 1 file changed, 7 insertions(+), 7 deletions(-) > > diff --git a/examples/bond/main.c b/examples/bond/main.c > index 335bde5c8d..4efebb3902 100644 > --- a/examples/bond/main.c > +++ b/examples/bond/main.c > @@ -373,7 +373,7 @@ static int lcore_main(__rte_unused void *arg1) > bond_ip = BOND_IP_1 | (BOND_IP_2 << 8) | > (BOND_IP_3 << 16) | (BOND_IP_4 << 24); > > - rte_spinlock_trylock(&global_flag_stru_p->lock); > + rte_spinlock_lock(&global_flag_stru_p->lock); > > while (global_flag_stru_p->LcoreMainIsRunning) { > rte_spinlock_unlock(&global_flag_stru_p->lock); > @@ -456,7 +456,7 @@ static int lcore_main(__rte_unused void *arg1) > if (is_free == 0) > rte_pktmbuf_free(pkts[i]); > } > - rte_spinlock_trylock(&global_flag_stru_p->lock); > + rte_spinlock_lock(&global_flag_stru_p->lock); > } > rte_spinlock_unlock(&global_flag_stru_p->lock); > printf("BYE lcore_main\n"); > @@ -571,7 +571,7 @@ static void cmd_start_parsed(__rte_unused void *parsed_result, > { > int worker_core_id = rte_lcore_id(); > > - rte_spinlock_trylock(&global_flag_stru_p->lock); > + rte_spinlock_lock(&global_flag_stru_p->lock); > if (global_flag_stru_p->LcoreMainIsRunning == 0) { > if (rte_eal_get_lcore_state(global_flag_stru_p->LcoreMainCore) > != WAIT) { > @@ -591,7 +591,7 @@ static void cmd_start_parsed(__rte_unused void *parsed_result, > if ((worker_core_id >= RTE_MAX_LCORE) || (worker_core_id == 0)) > return; > > - rte_spinlock_trylock(&global_flag_stru_p->lock); > + rte_spinlock_lock(&global_flag_stru_p->lock); > global_flag_stru_p->LcoreMainIsRunning = 1; > rte_spinlock_unlock(&global_flag_stru_p->lock); > cmdline_printf(cl, > @@ -659,7 +659,7 @@ static void cmd_stop_parsed(__rte_unused void *parsed_result, > struct cmdline *cl, > __rte_unused void *data) > { > - rte_spinlock_trylock(&global_flag_stru_p->lock); > + rte_spinlock_lock(&global_flag_stru_p->lock); > if (global_flag_stru_p->LcoreMainIsRunning == 0) { > cmdline_printf(cl, > "lcore_main not running on core:%d\n", > @@ -700,7 +700,7 @@ static void cmd_quit_parsed(__rte_unused void *parsed_result, > struct cmdline *cl, > __rte_unused void *data) > { > - rte_spinlock_trylock(&global_flag_stru_p->lock); > + rte_spinlock_lock(&global_flag_stru_p->lock); > if (global_flag_stru_p->LcoreMainIsRunning == 0) { > cmdline_printf(cl, > "lcore_main not running on core:%d\n", > @@ -762,7 +762,7 @@ static void cmd_show_parsed(__rte_unused void *parsed_result, > printf("\n"); > } > > - rte_spinlock_trylock(&global_flag_stru_p->lock); > + rte_spinlock_lock(&global_flag_stru_p->lock); > cmdline_printf(cl, > "Active_slaves:%d " > "packets received:Tot:%d Arp:%d IPv4:%d\n", >