Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chrony: use /dev/ptp_hyperv instead of /dev/ptp0 #1355

Merged
merged 1 commit into from Dec 10, 2021

Conversation

jlebon
Copy link
Member

@jlebon jlebon commented Nov 29, 2021

From the last paragraph in:

https://docs.microsoft.com/en-us/azure/virtual-machines/linux/time-sync#check-for-ptp-clock-source

In Linux VMs with Accelerated Networking enabled, you may see multiple
PTP devices listed because the Mellanox mlx5 driver also creates a
/dev/ptp device. Because the initialization order can be different
each time Linux boots, the PTP device corresponding to the Azure host
might be /dev/ptp0 or it might be /dev/ptp1, which makes it difficult
to configure chronyd with the correct clock source. To solve this
problem, the most recent Linux images have a udev rule that creates
the symlink /dev/ptp_hyperv to whichever /dev/ptp entry corresponds to
the Azure host. Chrony should be configured to use this symlink
instead of /dev/ptp0 or /dev/ptp1.

See: coreos/fedora-coreos-tracker#1031

As mentioned there, we might have to backport udev rules to RHCOS as
well to make sure that symlink gets created there too.

@jlebon
Copy link
Member Author

jlebon commented Nov 29, 2021

(Didn't test this; I need to dust off my Azure creds and CLI. If someone has warm access to it, would appreciate a check!)

@cgwalters
Copy link
Member

the most recent Linux images have a udev rule that creates
the symlink /dev/ptp_hyperv to whichever /dev/ptp entry corresponds to
the Azure host

For general interest, that udev rule is part of systemd:

[root@cosa-devsh ~]# grep -r hyperv /usr/lib
...
/usr/lib/udev/rules.d/50-udev-default.rules:SUBSYSTEM=="ptp", ATTR{clock_name}=="hyperv", SYMLINK += "ptp_hyperv"
[root@cosa-devsh ~]# rpm -qf /usr/lib/udev/rules.d/50-udev-default.rules 
systemd-udev-249.4-2.fc35.x86_64
[root@cosa-devsh ~]# 

So indeed we could probably hack this by backporting to our config overlay, but we also need to be careful here because "rhcos" == "rhel8" right now but not necessarily in the future...

dustymabe
dustymabe previously approved these changes Nov 30, 2021
Copy link
Member

@dustymabe dustymabe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lucab
Copy link
Contributor

lucab commented Nov 30, 2021

The udev rules is already being backported to RHEL8 (8.6 likely), see https://bugzilla.redhat.com/show_bug.cgi?id=1991834.

cgwalters
cgwalters previously approved these changes Dec 1, 2021
@dustymabe
Copy link
Member

Booted in azure on a Standard_DS1_v2 instance. Here is what I see:

[core@my-fcos-vm ~]$ ls -l /dev/ptp_hyperv 
lrwxrwxrwx. 1 root root 4 Dec  9 21:26 /dev/ptp_hyperv -> ptp0


[core@my-fcos-vm ~]$ chronyc  sources
MS Name/IP address         Stratum Poll Reach LastRx Last sample               
===============================================================================
#* PHC0                          0   3   377    10    -15us[  -24us] +/- 2661ns

Should I test on other instance types? Which ones?

@jlebon jlebon marked this pull request as ready for review December 9, 2021 21:52
From the last paragraph in:

https://docs.microsoft.com/en-us/azure/virtual-machines/linux/time-sync#check-for-ptp-clock-source

> In Linux VMs with Accelerated Networking enabled, you may see multiple
> PTP devices listed because the Mellanox mlx5 driver also creates a
> /dev/ptp device. Because the initialization order can be different
> each time Linux boots, the PTP device corresponding to the Azure host
> might be /dev/ptp0 or it might be /dev/ptp1, which makes it difficult
> to configure chronyd with the correct clock source. To solve this
> problem, the most recent Linux images have a udev rule that creates
> the symlink /dev/ptp_hyperv to whichever /dev/ptp entry corresponds to
> the Azure host. Chrony should be configured to use this symlink
> instead of /dev/ptp0 or /dev/ptp1.

See: coreos/fedora-coreos-tracker#1031
@jlebon jlebon dismissed stale reviews from cgwalters and dustymabe via 9090bf1 December 9, 2021 21:56
jlebon added a commit to jlebon/os that referenced this pull request Dec 9, 2021
This will create the `/dev/ptp_hyperv` symlink. We'll need this once our
chrony generator uses it:

coreos/fedora-coreos-config#1355
@dustymabe dustymabe merged commit d0ad4c8 into coreos:testing-devel Dec 10, 2021
jlebon added a commit to jlebon/os that referenced this pull request Dec 16, 2021
This will create the `/dev/ptp_hyperv` symlink. We'll need this once our
chrony generator uses it:

coreos/fedora-coreos-config#1355
jlebon added a commit to jlebon/os that referenced this pull request Dec 16, 2021
This will create the `/dev/ptp_hyperv` symlink. We'll need this once our
chrony generator uses it:

coreos/fedora-coreos-config#1355
@jlebon jlebon deleted the pr/fix-azure-ptp branch April 23, 2023 23:29
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.

None yet

4 participants