mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alexandre Torgue <alexandre.torgue@st.com>
To: Giuseppe CAVALLARO <peppe.cavallaro@st.com>, Pavel Machek <pavel@ucw.cz>
Cc: David Miller <davem@davemloft.net>, <netdev@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: stmmac ethernet in kernel 4.9-rc6: coalescing related pauses.
Date: Fri, 2 Dec 2016 15:26:12 +0100	[thread overview]
Message-ID: <5db2ce3e-d4eb-d5d0-594c-8cd0f2e70476@st.com> (raw)
In-Reply-To: <c4748c8f-ae4b-9bbc-7d20-9c7b7ce433c8@st.com>

Hi Pavel and Peppe,

On 12/02/2016 02:51 PM, Giuseppe CAVALLARO wrote:
> On 12/2/2016 1:32 PM, Pavel Machek wrote:
>> Hi!
>>
>>>> Well, if you have a workload that sends and receive packets, it tends
>>>> to work ok, as you do tx_clean() in stmmac_poll(). My workload is not
>>>> like that -- it is "sending packets at 3MB/sec, receiving none". So
>>>> the stmmac_tx_timer() is rescheduled and rescheduled and rescheduled,
>>>> and then we run out of transmit descriptors, and then 40msec passes,
>>>> and then we clean them. Bad.
>>>>
>>>> And that's why low-res timers do not cut it.
>>>
>>> in that case, I expect that the tuning of the driver could help you.
>>> I mean, by using ethtool, it could be enough to set the IC bit on all
>>> the descriptors. You should touch the tx_coal_frames.
>>>
>>> Then you can use ethtool -S to monitor the status.
>>
>> Yes, I did something similar. Unfortnunately that meant crash within
>> minutes, at least with 4.4 kernel. (If you know what was fixed between
>> 4.4 and 4.9, that would be helpful).
>
> 4.4 has no GMAC4 support.
> Alex, do you remember any patches to fix that?

No sorry Peppe.

Pavel,

Sorry but I'm a little bit confused. I'm dropped in some mails without 
historic. I see cleanup, coalescence issue and TSO question.
What is your main issue? Are you working on gmac4 or 3.x ?
Can you refresh a little bit the story please ?

