[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC PATCH v3] ptp: Add vDSO-style vmclock support
From: |
Simon Horman |
Subject: |
Re: [RFC PATCH v3] ptp: Add vDSO-style vmclock support |
Date: |
Mon, 8 Jul 2024 10:17:08 +0100 |
On Sat, Jul 06, 2024 at 04:14:39PM +0100, David Woodhouse wrote:
> From: David Woodhouse <dwmw@amazon.co.uk>
>
> The vmclock "device" provides a shared memory region with precision clock
> information. By using shared memory, it is safe across Live Migration.
>
> Like the KVM PTP clock, this can convert TSC-based cross timestamps into
> KVM clock values. Unlike the KVM PTP clock, it does so only when such is
> actually helpful.
>
> The memory region of the device is also exposed to userspace so it can be
> read or memory mapped by application which need reliable notification of
> clock disruptions.
>
> The shared memory structure is intended to be adopted into the nascent
> virtio-rtc specification (since one might consider a virtio-rtc
> specification that doesn't fix the live migration problem to be not fit
> for purpose). It can also be presented via a simple ACPI device.
>
> Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
...
> diff --git a/drivers/ptp/ptp_vmclock.c b/drivers/ptp/ptp_vmclock.c
...
> + /* If there is valid clock information, register a PTP clock */
> + if (st->cs_id) {
> + st->ptp_clock_info = ptp_vmclock_info;
> + strncpy(st->ptp_clock_info.name, st->name,
> sizeof(st->ptp_clock_info.name));
Hi David,
As per my comment on v2, although it is harmless in this case,
it would be nicer to use strscpy() here and avoid fortification warnings.
...