🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
3 messages
3 total messages Started by Ahmad Byagowi Fri, 27 Nov 2026 19:20
[PATCH net v7 0/2] ptp: serialize requests and stop active EXTTS
#23721
Author: Ahmad Byagowi
Date: Fri, 27 Nov 2026 19:20
39 lines
12493 bytes
This series is limited to the PTP/PHC core. No driver change is needed
to apply it.

The sysfs enable callbacks take pincfg_mux, as the ioctl callbacks
already do. The core tracks successfully enabled timestamp channels
under that mutex, including requests without a pin assignment. On
unregister, after the user interfaces have been removed, it disables
tracked channels and preserves existing cleanup for assigned pins.
The tracked channel indices go directly to EXTTS requests, without
changing pin assignments. PPS is disabled last, before source release.

Changes since v6:
  - Use the commit establishing the enable callback locking contract
    for the sysfs Fixes tag. Clarify unchanged error handling.
  - Replace the blanket disable loop with tracked channel cleanup.
    Do not call into drivers for idle, unassigned channels.
  - Keep the existing OCP detach and shared-PPS logic untouched.
  - Align the author name and coalesce the commit trailers.

Validation (local fixtures, not included in the patches): strict PTP
object builds on x86_64 and i386, allmodconfig and allyesconfig.
Source-derived tests model teardown, last-subscriber IRQ draining,
idle, failed and already-disabled requests, and unassigned channels.
The host fixture uses stubbed register and interrupt operations.
Nine local KUnit cases pass in QEMU with KASAN, lockdep and
DEBUG_ATOMIC_SLEEP, using real PTP unregister and sysfs callbacks
with a test clock.
No physical card or switch test was performed.

Coding-assistant support was used to review callback and teardown
paths, develop fixes and local test cases, and prepare changelogs.

v6: https://lore.kernel.org/r/20261126-timecard-core-v6-0-ahmadexp@gmail.com/
Review: https://lore.kernel.org/r/5d6416ea-d927-40ac-9424-dade40191373@linux.dev

Ahmad Byagowi (2):
  ptp: serialize sysfs enable requests with ioctl paths
  ptp: shut down enabled unassigned EXTTS channels on unregister
[PATCH net v7 1/2] ptp: serialize sysfs enable requests with ioctl paths
#23720
Author: Ahmad Byagowi
Date: Fri, 27 Nov 2026 19:20
59 lines
12626 bytes
Drivers may call ptp_find_pin() from their enable callback; that helper
requires the caller to hold pincfg_mux. The ioctl paths hold the lock,
but the EXTTS, PPS and periodic-output sysfs stores do not.

Take pincfg_mux around the three sysfs callbacks. Leave existing
validation, permission checks and callback error handling unchanged.
Return -ERESTARTSYS if lock acquisition is interrupted.

Developed with coding-assistant support during review and validation.

Fixes: 62582a7ee783 ("ptp: Avoid deadlocks in the programmable pin code.")
Link: https://lore.kernel.org/r/179579937722.3135.2568812643544816671@kernel.org
Signed-off-by: Ahmad Byagowi <ahmadexp@gmail.com>
---
 drivers/ptp/ptp_sysfs.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/ptp/ptp_sysfs.c b/drivers/ptp/ptp_sysfs.c
index 8e0e0aa09981..90fdddc1e6a7 100644
--- a/drivers/ptp/ptp_sysfs.c
+++ b/drivers/ptp/ptp_sysfs.c
@@ -60,7 +60,10 @@ static ssize_t extts_enable_store(struct device *dev,
 	if (req.extts.index >= ops->n_ext_ts)
 		goto out;
 
+	if (mutex_lock_interruptible(&ptp->pincfg_mux))
+		return -ERESTARTSYS;
 	err = ops->enable(ops, &req, enable ? 1 : 0);
+	mutex_unlock(&ptp->pincfg_mux);
 	if (err)
 		goto out;
 
@@ -130,7 +133,10 @@ static ssize_t period_store(struct device *dev,
 		goto out;
 
 	enable = req.perout.period.sec || req.perout.period.nsec;
+	if (mutex_lock_interruptible(&ptp->pincfg_mux))
+		return -ERESTARTSYS;
 	err = ops->enable(ops, &req, enable);
+	mutex_unlock(&ptp->pincfg_mux);
 	if (err)
 		goto out;
 
@@ -157,7 +163,10 @@ static ssize_t pps_enable_store(struct device *dev,
 	if (cnt != 1)
 		goto out;
 
+	if (mutex_lock_interruptible(&ptp->pincfg_mux))
+		return -ERESTARTSYS;
 	err = ops->enable(ops, &req, enable ? 1 : 0);
+	mutex_unlock(&ptp->pincfg_mux);
 	if (err)
 		goto out;
 

base-commit: 4392bb809812ac79449cd0cf1f5e00469ee102d1
-- 
2.54.0 (Apple Git-157)
Re: [PATCH net v7 0/2] ptp: serialize requests and stop active EXTTS
#23730
Author: netdev-bot+sinfo
Date: Fri, 27 Nov 2026 19:24
19 lines
8487 bytes
Hi!

This is an automated message. This series looks like a fix, but its
commit messages seem to be missing some information:

 - Whether the issue was actually triggered, or is only theoretical
   (e.g. found by LLM and not proven at runtime). If it was triggered
   please include the symptoms, like the stack trace or kernel messages.

Please do not repost the series just to address the above. Instead,
reply to this email with the missing information, so that reviewers
can take it into account.

*IMPORTANT*: If you do repost (for other reasons) - please include
the relevant info in the cover letter or commit messages.
-- 
The evaluation is done by an LLM so it may be wrong, if you think
that is the case please reply and explain.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads