Netdev List
 help / color / mirror / Atom feed
From: Ahmad Byagowi <ahmadexp@gmail.com>
To: netdev-bot+sashiko@kernel.org
Cc: andrew+netdev@lunn.ch, arkadiusz.kubalewski@intel.com,
	davem@davemloft.net, edumazet@kernel.org, jiri@resnulli.us,
	kuba@kernel.org, netdev@vger.kernel.org, pabeni@redhat.com,
	richardcochran@gmail.com, rmk+kernel@armlinux.org.uk,
	vadim.fedorenko@linux.dev, vladimir.oltean@nxp.com
Subject: Re: [PATCH net v3 1/4] ptp: disable all timestamp channels after removing the user interfaces
Date: Tue, 24 Nov 2026 14:52:29 -0800	[thread overview]
Message-ID: <20261124-timecard-common-v5-tests-r1-ahmadexp@gmail.com> (raw)
In-Reply-To: <179555822342.3135.3643426123083976487@kernel.org>

Thank you for the detailed review. These are valid concerns with v3.
The current eight-patch v5 series includes the runtime and SJA1105
prerequisites, and I have now published the test fixtures and results.

> Does this widen the race on pps_req_map at runtime? Before this patch, a
> disable on an already empty map returned early. Now it falls through to
> the register disable:

> The pps_req_map read-modify-write is not serialized against the register
> writes:
>
>   - extts_enable_store() and pps_enable_store() in ptp_sysfs.c call
>     ops->enable() without any lock.
>   - ptp_extts_request() and ptp_enable_pps() hold only ptp->pincfg_mux,
>     which the sysfs paths never take.
>   - ptp_ocp_enable() takes no driver lock.

Agreed. Fixing only teardown did not serialize those runtime callers.
V5 patch 1 takes the existing pincfg_mux around the EXTTS, PPS and PEROUT
sysfs enable callbacks, matching the ioctl paths. That mutex covers the
driver's subscription update, register programming and sleeping IRQ
drain. It avoids adding a second driver lock or a spinlock.

Four controlled interleavings pass in 100 source-derived runtime runs
with ASan/UBSan. Three KUnit cases call the actual sysfs stores under
mutex contention in QEMU with KASAN and lockdep. Removing each store's
lock makes its negative test fail at a runtime assertion.

V5 patch 3 retains Vadim's direct-channel teardown: remove the user
interfaces and drain active ioctls, then issue EXTTS disables for each
advertised channel followed by PPS. The final empty-map drain has a
separate reason: an empty software subscription map does not establish
that the source was initially idle, since IRQ registration does not
reset it. The prearmed state is injected in the model, not an observation
of a physical card.

> This switches a pin that is running PEROUT into EXTTS input mode, and
> rewrites the AVB params table over SPI.

> Is this reconfiguration intended?

No. V5 patch 2 makes sja1105_extts_enable() select the pin function only
when enabling EXTTS. Disable still clears extts_enabled and synchronously
deletes the polling timer, but does not reconfigure the pin. The fixture
executes the actual functions with stubbed configuration writes: 14
chip/direction cases, repeated disable, enable and error paths pass in
100 runs. Restoring the unconditional pin change fails the negative test.

> Where can these tests be found? They are not part of this patch or the
> series, and drivers/ptp/ has no KUnit infrastructure.

> Could the changelog name the hardware that was used, or state that
> ptp_ocp was not tested on hardware?

The public package, pinned to a Git commit, is here:
https://github.com/Time-Appliances-Project/Time-Card/tree/c889b25e9ea175f64dd811457f8f2c3d29512e45/DRV/Linux/tests/common-v5

It contains the source-extraction runners, complete C fixtures, KUnit
source, Makefile integration patch, KUnit configuration, build commands,
the submitted v5 patches, checksum manifest and result logs. These are
out-of-tree review fixtures; the integration patch supplies the missing
PTP KUnit build entry. The documented source preparation checks the
complete resulting tree against the exact submitted v5 tree.

The original run passed all eight QEMU KUnit cases, four targeted
x86_64/i386 allmodconfig/allyesconfig PTP/SJA1105 builds with
W=1 KCFLAGS=-Werror, and 100 cleanup/shared-PPS model runs. I also reran
the published model runners and all 20 negative variants on macOS and
Linux. A fresh checkout of the pinned public net base plus the supplied
v5 patches reproduces the tested source tree, and all eight QEMU KUnit
cases pass there too. No physical OCP/Time Card or SJA1105 hardware was
tested for these fixes. The userspace models stub MMIO, IRQ and timer
behavior; KUnit uses a synthetic clock. No physical unbind/rebind,
PCIe interrupt timing or SPI validation is claimed. V5's messages state
the software-only testing limits explicitly.

V5 series:
https://lore.kernel.org/r/20261123-timecard-common-v5-d669cfa034-0-ahmadexp@gmail.com
Patch 1, runtime serialization:
https://lore.kernel.org/r/20261123-timecard-common-v5-d669cfa034-1-ahmadexp@gmail.com
Patch 2, SJA1105 prerequisite:
https://lore.kernel.org/r/20261123-timecard-common-v5-d669cfa034-2-ahmadexp@gmail.com
Patch 3, timestamp teardown:
https://lore.kernel.org/r/20261123-timecard-common-v5-d669cfa034-3-ahmadexp@gmail.com

I have kept andrew+netdev@lunn.ch copied here. The v5 series used
andrew@lunn.ch; sorry for missing the netdev alias in that posting.

Ahmad

  reply	other threads:[~2026-11-24 22:52 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20 21:21 [PATCH net v3 0/4] ptp: fix timestamp teardown and OCP DPLL routing Ahmad Byagowi
2026-11-20 21:21 ` [PATCH net v3 1/4] ptp: disable all timestamp channels after removing the user interfaces Ahmad Byagowi
2026-11-22 20:10   ` Vadim Fedorenko
2026-11-23  1:57     ` Ahmad Byagowi
2026-11-24 22:10   ` netdev-bot+sashiko
2026-11-24 22:52     ` Ahmad Byagowi [this message]
2026-11-20 21:21 ` [PATCH net v3 2/4] ptp: ocp: use hardware selectors in DPLL frequency operations Ahmad Byagowi
2026-11-24 22:10   ` netdev-bot+sashiko
2026-11-24 22:52     ` Ahmad Byagowi
2026-11-20 21:21 ` [PATCH net v3 3/4] ptp: ocp: report disabled SMA inputs consistently over DPLL Ahmad Byagowi
2026-11-24 22:10   ` netdev-bot+sashiko
2026-11-24 22:52     ` Ahmad Byagowi
2026-11-20 21:21 ` [PATCH net v3 4/4] ptp: ocp: correct the DCF output frequency Ahmad Byagowi

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=20261124-timecard-common-v5-tests-r1-ahmadexp@gmail.com \
    --to=ahmadexp@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=arkadiusz.kubalewski@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=netdev-bot+sashiko@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=richardcochran@gmail.com \
    --cc=rmk+kernel@armlinux.org.uk \
    --cc=vadim.fedorenko@linux.dev \
    --cc=vladimir.oltean@nxp.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