Regards
Alex
>
>>> We had experimented this tuning on STB IP where just datagrams
>>> had to send externally. To be honest, although we had seen
>>> better results w/o any timer, we kept this approach enabled
>>> because the timer was fast enough to cover our tests on SH4 boxes.
>>
>> Please reply to David, and explain how it is supposed to
>> work... because right now it does not. 40 msec delays are not
>> acceptable in default configuration.
>
> I mean, that on UP and SMP system this schema helped
> to improve the performance saving CPU on my side and this has been
> tested since a long time (~4 years).
> I tested something similar to yours where unidirectional traffic
> with limited throughput was needed and I can confirm you that
> tuning/removing coalesce parameters this helped. The tuning I decided
> to keep in the driver was suitable in several user cases and if now
> you have problems or you want to review it I can just confirm that
> there are no problems on my side. If you want to simply the logic
> around the tx process and remove timer on official driver I can accept
> that. I will just ask you uto double check if the throughput and
> CPU usage when request max throughput (better if on GiGa setup) has
> no regressions.
> Otherwise we could start thinking about adaptive schema if feasible.
>
>>>>> In the ring, some descriptors can raise the irq (according to a
>>>>> threshold) and set the IC bit. In this path, the NAPI  poll will be
>>>>> scheduled.
>>>>
>>>> Not NAPI poll but stmmac_tx_timer(), right?
>>>
>>> in the xmit according the the threshold the timer is started or the
>>> interrupt is set inside the descriptor.
>>> Then stmmac_tx_clean will be always called and, if you see the flow,
>>> no irqlock protection is needed!
>>
>> Agreed that no irqlock protection is needed if we rely on napi and
>> timers.
>
> ok
>
>>
>>>>> Concerning the lock protection, we had reviewed long time ago and
>>>>> IIRC, no raise condition should be present. Open to review it,
>>>>> again!
>> ...
>>>> There's nothing that protect stmmac_poll() from running concurently
>>>> with stmmac_dma_interrupt(), right?
>>>
>>> This is not necessary.
>>
>> dma_interrupt accesses shared priv->xstats; variables are of type
>> unsigned long (not atomic_t), yet they are accesssed from interrupt
>> context and from stmmac_ethtool without any locking. That can result
>> in broken statistics AFAICT.
>
> ok we can check this and welcome patches and I'd prefer to
> remove xstats from critical part of the code like ISR (that
> comes from old story of the driver).
>
>>
>> Please take another look. As far as I can tell, you can have two cpus
>> at #1 and #2 in the code, at the same time. It looks like napi_... has
>> some atomic opertions inside so that looks safe at the first look. But
>> I'm not sure if they also include enough memory barriers to make it
>> safe...?
>
> Although I have never reproduced related issues on SMP platforms
> due to reordering of memory operations but, as said above, welcome
> review on this especially if you are seeing problems when manage NAPI.
>
> FYI, the only memory barrier you will see in the driver are about the
> OWN_BIT setting till now.
>
>> static void stmmac_dma_interrupt(struct stmmac_priv *priv)
>> {
>> ...
>>         status = priv->hw->dma->dma_interrupt(priv->ioaddr,
>> &priv->xstats);
>>         if (likely((status & handle_rx)) || (status & handle_tx)) {
>>                 if (likely(napi_schedule_prep(&priv->napi))) {
>> #1
>>                         stmmac_disable_dma_irq(priv);
>>                         __napi_schedule(&priv->napi);
>>                 }
>>         }
>>
>>
>> static int stmmac_poll(struct napi_struct *napi, int budget)
>> {
>>         struct stmmac_priv *priv = container_of(napi, struct
>> stmmac_priv, napi);
>>         int work_done = 0;
>>
>>         priv->xstats.napi_poll++;
>>         stmmac_tx_clean(priv);
>>
>>         work_done = stmmac_rx(priv, budget);
>>     if (work_done < budget) {
>>                 napi_complete(napi);
>> #2
>>             stmmac_enable_dma_irq(priv);
>>         }
>
> hmm, I have to check (and refresh my memory) but the driver
> uses the napi_schedule_prep.
>
> Regards
>
> Peppe
>
>>         return work_done;
>> }
>>
>>
>> Best regards,
>>                                     Pavel
>>
>

  reply	other threads:[~2016-12-02 14:26 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-23 10:51 stmmac ethernet in kernel 4.4: coalescing related pauses? Pavel Machek
2016-11-24  8:55 ` stmmac ethernet in kernel 4.9-rc6: coalescing related pauses Pavel Machek
2016-11-24 10:29   ` Pavel Machek
2016-11-24 10:36     ` Pavel Machek
2016-11-24 10:46       ` [PATCH] stmmac ethernet: unify locking Pavel Machek
2016-11-24 11:05         ` [PATCH] stmmac ethernet: remove cut & paste code Pavel Machek
2016-11-24 20:05           ` Joe Perches
2016-11-24 21:44             ` Pavel Machek
2016-11-24 22:27               ` Joe Perches
2016-11-28 11:50                 ` Pavel Machek
2016-11-28 14:24                   ` Joe Perches
2016-11-28 14:35                     ` Pavel Machek
2016-11-28 16:03                       ` Joe Perches
2016-11-24 16:04   ` stmmac ethernet in kernel 4.9-rc6: coalescing related pauses David Miller
2016-11-24 21:25     ` Pavel Machek
2016-12-02  8:24       ` Giuseppe CAVALLARO
2016-12-02  8:41         ` Giuseppe CAVALLARO
2016-12-02  8:45         ` Pavel Machek
2016-12-02  9:43           ` Giuseppe CAVALLARO
2016-12-02 12:32             ` Pavel Machek
2016-12-02 13:51               ` Giuseppe CAVALLARO
2016-12-02 14:26                 ` Alexandre Torgue [this message]
2016-12-02 15:19                   ` Giuseppe CAVALLARO
2016-12-05 12:14                     ` Pavel Machek
2016-12-05 12:01                 ` Pavel Machek
2016-12-05 10:15             ` Pavel Machek
2016-12-05 11:40               ` Lino Sanfilippo
2016-12-05 22:02                 ` Pavel Machek
2016-12-05 22:37                   ` Lino Sanfilippo
2016-12-05 22:40                     ` Pavel Machek
2016-12-05 22:54                       ` Lino Sanfilippo
2016-12-05 23:11                         ` Lino Sanfilippo
2016-12-02 14:05           ` Aw: " Lino Sanfilippo
2016-12-07 12:31             ` [RFC] " Pavel Machek
2016-12-07 13:18               ` Lino Sanfilippo
2016-12-05 11:56         ` Pavel Machek
2016-11-28 11:55     ` [PATCH] stmmac: fix comments, make debug output consistent Pavel Machek
2016-11-30  0:53       ` David Miller
2016-11-28 12:13     ` stmmac ethernet in kernel 4.9-rc6: coalescing related pauses Pavel Machek
2016-11-28 12:17     ` [PATCH] stmmac: reduce code duplication getting basic descriptors Pavel Machek
2016-11-28 15:25       ` kbuild test robot
2016-12-02 14:09       ` Alexandre Torgue
2016-11-30 11:44     ` [PATCH] stmmac: simplify flag assignment Pavel Machek
2016-12-01 20:23       ` David Miller
2016-12-01 22:48         ` stmmac: turn coalescing / NAPI off in stmmac Pavel Machek
2016-12-02  8:39           ` Giuseppe CAVALLARO
2016-12-02 10:42             ` Pavel Machek
2016-12-02 15:31               ` Giuseppe CAVALLARO
2016-12-05 11:45                 ` Pavel Machek
2016-12-02  8:27       ` [PATCH] stmmac: simplify flag assignment Giuseppe CAVALLARO
2016-12-01 10:32     ` [PATCH] stmmac: cleanup documenation, make it match reality Pavel Machek
2016-12-03 20:07       ` David Miller
2016-12-05 12:27     ` [PATCH] stmmac: disable tx coalescing Pavel Machek
2016-12-11 19:07       ` Pavel Machek
2016-12-11 19:31         ` David Miller
2016-12-11 19:57           ` Pavel Machek
2016-11-28 13:07 ` stmmac ethernet in kernel 4.4: coalescing related pauses? Lino Sanfilippo
2016-11-28 14:54   ` David Miller
2016-11-28 15:31     ` Eric Dumazet
2016-11-28 15:57       ` Lino Sanfilippo
2016-11-28 16:30         ` David Miller
2016-11-28 17:01           ` Lino Sanfilippo
2016-11-30 10:28       ` Pavel Machek
2016-11-28 15:33     ` Lino Sanfilippo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5db2ce3e-d4eb-d5d0-594c-8cd0f2e70476@st.com \
    --to=alexandre.torgue@st.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=peppe.cavallaro@st.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome