Skip to content

sys-kernel/coreos-modules: Enable CONFIG_PCIE_PTM - #4345

Open
hilljordan5768 wants to merge 1 commit into
flatcar:mainfrom
hilljordan5768:kernel-enable-pcie-ptm
Open

hilljordan5768 wants to merge 1 commit into
flatcar:mainfrom
hilljordan5768:kernel-enable-pcie-ptm

Conversation

@hilljordan5768

Copy link
Copy Markdown

Flatcar builds its kernel without CONFIG_PCIE_PTM, so igc can't enable PCIe Precision Time Measurement even when the root port and the NIC support it:

igc 0000:01:00.0: PCIe PTM not supported by PCIe bus/controller

Without PTM the PHC offers no PTP_SYS_OFFSET_PRECISE. phc2sys and chrony fall back to PTP_SYS_OFFSET_EXTENDED, which brackets each PHC read between two system clock reads a few microseconds apart.

PCIE_PTM depends only on PCI, and its help text says it is safe to enable without PTM-capable devices. I put it in commonconfig-6.18 so amd64 and arm64 both get it. On amd64 it also turns ICE_HWTS back on, which gives E810 PHCs precise cross-timestamps. Stable 4757.2.1 has ICE_HWTS=y, but 6.18 made it depend on PCIE_PTM, so olddefconfig on main leaves it unset.

Fixes flatcar/Flatcar#2457

AI use: I used Claude Code to make the config change, write the changelog entry and commit message, build the test image in the SDK, and run the tests below on my hardware.

How to use

zcat /proc/config.gz | grep -E 'CONFIG_PCIE_PTM|CONFIG_ICE_HWTS'

On a host with a PTM-capable root port and an igc NIC, dmesg shows igc ...: PTM enabled, and phc_ctl /dev/ptpN caps reports cross timestamping support.

Testing done

I built main (4867.0.0+nightly-20261028-2100) with this change in the SDK. Both kernel packages built from source.

./run_sdk_container -U -n pcie-ptm -a amd64 -- ./build_packages --board=amd64-usr --usepkg_exclude="sys-kernel/coreos-modules sys-kernel/coreos-kernel"
./run_sdk_container -U -n pcie-ptm -a amd64 -- ./build_image --board=amd64-usr prod

$ grep -E 'CONFIG_PCIE_PTM|CONFIG_ICE_HWTS' __build__/images/images/amd64-usr/latest/flatcar_production_image_kernel_config.txt
CONFIG_PCIE_PTM=y
CONFIG_ICE_HWTS=y

Then I installed the dev-signed payload on a bare-metal Stable 4757.2.1 host with three Intel I226 NICs behind PTM-capable root ports:

sudo flatcar-update -V 4867.0.0+nightly-20261028-2100 -P flatcar_test_update.gz -D -O no
sudo systemctl reboot

Before, on Stable 4757.2.1 (6.12.111-flatcar):

$ sudo dmesg | grep -i ptm
igc 0000:01:00.0: PCIe PTM not supported by PCIe bus/controller
igc 0000:58:00.0: PCIe PTM not supported by PCIe bus/controller
igc 0000:59:00.0: PCIe PTM not supported by PCIe bus/controller
$ sudo phc_ctl /dev/ptp0 caps | grep cross
  doesn't have cross timestamping support

After, on 4867.0.0 nightly with this change (6.18.58-flatcar):

$ sudo dmesg | grep -i ptm
pci 0000:00:01.0: PTM enabled (root), 4ns granularity
pci 0000:00:06.0: PTM enabled (root), 4ns granularity
pci 0000:00:06.2: PTM enabled (root), 4ns granularity
pci 0000:00:07.0: PTM enabled (root), 4ns granularity
pci 0000:00:07.2: PTM enabled (root), 4ns granularity
pci 0000:00:1c.0: PTM enabled (root), 4ns granularity
pci 0000:00:1d.0: PTM enabled (root), 4ns granularity
pci 0000:00:1d.3: PTM enabled (root), 4ns granularity
igc 0000:01:00.0: PTM enabled, 4ns granularity
igc 0000:58:00.0: PTM enabled, 4ns granularity
igc 0000:59:00.0: PTM enabled, 4ns granularity
$ sudo phc_ctl /dev/ptp0 caps | grep cross
  has cross timestamping support

ptp1 and ptp2 give the same phc_ctl result.

To see what PTM buys, I sampled each PHC against CLOCK_MONOTONIC_RAW at 10 Hz for 2 minutes on the PTM boot, reading both ways back to back. None of the 7200 reads failed. Scatter is the RMS residual after a quadratic fit in 10 s chunks:

EXTENDED, best of 5 PRECISE
PHC vs system clock 10.9 to 14.8 ns 2.4 to 4.7 ns
PHC vs PHC 16.9 to 20.0 ns 3.5 to 5.6 ns

EXTENDED also reads 516 to 709 ns away from PRECISE, and the gap differs per port. Comparing two PHCs through EXTENDED on this host carries a constant error of up to about 200 ns.

For arm64 I only checked that make olddefconfig keeps CONFIG_PCIE_PTM=y with arm64_defconfig-6.18. I have no arm64 PTM hardware to boot.

  • Changelog entries added in the respective changelog/ directory (user-facing change, bug fix, security fix, update)
  • Inspected CI output for image differences: /boot and /usr size, packages, list files for any missing binaries, kernel modules, config files, kernel modules, etc. (needs a maintainer to start CI)

🤖 Generated with Claude Code

Without CONFIG_PCIE_PTM, igc and other drivers can't enable PCIe
Precision Time Measurement ("PCIe PTM not supported by PCIe
bus/controller"), so their PHCs offer no PTP_SYS_OFFSET_PRECISE.
phc2sys and chrony then fall back to PTP_SYS_OFFSET_EXTENDED, which
brackets each PHC read between system clock reads a few microseconds
apart.

PCIE_PTM depends only on PCI, and its help text says it is safe to
enable on systems without PTM-capable devices. It goes in commonconfig
so amd64 and arm64 both get it.

On amd64 it also turns ICE_HWTS back on, which gives ice (E810) PHCs
precise cross-timestamps. Stable 4757.2.1 has ICE_HWTS=y, but 6.18
made it depend on PCIE_PTM, so olddefconfig on main leaves it unset.

Issue: flatcar/Flatcar#2457
Signed-off-by: Jordan Hill <jordan@hillmedia.org>
@hilljordan5768
hilljordan5768 requested a review from a team as a code owner October 30, 2026 01:36

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[RFE] Enable CONFIG_PCIE_PTM

1 participant