All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@kernel.org>
To: Nikolai Zhubr <zhubr.2@gmail.com>
Cc: "Maciej W. Rozycki" <macro@orcam.me.uk>,
	Thomas Gleixner <tglx@linutronix.de>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	netdev <netdev@vger.kernel.org>,
	"the arch/x86 maintainers" <x86@kernel.org>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	"H. Peter Anvin" <hpa@zytor.com>
Subject: Re: Realtek 8139 problem on 486.
Date: Fri, 9 Jul 2021 09:31:34 +0200	[thread overview]
Message-ID: <CAK8P3a0uFAsKXenAhPdJWXVNUNw1qjuyrY+5jaEtB25Tj8wK3w@mail.gmail.com> (raw)
In-Reply-To: <60E75057.60706@gmail.com>

On Thu, Jul 8, 2021 at 9:21 PM Nikolai Zhubr <zhubr.2@gmail.com> wrote:
>
> Hello Arnd,
>
> 03.07.2021 12:10, Arnd Bergmann:
> > The simplest workaround would be to just move the
> > "spin_lock_irqsave(&tp->lock, flags);" a few lines down, below the rx
> > processing. This keeps the locking rules exactly how they were before
>
> Indeed, moving spin_lock_irqsave below rtl8139_rx eliminated the warn_on
> message apparently, here is a new log:
>
> https://pastebin.com/dVFNVEu4
>
> and here is my resulting diff:
>
> https://pastebin.com/CzNzsUPu

Ok, great, the patch looks good to me, and I think we should just
merge that, in addition to Maciej's bugfix for the platform.

> My usual tests run fine. However I still see 2 issues:
>
> 1. I do not understand all this locking thing enough to do a good
> cleanup myself, and it looks like it needs one;

A lot of drivers need one. With your latest patch, I'm confident enough
that it's not getting worse here and given the age of this device I don't
think the cleanup is required. It's probably possible to squeeze out a
little more performance from this device on SMP systems by
improving it, but this would still be hopeless to compete against a
$5 gigabit ethernet card.

> 2. It looks like in case of incorrect (edge) triggering mode, the "poll
> approach" with no loop added in the poll function would still allow a
> race window, as explained in following outline (from some previous mails):
>
> 22.06.2021 14:12, David Laight:
>  > Typically you need to:
>  > 1) stop the chip driving IRQ low.
>  > 2) process all the completed RX and TX entries.
>  > 3) clear the chip's interrupt pending bits (often write to clear).
>  > 4) check for completed RX/TX entries, back to 2 if found.
>  > 5) enable driving IRQ.
>  >
>  > The loop (4) is needed because of the timing window between
>  > (2) and (3).
>  > You can swap (2) and (3) over - but then you get an additional
>  > interrupt if packets arrive during processing - which is common.
>
> So in terms of such outline, the "poll approach" now implements 1, 2, 3,
> 5 but still misses 4, and my understanding is that it is therefore still
> not a complete solution for the broken triggering case (Although
> practically, the time window might be too small for the race effect to
> be ever observable) From my previous testing I know that such a loop
> does not affect the perfomance too much anyway, so it seems quite safe
> to add it. Maybe I've missunderstood something though.

The latest version of your patch already does what David explained as
the alternative: the 'ack'  (step 3) happens before processing the interrupts
(2), so you don't need step 4 for correctness. You had that in the previous
version of the patch that had the loop, and since you have experimentally
shown that it makes no significant difference to performance, I'd rather
leave it out for simplicity.

If another event becomes pending after the Ack but before the
napi_complete_done(), then we get an interrupt and call napi_schedule()
again.

For some reason, the TxErr bit is only cleared after tx processing, so
we could miss an error event, but that seems fine as the tx errors are
not handled in any way other than counting them, which is already
unreliable if multiple transmits fail before the interrupt comes.

       Arnd

  reply	other threads:[~2021-07-09  7:31 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-29 14:08 Realtek 8139 problem on 486 Nikolai Zhubr
2021-05-29 18:42 ` Heiner Kallweit
2021-05-29 21:44   ` tedheadster
2021-05-30  0:49     ` Nikolai Zhubr
2021-05-30 10:36       ` Nikolai Zhubr
2021-05-30 17:27         ` Nikolai Zhubr
2021-05-30 20:54           ` Arnd Bergmann
2021-05-30 23:17             ` Nikolai Zhubr
2021-05-31 16:53               ` Nikolai Zhubr
2021-05-31 18:39                 ` Arnd Bergmann
2021-05-31 22:18                   ` Nikolai Zhubr
2021-05-31 22:30                     ` Heiner Kallweit
2021-06-01  7:20                       ` Arnd Bergmann
2021-06-01 10:53                         ` Nikolai Zhubr
2021-06-01 11:42                           ` Heiner Kallweit
2021-06-01 16:09                             ` Nikolai Zhubr
2021-06-01 21:48                               ` Heiner Kallweit
2021-06-01 23:37                                 ` Nikolai Zhubr
2021-06-02  9:12                                   ` Arnd Bergmann
2021-06-07 23:07                                     ` Nikolai Zhubr
2021-06-08  7:44                                       ` Arnd Bergmann
2021-06-08 20:32                                         ` Nikolai Zhubr
2021-06-08 20:45                                           ` Arnd Bergmann
2021-06-08 22:07                                             ` Nikolai Zhubr
2021-06-09  7:09                                               ` Arnd Bergmann
2021-06-12 17:40                                                 ` Nikolai Zhubr
2021-06-12 22:41                                                   ` Arnd Bergmann
2021-06-13 14:10                                                     ` Nikolai Zhubr
2021-06-13 21:52                                                       ` Arnd Bergmann
2021-06-03 18:32                                 ` Maciej W. Rozycki
2021-06-04  7:36                                   ` Arnd Bergmann
2021-06-20  0:34                                     ` Thomas Gleixner
2021-06-20 10:19                                       ` Arnd Bergmann
2021-06-21  4:10                                       ` Maciej W. Rozycki
2021-06-21 11:22                                         ` Arnd Bergmann
2021-06-21 14:42                                           ` Maciej W. Rozycki
2021-06-21 15:20                                             ` Arnd Bergmann
2021-06-22 11:12                                             ` David Laight
2021-06-22 12:42                                           ` Nikolai Zhubr
2021-06-22 13:22                                             ` Arnd Bergmann
2021-06-22 18:42                                               ` Nikolai Zhubr
2021-06-22 19:26                                                 ` Arnd Bergmann
2021-06-23  1:04                                                   ` Maciej W. Rozycki
2021-06-24 17:56                                                     ` Nikolai Zhubr
2021-06-24 18:25                                                       ` Maciej W. Rozycki
2021-07-14 23:32                                                         ` Maciej W. Rozycki
2021-07-15  7:32                                                           ` Nikolai Zhubr
2021-07-16 23:48                                                             ` Maciej W. Rozycki
2021-06-23 16:31                                                   ` Nikolai Zhubr
2021-06-23 23:39                                                     ` Maciej W. Rozycki
2021-06-24  8:28                                                       ` Arnd Bergmann
2021-07-02 19:02                                                         ` Nikolai Zhubr
2021-07-03  9:10                                                           ` Arnd Bergmann
2021-07-08 19:21                                                             ` Nikolai Zhubr
2021-07-09  7:31                                                               ` Arnd Bergmann [this message]
2021-07-09 12:43                                                               ` David Laight
2021-06-01 17:44                             ` Maciej W. Rozycki
2021-06-02 15:14                               ` Nikolai Zhubr
2021-06-02 15:28                                 ` Arnd Bergmann
2021-05-31 19:05                 ` Heiner Kallweit
2021-05-31 18:29 ` Denis Kirjanov

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=CAK8P3a0uFAsKXenAhPdJWXVNUNw1qjuyrY+5jaEtB25Tj8wK3w@mail.gmail.com \
    --to=arnd@kernel.org \
    --cc=bp@alien8.de \
    --cc=hkallweit1@gmail.com \
    --cc=hpa@zytor.com \
    --cc=macro@orcam.me.uk \
    --cc=mingo@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=zhubr.2@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.