Subject: Re: [PATCH RFC 5/5] net:stmmac: asynchronous tx_clean

From: Jimmy PERCHET <[email-masked]>
Date: Mon, 21 Oct 2013 20:05:21 +0200

On 21/10/2013 18:30, Eric Dumazet wrote:
> On Mon, 2013-10-21 at 15:52 +0200, Giuseppe CAVALLARO wrote:
>> Hello Jimmy
>>
>> On 10/16/2013 5:24 PM, Jimmy Perchet wrote:
>>> Tx descriptor's cleanup and preparation are serialized, which is not necessary
>>> and decrease performance.
>>> In addition TX descriptor's cleanup is performed on NET_RX softirq, this is
>>> confusing.
>>
>> hmm, here you are changing the logic behind the tx/rx processes.
>>
>> As done in many drivers, the stmmac cleans the tx resources in
>> NAPI context and this is not a confuse approach ;-).
>>
>> It gave me some performance improvements especially on TCP benchmarks.
>>
>>> This patch unserialize tx descriptor's cleanup and preparation
>>> and defer cleanup in workqueue.
>>
>> So you decide to use workqueue and I kindly ask you to give me more
>> details about the performance improvements (UDP/TCP) and cpu usage.
>>
>> I can try to do some tests on my side too. This could take a while
>> unfortunately.
> 
> Anyway this patch is buggy.
> 
> 1) Removing tx_lock spinlock in TX completion adds a race in
> stmmac_xmit()
> 
> 2) Generally speaking, we should not rely on a work queue to perform TX
> completions.
> 
> Think about being flooded by incoming frames.
> 
> Work queue could never be scheduled.
> 
> 
I understand your point. Nevertheless I think it is still possible
to avoid serialization, and therefore increase performance, even if
completions must remain in softirq. What do you think ?

In my patch I tried to avoid any race condition. (by updating both
descriptor's cursors only once, for instance)
Could you explain the possible race you see ?

Best Regards,
Jimmy