mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stanislaw Pal <kuncy7@gmail.com>
To: Luiz Angelo Daros de Luca <luizluca@gmail.com>
Cc: "Linus Walleij" <linusw@kernel.org>,
	"Andrew Lunn" <andrew@lunn.ch>,
	"Vladimir Oltean" <olteanv@gmail.com>,
	"David S . Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Alvin Šipraga" <alvin.sipraga@analog.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v2] net: dsa: realtek: rtl8365mb: wait out the full chip reset time
Date: Wed,  9 Sep 2026 12:13:55 +0200	[thread overview]
Message-ID: <20260909101355.25660-1-kuncy7@gmail.com> (raw)
In-Reply-To: <CAJq09z4qBz+poVQR3tEQzB-_4se5ka76Xq1mwEM0RvEnTuGLNw@mail.gmail.com>

Hi Luiz,

Thanks - all three points are fair, and the first one I owe you a
correction on.


The power supply
----------------

That July message was too broadly worded, and I should have followed up
in that thread rather than leaving it as the last word.

What the A/B/A established still holds, but for a narrower fault than I
claimed. The July signature was link up at 2.5G/Full with 326 FCS errors
and 326 drop events on the switch's CPU-facing port; swapping the supply
made it go away and putting the old one back brought it straight back.
I have no reason to doubt that part.

What I got wrong was declaring the cold-start problem closed. On the new
supply the board later came up broken again, several times, with a
different signature: no FCS errors, no drop events, no CRC or symbol
errors anywhere - the switch simply never forwards what the CPU sends,
and the MIB TX counters on the user ports stay at zero. A power cycle or
a driver re-probe clears it. That is the failure these patches address,
and it happens on a supply that is not faulty.

So: two faults, one supply-related and settled, one not. I conflated
them in July.


Why unbind/rebind always works
------------------------------

I do not have a measurement that settles this, so treat what follows as
a hypothesis.

At rebind the chip has been powered for minutes or hours, so whatever
internal power-on sequence it runs is long finished; the driver's reset
then only restarts the register blocks, and they come back quickly. From
cold, the reset lands while that power-on initialisation is still in
progress, and the two overlap. That would explain why the extra wait
only ever matters on the first probe after power-on, and why every warm
path - rebind, reboot, sysupgrade - is clean regardless.

It also fits your RTL8367R observation: if the reset bit reflects the
register-level reset rather than the completion of the internal boot,
then how much slack there is after the bit clears is a property of the
part, and a driver that keys off the bit alone is relying on that slack
being zero.


The deadline arithmetic
-----------------------

I have no attachment to the implementation, but I would rather not
change it on my own judgement here, because you and Linus have landed on
opposite sides: he reviewed this version specifically liking the
deadline optimisation, and you would rather see the complexity gone.

If you two settle on the simple form I will send a v3 with

	msleep(RTL8365MB_CHIP_RESET_TIME_MS);

up front and a single read of RTL8365MB_CHIP_RESET_HW_MASK afterwards,
returning -ETIMEDOUT if it is still set. Total probe time is the same
either way; what the current version buys is only that a chip whose poll
already took the full second does not wait twice, which on reflection is
not worth the arithmetic if it reads as complexity to the people
maintaining this.


Numbers
-------

One thing I should be straight about: the "one cold boot in seven"
figure was measured with both patches applied together, so it does not
attribute the failures to either one on its own. Johan raised the same
point on the OpenWrt PR. I am running per-arm cold-boot counts now -
neither patch, 714-01 alone, both - on the only board I have that
reproduces this, and I will report the counts when I have enough boots
for them to mean anything. If 714-01 alone turns out to be sufficient,
the second patch should be dropped rather than respun.

Best regards,
Stanislaw

  reply	other threads:[~2026-09-09 10:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-08 17:44 Stanislaw Pal
2026-09-08 20:35 ` Linus Walleij
2026-09-08 21:36 ` Luiz Angelo Daros de Luca
2026-09-09 10:13   ` Stanislaw Pal [this message]
2026-09-09 11:31     ` Alvin Šipraga

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=20260909101355.25660-1-kuncy7@gmail.com \
    --to=kuncy7@gmail.com \
    --cc=alvin.sipraga@analog.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linusw@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luizluca@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.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

all inboxes | Powered by JetHome®