DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] Question about bonding mode set API
@ 2021-10-19 13:34 Min Hu (Connor)
  2021-10-21 12:57 ` Min Hu (Connor)
  0 siblings, 1 reply; 3+ messages in thread
From: Min Hu (Connor) @ 2021-10-19 13:34 UTC (permalink / raw)
  To: dev, Ferruh Yigit, Thomas Monjalon

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.




























^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] Question about bonding mode set API
  2021-10-19 13:34 [dpdk-dev] Question about bonding mode set API Min Hu (Connor)
@ 2021-10-21 12:57 ` Min Hu (Connor)
  2021-11-25  8:08   ` Min Hu (Connor)
  0 siblings, 1 reply; 3+ messages in thread
From: Min Hu (Connor) @ 2021-10-21 12:57 UTC (permalink / raw)
  To: dev; +Cc: Ferruh Yigit, Thomas Monjalon

Hi, Thomas, Ferruh,
	have any suggustions?

在 2021/10/19 21:34, Min Hu (Connor) 写道:
> 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.
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> .

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] Question about bonding mode set API
  2021-10-21 12:57 ` Min Hu (Connor)
@ 2021-11-25  8:08   ` Min Hu (Connor)
  0 siblings, 0 replies; 3+ messages in thread
From: Min Hu (Connor) @ 2021-11-25  8:08 UTC (permalink / raw)
  To: dev; +Cc: Ferruh Yigit, Thomas Monjalon

Hi, all,
	any opinions about this question?
	Hope for your reply, thanks.

在 2021/10/21 20:57, Min Hu (Connor) 写道:
> Hi, Thomas, Ferruh,
>      have any suggustions?
> 
> 在 2021/10/19 21:34, Min Hu (Connor) 写道:
>> 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.
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> .
> .

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-11-25  8:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-19 13:34 [dpdk-dev] Question about bonding mode set API Min Hu (Connor)
2021-10-21 12:57 ` Min Hu (Connor)
2021-11-25  8:08   ` Min Hu (Connor)

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ http://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git