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 09CBEA0C41; Tue, 19 Oct 2021 15:34:12 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DFDFC411A9; Tue, 19 Oct 2021 15:34:11 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id D3E024119C for ; Tue, 19 Oct 2021 15:34:10 +0200 (CEST) Received: from dggeme756-chm.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4HYZNH082Yzbglk; Tue, 19 Oct 2021 21:29:35 +0800 (CST) Received: from [10.67.103.128] (10.67.103.128) by dggeme756-chm.china.huawei.com (10.3.19.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.15; Tue, 19 Oct 2021 21:34:07 +0800 To: "dev@dpdk.org" , Ferruh Yigit , Thomas Monjalon From: "Min Hu (Connor)" Message-ID: Date: Tue, 19 Oct 2021 21:34:07 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.3.1 MIME-Version: 1.0 Content-Type: text/plain; charset="gbk"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.103.128] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggeme756-chm.china.huawei.com (10.3.19.102) X-CFilter-Loop: Reflected Subject: [dpdk-dev] Question about bonding mode set API 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 Sender: "dev" Hi, all, I met one questions: when I start testpmd, and type command like this, it will lead to Segmentation fault, like: testpmd> create bonded device 4 0 testpmd> add bonding slave 0 2 testpmd> add bonding slave 1 2 testpmd> port start 2 testpmd> set bonding mode 0 2 testpmd> quit Stopping port 0... Stopping ports... Please remove port 0 from bonded device. Done Stopping port 1... Stopping ports... Please remove port 1 from bonded device. Done Stopping port 2... Stopping ports... Done Shutting down port 0... Closing ports... Please remove port 0 from bonded device. Done Shutting down port 1... Closing ports... Please remove port 1 from bonded device. Done Shutting down port 2... Closing ports... 0000:7d:00.0 hns3_dev_close(): Close port 0 finished Port 0 is closed 0000:7d:00.1 hns3_dev_close(): Close port 1 finished Port 1 is closed Port 2 is closed Done Bye... Segmentation fault *************** The reason to the bug is that rte timer do not be cancelled when quit. That is, in 'bond_ethdev_start', resources are alloced according to different bonding mode. in 'bond_ethdev_stop', resources are free by the corresponding mode. For example, 'bond_ethdev_start' start bond_mode_8023ad_ext_periodic_cb timer for bonding mode 4. and 'bond_ethdev_stop' cancel the timer only when the current bonding mode is 4. If the bonding mode is changed(not 4), and directly quit the process, the timer will still on, and freed memory will be accessed, then segmentation fault. *********** That is just one bug for doing that, any bugs such as memory leakage will occur. In my opinion, I think that operation is not permitted. we should standardized usage of the API. When we want to use 'bond_ethdev_mode_set', we should do like that order: bond_ethdev_stop bond_ethdev_mode_set bond_ethdev_start Because 'bonding mode'changed means resources changed, we should reallocate resources for different mode. What is your opinion? wish your reply. Best regards.